summaryrefslogtreecommitdiffstats
path: root/OvmfPkg
diff options
context:
space:
mode:
authorBrijesh Singh <brijesh.singh@amd.com>2017-08-23 06:57:17 -0400
committerLaszlo Ersek <lersek@redhat.com>2017-08-25 10:42:19 +0200
commit60ee56295fb672bf5a324d4016582c88facb2ecf (patch)
treeece47e86e6dbcf946357618cceedac7e718e1ac1 /OvmfPkg
parent53a4c6047f3ce2ece7bb8db5b9815a1c9227dddb (diff)
downloadedk2-60ee56295fb672bf5a324d4016582c88facb2ecf.tar.gz
edk2-60ee56295fb672bf5a324d4016582c88facb2ecf.tar.bz2
edk2-60ee56295fb672bf5a324d4016582c88facb2ecf.zip
OvmfPkg/Virtio10Dxe: add the RingBaseShift offset
virtio drivers use VIRTIO_DEVICE_PROTOCOL.MapSharedBuffer() to map the ring buffer host address to a device address. If an IOMMU is present then RingBaseShift contains the offset from the host address. Suggested-by: Laszlo Ersek <lersek@redhat.com> 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> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Regression-tested-by: Laszlo Ersek <lersek@redhat.com>
Diffstat (limited to 'OvmfPkg')
-rw-r--r--OvmfPkg/Virtio10Dxe/Virtio10.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/OvmfPkg/Virtio10Dxe/Virtio10.c b/OvmfPkg/Virtio10Dxe/Virtio10.c
index ef9a007106..e9b50b6e43 100644
--- a/OvmfPkg/Virtio10Dxe/Virtio10.c
+++ b/OvmfPkg/Virtio10Dxe/Virtio10.c
@@ -498,11 +498,10 @@ Virtio10SetQueueAddress (
UINT64 Address;
UINT16 Enable;
- ASSERT (RingBaseShift == 0);
-
Dev = VIRTIO_1_0_FROM_VIRTIO_DEVICE (This);
Address = (UINTN)Ring->Desc;
+ Address += RingBaseShift;
Status = Virtio10Transfer (Dev->PciIo, &Dev->CommonConfig, TRUE,
OFFSET_OF (VIRTIO_PCI_COMMON_CFG, QueueDesc),
sizeof Address, &Address);
@@ -511,6 +510,7 @@ Virtio10SetQueueAddress (
}
Address = (UINTN)Ring->Avail.Flags;
+ Address += RingBaseShift;
Status = Virtio10Transfer (Dev->PciIo, &Dev->CommonConfig, TRUE,
OFFSET_OF (VIRTIO_PCI_COMMON_CFG, QueueAvail),
sizeof Address, &Address);
@@ -519,6 +519,7 @@ Virtio10SetQueueAddress (
}
Address = (UINTN)Ring->Used.Flags;
+ Address += RingBaseShift;
Status = Virtio10Transfer (Dev->PciIo, &Dev->CommonConfig, TRUE,
OFFSET_OF (VIRTIO_PCI_COMMON_CFG, QueueUsed),
sizeof Address, &Address);