summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--OvmfPkg/Include/Protocol/VirtioDevice.h12
-rw-r--r--OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDevice.h4
-rw-r--r--OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDeviceFunctions.c7
-rw-r--r--OvmfPkg/VirtioBlkDxe/VirtioBlk.c3
-rw-r--r--OvmfPkg/VirtioNetDxe/SnpInitialize.c3
-rw-r--r--OvmfPkg/VirtioPciDeviceDxe/VirtioPciDevice.h4
-rw-r--r--OvmfPkg/VirtioPciDeviceDxe/VirtioPciFunctions.c6
-rw-r--r--OvmfPkg/VirtioRngDxe/VirtioRng.c3
-rw-r--r--OvmfPkg/VirtioScsiDxe/VirtioScsi.c3
9 files changed, 21 insertions, 24 deletions
diff --git a/OvmfPkg/Include/Protocol/VirtioDevice.h b/OvmfPkg/Include/Protocol/VirtioDevice.h
index f8afa7120a..910a4866e7 100644
--- a/OvmfPkg/Include/Protocol/VirtioDevice.h
+++ b/OvmfPkg/Include/Protocol/VirtioDevice.h
@@ -19,6 +19,8 @@
#ifndef __VIRTIO_DEVICE_H__
#define __VIRTIO_DEVICE_H__
+#include <IndustryStandard/Virtio.h>
+
// VirtIo Specification Revision: Major[31:24].Minor[23:16].Revision[15:0
#define VIRTIO_SPEC_REVISION(major,minor,revision) \
((((major) & 0xFF) << 24) | (((minor) & 0xFF) << 16) | ((revision) & 0xFFFF))
@@ -127,14 +129,12 @@ EFI_STATUS
);
/**
- Write the queue address field in the Virtio Header.
-
- The parameter Address must be the base address of the virtqueue divided
- by 4096.
+ Write the queue address field(s) in the Virtio Header.
@param[in] This This instance of VIRTIO_DEVICE_PROTOCOL
- @param[in] Address The 32-bit Queue Address field
+ @param[in] Ring The initialized VRING object to take the
+ addresses from.
@retval EFI_SUCCESS The data was written successfully.
@retval EFI_UNSUPPORTED The underlying IO device doesn't support the
@@ -144,7 +144,7 @@ typedef
EFI_STATUS
(EFIAPI *VIRTIO_SET_QUEUE_ADDRESS) (
IN VIRTIO_DEVICE_PROTOCOL *This,
- IN UINT32 Address
+ IN VRING *Ring
);
/**
diff --git a/OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDevice.h b/OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDevice.h
index 3b1e90ba9f..4130dbc043 100644
--- a/OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDevice.h
+++ b/OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDevice.h
@@ -112,8 +112,8 @@ VirtioMmioSetQueueSel (
EFI_STATUS
VirtioMmioSetQueueAddress (
- VIRTIO_DEVICE_PROTOCOL *This,
- UINT32 Address
+ IN VIRTIO_DEVICE_PROTOCOL *This,
+ IN VRING *Ring
);
EFI_STATUS
diff --git a/OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDeviceFunctions.c b/OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDeviceFunctions.c
index 2cd293ab88..53c734f6b1 100644
--- a/OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDeviceFunctions.c
+++ b/OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDeviceFunctions.c
@@ -180,15 +180,16 @@ VirtioMmioSetQueueSel (
EFI_STATUS
VirtioMmioSetQueueAddress (
- VIRTIO_DEVICE_PROTOCOL *This,
- UINT32 Address
+ IN VIRTIO_DEVICE_PROTOCOL *This,
+ IN VRING *Ring
)
{
VIRTIO_MMIO_DEVICE *Device;
Device = VIRTIO_MMIO_DEVICE_FROM_VIRTIO_DEVICE (This);
- VIRTIO_CFG_WRITE (Device, VIRTIO_MMIO_OFFSET_QUEUE_PFN, Address);
+ VIRTIO_CFG_WRITE (Device, VIRTIO_MMIO_OFFSET_QUEUE_PFN,
+ (UINT32)((UINTN)Ring->Base >> EFI_PAGE_SHIFT));
return EFI_SUCCESS;
}
diff --git a/OvmfPkg/VirtioBlkDxe/VirtioBlk.c b/OvmfPkg/VirtioBlkDxe/VirtioBlk.c
index b35f60c9d2..daccc7a5d0 100644
--- a/OvmfPkg/VirtioBlkDxe/VirtioBlk.c
+++ b/OvmfPkg/VirtioBlkDxe/VirtioBlk.c
@@ -730,8 +730,7 @@ VirtioBlkInit (
//
// step 4c -- Report GPFN (guest-physical frame number) of queue.
//
- Status = Dev->VirtIo->SetQueueAddress (Dev->VirtIo,
- (UINT32) ((UINTN) Dev->Ring.Base >> EFI_PAGE_SHIFT));
+ Status = Dev->VirtIo->SetQueueAddress (Dev->VirtIo, &Dev->Ring);
if (EFI_ERROR (Status)) {
goto ReleaseQueue;
}
diff --git a/OvmfPkg/VirtioNetDxe/SnpInitialize.c b/OvmfPkg/VirtioNetDxe/SnpInitialize.c
index 71b67fa52d..f06b0a5a57 100644
--- a/OvmfPkg/VirtioNetDxe/SnpInitialize.c
+++ b/OvmfPkg/VirtioNetDxe/SnpInitialize.c
@@ -95,8 +95,7 @@ VirtioNetInitRing (
//
// step 4c -- report GPFN (guest-physical frame number) of queue
//
- Status = Dev->VirtIo->SetQueueAddress (Dev->VirtIo,
- (UINT32) ((UINTN) Ring->Base >> EFI_PAGE_SHIFT));
+ Status = Dev->VirtIo->SetQueueAddress (Dev->VirtIo, Ring);
if (EFI_ERROR (Status)) {
goto ReleaseQueue;
}
diff --git a/OvmfPkg/VirtioPciDeviceDxe/VirtioPciDevice.h b/OvmfPkg/VirtioPciDeviceDxe/VirtioPciDevice.h
index 95f82611e2..8f17a16c88 100644
--- a/OvmfPkg/VirtioPciDeviceDxe/VirtioPciDevice.h
+++ b/OvmfPkg/VirtioPciDeviceDxe/VirtioPciDevice.h
@@ -124,8 +124,8 @@ VirtioPciSetGuestFeatures (
EFI_STATUS
EFIAPI
VirtioPciSetQueueAddress (
- VIRTIO_DEVICE_PROTOCOL *This,
- UINT32 Address
+ IN VIRTIO_DEVICE_PROTOCOL *This,
+ IN VRING *Ring
);
EFI_STATUS
diff --git a/OvmfPkg/VirtioPciDeviceDxe/VirtioPciFunctions.c b/OvmfPkg/VirtioPciDeviceDxe/VirtioPciFunctions.c
index 4ba37a2d1c..243aa14c24 100644
--- a/OvmfPkg/VirtioPciDeviceDxe/VirtioPciFunctions.c
+++ b/OvmfPkg/VirtioPciDeviceDxe/VirtioPciFunctions.c
@@ -181,8 +181,8 @@ VirtioPciSetGuestFeatures (
EFI_STATUS
EFIAPI
VirtioPciSetQueueAddress (
- VIRTIO_DEVICE_PROTOCOL *This,
- UINT32 Address
+ IN VIRTIO_DEVICE_PROTOCOL *This,
+ IN VRING *Ring
)
{
VIRTIO_PCI_DEVICE *Dev;
@@ -190,7 +190,7 @@ VirtioPciSetQueueAddress (
Dev = VIRTIO_PCI_DEVICE_FROM_VIRTIO_DEVICE (This);
return VirtioPciIoWrite (Dev, VIRTIO_PCI_OFFSET_QUEUE_ADDRESS, sizeof (UINT32),
- Address);
+ (UINT32)((UINTN)Ring->Base >> EFI_PAGE_SHIFT));
}
EFI_STATUS
diff --git a/OvmfPkg/VirtioRngDxe/VirtioRng.c b/OvmfPkg/VirtioRngDxe/VirtioRng.c
index de4afefe70..290bddeeec 100644
--- a/OvmfPkg/VirtioRngDxe/VirtioRng.c
+++ b/OvmfPkg/VirtioRngDxe/VirtioRng.c
@@ -284,8 +284,7 @@ VirtioRngInit (
//
// step 4c -- Report GPFN (guest-physical frame number) of queue.
//
- Status = Dev->VirtIo->SetQueueAddress (Dev->VirtIo,
- (UINT32) ((UINTN) Dev->Ring.Base >> EFI_PAGE_SHIFT));
+ Status = Dev->VirtIo->SetQueueAddress (Dev->VirtIo, &Dev->Ring);
if (EFI_ERROR (Status)) {
goto ReleaseQueue;
}
diff --git a/OvmfPkg/VirtioScsiDxe/VirtioScsi.c b/OvmfPkg/VirtioScsiDxe/VirtioScsi.c
index 5295288622..162577bcb9 100644
--- a/OvmfPkg/VirtioScsiDxe/VirtioScsi.c
+++ b/OvmfPkg/VirtioScsiDxe/VirtioScsi.c
@@ -841,8 +841,7 @@ VirtioScsiInit (
//
// step 4c -- Report GPFN (guest-physical frame number) of queue.
//
- Status = Dev->VirtIo->SetQueueAddress (Dev->VirtIo,
- (UINT32) ((UINTN) Dev->Ring.Base >> EFI_PAGE_SHIFT));
+ Status = Dev->VirtIo->SetQueueAddress (Dev->VirtIo, &Dev->Ring);
if (EFI_ERROR (Status)) {
goto ReleaseQueue;
}