VirtualBox

Ignore:
Timestamp:
Aug 28, 2023 11:09:40 AM (18 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
158925
Message:

BIOS: Support also ISA BusLogic/Adaptec HBAs, not just PCI (see bugref:6549).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/PC/BIOS/buslogic.c

    r98103 r100984  
    6969#define BUSLOGIC_REGISTER_DATAIN    1 /**< Readonly */
    7070#define BUSLOGIC_REGISTER_INTERRUPT 2 /**< Readonly */
     71#define BUSLOGIC_REGISTER_GEOMETRY  3 /**< Readonly */
     72
    7173/** Fields for the interrupt register. */
    7274# define BL_INTR_IMBL   RT_BIT(0)   /* Incoming Mailbox Loaded. */
     
    221223
    222224/**
    223  * Init the BusLogic SCSI driver and detect attached disks.
     225 * Init the BusLogic PCI SCSI driver and detect attached disks.
    224226 */
    225227int buslogic_scsi_init(void __far *pvHba, uint8_t u8Bus, uint8_t u8DevFn)
     
    250252    return 1;
    251253}
     254
     255/**
     256 * Init the AHA-154x compatible ISA SCSI driver and find attached disks.
     257 * The HBA was already detected.
     258 */
     259int 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 */
     272uint16_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
Note: See TracChangeset for help on using the changeset viewer.

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