X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=OvmfPkg%2FInclude%2FLibrary%2FVirtioLib.h;h=bca58cdeb2aa1fdfe5f49a7f72a64d4aaf42002e;hp=929e00c5f7d53cccb5b430786de92e2f195d0595;hb=61a044c6c15f5806a30ff23409ba5287d9d07163;hpb=fc2c1543e51ee6fc8a2956594456eb4db5f0a3ca diff --git a/OvmfPkg/Include/Library/VirtioLib.h b/OvmfPkg/Include/Library/VirtioLib.h index 929e00c5f7..bca58cdeb2 100644 --- a/OvmfPkg/Include/Library/VirtioLib.h +++ b/OvmfPkg/Include/Library/VirtioLib.h @@ -42,9 +42,8 @@ @param[out] Ring The virtio ring to set up. - @retval EFI_OUT_OF_RESOURCES AllocatePages() failed to allocate contiguous - pages for the requested QueueSize. Fields of - Ring have indeterminate value. + @return Status codes propagated from + VirtIo->AllocateSharedPages(). @retval EFI_SUCCESS Allocation and setup successful. Ring->Base (and nothing else) is responsible for @@ -60,6 +59,32 @@ VirtioRingInit ( ); +/** + + Map the ring buffer so that it can be accessed equally by both guest + and hypervisor. + + @param[in] VirtIo The virtio device instance. + + @param[in] Ring The virtio ring to map. + + @param[out] RingBaseShift A resulting translation offset, to be + passed to VirtIo->SetQueueAddress(). + + @param[out] Mapping A resulting token to pass to + VirtIo->UnmapSharedBuffer(). + + @return Status code from VirtIo->MapSharedBuffer() +**/ +EFI_STATUS +EFIAPI +VirtioRingMap ( + IN VIRTIO_DEVICE_PROTOCOL *VirtIo, + IN VRING *Ring, + OUT UINT64 *RingBaseShift, + OUT VOID **Mapping + ); + /** Tear down the internal resources of a configured virtio ring. @@ -126,33 +151,34 @@ VirtioPrepare ( The caller is responsible for initializing *Indices with VirtioPrepare() first. - @param[in,out] Ring The virtio ring to append the buffer to, as a - descriptor. + @param[in,out] Ring The virtio ring to append the buffer to, + as a descriptor. - @param[in] BufferPhysAddr (Guest pseudo-physical) start address of the - transmit / receive buffer. + @param[in] BufferDeviceAddress (Bus master device) start address of the + transmit / receive buffer. - @param[in] BufferSize Number of bytes to transmit or receive. + @param[in] BufferSize Number of bytes to transmit or receive. - @param[in] Flags A bitmask of VRING_DESC_F_* flags. The caller - computes this mask dependent on further buffers to - append and transfer direction. - VRING_DESC_F_INDIRECT is unsupported. The - VRING_DESC.Next field is always set, but the host - only interprets it dependent on VRING_DESC_F_NEXT. + @param[in] Flags A bitmask of VRING_DESC_F_* flags. The + caller computes this mask dependent on + further buffers to append and transfer + direction. VRING_DESC_F_INDIRECT is + unsupported. The VRING_DESC.Next field is + always set, but the host only interprets + it dependent on VRING_DESC_F_NEXT. - @param[in,out] Indices Indices->HeadDescIdx is not accessed. - On input, Indices->NextDescIdx identifies the next - descriptor to carry the buffer. On output, - Indices->NextDescIdx is incremented by one, modulo - 2^16. + @param[in,out] Indices Indices->HeadDescIdx is not accessed. + On input, Indices->NextDescIdx identifies + the next descriptor to carry the buffer. + On output, Indices->NextDescIdx is + incremented by one, modulo 2^16. **/ VOID EFIAPI VirtioAppendDesc ( IN OUT VRING *Ring, - IN UINTN BufferPhysAddr, + IN UINT64 BufferDeviceAddress, IN UINT32 BufferSize, IN UINT16 Flags, IN OUT DESC_INDICES *Indices