diff mbox

Add build option to support VExpress A15 QEMU emulation

Message ID 1389760710-17762-2-git-send-email-roy.franz@linaro.org
State New
Headers show

Commit Message

Roy Franz Jan. 15, 2014, 4:38 a.m. UTC
This patch adds an EDK2_ARMVE_SUPPORT_QEMU macro that can be defined at build
time to build an image that supports QEMU.  The default build is unchanged and
builds the RTSM configuration.

Two configuration changes are made to support QEMU:

The RTSM VExpress model emulates a different networking controller (91C111)
than the VExpress board (9118).  QEMU emulates the 9118 which matches the
real hardare. Defining the EDK2_ARMVE_SUPPORT_QEMU macro configures the
build to use the 9118 networking driver.

QEMU only models fixed size blocks within a flash device, and the RTSM
configuration stores EFI variables in the smaller boot blocks of the
flash.  When built for QEMU the larger blocks are used that QEMU properly
emulates.

Signed-off-by: Roy Franz <roy.franz@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.0
---
 .../ArmVExpressPkg/ArmVExpress-RTSM-A15.dsc        |   22 +++++++++++++++++---
 .../ArmVExpressPkg/ArmVExpress-RTSM-A15.fdf        |    8 ++++++-
 .../ArmVExpressPkg/ArmVExpress-RTSM-A15_MPCore.dsc |   10 +++++++++
 3 files changed, 36 insertions(+), 4 deletions(-)
diff mbox

Patch

diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15.dsc b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15.dsc
index 67051ac..9404c3f 100644
--- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15.dsc
+++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15.dsc
@@ -81,12 +81,22 @@ 
   #
   # NV Storage PCDs. Use base of 0x0C000000 for NOR1
   #
+!if $(EDK2_ARMVE_SUPPORT_QEMU) == 1
+  # QEMU only models a single flash block size, so use larger blocks
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase|0x0FF00000
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize|0x00040000
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase|0x0FF40000
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize|0x00040000
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase|0x0FF80000
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize|0x00040000
+!else
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase|0x0FFC0000
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize|0x00010000
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase|0x0FFD0000
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize|0x00010000
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase|0x0FFE0000
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize|0x00010000
+!endif
 
   gArmTokenSpaceGuid.PcdVFPEnabled|1
   
@@ -141,9 +151,15 @@ 
   gArmTokenSpaceGuid.PcdGicDistributorBase|0x2C001000
   gArmTokenSpaceGuid.PcdGicInterruptInterfaceBase|0x2C002000
 
-  # Ethernet (SMSC 91C111)
-  gArmPlatformTokenSpaceGuid.PcdLan91xDxeBaseAddress|0x1A000000
-
+  # Select network device based on build time macro
+!if $(EDK2_ARMVE_SUPPORT_QEMU) == 1
+  # Ethernet (SMSC 9118, for QEMU, matches real hardware)
+  gArmPlatformTokenSpaceGuid.PcdLan9118DxeBaseAddress|0x1A000000
+!else
+  # Ethernet (SMSC 91C111, for RTSM)
+  gArmPlatformTokenSpaceGuid.PcdLan91xDxeBaseAddress|0x1A000000
+!endif
+
   #
   # ARM OS Loader
   #
diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15.fdf b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15.fdf
index be79efd..0177849 100644
--- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15.fdf
+++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15.fdf
@@ -144,7 +144,13 @@  READ_LOCK_STATUS   = TRUE
   INF MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Dxe.inf
   INF MdeModulePkg/Universal/Network/UefiPxeBcDxe/UefiPxeBcDxe.inf
   INF MdeModulePkg/Universal/Network/IScsiDxe/IScsiDxe.inf
-  INF ArmPlatformPkg/Drivers/LAN91xDxe/LAN91xDxe.inf
+!if $(EDK2_ARMVE_SUPPORT_QEMU) == 1
+  # LAN9118Dxe.inf for QEMU (matches use of 9118 on real VExpress board)
+  INF ArmPlatformPkg/Drivers/LAN9118Dxe/LAN9118Dxe.inf
+!else
+  # LAN91xDxe.inf for RTSM
+  INF ArmPlatformPkg/Drivers/LAN91xDxe/LAN91xDxe.inf
+!endif
 
   #
   # Multiple Console IO support
diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15_MPCore.dsc b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15_MPCore.dsc
index 8f3c11b..ea02ece 100644
--- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15_MPCore.dsc
+++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15_MPCore.dsc
@@ -83,12 +83,22 @@ 
   #
   # NV Storage PCDs. Use base of 0x0C000000 for NOR1
   #
+!if $(EDK2_ARMVE_SUPPORT_QEMU) == 1
+  # QEMU only models a single flash block size, so use larger blocks
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase|0x0FF00000
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize|0x00040000
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase|0x0FF40000
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize|0x00040000
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase|0x0FF80000
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize|0x00040000
+!else
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase|0x0FFC0000
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize|0x00010000
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase|0x0FFD0000
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize|0x00010000
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase|0x0FFE0000
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize|0x00010000
+!endif
 
   gArmTokenSpaceGuid.PcdVFPEnabled|1