VirtualBox

Changeset 89267 in vbox for trunk/src/VBox/Devices/PC


Ignore:
Timestamp:
May 25, 2021 11:15:02 AM (4 years ago)
Author:
vboxsync
Message:

PC/BIOS/buslogic: Use the EXECUTE SCSI command instead of the mailbox interface to not interfer with guest drivers using it, bugref:4841

Location:
trunk/src/VBox/Devices/PC/BIOS
Files:
5 edited

Legend:

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

    r89211 r89267  
    3232#endif
    3333
    34 #define BUSLOGICCOMMAND_EXECUTE_MAILBOX_COMMAND        0x02
    35 #define BUSLOGICCOMMAND_INITIALIZE_EXTENDED_MAILBOX    0x81
    3634#define BUSLOGICCOMMAND_DISABLE_HOST_ADAPTER_INTERRUPT 0x25
     35#define BUSLOGICCOMMAND_EXECUTE_SCSI_COMMAND           0x83
    3736
    3837
     
    6766# define BL_INTR_INTV   RT_BIT(7)   /* Interrupt Valid. */
    6867
    69 /** Structure for the INITIALIZE EXTENDED MAILBOX request. */
    70 #pragma pack(1)
    71 typedef struct ReqInitExtMbx
    72 {
    73     /** Number of mailboxes in guest memory. */
    74     uint8_t  cMailbox;
    75     /** Physical address of the first mailbox. */
    76     uint32_t uMailboxBaseAddress;
    77 } ReqInitExtMbx;
    78 #pragma pack()
    79 
    80 /**
    81  * Structure of a mailbox in guest memory.
    82  * The incoming and outgoing mailbox have the same size
    83  * but the incoming one has some more fields defined which
    84  * are marked as reserved in the outgoing one.
    85  * The last field is also different from the type.
    86  * For outgoing mailboxes it is the action and
    87  * for incoming ones the completion status code for the task.
    88  * We use one structure for both types.
    89  */
    90 typedef struct Mailbox32
    91 {
    92     /** Physical address of the CCB structure in the guest memory. */
    93     volatile uint32_t u32PhysAddrCCB;
    94     /** Type specific data. */
    95     union
    96     {
    97         /** For outgoing mailboxes. */
    98         struct
    99         {
    100             /** Reserved */
    101             uint8_t uReserved[3];
    102             /** Action code. */
    103             uint8_t uActionCode;
    104         } out;
    105         /** For incoming mailboxes. */
    106         struct
    107         {
    108             /** The host adapter status after finishing the request. */
    109             volatile uint8_t  uHostAdapterStatus;
    110             /** The status of the device which executed the request after executing it. */
    111             volatile uint8_t  uTargetDeviceStatus;
    112             /** Reserved. */
    113             volatile uint8_t  uReserved;
    114             /** The completion status code of the request. */
    115             volatile uint8_t uCompletionCode;
    116         } in;
    117     } u;
    118 } Mailbox32, *PMailbox32;
    119 
    120 /**
    121  * Action codes for outgoing mailboxes.
    122  */
    123 enum BUSLOGIC_MAILBOX_OUTGOING_ACTION
    124 {
    125     BUSLOGIC_MAILBOX_OUTGOING_ACTION_FREE = 0x00,
    126     BUSLOGIC_MAILBOX_OUTGOING_ACTION_START_COMMAND = 0x01,
    127     BUSLOGIC_MAILBOX_OUTGOING_ACTION_ABORT_COMMAND = 0x02
    128 };
    129 
    130 /**
    131  * Completion codes for incoming mailboxes.
    132  */
    133 enum BUSLOGIC_MAILBOX_INCOMING_COMPLETION
    134 {
    135     BUSLOGIC_MAILBOX_INCOMING_COMPLETION_FREE = 0x00,
    136     BUSLOGIC_MAILBOX_INCOMING_COMPLETION_WITHOUT_ERROR = 0x01,
    137     BUSLOGIC_MAILBOX_INCOMING_COMPLETION_ABORTED = 0x02,
    138     BUSLOGIC_MAILBOX_INCOMING_COMPLETION_ABORTED_NOT_FOUND = 0x03,
    139     BUSLOGIC_MAILBOX_INCOMING_COMPLETION_WITH_ERROR = 0x04,
    140     BUSLOGIC_MAILBOX_INCOMING_COMPLETION_INVALID_CCB = 0x05
    141 };
    142 
    143 /**
    144  * Host adapter status for incoming mailboxes.
    145  */
    146 enum BUSLOGIC_MAILBOX_INCOMING_ADAPTER_STATUS
    147 {
    148     BUSLOGIC_MAILBOX_INCOMING_ADAPTER_STATUS_CMD_COMPLETED = 0x00,
    149     BUSLOGIC_MAILBOX_INCOMING_ADAPTER_STATUS_LINKED_CMD_COMPLETED = 0x0a,
    150     BUSLOGIC_MAILBOX_INCOMING_ADAPTER_STATUS_LINKED_CMD_COMPLETED_WITH_FLAG = 0x0b,
    151     BUSLOGIC_MAILBOX_INCOMING_ADAPTER_STATUS_DATA_UNDERUN = 0x0c,
    152     BUSLOGIC_MAILBOX_INCOMING_ADAPTER_STATUS_SCSI_SELECTION_TIMEOUT = 0x11,
    153     BUSLOGIC_MAILBOX_INCOMING_ADAPTER_STATUS_DATA_OVERRUN = 0x12,
    154     BUSLOGIC_MAILBOX_INCOMING_ADAPTER_STATUS_UNEXPECTED_BUS_FREE = 0x13,
    155     BUSLOGIC_MAILBOX_INCOMING_ADAPTER_STATUS_INVALID_BUS_PHASE_REQUESTED = 0x14,
    156     BUSLOGIC_MAILBOX_INCOMING_ADAPTER_STATUS_INVALID_OUTGOING_MAILBOX_ACTION_CODE = 0x15,
    157     BUSLOGIC_MAILBOX_INCOMING_ADAPTER_STATUS_INVALID_COMMAND_OPERATION_CODE = 0x16,
    158     BUSLOGIC_MAILBOX_INCOMING_ADAPTER_STATUS_LINKED_CCB_HAS_INVALID_LUN = 0x17,
    159     BUSLOGIC_MAILBOX_INCOMING_ADAPTER_STATUS_INVALID_COMMAND_PARAMETER = 0x1a,
    160     BUSLOGIC_MAILBOX_INCOMING_ADAPTER_STATUS_AUTO_REQUEST_SENSE_FAILED = 0x1b,
    161     BUSLOGIC_MAILBOX_INCOMING_ADAPTER_STATUS_TAGGED_QUEUING_MESSAGE_REJECTED = 0x1c,
    162     BUSLOGIC_MAILBOX_INCOMING_ADAPTER_STATUS_UNSUPPORTED_MESSAGE_RECEIVED = 0x1d,
    163     BUSLOGIC_MAILBOX_INCOMING_ADAPTER_STATUS_HOST_ADAPTER_HARDWARE_FAILED = 0x20,
    164     BUSLOGIC_MAILBOX_INCOMING_ADAPTER_STATUS_TARGET_FAILED_RESPONSE_TO_ATN = 0x21,
    165     BUSLOGIC_MAILBOX_INCOMING_ADAPTER_STATUS_HOST_ADAPTER_ASSERTED_RST = 0x22,
    166     BUSLOGIC_MAILBOX_INCOMING_ADAPTER_STATUS_OTHER_DEVICE_ASSERTED_RST = 0x23,
    167     BUSLOGIC_MAILBOX_INCOMING_ADAPTER_STATUS_TARGET_DEVICE_RECONNECTED_IMPROPERLY = 0x24,
    168     BUSLOGIC_MAILBOX_INCOMING_ADAPTER_STATUS_HOST_ADAPTER_ASSERTED_BUS_DEVICE_RESET = 0x25,
    169     BUSLOGIC_MAILBOX_INCOMING_ADAPTER_STATUS_ABORT_QUEUE_GENERATED = 0x26,
    170     BUSLOGIC_MAILBOX_INCOMING_ADAPTER_STATUS_HOST_ADAPTER_SOFTWARE_ERROR = 0x27,
    171     BUSLOGIC_MAILBOX_INCOMING_ADAPTER_STATUS_HOST_ADAPTER_HARDWARE_TIMEOUT_ERROR = 0x30,
    172     BUSLOGIC_MAILBOX_INCOMING_ADAPTER_STATUS_SCSI_PARITY_ERROR_DETECTED = 0x34
    173 };
    174 
    175 /**
    176  * Device status codes for incoming mailboxes.
    177  */
    178 enum BUSLOGIC_MAILBOX_INCOMING_DEVICE_STATUS
    179 {
    180     BUSLOGIC_MAILBOX_INCOMING_DEVICE_STATUS_OPERATION_GOOD = 0x00,
    181     BUSLOGIC_MAILBOX_INCOMING_DEVICE_STATUS_CHECK_CONDITION = 0x02,
    182     BUSLOGIC_MAILBOX_INCOMING_DEVICE_STATUS_DEVICE_BUSY = 0x08
    183 };
    184 
    185 /**
    186  * Opcode types for CCB.
    187  */
    188 enum BUSLOGIC_CCB_OPCODE
    189 {
    190     BUSLOGIC_CCB_OPCODE_INITIATOR_CCB = 0x00,
    191     BUSLOGIC_CCB_OPCODE_TARGET_CCB = 0x01,
    192     BUSLOGIC_CCB_OPCODE_INITIATOR_CCB_SCATTER_GATHER = 0x02,
    193     BUSLOGIC_CCB_OPCODE_INITIATOR_CCB_RESIDUAL_DATA_LENGTH = 0x03,
    194     BUSLOGIC_CCB_OPCODE_INITIATOR_CCB_RESIDUAL_SCATTER_GATHER = 0x04,
    195     BUSLOGIC_CCB_OPCODE_BUS_DEVICE_RESET = 0x81
    196 };
    197 
    198 /**
    199  * Data transfer direction.
    200  */
    201 enum BUSLOGIC_CCB_DIRECTION
    202 {
    203     BUSLOGIC_CCB_DIRECTION_UNKNOWN = 0x00,
    204     BUSLOGIC_CCB_DIRECTION_IN      = 0x01,
    205     BUSLOGIC_CCB_DIRECTION_OUT     = 0x02,
    206     BUSLOGIC_CCB_DIRECTION_NO_DATA = 0x03
    207 };
    208 
    209 /**
    210  * The command control block for a SCSI request.
    211  */
    212 typedef struct CCB32
    213 {
    214     /** Opcode. */
    215     uint8_t       uOpcode;
     68/**
     69 * The structure for the "Execute SCSI Command" command.
     70 */
     71typedef struct ESCMD
     72{
     73    /** Data length. */
     74    uint32_t        cbData;
     75    /** Data pointer. */
     76    uint32_t        u32PhysAddrData;
     77    /** The device the request is sent to. */
     78    uint8_t         uTargetId;
     79    /** The LUN in the device. */
     80    uint8_t         uLogicalUnit;
    21681    /** Reserved */
    217     unsigned char uReserved1 :      3;
     82    unsigned char   uReserved1 : 3;
    21883    /** Data direction for the request. */
    219     unsigned char uDataDirection :  2;
    220     /** Whether the request is tag queued. */
    221     unsigned char fTagQueued :      1;
    222     /** Queue tag mode. */
    223     unsigned char uQueueTag :       2;
     84    unsigned char   uDataDirection : 2;
     85    /** Reserved */
     86    unsigned char   uReserved2 : 3;
    22487    /** Length of the SCSI CDB. */
    225     uint8_t       cbCDB;
    226     /** Sense data length. */
    227     uint8_t       cbSenseData;
    228     /** Data length. */
    229     uint32_t      cbData;
    230     /** Data pointer.
    231      *  This points to the data region or a scatter gather list based on the opcode.
    232      */
    233     uint32_t      u32PhysAddrData;
    234     /** Reserved. */
    235     uint8_t       uReserved2[2];
    236     /** Host adapter status. */
    237     uint8_t       uHostAdapterStatus;
    238     /** Device adapter status. */
    239     uint8_t       uDeviceStatus;
    240     /** The device the request is sent to. */
    241     uint8_t       uTargetId;
    242     /**The LUN in the device. */
    243     unsigned char uLogicalUnit : 5;
    244     /** Legacy tag. */
    245     unsigned char fLegacyTagEnable : 1;
    246     /** Legacy queue tag. */
    247     unsigned char uLegacyQueueTag : 2;
    248     /** The SCSI CDB.  (A CDB can be 12 bytes long.) */
    249     uint8_t       abCDB[12];
    250     /** Reserved. */
    251     uint8_t       uReserved3[6];
    252     /** Sense data pointer. */
    253     uint32_t      u32PhysAddrSenseData;
    254 } CCB32, *PCCB32;
    255 
    256 /** 32-bit scatter-gather list entry. */
    257 typedef struct SGE32
    258 {
    259     uint32_t   cbSegment;
    260     uint32_t   u32PhysAddrSegmentBase;
    261 } SGE32, *PSGE32;
    262 
     88    uint8_t         cbCDB;
     89    /** The SCSI CDB.  (A CDB can be 12 bytes long.)   */
     90    uint8_t         abCDB[16];
     91} ESCMD, *PESCMD;
    26392
    26493/**
     
    26796typedef struct
    26897{
    269     /** Outgoing mailbox - must come first because of alignment reasons. */
    270     Mailbox32        MbxOut32;
    271     /** Incoming mailbox. */
    272     Mailbox32        MbxIn32;
    273     /** Command control block. */
    274     CCB32            Ccb32;
    275     /** List of scatter gather entries. */
    276     SGE32            aSge[3];
     98    /** The execute SCSI command. */
     99    ESCMD            EsCmd;
    277100    /** I/O base of device. */
    278101    uint16_t         u16IoBase;
    279102    /** The sink buf. */
    280103    void __far       *pvSinkBuf;
     104    /** Size of the sink buffer in bytes. */
     105    uint16_t         cbSinkBuf;
    281106} buslogic_t;
    282107
     
    321146{
    322147    buslogic_t __far *buslogic = (buslogic_t __far *)pvHba;
     148    uint8_t abReply[4];
    323149    int i;
    324 
    325     buslogic->MbxIn32.u.in.uCompletionCode = BUSLOGIC_MAILBOX_INCOMING_COMPLETION_FREE;
    326 
    327     _fmemset(&buslogic->Ccb32, 0, sizeof(buslogic->Ccb32));
    328 
    329     buslogic->Ccb32.uOpcode         = BUSLOGIC_CCB_OPCODE_INITIATOR_CCB_SCATTER_GATHER;
    330     buslogic->Ccb32.uDataDirection  = BUSLOGIC_CCB_DIRECTION_OUT;
    331     buslogic->Ccb32.cbCDB           = cbCDB;
    332     buslogic->Ccb32.cbSenseData     = 0;
    333     buslogic->Ccb32.cbData          = sizeof(buslogic->aSge[0]);
    334     buslogic->Ccb32.u32PhysAddrData = buslogic_addr_to_phys(&buslogic->aSge[0]);
    335     buslogic->Ccb32.uTargetId       = idTgt;
     150    int rc;
     151
     152    _fmemset(&buslogic->EsCmd, 0, sizeof(buslogic->EsCmd));
     153    _fmemset(abReply, 0, sizeof(abReply));
     154
     155    buslogic->EsCmd.cbData = length;
     156    buslogic->EsCmd.u32PhysAddrData = buslogic_addr_to_phys(buffer);
     157    buslogic->EsCmd.uTargetId       = idTgt;
     158    buslogic->EsCmd.uLogicalUnit    = 0;
     159    buslogic->EsCmd.uDataDirection  = 0;
     160    buslogic->EsCmd.cbCDB           = cbCDB;
     161
    336162    for (i = 0; i < cbCDB; i++)
    337         buslogic->Ccb32.abCDB[i] = aCDB[i];
    338 
    339     buslogic->aSge[0].cbSegment = length;
    340     buslogic->aSge[0].u32PhysAddrSegmentBase = buslogic_addr_to_phys(buffer);
    341 
    342     /* Send it off. */
    343     buslogic->MbxOut32.u32PhysAddrCCB    = buslogic_addr_to_phys(&buslogic->Ccb32);
    344     buslogic->MbxOut32.u.out.uActionCode = BUSLOGIC_MAILBOX_OUTGOING_ACTION_START_COMMAND;
    345     outb(buslogic->u16IoBase + BUSLOGIC_REGISTER_COMMAND, BUSLOGICCOMMAND_EXECUTE_MAILBOX_COMMAND);
    346 
    347     /* Wait for it to finish. */
    348     while (!(inb(buslogic->u16IoBase + BUSLOGIC_REGISTER_INTERRUPT) & BL_INTR_IMBL));
    349 
    350     /* Clear interrupt status. */
    351     outb(buslogic->u16IoBase + BUSLOGIC_REGISTER_CONTROL, BL_CTRL_RINT);
    352 
    353     /* Check mailbox status. */
    354     if (buslogic->MbxIn32.u.in.uCompletionCode != BUSLOGIC_MAILBOX_INCOMING_COMPLETION_WITHOUT_ERROR)
    355         return 4;
    356 
    357     return 0;
     163        buslogic->EsCmd.abCDB[i] = aCDB[i];
     164
     165    rc = buslogic_cmd(buslogic, BUSLOGICCOMMAND_EXECUTE_SCSI_COMMAND, (uint8_t __far *)&buslogic->EsCmd,
     166                      sizeof(buslogic->EsCmd) - sizeof(buslogic->EsCmd.abCDB) + cbCDB, &abReply[0], sizeof(abReply));
     167    if (!rc)
     168        rc = abReply[2];
     169
     170    return rc;
    358171}
    359172
     
    363176{
    364177    buslogic_t __far *buslogic = (buslogic_t __far *)pvHba;
     178    uint8_t abReply[4];
    365179    int i;
    366     uint8_t idxSge = 0;
    367 
    368     buslogic->MbxIn32.u.in.uCompletionCode = BUSLOGIC_MAILBOX_INCOMING_COMPLETION_FREE;
    369 
    370     _fmemset(&buslogic->Ccb32, 0, sizeof(buslogic->Ccb32));
    371 
    372     buslogic->Ccb32.uOpcode         = BUSLOGIC_CCB_OPCODE_INITIATOR_CCB_SCATTER_GATHER;
    373     buslogic->Ccb32.uDataDirection  = BUSLOGIC_CCB_DIRECTION_IN;
    374     buslogic->Ccb32.cbCDB           = cbCDB;
    375     buslogic->Ccb32.cbSenseData     = 0;
    376     buslogic->Ccb32.u32PhysAddrData = buslogic_addr_to_phys(&buslogic->aSge[0]);
    377     buslogic->Ccb32.uTargetId       = idTgt;
     180    int rc;
     181
     182    DBG_BUSLOGIC("buslogic_scsi_cmd_data_in:\n");
     183
     184    if (   (   skip_b
     185            || skip_a)
     186        && skip_b + length + skip_a > buslogic->cbSinkBuf) /* Sink buffer is only 16KB at the moment. */
     187        return 1;
     188
     189    _fmemset(&buslogic->EsCmd, 0, sizeof(buslogic->EsCmd));
     190    _fmemset(abReply, 0, sizeof(abReply));
     191
     192    if (!skip_b && !skip_a)
     193    {
     194        buslogic->EsCmd.cbData = length;
     195        buslogic->EsCmd.u32PhysAddrData = buslogic_addr_to_phys(buffer);
     196    }
     197    else
     198    {
     199        buslogic->EsCmd.cbData = length + skip_b + skip_a;
     200        buslogic->EsCmd.u32PhysAddrData = buslogic_addr_to_phys(buslogic->pvSinkBuf); /* Requires the sink buffer because there is no S/G variant. */
     201    }
     202    buslogic->EsCmd.uTargetId       = idTgt;
     203    buslogic->EsCmd.uLogicalUnit    = 0;
     204    buslogic->EsCmd.uDataDirection  = 0;
     205    buslogic->EsCmd.cbCDB           = cbCDB;
     206
    378207    for (i = 0; i < cbCDB; i++)
    379         buslogic->Ccb32.abCDB[i] = aCDB[i];
    380 
    381     /* Prepend a sinkhole if data is skipped upfront. */
    382     if (skip_b)
    383     {
    384         buslogic->aSge[idxSge].cbSegment = skip_b;
    385         buslogic->aSge[idxSge].u32PhysAddrSegmentBase = buslogic_addr_to_phys(buslogic->pvSinkBuf);
    386         idxSge++;
    387     }
    388 
    389     buslogic->aSge[idxSge].cbSegment = length;
    390     buslogic->aSge[idxSge].u32PhysAddrSegmentBase = buslogic_addr_to_phys(buffer);
    391     idxSge++;
    392 
    393     /* Append a sinkhole if data is skipped at the end. */
    394     if (skip_a)
    395     {
    396         buslogic->aSge[idxSge].cbSegment = skip_a;
    397         buslogic->aSge[idxSge].u32PhysAddrSegmentBase = buslogic_addr_to_phys(buslogic->pvSinkBuf);
    398         idxSge++;
    399     }
    400 
    401     buslogic->Ccb32.cbData = idxSge * sizeof(buslogic->aSge[0]);
    402 
    403     /* Send it off. */
    404     buslogic->MbxOut32.u32PhysAddrCCB    = buslogic_addr_to_phys(&buslogic->Ccb32);
    405     buslogic->MbxOut32.u.out.uActionCode = BUSLOGIC_MAILBOX_OUTGOING_ACTION_START_COMMAND;
    406     outb(buslogic->u16IoBase + BUSLOGIC_REGISTER_COMMAND, BUSLOGICCOMMAND_EXECUTE_MAILBOX_COMMAND);
    407 
    408     /* Wait for it to finish. */
    409     while (!(inb(buslogic->u16IoBase + BUSLOGIC_REGISTER_INTERRUPT) & BL_INTR_IMBL));
    410 
    411     /* Clear interrupt status. */
    412     outb(buslogic->u16IoBase + BUSLOGIC_REGISTER_CONTROL, BL_CTRL_RINT);
    413 
    414     /* Check mailbox status. */
    415     if (buslogic->MbxIn32.u.in.uCompletionCode != BUSLOGIC_MAILBOX_INCOMING_COMPLETION_WITHOUT_ERROR)
    416         return 4;
    417 
    418     return 0;
     208        buslogic->EsCmd.abCDB[i] = aCDB[i];
     209
     210    rc = buslogic_cmd(buslogic, BUSLOGICCOMMAND_EXECUTE_SCSI_COMMAND, (uint8_t __far *)&buslogic->EsCmd,
     211                      sizeof(buslogic->EsCmd) - sizeof(buslogic->EsCmd.abCDB) + cbCDB, &abReply[0], sizeof(abReply));
     212    if (!rc)
     213    {
     214        /* Copy the data over from the sink buffer. */
     215        if (abReply[2] == 0)
     216        {
     217            if (skip_b || skip_a)
     218                _fmemcpy(buffer, (const uint8_t __far *)buslogic->pvSinkBuf + skip_b, length);
     219        }
     220        else
     221            rc = abReply[2];
     222    }
     223
     224    return rc;
    419225}
    420226
     
    424230static int buslogic_scsi_hba_init(buslogic_t __far *buslogic)
    425231{
    426     int rc;
    427232    uint8_t bIrqOff = 0;
    428     ReqInitExtMbx       ReqInitMbx;
    429233
    430234    /* Hard reset. */
     
    433237
    434238    /* Disable interrupts. */
    435     rc = buslogic_cmd(buslogic, BUSLOGICCOMMAND_DISABLE_HOST_ADAPTER_INTERRUPT,
    436                       (unsigned char __far *)&bIrqOff, sizeof(bIrqOff),
    437                       NULL, 0);
    438     if (!rc)
    439     {
    440         /* Initialize mailbox. */
    441         ReqInitMbx.cMailbox = 1;
    442         ReqInitMbx.uMailboxBaseAddress = buslogic_addr_to_phys(&buslogic->MbxOut32);
    443         rc = buslogic_cmd(buslogic, BUSLOGICCOMMAND_INITIALIZE_EXTENDED_MAILBOX,
    444                           (unsigned char __far *)&ReqInitMbx, sizeof(ReqInitMbx),
    445                           NULL, 0);
    446     }
    447 
    448     return rc;
     239    return buslogic_cmd(buslogic, BUSLOGICCOMMAND_DISABLE_HOST_ADAPTER_INTERRUPT,
     240                        (unsigned char __far *)&bIrqOff, sizeof(bIrqOff),
     241                        NULL, 0);
    449242}
    450243
     
    452245 * Init the BusLogic SCSI driver and detect attached disks.
    453246 */
    454 int buslogic_scsi_init(void __far *pvHba, void __far *pvSinkBuf, uint8_t u8Bus, uint8_t u8DevFn)
     247int buslogic_scsi_init(void __far *pvHba, void __far *pvSinkBuf, uint16_t cbSinkBuf, uint8_t u8Bus, uint8_t u8DevFn)
    455248{
    456249    buslogic_t __far *buslogic = (buslogic_t __far *)pvHba;
     
    473266        buslogic->u16IoBase = u16IoBase;
    474267        buslogic->pvSinkBuf = pvSinkBuf;
     268        buslogic->cbSinkBuf = cbSinkBuf;
    475269        return buslogic_scsi_hba_init(buslogic);
    476270    }
  • trunk/src/VBox/Devices/PC/BIOS/lsilogic.c

    r89211 r89267  
    536536 * Init the LsiLogic SCSI driver and detect attached disks.
    537537 */
    538 int lsilogic_scsi_init(void __far *pvHba, void __far *pvSinkBuf, uint8_t u8Bus, uint8_t u8DevFn)
     538int lsilogic_scsi_init(void __far *pvHba, void __far *pvSinkBuf, uint16_t cbSinkBuf, uint8_t u8Bus, uint8_t u8DevFn)
    539539{
    540540    lsilogic_t __far *lsilogic = (lsilogic_t __far *)pvHba;
  • trunk/src/VBox/Devices/PC/BIOS/scsi.c

    r89211 r89267  
    3535#define VBOX_SCSI_NO_HBA 0xffff
    3636
    37 typedef int (* scsi_hba_init)(void __far *pvHba, void __far *pvSinkBuf, uint8_t u8Bus, uint8_t u8DevFn);
     37#define VBOX_SCSI_SINK_BUF_KB 16
     38
     39typedef int (* scsi_hba_init)(void __far *pvHba, void __far *pvSinkBuf, uint16_t cbSinkBuf, uint8_t u8Bus, uint8_t u8DevFn);
    3840typedef int (* scsi_hba_cmd_data_out)(void __far *pvHba, uint8_t idTgt, uint8_t __far *aCDB,
    3941                                      uint8_t cbCDB, uint8_t __far *buffer, uint32_t length);
     
    129131        return 0;
    130132
    131     base_mem_kb -= 2; /* Allocate 2K block. */
     133    base_mem_kb -= VBOX_SCSI_SINK_BUF_KB;
    132134    sink_seg = (((uint32_t)base_mem_kb * 1024) >> 4); /* Calculate start segment. */
    133135
     
    573575
    574576            DBG_SCSI("SCSI HBA at Bus %u DevFn 0x%x (raw 0x%x)\n", u8Bus, u8DevFn, busdevfn);
    575             rc = hbaacc[i].init(hba_seg :> 0, sink_seg :> 0, u8Bus, u8DevFn);
     577            rc = hbaacc[i].init(hba_seg :> 0, sink_seg :> 0, VBOX_SCSI_SINK_BUF_KB * 1024, u8Bus, u8DevFn);
    576578            if (!rc)
    577579                scsi_enumerate_attached_devices(hba_seg, i);
  • trunk/src/VBox/Devices/PC/BIOS/scsi.h

    r89211 r89267  
    5757ct_assert(sizeof(cdb_rw16) == 16);
    5858
    59 extern int lsilogic_scsi_init(void __far *pvHba, void __far *pvSinkBuf, uint8_t u8Bus, uint8_t u8DevFn);
     59extern int lsilogic_scsi_init(void __far *pvHba, void __far *pvSinkBuf, uint16_t cbSinkBuf, uint8_t u8Bus, uint8_t u8DevFn);
    6060extern int lsilogic_scsi_cmd_data_out(void __far *pvHba, uint8_t idTgt, uint8_t __far *aCDB,
    6161                                      uint8_t cbCDB, uint8_t __far *buffer, uint32_t length);
     
    6464                                     uint16_t skip_a);
    6565
    66 extern int buslogic_scsi_init(void __far *pvHba, void __far *pvSinkBuf, uint8_t u8Bus, uint8_t u8DevFn);
     66extern int buslogic_scsi_init(void __far *pvHba, void __far *pvSinkBuf, uint16_t cbSinkBuf, uint8_t u8Bus, uint8_t u8DevFn);
    6767extern int buslogic_scsi_cmd_data_out(void __far *pvHba, uint8_t idTgt, uint8_t __far *aCDB,
    6868                                      uint8_t cbCDB, uint8_t __far *buffer, uint32_t length);
     
    7171                                     uint16_t skip_a);
    7272
    73 extern int virtio_scsi_init(void __far *pvHba, void __far *pvSinkBuf, uint8_t u8Bus, uint8_t u8DevFn);
     73extern int virtio_scsi_init(void __far *pvHba, void __far *pvSinkBuf, uint16_t cbSinkBuf, uint8_t u8Bus, uint8_t u8DevFn);
    7474extern int virtio_scsi_cmd_data_out(void __far *pvHba, uint8_t idTgt, uint8_t __far *aCDB,
    7575                                    uint8_t cbCDB, uint8_t __far *buffer, uint32_t length);
  • trunk/src/VBox/Devices/PC/BIOS/virtio.c

    r89211 r89267  
    662662 * Init the VirtIO SCSI driver and detect attached disks.
    663663 */
    664 int virtio_scsi_init(void __far *pvHba, void __far *pvSinkBuf, uint8_t u8Bus, uint8_t u8DevFn)
     664int virtio_scsi_init(void __far *pvHba, void __far *pvSinkBuf, uint16_t cbSinkBuf, uint8_t u8Bus, uint8_t u8DevFn)
    665665{
    666666    virtio_t __far *virtio = (virtio_t __far *)pvHba;
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