mirror of https://github.com/acidanthera/audk.git
OvmfPkg/VirtioMmioDeviceLib: Add virtio 1.0 detection.
Add #defines for the Version field. Read and store the version, log the version found as info message. Continue to return UNSUPPORTED for now, we need some more patches to complete virtio 1.0 support first. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
This commit is contained in:
parent
94e465e5cb
commit
08293e43da
|
@ -58,7 +58,6 @@ VirtioMmioInit (
|
|||
)
|
||||
{
|
||||
UINT32 MagicValue;
|
||||
UINT32 Version;
|
||||
|
||||
//
|
||||
// Initialize VirtIo Mmio Device
|
||||
|
@ -66,7 +65,6 @@ VirtioMmioInit (
|
|||
CopyMem (&Device->VirtioDevice, &mMmioDeviceProtocolTemplate,
|
||||
sizeof (VIRTIO_DEVICE_PROTOCOL));
|
||||
Device->BaseAddress = BaseAddress;
|
||||
Device->VirtioDevice.Revision = VIRTIO_SPEC_REVISION (0, 9, 5);
|
||||
Device->VirtioDevice.SubSystemDeviceId =
|
||||
MmioRead32 (BaseAddress + VIRTIO_MMIO_OFFSET_DEVICE_ID);
|
||||
|
||||
|
@ -78,8 +76,19 @@ VirtioMmioInit (
|
|||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
Version = VIRTIO_CFG_READ (Device, VIRTIO_MMIO_OFFSET_VERSION);
|
||||
if (Version != 1) {
|
||||
Device->Version = VIRTIO_CFG_READ (Device, VIRTIO_MMIO_OFFSET_VERSION);
|
||||
switch (Device->Version) {
|
||||
case VIRTIO_MMIO_DEVICE_VERSION_0_95:
|
||||
DEBUG ((DEBUG_INFO, "%a virtio 0.9.5, id %d\n", __FUNCTION__,
|
||||
Device->VirtioDevice.SubSystemDeviceId));
|
||||
Device->VirtioDevice.Revision = VIRTIO_SPEC_REVISION (0, 9, 5);
|
||||
break;
|
||||
case VIRTIO_MMIO_DEVICE_VERSION_1_00:
|
||||
DEBUG ((DEBUG_INFO, "%a virtio 1.0, id %d\n", __FUNCTION__,
|
||||
Device->VirtioDevice.SubSystemDeviceId));
|
||||
Device->VirtioDevice.Revision = VIRTIO_SPEC_REVISION (1, 0, 0);
|
||||
return EFI_UNSUPPORTED;
|
||||
default:
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,9 +23,13 @@
|
|||
#include <Library/MemoryAllocationLib.h>
|
||||
|
||||
#define VIRTIO_MMIO_DEVICE_SIGNATURE SIGNATURE_32 ('V', 'M', 'I', 'O')
|
||||
#define VIRTIO_MMIO_DEVICE_VERSION_0_95 1
|
||||
#define VIRTIO_MMIO_DEVICE_VERSION_1_00 2
|
||||
|
||||
|
||||
typedef struct {
|
||||
UINT32 Signature;
|
||||
UINT32 Version;
|
||||
VIRTIO_DEVICE_PROTOCOL VirtioDevice;
|
||||
PHYSICAL_ADDRESS BaseAddress;
|
||||
} VIRTIO_MMIO_DEVICE;
|
||||
|
|
Loading…
Reference in New Issue