diff options
author | oliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524> | 2011-09-22 23:11:03 +0000 |
---|---|---|
committer | oliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524> | 2011-09-22 23:11:03 +0000 |
commit | 8fc38a3f50915b6b11b48f830f6c7b091dbb35d8 (patch) | |
tree | 459a4a3c480686413b588183f04cc312a6bbd9d0 /ArmPlatformPkg/PlatformPei | |
parent | 5b1928ffd6c03d171a06b89542d25ed01562c1eb (diff) | |
download | edk2-platforms-8fc38a3f50915b6b11b48f830f6c7b091dbb35d8.tar.xz |
ArmPlatformPkg: Introduce ArmPlatformGlobalVariableLib
This library hides where the 'XIP' Global Variable are located in the memory.
It is expected the Sec/PrePi modules define the Global Variable area through
the GlobalVariable HOB.
The ArmPlatformGlobalVariableLib library allows access to global variables by
their offsets in this region.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12420 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'ArmPlatformPkg/PlatformPei')
-rwxr-xr-x | ArmPlatformPkg/PlatformPei/PlatformPeim.c | 41 | ||||
-rwxr-xr-x | ArmPlatformPkg/PlatformPei/PlatformPeim.inf | 6 |
2 files changed, 45 insertions, 2 deletions
diff --git a/ArmPlatformPkg/PlatformPei/PlatformPeim.c b/ArmPlatformPkg/PlatformPei/PlatformPeim.c index 5921e35bd8..8392ecf6c2 100755 --- a/ArmPlatformPkg/PlatformPei/PlatformPeim.c +++ b/ArmPlatformPkg/PlatformPei/PlatformPeim.c @@ -17,15 +17,22 @@ //
// The protocols, PPI and GUID defintions for this module
//
+#include <Ppi/ArmGlobalVariable.h>
#include <Ppi/MasterBootMode.h>
#include <Ppi/BootInRecoveryMode.h>
+#include <Ppi/GuidedSectionExtraction.h>
//
// The Library classes this module consumes
//
+#include <Library/ArmPlatformLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/DebugLib.h>
+#include <Library/HobLib.h>
#include <Library/PeimEntryPoint.h>
+#include <Library/PeiServicesLib.h>
#include <Library/PcdLib.h>
-#include <Library/DebugLib.h>
-#include <Library/ArmPlatformLib.h>
+
+#include <Guid/ArmGlobalVariableHob.h>
EFI_STATUS
EFIAPI
@@ -55,6 +62,24 @@ EFI_PEI_PPI_DESCRIPTOR mPpiListRecoveryBootMode = { NULL
};
+VOID
+EFIAPI
+BuildGlobalVariableHob (
+ IN EFI_PHYSICAL_ADDRESS GlobalVariableBase,
+ IN UINT32 GlobalVariableSize
+ )
+{
+ EFI_STATUS Status;
+ ARM_HOB_GLOBAL_VARIABLE *Hob;
+
+ Status = PeiServicesCreateHob (EFI_HOB_TYPE_GUID_EXTENSION, sizeof (ARM_HOB_GLOBAL_VARIABLE), (VOID**)&Hob);
+ if (!EFI_ERROR(Status)) {
+ CopyGuid (&(Hob->Header.Name), &gArmGlobalVariableGuid);
+ Hob->GlobalVariableBase = GlobalVariableBase;
+ Hob->GlobalVariableSize = GlobalVariableSize;
+ }
+}
+
/*++
Routine Description:
@@ -80,11 +105,23 @@ InitializePlatformPeim ( {
EFI_STATUS Status;
UINTN BootMode;
+ ARM_GLOBAL_VARIABLE_PPI *ArmGlobalVariablePpi;
+ EFI_PHYSICAL_ADDRESS GlobalVariableBase;
DEBUG ((EFI_D_ERROR, "Platform PEIM Loaded\n"));
PlatformPeim ();
+ Status = PeiServicesLocatePpi (&gArmGlobalVariablePpiGuid, 0, NULL, (VOID**)&ArmGlobalVariablePpi);
+ if (!EFI_ERROR(Status)) {
+ Status = ArmGlobalVariablePpi->GetGlobalVariableMemory (&GlobalVariableBase);
+
+ if (!EFI_ERROR(Status)) {
+ // Declare the Global Variable HOB
+ BuildGlobalVariableHob (GlobalVariableBase, FixedPcdGet32 (PcdPeiGlobalVariableSize));
+ }
+ }
+
BootMode = ArmPlatformGetBootMode ();
Status = (**PeiServices).SetBootMode (PeiServices, (UINT8) BootMode);
ASSERT_EFI_ERROR (Status);
diff --git a/ArmPlatformPkg/PlatformPei/PlatformPeim.inf b/ArmPlatformPkg/PlatformPei/PlatformPeim.inf index 201c98cd5d..e8d3439217 100755 --- a/ArmPlatformPkg/PlatformPei/PlatformPeim.inf +++ b/ArmPlatformPkg/PlatformPei/PlatformPeim.inf @@ -47,6 +47,10 @@ [Ppis]
gEfiPeiMasterBootModePpiGuid # PPI ALWAYS_PRODUCED
gEfiPeiBootInRecoveryModePpiGuid # PPI SOMETIMES_PRODUCED
+ gArmGlobalVariablePpiGuid
+
+[Guids]
+ gArmGlobalVariableGuid
[FixedPcd]
gArmTokenSpaceGuid.PcdFdBaseAddress
@@ -58,6 +62,8 @@ gEmbeddedTokenSpaceGuid.PcdPrePiCpuMemorySize
gEmbeddedTokenSpaceGuid.PcdPrePiCpuIoSize
+ gArmPlatformTokenSpaceGuid.PcdPeiGlobalVariableSize
+
[Depex]
TRUE
|