VirtualBox

Ignore:
Timestamp:
May 28, 2021 3:44:38 PM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
144713
Message:

Devices/PC/BIOS: Remove the skip_b,skip_a mechanism as it is unused now making the device drivers lss complex, bugref:4841

File:
1 edited

Legend:

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

    r89267 r89364  
    103103typedef struct
    104104{
    105     /** The descriptor table, using 5 max. */
    106     virtio_q_desc_t      aDescTbl[5];
     105    /** The descriptor table, using 3 max. */
     106    virtio_q_desc_t      aDescTbl[3];
    107107    /** Available ring. */
    108108    virtio_q_avail_t     AvailRing;
     
    209209    /** Device/Function number. */
    210210    uint8_t          u8DevFn;
    211     /** The sink buf. */
    212     void __far       *pvSinkBuf;
    213211    /** The current executed command structure. */
    214212    virtio_scsi_req_hdr_t ScsiReqHdr;
     
    435433
    436434int virtio_scsi_cmd_data_in(void __far *pvHba, uint8_t idTgt, uint8_t __far *aCDB,
    437                             uint8_t cbCDB, uint8_t __far *buffer, uint32_t length, uint16_t skip_b,
    438                             uint16_t skip_a)
     435                            uint8_t cbCDB, uint8_t __far *buffer, uint32_t length)
    439436{
    440437    virtio_t __far *virtio = (virtio_t __far *)pvHba;
    441438    uint16_t idxUsedOld = virtio->Queue.UsedRing.idxNextUsed;
    442     uint8_t idxDesc = 0;
    443439
    444440    _fmemset(&virtio->ScsiReqHdr, 0, sizeof(virtio->ScsiReqHdr));
     
    452448
    453449    /* Fill in the descriptors. */
    454     virtio->Queue.aDescTbl[idxDesc].GCPhysBufLow  = virtio_addr_to_phys(&virtio->ScsiReqHdr);
    455     virtio->Queue.aDescTbl[idxDesc].GCPhysBufHigh = 0;
    456     virtio->Queue.aDescTbl[idxDesc].cbBuf         = sizeof(virtio->ScsiReqHdr);
    457     virtio->Queue.aDescTbl[idxDesc].fFlags        = VIRTIO_Q_DESC_F_NEXT;
    458     virtio->Queue.aDescTbl[idxDesc].idxNext       = 1;
    459     idxDesc++;
     450    virtio->Queue.aDescTbl[0].GCPhysBufLow  = virtio_addr_to_phys(&virtio->ScsiReqHdr);
     451    virtio->Queue.aDescTbl[0].GCPhysBufHigh = 0;
     452    virtio->Queue.aDescTbl[0].cbBuf         = sizeof(virtio->ScsiReqHdr);
     453    virtio->Queue.aDescTbl[0].fFlags        = VIRTIO_Q_DESC_F_NEXT;
     454    virtio->Queue.aDescTbl[0].idxNext       = 1;
    460455
    461456    /* No data out buffer, the status comes right after this in the next descriptor. */
    462     virtio->Queue.aDescTbl[idxDesc].GCPhysBufLow  = virtio_addr_to_phys(&virtio->ScsiReqSts);
    463     virtio->Queue.aDescTbl[idxDesc].GCPhysBufHigh = 0;
    464     virtio->Queue.aDescTbl[idxDesc].cbBuf         = sizeof(virtio->ScsiReqSts);
    465     virtio->Queue.aDescTbl[idxDesc].fFlags        = VIRTIO_Q_DESC_F_WRITE | VIRTIO_Q_DESC_F_NEXT;
    466     virtio->Queue.aDescTbl[idxDesc].idxNext       = 2;
    467     idxDesc++;
    468 
    469     /* Prepend a sinkhole if data is skipped upfront. */
    470     if (skip_b)
    471     {
    472         virtio->Queue.aDescTbl[idxDesc].GCPhysBufLow  = virtio_addr_to_phys(virtio->pvSinkBuf);
    473         virtio->Queue.aDescTbl[idxDesc].GCPhysBufHigh = 0;
    474         virtio->Queue.aDescTbl[idxDesc].cbBuf         = skip_b;
    475         virtio->Queue.aDescTbl[idxDesc].fFlags        = VIRTIO_Q_DESC_F_WRITE | VIRTIO_Q_DESC_F_NEXT;
    476         virtio->Queue.aDescTbl[idxDesc].idxNext       = idxDesc + 1;
    477         idxDesc++;
    478     }
    479 
    480     virtio->Queue.aDescTbl[idxDesc].GCPhysBufLow  = virtio_addr_to_phys(buffer);
    481     virtio->Queue.aDescTbl[idxDesc].GCPhysBufHigh = 0;
    482     virtio->Queue.aDescTbl[idxDesc].cbBuf         = length;
    483     virtio->Queue.aDescTbl[idxDesc].fFlags        = VIRTIO_Q_DESC_F_WRITE; /* End of chain. */
    484     virtio->Queue.aDescTbl[idxDesc].idxNext       = skip_a ? idxDesc + 1 : 0;
    485     idxDesc++;
    486 
    487     /* Append a sinkhole if data is skipped at the end. */
    488     if (skip_a)
    489     {
    490         virtio->Queue.aDescTbl[idxDesc - 1].fFlags  |= VIRTIO_Q_DESC_F_NEXT;
    491         virtio->Queue.aDescTbl[idxDesc - 1].idxNext = idxDesc;
    492 
    493         virtio->Queue.aDescTbl[idxDesc].GCPhysBufLow  = virtio_addr_to_phys(virtio->pvSinkBuf);
    494         virtio->Queue.aDescTbl[idxDesc].GCPhysBufHigh = 0;
    495         virtio->Queue.aDescTbl[idxDesc].cbBuf         = skip_a;
    496         virtio->Queue.aDescTbl[idxDesc].fFlags        = VIRTIO_Q_DESC_F_WRITE; /* End of chain. */
    497         virtio->Queue.aDescTbl[idxDesc].idxNext       = 0;
    498     }
     457    virtio->Queue.aDescTbl[1].GCPhysBufLow  = virtio_addr_to_phys(&virtio->ScsiReqSts);
     458    virtio->Queue.aDescTbl[1].GCPhysBufHigh = 0;
     459    virtio->Queue.aDescTbl[1].cbBuf         = sizeof(virtio->ScsiReqSts);
     460    virtio->Queue.aDescTbl[1].fFlags        = VIRTIO_Q_DESC_F_WRITE | VIRTIO_Q_DESC_F_NEXT;
     461    virtio->Queue.aDescTbl[1].idxNext       = 2;
     462
     463    virtio->Queue.aDescTbl[2].GCPhysBufLow  = virtio_addr_to_phys(buffer);
     464    virtio->Queue.aDescTbl[2].GCPhysBufHigh = 0;
     465    virtio->Queue.aDescTbl[2].cbBuf         = length;
     466    virtio->Queue.aDescTbl[2].fFlags        = VIRTIO_Q_DESC_F_WRITE; /* End of chain. */
     467    virtio->Queue.aDescTbl[2].idxNext       = 0;
    499468
    500469    /* Put it into the queue, the index is supposed to be free-running and clipped to the ring size
     
    662631 * Init the VirtIO SCSI driver and detect attached disks.
    663632 */
    664 int virtio_scsi_init(void __far *pvHba, void __far *pvSinkBuf, uint16_t cbSinkBuf, uint8_t u8Bus, uint8_t u8DevFn)
     633int virtio_scsi_init(void __far *pvHba, uint8_t u8Bus, uint8_t u8DevFn)
    665634{
    666635    virtio_t __far *virtio = (virtio_t __far *)pvHba;
     
    714683        /* Enable PCI memory, I/O, bus mastering access in command register. */
    715684        pci_write_config_word(u8Bus, u8DevFn, 4, 0x7);
    716 
    717         virtio->pvSinkBuf = pvSinkBuf;
    718685        return virtio_scsi_hba_init(virtio, u8Bus, u8DevFn, u8PciCapOffVirtIo);
    719686    }
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