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
This commit is contained in:
oliviermartin
2011-09-22 23:11:03 +00:00
parent 5b1928ffd6
commit 8fc38a3f50
30 changed files with 739 additions and 49 deletions

View File

@ -16,6 +16,7 @@
**/
#include <PiPei.h>
#include <Library/ArmPlatformGlobalVariableLib.h>
#include <Library/PeiServicesTablePointerLib.h>
#include <Library/DebugLib.h>
#include <Library/PcdLib.h>
@ -33,17 +34,12 @@
VOID
EFIAPI
SetPeiServicesTablePointer (
IN CONST EFI_PEI_SERVICES ** PeiServicesTablePointer
IN CONST EFI_PEI_SERVICES **PeiServicesTablePointer
)
{
UINTN *PeiPtrLoc;
ASSERT (PeiServicesTablePointer != NULL);
PeiPtrLoc = (UINTN *)(UINTN)(PcdGet32 (PcdCPUCoresNonSecStackBase) +
(PcdGet32 (PcdCPUCoresNonSecStackSize) / 2) -
PcdGet32 (PcdPeiGlobalVariableSize) +
PcdGet32 (PcdPeiServicePtrGlobalOffset));
*PeiPtrLoc = (UINTN)PeiServicesTablePointer;
ArmPlatformSetGlobalVariable (PcdGet32 (PcdPeiServicePtrGlobalOffset), sizeof(EFI_PEI_SERVICES **), &PeiServicesTablePointer);
}
/**
@ -58,19 +54,17 @@ SetPeiServicesTablePointer (
@return The pointer to PeiServices.
**/
CONST EFI_PEI_SERVICES **
CONST EFI_PEI_SERVICES**
EFIAPI
GetPeiServicesTablePointer (
VOID
)
{
UINTN *PeiPtrLoc;
EFI_PEI_SERVICES **PeiServicesTablePointer;
PeiPtrLoc = (UINTN *)(UINTN)(PcdGet32 (PcdCPUCoresNonSecStackBase) +
(PcdGet32 (PcdCPUCoresNonSecStackSize) / 2) -
PcdGet32 (PcdPeiGlobalVariableSize) +
PcdGet32 (PcdPeiServicePtrGlobalOffset));
return (CONST EFI_PEI_SERVICES **)*PeiPtrLoc;
ArmPlatformGetGlobalVariable (PcdGet32 (PcdPeiServicePtrGlobalOffset), sizeof(EFI_PEI_SERVICES **), &PeiServicesTablePointer);
return (CONST EFI_PEI_SERVICES**)PeiServicesTablePointer;
}