VirtualBox

source: vbox/trunk/src/VBox/Devices/PC/BIOS/scsi.c@ 47986

Last change on this file since 47986 was 46241, checked in by vboxsync, 12 years ago

BIOS: Properly handle SCSI disk reads of 64K or more.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 21.4 KB
Line 
1/* $Id: scsi.c 46241 2013-05-23 15:15:39Z vboxsync $ */
2/** @file
3 * SCSI host adapter driver to boot from SCSI disks
4 */
5
6/*
7 * Copyright (C) 2004-2012 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18#include <stdint.h>
19#include <string.h>
20#include "biosint.h"
21#include "inlines.h"
22#include "ebda.h"
23
24
25#if DEBUG_SCSI
26# define DBG_SCSI(...) BX_INFO(__VA_ARGS__)
27#else
28# define DBG_SCSI(...)
29#endif
30
31#define VBSCSI_BUSY (1 << 0)
32#define VBSCSI_ERROR (1 << 1)
33
34/* The I/O port of the BusLogic SCSI adapter. */
35#define BUSLOGIC_BIOS_IO_PORT 0x430
36/* The I/O port of the LsiLogic SCSI adapter. */
37#define LSILOGIC_BIOS_IO_PORT 0x434
38/* The I/O port of the LsiLogic SAS adapter. */
39#define LSILOGIC_SAS_BIOS_IO_PORT 0x438
40
41#define VBSCSI_REGISTER_STATUS 0
42#define VBSCSI_REGISTER_COMMAND 0
43#define VBSCSI_REGISTER_DATA_IN 1
44#define VBSCSI_REGISTER_IDENTIFY 2
45#define VBSCSI_REGISTER_RESET 3
46#define VBSCSI_REGISTER_DEVSTAT 3
47
48#define VBSCSI_MAX_DEVICES 16 /* Maximum number of devices a SCSI device can have. */
49
50/* Command opcodes. */
51#define SCSI_INQUIRY 0x12
52#define SCSI_READ_CAPACITY 0x25
53#define SCSI_READ_10 0x28
54#define SCSI_WRITE_10 0x2a
55
56/* Data transfer direction. */
57#define SCSI_TXDIR_FROM_DEVICE 0
58#define SCSI_TXDIR_TO_DEVICE 1
59
60#pragma pack(1)
61
62/* READ_10/WRITE_10 CDB layout. */
63typedef struct {
64 uint16_t command; /* Command. */
65 uint32_t lba; /* LBA, MSB first! */
66 uint8_t pad1; /* Unused. */
67 uint16_t nsect; /* Sector count, MSB first! */
68 uint8_t pad2; /* Unused. */
69} cdb_rw10;
70
71#pragma pack()
72
73ct_assert(sizeof(cdb_rw10) == 10);
74
75
76void insb_discard(unsigned nbytes, unsigned port);
77#pragma aux insb_discard = \
78 ".286" \
79 "again:" \
80 "in al,dx" \
81 "loop again" \
82 parm [cx] [dx] modify exact [cx ax] nomemory;
83
84
85int scsi_cmd_data_in(uint16_t io_base, uint8_t target_id, uint8_t __far *aCDB,
86 uint8_t cbCDB, uint8_t __far *buffer, uint32_t length)
87{
88 /* Check that the adapter is ready. */
89 uint8_t status, sizes;
90 uint16_t i;
91
92 do
93 status = inb(io_base + VBSCSI_REGISTER_STATUS);
94 while (status & VBSCSI_BUSY);
95
96
97 sizes = ((length >> 12) & 0xF0) | cbCDB;
98 outb(io_base + VBSCSI_REGISTER_COMMAND, target_id); /* Write the target ID. */
99 outb(io_base + VBSCSI_REGISTER_COMMAND, SCSI_TXDIR_FROM_DEVICE); /* Write the transfer direction. */
100 outb(io_base + VBSCSI_REGISTER_COMMAND, sizes); /* Write CDB size and top bufsize bits. */
101 outb(io_base + VBSCSI_REGISTER_COMMAND, length); /* Write the buffer size. */
102 outb(io_base + VBSCSI_REGISTER_COMMAND, (length >> 8));
103 for (i = 0; i < cbCDB; i++) /* Write the CDB. */
104 outb(io_base + VBSCSI_REGISTER_COMMAND, aCDB[i]);
105
106 /* Now wait for the command to complete. */
107 do
108 status = inb(io_base + VBSCSI_REGISTER_STATUS);
109 while (status & VBSCSI_BUSY);
110
111 /* Read in the data. The transfer length may be exactly 64K or more,
112 * which needs a bit of care when we're using 16-bit 'rep ins'.
113 */
114 while (length > 32768) {
115 DBG_SCSI("%s: reading 32K to %X:%X\n", __func__, FP_SEG(buffer), FP_OFF(buffer));
116 rep_insb(buffer, 32768, io_base + VBSCSI_REGISTER_DATA_IN);
117 length -= 32768;
118 buffer = (FP_SEG(buffer) + (32768 >> 4)) :> FP_OFF(buffer);
119 }
120
121 DBG_SCSI("%s: reading %ld bytes to %X:%X\n", __func__, length, FP_SEG(buffer), FP_OFF(buffer));
122 rep_insb(buffer, length, io_base + VBSCSI_REGISTER_DATA_IN);
123
124 return 0;
125}
126
127int scsi_cmd_data_out(uint16_t io_base, uint8_t target_id, uint8_t __far *aCDB,
128 uint8_t cbCDB, uint8_t __far *buffer, uint32_t length)
129{
130 /* Check that the adapter is ready. */
131 uint8_t status, sizes;
132 uint16_t i;
133
134 do
135 status = inb(io_base + VBSCSI_REGISTER_STATUS);
136 while (status & VBSCSI_BUSY);
137
138
139 sizes = ((length >> 12) & 0xF0) | cbCDB;
140 outb(io_base + VBSCSI_REGISTER_COMMAND, target_id); /* Write the target ID. */
141 outb(io_base + VBSCSI_REGISTER_COMMAND, SCSI_TXDIR_TO_DEVICE); /* Write the transfer direction. */
142 outb(io_base + VBSCSI_REGISTER_COMMAND, sizes); /* Write CDB size and top bufsize bits. */
143 outb(io_base + VBSCSI_REGISTER_COMMAND, length); /* Write the buffer size. */
144 outb(io_base + VBSCSI_REGISTER_COMMAND, (length >> 8));
145 for (i = 0; i < cbCDB; i++) /* Write the CDB. */
146 outb(io_base + VBSCSI_REGISTER_COMMAND, aCDB[i]);
147
148 /* Write out the data. The transfer length may be exactly 64K or more,
149 * which needs a bit of care when we're using 16-bit 'rep outs'.
150 */
151 while (length > 32768) {
152 DBG_SCSI("%s: writing 32K from %X:%X\n", __func__, FP_SEG(buffer), FP_OFF(buffer));
153 rep_outsb(buffer, 32768, io_base + VBSCSI_REGISTER_DATA_IN);
154 length -= 32768;
155 buffer = (FP_SEG(buffer) + (32768 >> 4)) :> FP_OFF(buffer);
156 }
157
158 DBG_SCSI("%s: writing %ld bytes from %X:%X\n", __func__, length, FP_SEG(buffer), FP_OFF(buffer));
159 rep_outsb(buffer, length, io_base + VBSCSI_REGISTER_DATA_IN);
160
161 /* Now wait for the command to complete. */
162 do
163 status = inb(io_base + VBSCSI_REGISTER_STATUS);
164 while (status & VBSCSI_BUSY);
165
166 return 0;
167}
168
169/**
170 * Read sectors from an attached SCSI device.
171 *
172 * @returns status code.
173 * @param bios_dsk Pointer to disk request packet (in the
174 * EBDA).
175 */
176int scsi_read_sectors(bio_dsk_t __far *bios_dsk)
177{
178 uint8_t rc;
179 cdb_rw10 cdb;
180 uint16_t count;
181 uint16_t io_base;
182 uint8_t target_id;
183 uint8_t device_id;
184
185 device_id = VBOX_GET_SCSI_DEVICE(bios_dsk->drqp.dev_id);
186 if (device_id > BX_MAX_SCSI_DEVICES)
187 BX_PANIC("scsi_read_sectors: device_id out of range %d\n", device_id);
188
189 count = bios_dsk->drqp.nsect;
190
191 /* Prepare a CDB. */
192 cdb.command = SCSI_READ_10;
193 cdb.lba = swap_32(bios_dsk->drqp.lba);
194 cdb.pad1 = 0;
195 cdb.nsect = swap_16(count);
196 cdb.pad2 = 0;
197
198
199 io_base = bios_dsk->scsidev[device_id].io_base;
200 target_id = bios_dsk->scsidev[device_id].target_id;
201
202 DBG_SCSI("%s: reading %u sectors, device %d, target %d\n", __func__,
203 count, device_id, bios_dsk->scsidev[device_id].target_id);
204
205 rc = scsi_cmd_data_in(io_base, target_id, (void __far *)&cdb, 10,
206 bios_dsk->drqp.buffer, (count * 512L));
207
208 if (!rc)
209 {
210 bios_dsk->drqp.trsfsectors = count;
211 bios_dsk->drqp.trsfbytes = count * 512L;
212 }
213 DBG_SCSI("%s: transferred %u sectors\n", __func__, bios_dsk->drqp.nsect);
214
215 return rc;
216}
217
218/**
219 * Write sectors to an attached SCSI device.
220 *
221 * @returns status code.
222 * @param bios_dsk Pointer to disk request packet (in the
223 * EBDA).
224 */
225int scsi_write_sectors(bio_dsk_t __far *bios_dsk)
226{
227 uint8_t rc;
228 cdb_rw10 cdb;
229 uint16_t count;
230 uint16_t io_base;
231 uint8_t target_id;
232 uint8_t device_id;
233
234 device_id = VBOX_GET_SCSI_DEVICE(bios_dsk->drqp.dev_id);
235 if (device_id > BX_MAX_SCSI_DEVICES)
236 BX_PANIC("scsi_write_sectors: device_id out of range %d\n", device_id);
237
238 count = bios_dsk->drqp.nsect;
239
240 /* Prepare a CDB. */
241 cdb.command = SCSI_WRITE_10;
242 cdb.lba = swap_32(bios_dsk->drqp.lba);
243 cdb.pad1 = 0;
244 cdb.nsect = swap_16(count);
245 cdb.pad2 = 0;
246
247 io_base = bios_dsk->scsidev[device_id].io_base;
248 target_id = bios_dsk->scsidev[device_id].target_id;
249
250 DBG_SCSI("%s: writing %u sectors, device %d, target %d\n", __func__,
251 count, device_id, bios_dsk->scsidev[device_id].target_id);
252
253 rc = scsi_cmd_data_out(io_base, target_id, (void __far *)&cdb, 10,
254 bios_dsk->drqp.buffer, (count * 512L));
255
256 if (!rc)
257 {
258 bios_dsk->drqp.trsfsectors = count;
259 bios_dsk->drqp.trsfbytes = (count * 512L);
260 }
261 DBG_SCSI("%s: transferred %u sectors\n", __func__, bios_dsk->drqp.nsect);
262
263 return rc;
264}
265
266
267//@todo: move
268#define ATA_DATA_NO 0x00
269#define ATA_DATA_IN 0x01
270#define ATA_DATA_OUT 0x02
271
272/**
273 * Perform a "packet style" read with supplied CDB.
274 *
275 * @returns status code.
276 * @param bios_dsk Pointer to disk request packet (in the
277 * EBDA).
278 */
279uint16_t scsi_cmd_packet(uint16_t device_id, uint8_t cmdlen, char __far *cmdbuf,
280 uint16_t before, uint32_t length, uint8_t inout, char __far *buffer)
281{
282 bio_dsk_t __far *bios_dsk = read_word(0x0040, 0x000E) :> &EbdaData->bdisk;
283 uint32_t read_len;
284 uint8_t status, sizes;
285 uint16_t i;
286 uint16_t io_base;
287 uint8_t target_id;
288
289 /* Data out is currently not supported. */
290 if (inout == ATA_DATA_OUT) {
291 BX_INFO("%s: DATA_OUT not supported yet\n", __func__);
292 return 1;
293 }
294
295 /* Convert to SCSI specific device number. */
296 device_id = VBOX_GET_SCSI_DEVICE(device_id);
297
298 DBG_SCSI("%s: reading %lu bytes, skip %u/%u, device %d, target %d\n", __func__,
299 length, bios_dsk->drqp.skip_b, bios_dsk->drqp.skip_a,
300 device_id, bios_dsk->scsidev[device_id].target_id);
301 DBG_SCSI("%s: reading %u %u-byte sectors\n", __func__,
302 bios_dsk->drqp.nsect, bios_dsk->drqp.sect_sz);
303
304 cmdlen -= 2; /* ATAPI uses 12-byte command packets for a READ 10. */
305
306 io_base = bios_dsk->scsidev[device_id].io_base;
307 target_id = bios_dsk->scsidev[device_id].target_id;
308
309 /* Wait until the adapter is ready. */
310 do
311 status = inb(io_base + VBSCSI_REGISTER_STATUS);
312 while (status & VBSCSI_BUSY);
313
314 /* On the SCSI level, we have to transfer whole sectors. */
315 /* NB: With proper residual length support, this should not be necessary; we should
316 * be able to avoid transferring the 'after' part of the sector.
317 */
318 read_len = length + before + bios_dsk->drqp.skip_a;
319
320 sizes = (((read_len) >> 12) & 0xF0) | cmdlen;
321 outb(io_base + VBSCSI_REGISTER_COMMAND, target_id); /* Write the target ID. */
322 outb(io_base + VBSCSI_REGISTER_COMMAND, SCSI_TXDIR_FROM_DEVICE); /* Write the transfer direction. */
323 outb(io_base + VBSCSI_REGISTER_COMMAND, sizes); /* Write the CDB size. */
324 outb(io_base + VBSCSI_REGISTER_COMMAND, read_len); /* Write the buffer size. */
325 outb(io_base + VBSCSI_REGISTER_COMMAND, (read_len) >> 8);
326 for (i = 0; i < cmdlen; i++) /* Write the CDB. */
327 outb(io_base + VBSCSI_REGISTER_COMMAND, cmdbuf[i]);
328
329 /* Now wait for the command to complete. */
330 do
331 status = inb(io_base + VBSCSI_REGISTER_STATUS);
332 while (status & VBSCSI_BUSY);
333
334 /* If any error occurred, inform the caller and don't bother reading the data. */
335 if (status & VBSCSI_ERROR) {
336 outb(io_base + VBSCSI_REGISTER_RESET, 0);
337
338 status = inb(io_base + VBSCSI_REGISTER_DEVSTAT);
339 DBG_SCSI("%s: read failed, device status %02X\n", __func__, status);
340 return 3;
341 }
342
343 /* Transfer the data read from the device. */
344
345 if (before) /* If necessary, throw away data which needs to be skipped. */
346 insb_discard(before, io_base + VBSCSI_REGISTER_DATA_IN);
347
348 bios_dsk->drqp.trsfbytes = length;
349
350 /* The requested length may be exactly 64K or more, which needs
351 * a bit of care when we're using 16-bit 'rep ins'.
352 */
353 while (length > 32768) {
354 DBG_SCSI("%s: reading 32K to %X:%X\n", __func__, FP_SEG(buffer), FP_OFF(buffer));
355 rep_insb(buffer, 32768, io_base + VBSCSI_REGISTER_DATA_IN);
356 length -= 32768;
357 buffer = (FP_SEG(buffer) + (32768 >> 4)) :> FP_OFF(buffer);
358 }
359
360 DBG_SCSI("%s: reading %ld bytes to %X:%X\n", __func__, length, FP_SEG(buffer), FP_OFF(buffer));
361 rep_insb(buffer, length, io_base + VBSCSI_REGISTER_DATA_IN);
362
363 if (bios_dsk->drqp.skip_a) /* If necessary, throw away more data. */
364 insb_discard(bios_dsk->drqp.skip_a, io_base + VBSCSI_REGISTER_DATA_IN);
365
366 return 0;
367}
368
369/**
370 * Enumerate attached devices.
371 *
372 * @returns nothing.
373 * @param io_base The I/O base port of the controller.
374 */
375void scsi_enumerate_attached_devices(uint16_t io_base)
376{
377 int i;
378 uint8_t buffer[0x0200];
379 bio_dsk_t __far *bios_dsk;
380
381 bios_dsk = read_word(0x0040, 0x000E) :> &EbdaData->bdisk;
382
383 /* Go through target devices. */
384 for (i = 0; i < VBSCSI_MAX_DEVICES; i++)
385 {
386 uint8_t rc;
387 uint8_t aCDB[10];
388 uint8_t hd_index, devcount_scsi;
389
390 aCDB[0] = SCSI_INQUIRY;
391 aCDB[1] = 0;
392 aCDB[2] = 0;
393 aCDB[3] = 0;
394 aCDB[4] = 5; /* Allocation length. */
395 aCDB[5] = 0;
396
397 rc = scsi_cmd_data_in(io_base, i, aCDB, 6, buffer, 5);
398 if (rc != 0)
399 BX_PANIC("%s: SCSI_INQUIRY failed\n", __func__);
400
401 /* Check the attached device. */
402 if ( ((buffer[0] & 0xe0) == 0)
403 && ((buffer[0] & 0x1f) == 0x00))
404 {
405 DBG_SCSI("%s: Disk detected at %d\n", __func__, i);
406
407 /* We add the disk only if the maximum is not reached yet. */
408 if (bios_dsk->scsi_devcount < BX_MAX_SCSI_DEVICES)
409 {
410 uint32_t sectors, sector_size, cylinders;
411 uint16_t heads, sectors_per_track;
412 uint8_t hdcount;
413
414 /* Issue a read capacity command now. */
415 _fmemset(aCDB, 0, sizeof(aCDB));
416 aCDB[0] = SCSI_READ_CAPACITY;
417
418 rc = scsi_cmd_data_in(io_base, i, aCDB, 10, buffer, 8);
419 if (rc != 0)
420 BX_PANIC("%s: SCSI_READ_CAPACITY failed\n", __func__);
421
422 /* Build sector number and size from the buffer. */
423 //@todo: byte swapping for dword sized items should be farmed out...
424 sectors = ((uint32_t)buffer[0] << 24)
425 | ((uint32_t)buffer[1] << 16)
426 | ((uint32_t)buffer[2] << 8)
427 | ((uint32_t)buffer[3]);
428
429 sector_size = ((uint32_t)buffer[4] << 24)
430 | ((uint32_t)buffer[5] << 16)
431 | ((uint32_t)buffer[6] << 8)
432 | ((uint32_t)buffer[7]);
433
434 /* We only support the disk if sector size is 512 bytes. */
435 if (sector_size != 512)
436 {
437 /* Leave a log entry. */
438 BX_INFO("Disk %d has an unsupported sector size of %u\n", i, sector_size);
439 continue;
440 }
441
442 /* We need to calculate the geometry for the disk. From
443 * the BusLogic driver in the Linux kernel.
444 */
445 if (sectors >= (uint32_t)4 * 1024 * 1024)
446 {
447 heads = 255;
448 sectors_per_track = 63;
449 }
450 else if (sectors >= (uint32_t)2 * 1024 * 1024)
451 {
452 heads = 128;
453 sectors_per_track = 32;
454 }
455 else
456 {
457 heads = 64;
458 sectors_per_track = 32;
459 }
460 cylinders = (uint32_t)(sectors / (heads * sectors_per_track));
461 devcount_scsi = bios_dsk->scsi_devcount;
462
463 /* Calculate index into the generic disk table. */
464 hd_index = devcount_scsi + BX_MAX_ATA_DEVICES;
465
466 bios_dsk->scsidev[devcount_scsi].io_base = io_base;
467 bios_dsk->scsidev[devcount_scsi].target_id = i;
468 bios_dsk->devices[hd_index].type = DSK_TYPE_SCSI;
469 bios_dsk->devices[hd_index].device = DSK_DEVICE_HD;
470 bios_dsk->devices[hd_index].removable = 0;
471 bios_dsk->devices[hd_index].lock = 0;
472 bios_dsk->devices[hd_index].blksize = sector_size;
473 bios_dsk->devices[hd_index].translation = GEO_TRANSLATION_LBA;
474
475 /* Write LCHS values. */
476 bios_dsk->devices[hd_index].lchs.heads = heads;
477 bios_dsk->devices[hd_index].lchs.spt = sectors_per_track;
478 if (cylinders > 1024)
479 bios_dsk->devices[hd_index].lchs.cylinders = 1024;
480 else
481 bios_dsk->devices[hd_index].lchs.cylinders = (uint16_t)cylinders;
482
483 BX_INFO("SCSI %d-ID#%d: LCHS=%u/%u/%u %ld sectors\n", devcount_scsi,
484 i, (uint16_t)cylinders, heads, sectors_per_track, sectors);
485
486 /* Write PCHS values. */
487 bios_dsk->devices[hd_index].pchs.heads = heads;
488 bios_dsk->devices[hd_index].pchs.spt = sectors_per_track;
489 if (cylinders > 1024)
490 bios_dsk->devices[hd_index].pchs.cylinders = 1024;
491 else
492 bios_dsk->devices[hd_index].pchs.cylinders = (uint16_t)cylinders;
493
494 bios_dsk->devices[hd_index].sectors = sectors;
495
496 /* Store the id of the disk in the ata hdidmap. */
497 hdcount = bios_dsk->hdcount;
498 bios_dsk->hdidmap[hdcount] = devcount_scsi + BX_MAX_ATA_DEVICES;
499 hdcount++;
500 bios_dsk->hdcount = hdcount;
501
502 /* Update hdcount in the BDA. */
503 hdcount = read_byte(0x40, 0x75);
504 hdcount++;
505 write_byte(0x40, 0x75, hdcount);
506
507 devcount_scsi++;
508 bios_dsk->scsi_devcount = devcount_scsi;
509 }
510 else
511 {
512 /* We reached the maximum of SCSI disks we can boot from. We can quit detecting. */
513 break;
514 }
515 }
516 else if ( ((buffer[0] & 0xe0) == 0)
517 && ((buffer[0] & 0x1f) == 0x05))
518 {
519 uint8_t cdcount;
520 uint8_t removable;
521
522 BX_INFO("SCSI %d-ID#%d: CD/DVD-ROM\n", devcount_scsi, i);
523
524 /* Calculate index into the generic device table. */
525 hd_index = devcount_scsi + BX_MAX_ATA_DEVICES;
526
527 removable = buffer[1] & 0x80 ? 1 : 0;
528
529 bios_dsk->scsidev[devcount_scsi].io_base = io_base;
530 bios_dsk->scsidev[devcount_scsi].target_id = i;
531 bios_dsk->devices[hd_index].type = DSK_TYPE_SCSI;
532 bios_dsk->devices[hd_index].device = DSK_DEVICE_CDROM;
533 bios_dsk->devices[hd_index].removable = removable;
534 bios_dsk->devices[hd_index].blksize = 2048;
535
536 /* Store the ID of the device in the BIOS cdidmap. */
537 cdcount = bios_dsk->cdcount;
538 bios_dsk->cdidmap[cdcount] = devcount_scsi + BX_MAX_ATA_DEVICES;
539 cdcount++;
540 bios_dsk->cdcount = cdcount;
541
542 devcount_scsi++;
543 bios_dsk->scsi_devcount = devcount_scsi;
544 }
545 else
546 DBG_SCSI("%s: No supported device detected at %d\n", __func__, i);
547 }
548}
549
550/**
551 * Init the SCSI driver and detect attached disks.
552 */
553void BIOSCALL scsi_init(void)
554{
555 uint8_t identifier;
556 bio_dsk_t __far *bios_dsk;
557
558 bios_dsk = read_word(0x0040, 0x000E) :> &EbdaData->bdisk;
559
560 bios_dsk->scsi_devcount = 0;
561
562 identifier = 0;
563
564 /* Detect the BusLogic adapter. */
565 outb(BUSLOGIC_BIOS_IO_PORT+VBSCSI_REGISTER_IDENTIFY, 0x55);
566 identifier = inb(BUSLOGIC_BIOS_IO_PORT+VBSCSI_REGISTER_IDENTIFY);
567
568 if (identifier == 0x55)
569 {
570 /* Detected - Enumerate attached devices. */
571 DBG_SCSI("scsi_init: BusLogic SCSI adapter detected\n");
572 outb(BUSLOGIC_BIOS_IO_PORT+VBSCSI_REGISTER_RESET, 0);
573 scsi_enumerate_attached_devices(BUSLOGIC_BIOS_IO_PORT);
574 }
575 else
576 {
577 DBG_SCSI("scsi_init: BusLogic SCSI adapter not detected\n");
578 }
579
580 /* Detect the LSI Logic parallel SCSI adapter. */
581 outb(LSILOGIC_BIOS_IO_PORT+VBSCSI_REGISTER_IDENTIFY, 0x55);
582 identifier = inb(LSILOGIC_BIOS_IO_PORT+VBSCSI_REGISTER_IDENTIFY);
583
584 if (identifier == 0x55)
585 {
586 /* Detected - Enumerate attached devices. */
587 DBG_SCSI("scsi_init: LSI Logic SCSI adapter detected\n");
588 outb(LSILOGIC_BIOS_IO_PORT+VBSCSI_REGISTER_RESET, 0);
589 scsi_enumerate_attached_devices(LSILOGIC_BIOS_IO_PORT);
590 }
591 else
592 {
593 DBG_SCSI("scsi_init: LSI Logic SCSI adapter not detected\n");
594 }
595
596 /* Detect the LSI Logic SAS adapter. */
597 outb(LSILOGIC_SAS_BIOS_IO_PORT+VBSCSI_REGISTER_IDENTIFY, 0x55);
598 identifier = inb(LSILOGIC_SAS_BIOS_IO_PORT+VBSCSI_REGISTER_IDENTIFY);
599
600 if (identifier == 0x55)
601 {
602 /* Detected - Enumerate attached devices. */
603 DBG_SCSI("scsi_init: LSI Logic SAS adapter detected\n");
604 outb(LSILOGIC_SAS_BIOS_IO_PORT+VBSCSI_REGISTER_RESET, 0);
605 scsi_enumerate_attached_devices(LSILOGIC_SAS_BIOS_IO_PORT);
606 }
607 else
608 {
609 DBG_SCSI("scsi_init: LSI Logic SAS adapter not detected\n");
610 }
611}
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette