VirtualBox

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

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

BIOS: A bit more debug output.

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

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