summaryrefslogtreecommitdiff
path: root/ArmPlatformPkg/Library/PeiServicesTablePointerLib
diff options
context:
space:
mode:
Diffstat (limited to 'ArmPlatformPkg/Library/PeiServicesTablePointerLib')
-rw-r--r--ArmPlatformPkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointer.c22
-rw-r--r--ArmPlatformPkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointerLib.inf9
2 files changed, 11 insertions, 20 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;
}
diff --git a/ArmPlatformPkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointerLib.inf b/ArmPlatformPkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointerLib.inf
index 5c0811b837..1e8b5e131e 100644
--- a/ArmPlatformPkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointerLib.inf
+++ b/ArmPlatformPkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointerLib.inf
@@ -21,7 +21,7 @@
INF_VERSION = 0x00010005
BASE_NAME = PeiServicesTablePointerLib
FILE_GUID = 1c747f6b-0a58-49ae-8ea3-0327a4fa10e3
- MODULE_TYPE = PEIM
+ MODULE_TYPE = BASE
VERSION_STRING = 1.0
LIBRARY_CLASS = PeiServicesTablePointerLib|PEIM PEI_CORE SEC
@@ -37,11 +37,8 @@
ArmPlatformPkg/ArmPlatformPkg.dec
[LibraryClasses]
- DebugLib
+ ArmPlatformGlobalVariableLib
[Pcd]
gArmPlatformTokenSpaceGuid.PcdPeiServicePtrGlobalOffset
- gArmPlatformTokenSpaceGuid.PcdCPUCoresNonSecStackBase
- gArmPlatformTokenSpaceGuid.PcdCPUCoresNonSecStackSize
- gArmPlatformTokenSpaceGuid.PcdPeiGlobalVariableSize
-
+