Changeset 82174 in vbox for trunk/src/VBox/Devices/PC/BIOS
- Timestamp:
- Nov 25, 2019 1:13:14 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/PC/BIOS/virtio.c
r82164 r82174 67 67 { 68 68 /** Flags. */ 69 uint16_t fFlags;69 volatile uint16_t fFlags; 70 70 /** Next index to write an available buffer by the driver. */ 71 uint16_t idxNextFree;71 volatile uint16_t idxNextFree; 72 72 /** The ring - we only provide one entry. */ 73 uint16_t au16Ring[VIRTIO_SCSI_RING_ELEM];73 volatile uint16_t au16Ring[VIRTIO_SCSI_RING_ELEM]; 74 74 /** Used event index. */ 75 uint16_t u16EvtUsed;75 volatile uint16_t u16EvtUsed; 76 76 } virtio_q_avail_t; 77 77 … … 437 437 { 438 438 uint16_t idxUsedOld = virtio->Queue.UsedRing.idxNextUsed; 439 uint64_t idxNext = virtio->Queue.AvailRing.idxNextFree;440 439 441 440 _fmemset(&virtio->ScsiReqHdr, 0, sizeof(virtio->ScsiReqHdr)); … … 459 458 virtio->Queue.aDescTbl[1].cbBuf = length; 460 459 virtio->Queue.aDescTbl[1].fFlags = VIRTIO_Q_DESC_F_NEXT; 461 virtio->Queue.aDescTbl[1].idxNext = 1;462 463 virtio->Queue.aDescTbl[ 1].GCPhysBufLow = virtio_addr_to_phys(&virtio->ScsiReqSts);464 virtio->Queue.aDescTbl[ 1].GCPhysBufHigh = 0;465 virtio->Queue.aDescTbl[ 1].cbBuf = sizeof(virtio->ScsiReqSts);466 virtio->Queue.aDescTbl[ 1].fFlags = VIRTIO_Q_DESC_F_WRITE; /* End of chain. */467 virtio->Queue.aDescTbl[ 1].idxNext = 0;460 virtio->Queue.aDescTbl[1].idxNext = 2; 461 462 virtio->Queue.aDescTbl[2].GCPhysBufLow = virtio_addr_to_phys(&virtio->ScsiReqSts); 463 virtio->Queue.aDescTbl[2].GCPhysBufHigh = 0; 464 virtio->Queue.aDescTbl[2].cbBuf = sizeof(virtio->ScsiReqSts); 465 virtio->Queue.aDescTbl[2].fFlags = VIRTIO_Q_DESC_F_WRITE; /* End of chain. */ 466 virtio->Queue.aDescTbl[2].idxNext = 0; 468 467 469 468 /* Put it into the queue. */ … … 474 473 /* Notify the device about the new command. */ 475 474 DBG_VIRTIO("VirtIO: Submitting new request, Queue.offNotify=0x%x\n", virtio->Queue.offNotify); 476 virtio_reg_notify_write_u16(virtio, virtio->Queue.offNotify, idxNext);475 virtio_reg_notify_write_u16(virtio, virtio->Queue.offNotify, VIRTIO_SCSI_Q_REQUEST); 477 476 478 477 /* Wait for it to complete. */ … … 481 480 DBG_VIRTIO("VirtIO: Request complete u8Response=%u\n", virtio->ScsiReqSts.u8Response); 482 481 483 /* Read ISR register to de-assert the interrupt, don't need to do anything with out. */482 /* Read ISR register to de-assert the interrupt, don't need to do anything with it. */ 484 483 virtio_reg_isr_read_u8(virtio); 485 484 … … 494 493 { 495 494 uint16_t idxUsedOld = virtio->Queue.UsedRing.idxNextUsed; 496 uint64_t idxNext = virtio->Queue.AvailRing.idxNextFree;497 495 498 496 _fmemset(&virtio->ScsiReqHdr, 0, sizeof(virtio->ScsiReqHdr)); … … 532 530 /* Notify the device about the new command. */ 533 531 DBG_VIRTIO("VirtIO: Submitting new request, Queue.offNotify=0x%x\n", virtio->Queue.offNotify); 534 virtio_reg_notify_write_u16(virtio, virtio->Queue.offNotify, idxNext);532 virtio_reg_notify_write_u16(virtio, virtio->Queue.offNotify, VIRTIO_SCSI_Q_REQUEST); 535 533 536 534 /* Wait for it to complete. */ … … 539 537 DBG_VIRTIO("VirtIO: Request complete u8Response=%u\n", virtio->ScsiReqSts.u8Response); 540 538 541 /* Read ISR register to de-assert the interrupt, don't need to do anything with out. */539 /* Read ISR register to de-assert the interrupt, don't need to do anything with it. */ 542 540 virtio_reg_isr_read_u8(virtio); 543 541 … … 1039 1037 default: 1040 1038 DBG_VIRTIO("VirtIO SCSI HBA with unknown PCI capability type 0x%x\n", u8PciVirtioCfg); 1039 break; 1041 1040 } 1042 1041 }
Note:
See TracChangeset
for help on using the changeset viewer.