Changeset 100984 in vbox
- Timestamp:
- Aug 28, 2023 11:09:40 AM (13 months ago)
- Location:
- trunk/src/VBox/Devices/PC/BIOS
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/PC/BIOS/buslogic.c
r98103 r100984 69 69 #define BUSLOGIC_REGISTER_DATAIN 1 /**< Readonly */ 70 70 #define BUSLOGIC_REGISTER_INTERRUPT 2 /**< Readonly */ 71 #define BUSLOGIC_REGISTER_GEOMETRY 3 /**< Readonly */ 72 71 73 /** Fields for the interrupt register. */ 72 74 # define BL_INTR_IMBL RT_BIT(0) /* Incoming Mailbox Loaded. */ … … 221 223 222 224 /** 223 * Init the BusLogic SCSI driver and detect attached disks.225 * Init the BusLogic PCI SCSI driver and detect attached disks. 224 226 */ 225 227 int buslogic_scsi_init(void __far *pvHba, uint8_t u8Bus, uint8_t u8DevFn) … … 250 252 return 1; 251 253 } 254 255 /** 256 * Init the AHA-154x compatible ISA SCSI driver and find attached disks. 257 * The HBA was already detected. 258 */ 259 int btaha_scsi_init(void __far *pvHba, uint8_t u8Bus, uint8_t u8DevFn) 260 { 261 buslogic_t __far *buslogic = (buslogic_t __far *)pvHba; 262 263 buslogic->u16IoBase = (u8Bus << 8) | u8DevFn; 264 DBG_BUSLOGIC("AHA 154x compatible SCSI HBA at I/O port 0x%x)\n", buslogic->u16IoBase); 265 266 return buslogic_scsi_hba_init(buslogic); 267 } 268 269 /** 270 * Detect AHA-154x compatible ISA SCSI HBA presence. 271 */ 272 uint16_t btaha_scsi_detect(void) 273 { 274 uint16_t bases[] = { 0x330, 0x334, 0 }; 275 uint16_t iobase; 276 uint8_t val; 277 int i; 278 279 for (i = 0, iobase = bases[0]; iobase; iobase = bases[++i]) 280 { 281 /* Read the status register. The possible valid values after power-up 282 * or reset are 0x10 or 0x30. 283 */ 284 val = inb(iobase + BUSLOGIC_REGISTER_STATUS); 285 if ((val != 0x30) && (val != 0x10)) 286 continue; 287 288 /* Exclude PCI adapters in ISA compatible mode. The check reads the 289 * undocumented "geometry" register and only continues if bit 6 is 290 * set. 291 * The logic is kind of genius. On AHA-154xB and earlier, there's 292 * nothing and the read returns 0xFF. On AHA-154xC, the register 293 * returns the letters 'ADAP' in a round-robin fashion. On BusLogic 294 * ISA adapters, the firmware sets the register to 0x55 during 295 * power-up/reset (possibly also setting bit 7 if > 1GB drive 296 * support is enabled). In all cases, bit 6 will be set. 297 * But on BusLogic PCI HBAs, the geometry register is 0x80 (in our 298 * emulation) or possibly 0 and bit 6 is clear. 299 * Thus if bit 6 is not set, the device is rejected because it was 300 * likely already found as a PCI device, and must not be detected 301 * again at the alternative ISA-compatible I/O base. 302 */ 303 val = inb(iobase + BUSLOGIC_REGISTER_GEOMETRY); 304 if ((val & 0x40) == 0) 305 continue; 306 307 /* If we got this far, the I/O base is valid and we're done. */ 308 break; 309 } 310 311 return iobase ? iobase: 0xffff; 312 } 313 -
trunk/src/VBox/Devices/PC/BIOS/scsi.c
r99739 r100984 43 43 #define VBSCSI_MAX_DEVICES 16 /* Maximum number of devices a SCSI device currently supported. */ 44 44 45 #define VBOX_SCSI_NO_HBA 0xffff 46 45 #define VBOX_SCSI_NO_HBA 0xffff 46 47 typedef uint16_t (* scsi_hba_detect)(void); 47 48 typedef int (* scsi_hba_init)(void __far *pvHba, uint8_t u8Bus, uint8_t u8DevFn); 48 49 typedef int (* scsi_hba_cmd_data_out)(void __far *pvHba, uint8_t idTgt, uint8_t __far *aCDB, … … 55 56 uint16_t idPciVendor; 56 57 uint16_t idPciDevice; 58 scsi_hba_detect detect; 57 59 scsi_hba_init init; 58 60 scsi_hba_cmd_data_out cmd_data_out; … … 92 94 scsi_hba_t hbaacc[] = 93 95 { 94 { 0x1000, 0x0030, lsilogic_scsi_init, lsilogic_scsi_cmd_data_out, lsilogic_scsi_cmd_data_in }, /* SPI */95 { 0x1000, 0x0054, lsilogic_scsi_init, lsilogic_scsi_cmd_data_out, lsilogic_scsi_cmd_data_in }, /* SAS */96 { 0x104b, 0x1040, buslogic_scsi_init, buslogic_scsi_cmd_data_out, buslogic_scsi_cmd_data_in },96 { 0x1000, 0x0030, NULL, lsilogic_scsi_init, lsilogic_scsi_cmd_data_out, lsilogic_scsi_cmd_data_in }, /* SPI */ 97 { 0x1000, 0x0054, NULL, lsilogic_scsi_init, lsilogic_scsi_cmd_data_out, lsilogic_scsi_cmd_data_in }, /* SAS */ 98 { 0x104b, 0x1040, NULL, buslogic_scsi_init, buslogic_scsi_cmd_data_out, buslogic_scsi_cmd_data_in }, /* PCI */ 97 99 #ifdef VBOX_WITH_VIRTIO_SCSI 98 { 0x1af4, 0x1048, virtio_scsi_init, virtio_scsi_cmd_data_out, virtio_scsi_cmd_data_in }100 { 0x1af4, 0x1048, NULL, virtio_scsi_init, virtio_scsi_cmd_data_out, virtio_scsi_cmd_data_in }, 99 101 #endif 102 { 0xffff, 0xffff, btaha_scsi_detect, btaha_scsi_init, buslogic_scsi_cmd_data_out, buslogic_scsi_cmd_data_in } /* ISA */ 100 103 }; 101 104 … … 529 532 for (i = 0; i < sizeof(hbaacc)/sizeof(hbaacc[0]); i++) 530 533 { 531 uint16_t busdevfn = pci_find_device(hbaacc[i].idPciVendor, hbaacc[i].idPciDevice); 534 uint16_t busdevfn; 535 536 if (hbaacc[i].detect) { 537 busdevfn = hbaacc[i].detect(); 538 } else { 539 busdevfn = pci_find_device(hbaacc[i].idPciVendor, hbaacc[i].idPciDevice); 540 } 541 532 542 if (busdevfn != VBOX_SCSI_NO_HBA) 533 543 { -
trunk/src/VBox/Devices/PC/BIOS/scsi.h
r98103 r100984 79 79 uint8_t cbCDB, uint8_t __far *buffer, uint32_t length); 80 80 81 extern uint16_t btaha_scsi_detect(); 82 extern int btaha_scsi_init(void __far *pvHba, uint8_t u8Bus, uint8_t u8DevFn); 83 81 84 extern int virtio_scsi_init(void __far *pvHba, uint8_t u8Bus, uint8_t u8DevFn); 82 85 extern int virtio_scsi_cmd_data_out(void __far *pvHba, uint8_t idTgt, uint8_t __far *aCDB,
Note:
See TracChangeset
for help on using the changeset viewer.

