From a89cb4b77386dad8f54151a39ae1a215e386af00 Mon Sep 17 00:00:00 2001 From: oliviermartin Date: Fri, 3 Jun 2011 09:39:00 +0000 Subject: [PATCH] ArmPlatformPkg/ArmRealViewEbPkg: Use NorFlashDxe and enable variables services The ARM RealView EB (hardware and RTSM) supports the same NOR Flash controller as the ARM Versatile Express. Add the implementation of the NorFlashPlatformLib for ArmRealViewEb. Remove the Firmware Volume Block raw data used to enable environment variables on ARM RealView EB from the FDF file to use the NOR Flash driver. Replace the variable service emulation by the version using Firmware Volume Block. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11747 6f19259b-4bc3-4df7-8a09-765794883524 --- .../ArmRealViewEb-RTSM-A8.dsc | 18 ++++++- .../ArmRealViewEb-RTSM-A9x2.dsc | 18 ++++++- .../ArmRealViewEb-RTSM-MPCore.fdf | 39 ++------------ .../ArmRealViewEb-RTSM-UniCore.fdf | 39 ++------------ .../NorFlashArmRealViewEb.c | 52 +++++++++++++++++++ .../NorFlashArmRealViewEbLib.inf | 41 +++++++++++++++ 6 files changed, 135 insertions(+), 72 deletions(-) create mode 100644 ArmPlatformPkg/ArmRealViewEbPkg/Library/NorFlashArmRealViewEbLib/NorFlashArmRealViewEb.c create mode 100644 ArmPlatformPkg/ArmRealViewEbPkg/Library/NorFlashArmRealViewEbLib/NorFlashArmRealViewEbLib.inf diff --git a/ArmPlatformPkg/ArmRealViewEbPkg/ArmRealViewEb-RTSM-A8.dsc b/ArmPlatformPkg/ArmRealViewEbPkg/ArmRealViewEb-RTSM-A8.dsc index 7387bcc037..1ab0479dbc 100644 --- a/ArmPlatformPkg/ArmRealViewEbPkg/ArmRealViewEb-RTSM-A8.dsc +++ b/ArmPlatformPkg/ArmRealViewEbPkg/ArmRealViewEb-RTSM-A8.dsc @@ -43,6 +43,7 @@ BaseLib|MdePkg/Library/BaseLib/BaseLib.inf BaseMemoryLib|ArmPkg/Library/BaseMemoryLibStm/BaseMemoryLibStm.inf + SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf EfiResetSystemLib|ArmPlatformPkg/ArmRealViewEbPkg/Library/ResetSystemLib/ResetSystemLib.inf PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf @@ -111,6 +112,8 @@ PL011UartLib|ArmPlatformPkg/Drivers/PL011Uart/PL011Uart.inf BdsLib|ArmPkg/Library/BdsLib/BdsLib.inf + + NorFlashPlatformLib|ArmPlatformPkg/ArmRealViewEbPkg/Library/NorFlashArmRealViewEbLib/NorFlashArmRealViewEbLib.inf [LibraryClasses.common.SEC] ArmLib|ArmPkg/Library/ArmLib/ArmV7/ArmV7LibSec.inf @@ -296,6 +299,16 @@ gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x8000000F gEfiMdePkgTokenSpaceGuid.PcdReportStatusCodePropertyMask|0x07 + + # + # NV Storage PCDs. Use base of 0x43F00000 for NOR0 + # + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase|0x43F00000 + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize|0x000C0000 + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase|0x43FC0000 + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize|0x00020000 + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase|0x43FE0000 + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize|0x00020000 gEmbeddedTokenSpaceGuid.PcdEmbeddedAutomaticBootCommand|"" gEmbeddedTokenSpaceGuid.PcdEmbeddedDefaultTextColor|0x07 @@ -420,7 +433,8 @@ MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf - MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariableRuntimeDxe.inf + MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf + MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf EmbeddedPkg/EmbeddedMonotonicCounter/EmbeddedMonotonicCounter.inf EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf @@ -432,6 +446,8 @@ ArmPlatformPkg/ArmRealViewEbPkg/FvbDxe/FvbDxe.inf ArmPkg/Drivers/PL390Gic/PL390GicDxe.inf ArmPlatformPkg/Drivers/SP804TimerDxe/SP804TimerDxe.inf + + ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.inf # # Semi-hosting filesystem diff --git a/ArmPlatformPkg/ArmRealViewEbPkg/ArmRealViewEb-RTSM-A9x2.dsc b/ArmPlatformPkg/ArmRealViewEbPkg/ArmRealViewEb-RTSM-A9x2.dsc index 5f91b3bc7a..f1043421f4 100644 --- a/ArmPlatformPkg/ArmRealViewEbPkg/ArmRealViewEb-RTSM-A9x2.dsc +++ b/ArmPlatformPkg/ArmRealViewEbPkg/ArmRealViewEb-RTSM-A9x2.dsc @@ -44,6 +44,7 @@ BaseLib|MdePkg/Library/BaseLib/BaseLib.inf BaseMemoryLib|ArmPkg/Library/BaseMemoryLibStm/BaseMemoryLibStm.inf + SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf EfiResetSystemLib|ArmPlatformPkg/ArmRealViewEbPkg/Library/ResetSystemLib/ResetSystemLib.inf PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf @@ -112,6 +113,8 @@ PL011UartLib|ArmPlatformPkg/Drivers/PL011Uart/PL011Uart.inf BdsLib|ArmPkg/Library/BdsLib/BdsLib.inf + + NorFlashPlatformLib|ArmPlatformPkg/ArmRealViewEbPkg/Library/NorFlashArmRealViewEbLib/NorFlashArmRealViewEbLib.inf [LibraryClasses.common.SEC] ArmLib|ArmPkg/Library/ArmLib/ArmV7/ArmV7MPCoreLibSec.inf @@ -298,6 +301,16 @@ gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x8000000F gEfiMdePkgTokenSpaceGuid.PcdReportStatusCodePropertyMask|0x07 + + # + # NV Storage PCDs. Use base of 0x43F00000 for NOR0 + # + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase|0x43F00000 + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize|0x000C0000 + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase|0x43FC0000 + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize|0x00020000 + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase|0x43FE0000 + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize|0x00020000 gEmbeddedTokenSpaceGuid.PcdEmbeddedAutomaticBootCommand|"" gEmbeddedTokenSpaceGuid.PcdEmbeddedDefaultTextColor|0x07 @@ -431,7 +444,8 @@ MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf - MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariableRuntimeDxe.inf + MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf + MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf EmbeddedPkg/EmbeddedMonotonicCounter/EmbeddedMonotonicCounter.inf EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf @@ -443,6 +457,8 @@ ArmPlatformPkg/ArmRealViewEbPkg/FvbDxe/FvbDxe.inf ArmPkg/Drivers/PL390Gic/PL390GicDxe.inf ArmPlatformPkg/Drivers/SP804TimerDxe/SP804TimerDxe.inf + + ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.inf # # Semi-hosting filesystem diff --git a/ArmPlatformPkg/ArmRealViewEbPkg/ArmRealViewEb-RTSM-MPCore.fdf b/ArmPlatformPkg/ArmRealViewEbPkg/ArmRealViewEb-RTSM-MPCore.fdf index 01eb8d69f8..c34a4a5363 100644 --- a/ArmPlatformPkg/ArmRealViewEbPkg/ArmRealViewEb-RTSM-MPCore.fdf +++ b/ArmPlatformPkg/ArmRealViewEbPkg/ArmRealViewEb-RTSM-MPCore.fdf @@ -57,40 +57,6 @@ FV = FVMAIN_SEC gEmbeddedTokenSpaceGuid.PcdFlashFvMainBase|gEmbeddedTokenSpaceGuid.PcdFlashFvMainSize FV = FVMAIN_COMPACT -0x00150000|0x00010000 -gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase|gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize -#NV_VARIABLE_STORE -DATA = { - ## This is the EFI_FIRMWARE_VOLUME_HEADER - # ZeroVector [] - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - # FileSystemGuid: gEfiSystemNvDataFvGuid = - # { 0xFFF12B8D, 0x7696, 0x4C8B, { 0xA9, 0x85, 0x27, 0x47, 0x07, 0x5B, 0x4F, 0x50 }} - 0x8D, 0x2B, 0xF1, 0xFF, 0x96, 0x76, 0x8B, 0x4C, - 0xA9, 0x85, 0x27, 0x47, 0x07, 0x5B, 0x4F, 0x50, - # FvLength: 0x20000 - 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, - #Signature "_FVH" #Attributes - 0x5f, 0x46, 0x56, 0x48, 0xff, 0xfe, 0x04, 0x00, - #HeaderLength #CheckSum #ExtHeaderOffset #Reserved #Revision - 0x48, 0x00, 0x36, 0x09, 0x00, 0x00, 0x00, 0x02, - #Blockmap[0]: 2 Blocks * 0x10000 Bytes / Block - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, - #Blockmap[1]: End - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - ## This is the VARIABLE_STORE_HEADER - #Signature: gEfiVariableGuid = - # { 0xddcf3616, 0x3275, 0x4164, { 0x98, 0xb6, 0xfe, 0x85, 0x70, 0x7f, 0xfe, 0x7d }} - 0x16, 0x36, 0xcf, 0xdd, 0x75, 0x32, 0x64, 0x41, - 0x98, 0xb6, 0xfe, 0x85, 0x70, 0x7f, 0xfe, 0x7d, - #Size: 0xc000 (gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize) - 0x48 (size of EFI_FIRMWARE_VOLUME_HEADER) = 0xBFB8 - # This can speed up the Variable Dispatch a bit. - 0xB8, 0xBF, 0x00, 0x00, - #FORMATTED: 0x5A #HEALTHY: 0xFE #Reserved: UINT16 #Reserved1: UINT32 - 0x5A, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -} - ################################################################################ # # FV Section @@ -153,7 +119,8 @@ READ_LOCK_STATUS = TRUE INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf INF MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf INF MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf - INF MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariableRuntimeDxe.inf + INF MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf + INF MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf INF EmbeddedPkg/EmbeddedMonotonicCounter/EmbeddedMonotonicCounter.inf INF EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf INF EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf @@ -163,6 +130,8 @@ READ_LOCK_STATUS = TRUE INF ArmPkg/Drivers/PL390Gic/PL390GicDxe.inf INF ArmPlatformPkg/Drivers/SP804TimerDxe/SP804TimerDxe.inf + + INF ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.inf # # Semi-hosting filesystem diff --git a/ArmPlatformPkg/ArmRealViewEbPkg/ArmRealViewEb-RTSM-UniCore.fdf b/ArmPlatformPkg/ArmRealViewEbPkg/ArmRealViewEb-RTSM-UniCore.fdf index 29c8e7e271..c9c108e2e9 100644 --- a/ArmPlatformPkg/ArmRealViewEbPkg/ArmRealViewEb-RTSM-UniCore.fdf +++ b/ArmPlatformPkg/ArmRealViewEbPkg/ArmRealViewEb-RTSM-UniCore.fdf @@ -57,40 +57,6 @@ FV = FVMAIN_SEC gEmbeddedTokenSpaceGuid.PcdFlashFvMainBase|gEmbeddedTokenSpaceGuid.PcdFlashFvMainSize FV = FVMAIN_COMPACT -0x00150000|0x00010000 -gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase|gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize -#NV_VARIABLE_STORE -DATA = { - ## This is the EFI_FIRMWARE_VOLUME_HEADER - # ZeroVector [] - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - # FileSystemGuid: gEfiSystemNvDataFvGuid = - # { 0xFFF12B8D, 0x7696, 0x4C8B, { 0xA9, 0x85, 0x27, 0x47, 0x07, 0x5B, 0x4F, 0x50 }} - 0x8D, 0x2B, 0xF1, 0xFF, 0x96, 0x76, 0x8B, 0x4C, - 0xA9, 0x85, 0x27, 0x47, 0x07, 0x5B, 0x4F, 0x50, - # FvLength: 0x20000 - 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, - #Signature "_FVH" #Attributes - 0x5f, 0x46, 0x56, 0x48, 0xff, 0xfe, 0x04, 0x00, - #HeaderLength #CheckSum #ExtHeaderOffset #Reserved #Revision - 0x48, 0x00, 0x36, 0x09, 0x00, 0x00, 0x00, 0x02, - #Blockmap[0]: 2 Blocks * 0x10000 Bytes / Block - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, - #Blockmap[1]: End - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - ## This is the VARIABLE_STORE_HEADER - #Signature: gEfiVariableGuid = - # { 0xddcf3616, 0x3275, 0x4164, { 0x98, 0xb6, 0xfe, 0x85, 0x70, 0x7f, 0xfe, 0x7d }} - 0x16, 0x36, 0xcf, 0xdd, 0x75, 0x32, 0x64, 0x41, - 0x98, 0xb6, 0xfe, 0x85, 0x70, 0x7f, 0xfe, 0x7d, - #Size: 0xc000 (gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize) - 0x48 (size of EFI_FIRMWARE_VOLUME_HEADER) = 0xBFB8 - # This can speed up the Variable Dispatch a bit. - 0xB8, 0xBF, 0x00, 0x00, - #FORMATTED: 0x5A #HEALTHY: 0xFE #Reserved: UINT16 #Reserved1: UINT32 - 0x5A, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -} - ################################################################################ # # FV Section @@ -153,7 +119,8 @@ READ_LOCK_STATUS = TRUE INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf INF MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf INF MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf - INF MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariableRuntimeDxe.inf + INF MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf + INF MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf INF EmbeddedPkg/EmbeddedMonotonicCounter/EmbeddedMonotonicCounter.inf INF EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf INF EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf @@ -163,6 +130,8 @@ READ_LOCK_STATUS = TRUE INF ArmPkg/Drivers/PL390Gic/PL390GicDxe.inf INF ArmPlatformPkg/Drivers/SP804TimerDxe/SP804TimerDxe.inf + + INF ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.inf # # Semi-hosting filesystem diff --git a/ArmPlatformPkg/ArmRealViewEbPkg/Library/NorFlashArmRealViewEbLib/NorFlashArmRealViewEb.c b/ArmPlatformPkg/ArmRealViewEbPkg/Library/NorFlashArmRealViewEbLib/NorFlashArmRealViewEb.c new file mode 100644 index 0000000000..334dc067a9 --- /dev/null +++ b/ArmPlatformPkg/ArmRealViewEbPkg/Library/NorFlashArmRealViewEbLib/NorFlashArmRealViewEb.c @@ -0,0 +1,52 @@ +/** @file + + Copyright (c) 2011, ARM Ltd. All rights reserved.
+ This program and the accompanying materials + are licensed and made available under the terms and conditions of the BSD License + which accompanies this distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + + **/ + +#include +#include +#include + +#define NOR_FLASH_DEVICE_COUNT 1 + +// RTSM +NOR_FLASH_DESCRIPTION mNorFlashDevices[NOR_FLASH_DEVICE_COUNT] = { + { // UEFI + ARM_EB_SMB_NOR_BASE, + SIZE_128KB * 512, + SIZE_128KB, + {0xE7223039, 0x5836, 0x41E1, 0xB5, 0x42, 0xD7, 0xEC, 0x73, 0x6C, 0x5E, 0x59} + } +}; + +EFI_STATUS +NorFlashPlatformInitialization ( + VOID + ) +{ + return EFI_SUCCESS; +} + +EFI_STATUS +NorFlashPlatformGetDevices ( + OUT NOR_FLASH_DESCRIPTION **NorFlashDevices, + OUT UINT32 *Count + ) +{ + if ((NorFlashDevices == NULL) || (Count == NULL)) { + return EFI_INVALID_PARAMETER; + } + + *NorFlashDevices = mNorFlashDevices; + *Count = NOR_FLASH_DEVICE_COUNT; + + return EFI_SUCCESS; +} diff --git a/ArmPlatformPkg/ArmRealViewEbPkg/Library/NorFlashArmRealViewEbLib/NorFlashArmRealViewEbLib.inf b/ArmPlatformPkg/ArmRealViewEbPkg/Library/NorFlashArmRealViewEbLib/NorFlashArmRealViewEbLib.inf new file mode 100644 index 0000000000..54866b2f48 --- /dev/null +++ b/ArmPlatformPkg/ArmRealViewEbPkg/Library/NorFlashArmRealViewEbLib/NorFlashArmRealViewEbLib.inf @@ -0,0 +1,41 @@ +#/** @file +# +# Component discription file for ArmVeGraphicsDxe module +# +# Copyright (c) 2011, ARM Ltd. All rights reserved.
+# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +#**/ + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = NorFlashArmRealViewEbLib + FILE_GUID = a3a49a60-7597-11e0-b07c-0002a5d5c51b + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + LIBRARY_CLASS = NorFlashPlatformLib + +[Sources.common] + NorFlashArmRealViewEb.c + +[Packages] + MdePkg/MdePkg.dec + ArmPlatformPkg/ArmPlatformPkg.dec + +[LibraryClasses] + BaseLib + DebugLib + IoLib + +[Guids] + +[Protocols] + +[Pcd] + -- 2.39.2