summaryrefslogtreecommitdiff
path: root/ArmPlatformPkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointer.c
diff options
context:
space:
mode:
authoroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>2011-09-22 23:11:03 +0000
committeroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>2011-09-22 23:11:03 +0000
commit8fc38a3f50915b6b11b48f830f6c7b091dbb35d8 (patch)
tree459a4a3c480686413b588183f04cc312a6bbd9d0 /ArmPlatformPkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointer.c
parent5b1928ffd6c03d171a06b89542d25ed01562c1eb (diff)
downloadedk2-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/Library/PeiServicesTablePointerLib/PeiServicesTablePointer.c')
-rw-r--r--ArmPlatformPkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointer.c22
1 files changed, 8 insertions, 14 deletions
diff --git a/ArmPlatformPkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointer.c b/ArmPlatformPkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointer.c
index 0e6755d3aa..cb0041f90d 100644
--- a/ArmPlatformPkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointer.c
+++ b/ArmPlatformPkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointer.c
@@ -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;
}