summaryrefslogtreecommitdiffstats
path: root/ArmPlatformPkg/Library/PrePiHobListPointerLib
diff options
context:
space:
mode:
authoroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>2011-08-18 11:23:28 +0000
committeroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>2011-08-18 11:23:28 +0000
commite1808603dc4207ec82da1ffee3b23889b3cfc6e6 (patch)
treec6cc5c69c76d3ae42d5f5dc4a2745c02e2a183c1 /ArmPlatformPkg/Library/PrePiHobListPointerLib
parent37573927338afb96c8969e5ce1ea5db4d1c77a74 (diff)
downloadedk2-e1808603dc4207ec82da1ffee3b23889b3cfc6e6.tar.gz
edk2-e1808603dc4207ec82da1ffee3b23889b3cfc6e6.tar.bz2
edk2-e1808603dc4207ec82da1ffee3b23889b3cfc6e6.zip
ArmPlatformPkg/PrePiHobListPointerLib: Fixed pointer calculation
In the PrePi module, the global variables are located at the top of the stack. At the opposite of the PeiCore where the global variables are located in the middle of the stack. The top stack region is reserved for Temporary Memory. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12167 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'ArmPlatformPkg/Library/PrePiHobListPointerLib')
-rwxr-xr-xArmPlatformPkg/Library/PrePiHobListPointerLib/PrePiHobListPointer.c34
-rwxr-xr-xArmPlatformPkg/Library/PrePiHobListPointerLib/PrePiHobListPointerLib.inf1
2 files changed, 16 insertions, 19 deletions
diff --git a/ArmPlatformPkg/Library/PrePiHobListPointerLib/PrePiHobListPointer.c b/ArmPlatformPkg/Library/PrePiHobListPointerLib/PrePiHobListPointer.c
index dfcc27edf5..a18a02a9bb 100755
--- a/ArmPlatformPkg/Library/PrePiHobListPointerLib/PrePiHobListPointer.c
+++ b/ArmPlatformPkg/Library/PrePiHobListPointerLib/PrePiHobListPointer.c
@@ -17,14 +17,6 @@
#include <Library/DebugLib.h>
#include <Library/PcdLib.h>
-//
-// Have to use build system to set the original value in case we are running
-// from FLASH and globals don't work. So if you do a GetHobList() and gHobList
-// and gHobList is NULL the PCD default values are used.
-//
-VOID *gHobList = NULL;
-
-
/**
Returns the pointer to the HOB list.
@@ -39,11 +31,10 @@ PrePeiGetHobList (
VOID
)
{
- if (gHobList == NULL) {
- return (VOID *)*(UINTN*)(PcdGet32 (PcdCPUCoresNonSecStackBase) + (PcdGet32 (PcdCPUCoresNonSecStackSize) / 2) - PcdGet32 (PcdHobListPtrGlobalOffset));
- } else {
- return gHobList;
- }
+ return (VOID *)*(UINTN*)(PcdGet32 (PcdCPUCoresNonSecStackBase) +
+ PcdGet32 (PcdCPUCoresNonSecStackSize) -
+ PcdGet32 (PcdPeiGlobalVariableSize) +
+ PcdGet32 (PcdHobListPtrGlobalOffset));
}
@@ -60,10 +51,15 @@ PrePeiSetHobList (
IN VOID *HobList
)
{
- gHobList = HobList;
-
- //
- // If this code is running from ROM this could fail
- //
- return (gHobList == HobList) ? EFI_SUCCESS: EFI_UNSUPPORTED;
+ UINTN* HobListPtr;
+
+ HobListPtr = (UINTN*)(PcdGet32 (PcdCPUCoresNonSecStackBase) +
+ PcdGet32 (PcdCPUCoresNonSecStackSize) -
+ PcdGet32 (PcdPeiGlobalVariableSize) +
+ PcdGet32 (PcdHobListPtrGlobalOffset));
+
+ *HobListPtr = (UINTN)HobList;
+
+ return EFI_SUCCESS;
}
+
diff --git a/ArmPlatformPkg/Library/PrePiHobListPointerLib/PrePiHobListPointerLib.inf b/ArmPlatformPkg/Library/PrePiHobListPointerLib/PrePiHobListPointerLib.inf
index 5142f19a4e..c1fa999da5 100755
--- a/ArmPlatformPkg/Library/PrePiHobListPointerLib/PrePiHobListPointerLib.inf
+++ b/ArmPlatformPkg/Library/PrePiHobListPointerLib/PrePiHobListPointerLib.inf
@@ -34,4 +34,5 @@
gArmPlatformTokenSpaceGuid.PcdHobListPtrGlobalOffset
gArmPlatformTokenSpaceGuid.PcdCPUCoresNonSecStackBase
gArmPlatformTokenSpaceGuid.PcdCPUCoresNonSecStackSize
+ gArmPlatformTokenSpaceGuid.PcdPeiGlobalVariableSize
\ No newline at end of file