ArmPlatformPkg/ArmFvpDxe: Added Virtio Block support

Right now the ARM Platform driver does not do much, but
I expect to move most platform specific code into platform
specific driver in the future.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Olivier Martin <olivier.martin@arm.com>

v5:
- ensure / document that the VIRTIO_BLK_DEVICE_PATH structure must be
  packed
- fix whitespace damage in definition of "mVirtioBlockDevicePath"
- the platform driver is added to all platform DSC and FDF files in the
  previous patch; this patch focuses on virtio only

Change-Id: I3505bfc5b31085b8017bd9e6895a155bd7a2eee9
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-By: Olivier Martin <olivier.martin@arm.com>



git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14981 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Olivier Martin 2013-12-13 12:05:01 +00:00 committed by oliviermartin
parent 1e69576f53
commit e94784c68d
8 changed files with 81 additions and 1 deletions

View File

@ -13,6 +13,41 @@
**/
#include <Library/UefiLib.h>
#include <Library/VirtioMmioDeviceLib.h>
#include <Library/DebugLib.h>
#include <Library/UefiBootServicesTableLib.h>
#define ARM_FVP_BASE_VIRTIO_BLOCK_BASE 0x1c130000
#pragma pack(1)
typedef struct {
VENDOR_DEVICE_PATH Vendor;
EFI_DEVICE_PATH_PROTOCOL End;
} VIRTIO_BLK_DEVICE_PATH;
#pragma pack()
VIRTIO_BLK_DEVICE_PATH mVirtioBlockDevicePath =
{
{
{
HARDWARE_DEVICE_PATH,
HW_VENDOR_DP,
{
(UINT8)( sizeof(VENDOR_DEVICE_PATH) ),
(UINT8)((sizeof(VENDOR_DEVICE_PATH)) >> 8)
}
},
EFI_CALLER_ID_GUID,
},
{
END_DEVICE_PATH_TYPE,
END_ENTIRE_DEVICE_PATH_SUBTYPE,
{
sizeof (EFI_DEVICE_PATH_PROTOCOL),
0
}
}
};
EFI_STATUS
EFIAPI
@ -21,6 +56,20 @@ ArmFvpInitialise (
IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
return EFI_SUCCESS;
Status = gBS->InstallProtocolInterface (&ImageHandle,
&gEfiDevicePathProtocolGuid, EFI_NATIVE_INTERFACE,
&mVirtioBlockDevicePath);
if (EFI_ERROR (Status)) {
return Status;
}
// Declare the Virtio BlockIo device
Status = VirtioMmioInstallDevice (ARM_FVP_BASE_VIRTIO_BLOCK_BASE, ImageHandle);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "ArmFvpDxe: Failed to install Virtio block device\n"));
}
return Status;
}

View File

@ -26,7 +26,10 @@
[Packages]
MdePkg/MdePkg.dec
ArmPlatformPkg/ArmPlatformPkg.dec
OvmfPkg/OvmfPkg.dec
[LibraryClasses]
UefiDriverEntryPoint
UefiBootServicesTableLib
VirtioMmioDeviceLib
BaseMemoryLib

View File

@ -42,6 +42,10 @@
TimerLib|ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.inf
# Virtio Support
VirtioLib|OvmfPkg/Library/VirtioLib/VirtioLib.inf
VirtioMmioDeviceLib|OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDeviceLib.inf
[LibraryClasses.common.SEC]
ArmLib|ArmPkg/Library/ArmLib/AArch64/AArch64LibSec.inf
ArmPlatformSecLib|ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/ArmVExpressSecLib.inf
@ -261,6 +265,12 @@
ArmPlatformPkg/Drivers/PL180MciDxe/PL180MciDxe.inf
!endif
#
# Platform Driver
#
ArmPlatformPkg/ArmVExpressPkg/ArmFvpDxe/ArmFvpDxe.inf
OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
#
# FAT filesystem + GPT/MBR partitioning
#

View File

@ -176,6 +176,12 @@ READ_LOCK_STATUS = TRUE
INF ArmPlatformPkg/Drivers/PL180MciDxe/PL180MciDxe.inf
!endif
#
# Platform Driver
#
INF ArmPlatformPkg/ArmVExpressPkg/ArmFvpDxe/ArmFvpDxe.inf
INF OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
#
# UEFI application (Shell Embedded Boot Loader)
#

View File

@ -34,6 +34,10 @@
ArmCpuLib|ArmPkg/Drivers/ArmCpuLib/ArmCortexAEMv8Lib/ArmCortexAEMv8Lib.inf
ArmPlatformLib|ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/ArmVExpressFoundationLib.inf
# Virtio Support
VirtioLib|OvmfPkg/Library/VirtioLib/VirtioLib.inf
VirtioMmioDeviceLib|OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDeviceLib.inf
ArmPlatformSysConfigLib|ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSysConfigLib/ArmVExpressSysConfigLib.inf
TimerLib|ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.inf
@ -224,6 +228,7 @@
# Platform Driver
#
ArmPlatformPkg/ArmVExpressPkg/ArmFvpDxe/ArmFvpDxe.inf
OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
#
# FAT filesystem + GPT/MBR partitioning

View File

@ -158,6 +158,7 @@ READ_LOCK_STATUS = TRUE
# Platform Driver
#
INF ArmPlatformPkg/ArmVExpressPkg/ArmFvpDxe/ArmFvpDxe.inf
INF OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
#
# UEFI application (Shell Embedded Boot Loader)

View File

@ -40,6 +40,10 @@
TimerLib|ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.inf
# VirtIo Support
VirtioLib|OvmfPkg/Library/VirtioLib/VirtioLib.inf
VirtioMmioDeviceLib|OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDeviceLib.inf
[LibraryClasses.common.SEC]
ArmLib|ArmPkg/Library/ArmLib/AArch64/AArch64LibSec.inf
ArmPlatformSecLib|ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/ArmVExpressSecLib.inf
@ -258,6 +262,7 @@
# Platform Driver
#
ArmPlatformPkg/ArmVExpressPkg/ArmFvpDxe/ArmFvpDxe.inf
OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
#
# FAT filesystem + GPT/MBR partitioning

View File

@ -168,6 +168,7 @@ READ_LOCK_STATUS = TRUE
# Platform Driver
#
INF ArmPlatformPkg/ArmVExpressPkg/ArmFvpDxe/ArmFvpDxe.inf
INF OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
#
# UEFI application (Shell Embedded Boot Loader)