VirtualBox

Changeset 100986 in vbox for trunk/src/VBox/Devices/Storage


Ignore:
Timestamp:
Aug 28, 2023 2:35:30 PM (20 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
158927
Message:

BusLogic: More accurately emulate the geometry register; return sensible model and firmware version for BT-545C emulation.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Storage/DevBusLogic.cpp

    r99739 r100986  
    549549#define BUSLOGIC_REGISTER_GEOMETRY  3 /* Readonly */
    550550# define BL_GEOM_XLATEN  RT_BIT(7)  /* Extended geometry translation enabled. */
     551# define BL_GEOM_ISA     0x55       /* ISA adapter? Utterly undocumented. */
    551552
    552553/** Structure for the INQUIRE_PCI_HOST_ADAPTER_INFORMATION reply. */
     
    11951196    pThis->regStatus = BL_STAT_HARDY | BL_STAT_INREQ;
    11961197    pThis->regGeometry = BL_GEOM_XLATEN;
     1198
     1199    /* BusLogic's BTDOSM.SYS version 4.20 DOS ASPI driver (but not e.g.
     1200     * version 3.00) insists that bit 6 in the completely undocumented
     1201     * "geometry register" must be set when scanning for ISA devices.
     1202     * This bit may be a convenient way of avoiding a "double scan" of
     1203     * PCI HBAs (which do not have bit 6 set) in ISA compatibility mode.
     1204     *
     1205     * On a BT-542B and BT-545C, the geometry register contains the value
     1206     * 55h after power up/reset. In addition, bit 7 reflects the state
     1207     * of the >1GB disk setting (DIP switch or EEPROM).
     1208     */
     1209    if (pThis->uDevType == DEV_BT_545C)
     1210        pThis->regGeometry |= BL_GEOM_ISA;
     1211
    11971212    pThis->uOperationCode = 0xff; /* No command executing. */
    11981213    pThis->uPrevCmd = 0xff;
     
    19131928        case BUSLOGICCOMMAND_INQUIRE_PCI_HOST_ADAPTER_INFORMATION:
    19141929        {
     1930            /* Only supported on PCI BusLogic HBAs. */
     1931            if (pThis->uDevType != DEV_BT_958D)
     1932            {
     1933                Log(("Command %#x not valid for this adapter\n", pThis->uOperationCode));
     1934                pThis->cbReplyParametersLeft = 0;
     1935                pThis->regStatus |= BL_STAT_CMDINV;
     1936                break;
     1937            }
     1938
    19151939            PReplyInquirePCIHostAdapterInformation pReply = (PReplyInquirePCIHostAdapterInformation)pThis->aReplyBuffer;
    19161940            memset(pReply, 0, sizeof(ReplyInquirePCIHostAdapterInformation));
     
    19772001            }
    19782002
    1979             /* We report version 5.07B. This reply will provide the first two digits. */
    1980             pThis->aReplyBuffer[2] = '5'; /* Major version 5 */
    1981             pThis->aReplyBuffer[3] = '0'; /* Minor version 0 */
     2003            /* FW version 5.07B for BT-958, version 4.25J for BT-545. */
     2004            if (pThis->uDevType == DEV_BT_958D) {
     2005                pThis->aReplyBuffer[2] = '5'; /* Major version 5 */
     2006                pThis->aReplyBuffer[3] = '0'; /* Minor version 0 */
     2007            }
     2008            else
     2009            {
     2010                pThis->aReplyBuffer[2] = '4';
     2011                pThis->aReplyBuffer[3] = '2';
     2012            }
    19822013            pThis->cbReplyParametersLeft = 4; /* Reply is 4 bytes long */
    19832014            break;
     
    19942025            }
    19952026
    1996             pThis->aReplyBuffer[0] = '7';
     2027            /* FW version 5.07B for BT-958, version 4.25J for BT-545. */
     2028            if (pThis->uDevType == DEV_BT_958D)
     2029                pThis->aReplyBuffer[0] = '7';
     2030            else
     2031                pThis->aReplyBuffer[0] = '5';
    19972032            pThis->cbReplyParametersLeft = 1;
    19982033            break;
     
    20002035        case BUSLOGICCOMMAND_INQUIRE_FIRMWARE_VERSION_LETTER:
    20012036        {
    2002             pThis->aReplyBuffer[0] = 'B';
     2037            /* FW version 5.07B for BT-958, version 4.25J for BT-545. */
     2038            if (pThis->uDevType == DEV_BT_958D)
     2039                pThis->aReplyBuffer[0] = 'B';
     2040            else
     2041                pThis->aReplyBuffer[0] = 'J';
    20032042            pThis->cbReplyParametersLeft = 1;
    20042043            break;
     
    20712110            pThis->cbReplyParametersLeft = pThis->aCommandBuffer[0];
    20722111            memset(pThis->aReplyBuffer, 0, sizeof(pThis->aReplyBuffer));
    2073             const char aModelName[] = "958D ";  /* Trailing \0 is fine, that's the filler anyway. */
    2074             int cCharsToTransfer =   pThis->cbReplyParametersLeft <= sizeof(aModelName)
     2112            const char aModelName958[] = "958D ";   /* Trailing \0 is fine, that's the filler anyway. */
     2113            const char aModelName545[] = "54xC ";
     2114            AssertCompile(sizeof(aModelName958) == sizeof(aModelName545));
     2115            const char *pModelName = pThis->uDevType == DEV_BT_958D ? aModelName958 : aModelName545;
     2116            int cCharsToTransfer =   pThis->cbReplyParametersLeft <= sizeof(aModelName958)
    20752117                                   ? pThis->cbReplyParametersLeft
    2076                                    : sizeof(aModelName);
     2118                                   : sizeof(aModelName958);
    20772119
    20782120            for (int i = 0; i < cCharsToTransfer; i++)
    2079                 pThis->aReplyBuffer[i] = aModelName[i];
     2121                pThis->aReplyBuffer[i] = pModelName[i];
    20802122
    20812123            break;
     
    21372179
    21382180            /** @todo should this reflect the RAM contents (AutoSCSIRam)? */
    2139             pReply->uBusType = 'E';         /* EISA style */
     2181            if (pThis->uDevType == DEV_BT_958D)
     2182                pReply->uBusType = 'E';         /* EISA style */
     2183            else
     2184                pReply->uBusType = 'A';         /* ISA */
     2185
    21402186            pReply->u16ScatterGatherLimit = 8192;
    21412187            pReply->cMailbox = pThis->cMailbox;
     
    21442190            pReply->fHostWideSCSI = true;
    21452191            pReply->fHostUltraSCSI = true;
    2146             memcpy(pReply->aFirmwareRevision, "07B", sizeof(pReply->aFirmwareRevision));
     2192            /* FW version 5.07B for BT-958, version 4.25J for BT-545. */
     2193            if (pThis->uDevType == DEV_BT_958D)
     2194                memcpy(pReply->aFirmwareRevision, "07B", sizeof(pReply->aFirmwareRevision));
     2195            else
     2196                memcpy(pReply->aFirmwareRevision, "25J", sizeof(pReply->aFirmwareRevision));
    21472197
    21482198            break;
     
    21722222                pReply->uCharacterD = 'D';      /* BusLogic model. */
    21732223            }
    2174             pReply->uHostBusType = 'F';     /* PCI bus. */
     2224            if (pThis->uDevType == DEV_BT_958D)
     2225                pReply->uHostBusType = 'F';     /* PCI bus. */
     2226            else
     2227                pReply->uHostBusType = 'A';     /* ISA bus. */
    21752228            break;
    21762229        }
     
    25512604            if (pThis->uDevType == DEV_AHA_1540B)
    25522605            {
     2606                /* NB: The AHA-154xB actually does not respond on this I/O port and
     2607                 * returns 0xFF. However, Adaptec's last ASP4DOS.SYS version (3.36)
     2608                 * assumes the AHA-154xC behavior and fails to load if the 'ADAP'
     2609                 * signature is not present.
     2610                 */
    25532611                uint8_t off = pThis->uAhaSigIdx & 3;
    25542612                *pu32 = s_szAhaSig[off];
Note: See TracChangeset for help on using the changeset viewer.

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