summaryrefslogtreecommitdiffstats
path: root/OvmfPkg/Include
diff options
context:
space:
mode:
authorBrijesh Singh <brijesh.singh@amd.com>2017-08-23 06:57:18 -0400
committerLaszlo Ersek <lersek@redhat.com>2017-08-25 10:42:19 +0200
commitfef6becb55355c2f6cf0a99f6e7e564d3165ee49 (patch)
tree4a053f610e193a3b93976cf1240b266a6e9b6329 /OvmfPkg/Include
parent60ee56295fb672bf5a324d4016582c88facb2ecf (diff)
downloadedk2-fef6becb55355c2f6cf0a99f6e7e564d3165ee49.tar.gz
edk2-fef6becb55355c2f6cf0a99f6e7e564d3165ee49.tar.bz2
edk2-fef6becb55355c2f6cf0a99f6e7e564d3165ee49.zip
OvmfPkg/VirtioLib: add function to map VRING
Add a function to map the ring buffer with BusMasterCommonBuffer so that ring can be accessed by both guest and hypervisor. Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Jordan Justen <jordan.l.justen@intel.com> Cc: Tom Lendacky <thomas.lendacky@amd.com> Cc: Laszlo Ersek <lersek@redhat.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Brijesh Singh <brijesh.singh@amd.com> [lersek@redhat.com: fix typo in commit message] Reviewed-by: Laszlo Ersek <lersek@redhat.com> Regression-tested-by: Laszlo Ersek <lersek@redhat.com>
Diffstat (limited to 'OvmfPkg/Include')
-rw-r--r--OvmfPkg/Include/Library/VirtioLib.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/OvmfPkg/Include/Library/VirtioLib.h b/OvmfPkg/Include/Library/VirtioLib.h
index 929e00c5f7..6a422deba2 100644
--- a/OvmfPkg/Include/Library/VirtioLib.h
+++ b/OvmfPkg/Include/Library/VirtioLib.h
@@ -62,6 +62,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.
The caller is responsible to stop the host from using this ring before