]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPlatformPkg/ArmPlatformGlobalVariableLib: Added an assert to ensure the 'VariableO...
authoroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 27 Feb 2012 10:26:16 +0000 (10:26 +0000)
committeroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 27 Feb 2012 10:26:16 +0000 (10:26 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13043 6f19259b-4bc3-4df7-8a09-765794883524

ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/Dxe/DxeArmPlatformGlobalVariableLib.inf
ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/Pei/PeiArmPlatformGlobalVariableLib.c
ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/Pei/PeiArmPlatformGlobalVariableLib.inf
ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/PrePi/PrePiArmPlatformGlobalVariableLib.c
ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/PrePi/PrePiArmPlatformGlobalVariableLib.inf
ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/Sec/SecArmPlatformGlobalVariableLib.c
ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/Sec/SecArmPlatformGlobalVariableLib.inf

index a1e9dcf80ac8494b2d5fd972df8f78e9fed55ebf..2b1c7aaf53f27986b1fda8c1be68964dbcb4216e 100644 (file)
@@ -2,7 +2,7 @@
 # Timer library implementation
 #  
 #  
-#  Copyright (c) 2011, ARM Ltd. All rights reserved.<BR>
+#  Copyright (c) 2011-2012, ARM Ltd. All rights reserved.<BR>
 #  This program and the accompanying materials
 #  are licensed and made available under the terms and conditions of the BSD License
 #  which accompanies this distribution.  The full text of the license may be found at
@@ -32,6 +32,7 @@
 
 [LibraryClasses]
   BaseLib
+  DebugLib
   HobLib
 
 [Guids]
index 57ea0f416fa985eb177fbcfa595a1ff8fa315d60..e03a7aeee3ac642c837328c927af7c153b7dabdf 100644 (file)
@@ -1,6 +1,6 @@
 /** @file
 *
-*  Copyright (c) 2011, ARM Limited. All rights reserved.
+*  Copyright (c) 2011-2012, ARM Limited. All rights reserved.
 *
 *  This program and the accompanying materials
 *  are licensed and made available under the terms and conditions of the BSD License
@@ -17,9 +17,7 @@
 #include <Library/BaseLib.h>
 #include <Library/BaseMemoryLib.h>
 #include <Library/PcdLib.h>
-
-//TODO: RemoveMe
-//#include <Library/DebugLib.h>
+#include <Library/DebugLib.h>
 
 // Declared by ArmPlatformPkg/PrePi Module
 extern UINTN mGlobalVariableBase;
@@ -33,6 +31,9 @@ ArmPlatformGetGlobalVariable (
 {
   UINTN  GlobalVariableBase;
 
+  // Ensure the Global Variable Size have been initialized
+  ASSERT (VariableOffset < PcdGet32 (PcdPeiGlobalVariableSize));
+
   GlobalVariableBase = PcdGet32 (PcdCPUCoresStackBase) + PcdGet32 (PcdCPUCorePrimaryStackSize) - PcdGet32 (PcdPeiGlobalVariableSize) + VariableOffset;
 
   if (VariableSize == 4) {
@@ -55,6 +56,9 @@ ArmPlatformSetGlobalVariable (
 {
   UINTN  GlobalVariableBase;
 
+  // Ensure the Global Variable Size have been initialized
+  ASSERT (VariableOffset < PcdGet32 (PcdPeiGlobalVariableSize));
+
   GlobalVariableBase = PcdGet32 (PcdCPUCoresStackBase) + PcdGet32 (PcdCPUCorePrimaryStackSize) - PcdGet32 (PcdPeiGlobalVariableSize) + VariableOffset;
 
   if (VariableSize == 4) {
index a86a119f42e9b1bfb47564930f3a51c8fef8863c..ad920d723001bd6c48c05e6b0c38ad3e1240057d 100644 (file)
@@ -2,7 +2,7 @@
 # Timer library implementation
 #  
 #  
-#  Copyright (c) 2011, ARM Ltd. All rights reserved.<BR>
+#  Copyright (c) 2011-2012, ARM Ltd. All rights reserved.<BR>
 #  This program and the accompanying materials
 #  are licensed and made available under the terms and conditions of the BSD License
 #  which accompanies this distribution.  The full text of the license may be found at
@@ -30,6 +30,7 @@
 
 [LibraryClasses]
   BaseLib
+  DebugLib
   PcdLib
 
 [FixedPcd]
index 37b337bff299180267a7f271e114d051a20ea274..ced49d0db886e6e8ec3e85e62ade363277a13e73 100644 (file)
@@ -1,6 +1,6 @@
 /** @file
 *
-*  Copyright (c) 2011, ARM Limited. All rights reserved.
+*  Copyright (c) 2011-2012, ARM Limited. All rights reserved.
 *
 *  This program and the accompanying materials
 *  are licensed and made available under the terms and conditions of the BSD License
@@ -17,6 +17,7 @@
 #include <Library/BaseLib.h>
 #include <Library/BaseMemoryLib.h>
 #include <Library/PcdLib.h>
+#include <Library/DebugLib.h>
 
 #define IS_XIP() (((UINT32)PcdGet32 (PcdFdBaseAddress) > (UINT32)(PcdGet32 (PcdSystemMemoryBase) + PcdGet32 (PcdSystemMemorySize))) || \
                   ((PcdGet32 (PcdFdBaseAddress) + PcdGet32 (PcdFdSize)) < PcdGet32 (PcdSystemMemoryBase)))
@@ -33,6 +34,9 @@ ArmPlatformGetGlobalVariable (
 {
   UINTN  GlobalVariableBase;
 
+  // Ensure the Global Variable Size have been initialized
+  ASSERT (VariableOffset < PcdGet32 (PcdPeiGlobalVariableSize));
+
   if (IS_XIP()) {
     // In Case of XIP, we expect the Primary Stack at the top of the System Memory
     // The size must be 64bit aligned to allow 64bit variable to be aligned
@@ -59,6 +63,9 @@ ArmPlatformSetGlobalVariable (
 {
   UINTN  GlobalVariableBase;
 
+  // Ensure the Global Variable Size have been initialized
+  ASSERT (VariableOffset < PcdGet32 (PcdPeiGlobalVariableSize));
+
   if (IS_XIP()) {
     // In Case of XIP, we expect the Primary Stack at the top of the System Memory
     // The size must be 64bit aligned to allow 64bit variable to be aligned
index dfe8f2e4b9e73820d69cc875c70542e88e1d13ee..224d2056fa558aa46564bc4d6b59064da6b93fa0 100644 (file)
@@ -1,8 +1,6 @@
 #/** @file
-# Timer library implementation
 #  
-#  
-#  Copyright (c) 2011, ARM Ltd. All rights reserved.<BR>
+#  Copyright (c) 2011-2012, ARM Ltd. All rights reserved.<BR>
 #  This program and the accompanying materials
 #  are licensed and made available under the terms and conditions of the BSD License
 #  which accompanies this distribution.  The full text of the license may be found at
@@ -31,6 +29,7 @@
 
 [LibraryClasses]
   BaseLib
+  DebugLib
   PcdLib
 
 [FixedPcd]
@@ -40,7 +39,6 @@
   gArmTokenSpaceGuid.PcdSystemMemoryBase
   gArmTokenSpaceGuid.PcdSystemMemorySize
 
-  gArmPlatformTokenSpaceGuid.PcdCPUCoresStackBase
   gArmPlatformTokenSpaceGuid.PcdCPUCorePrimaryStackSize
   gArmPlatformTokenSpaceGuid.PcdPeiGlobalVariableSize
 
index 6cdc209cbc8a3600bec5540af88ab799c087f8a7..e719e575e703aaf2307dc3a93e4c63d2d43535ac 100644 (file)
@@ -1,6 +1,6 @@
 /** @file
 *
-*  Copyright (c) 2011, ARM Limited. All rights reserved.
+*  Copyright (c) 2011-2012, ARM Limited. All rights reserved.
 *
 *  This program and the accompanying materials
 *  are licensed and made available under the terms and conditions of the BSD License
@@ -17,9 +17,7 @@
 #include <Library/BaseLib.h>
 #include <Library/BaseMemoryLib.h>
 #include <Library/PcdLib.h>
-
-//TODO: RemoveMe
-//#include <Library/DebugLib.h>
+#include <Library/DebugLib.h>
 
 VOID
 ArmPlatformGetGlobalVariable (
@@ -30,6 +28,9 @@ ArmPlatformGetGlobalVariable (
 {
   UINTN  GlobalVariableBase;
 
+  // Ensure the Global Variable Size have been initialized
+  ASSERT (VariableOffset < PcdGet32 (PcdSecGlobalVariableSize));
+
   GlobalVariableBase = PcdGet32 (PcdCPUCoresSecStackBase) + PcdGet32 (PcdCPUCoreSecPrimaryStackSize) - PcdGet32 (PcdSecGlobalVariableSize) + VariableOffset;
   
   if (VariableSize == 4) {
@@ -39,8 +40,6 @@ ArmPlatformGetGlobalVariable (
   } else {
     CopyMem (Variable, (VOID*)(GlobalVariableBase + VariableOffset), VariableSize);
   }
-
-  //DEBUG((EFI_D_ERROR,"++ GET Offset[%d] = 0x%x\n",VariableOffset,*(UINTN*)Variable));
 }
 
 VOID
@@ -52,6 +51,9 @@ ArmPlatformSetGlobalVariable (
 {
   UINTN  GlobalVariableBase;
 
+  // Ensure the Global Variable Size have been initialized
+  ASSERT (VariableOffset < PcdGet32 (PcdSecGlobalVariableSize));
+
   GlobalVariableBase = PcdGet32 (PcdCPUCoresSecStackBase) + PcdGet32 (PcdCPUCoreSecPrimaryStackSize) - PcdGet32 (PcdSecGlobalVariableSize) + VariableOffset;
 
   if (VariableSize == 4) {
@@ -61,7 +63,5 @@ ArmPlatformSetGlobalVariable (
   } else {
     CopyMem ((VOID*)(GlobalVariableBase + VariableOffset), Variable, VariableSize);
   }
-
-  //DEBUG((EFI_D_ERROR,"++ SET Offset[%d] = 0x%x\n",VariableOffset,*(UINTN*)Variable));
 }
 
index 2c351b2b853024d4b6ecceaf2adc26092385ee98..f12d5a618f83e4d68c6fa6c139f50b5c48abb6f5 100644 (file)
@@ -1,8 +1,6 @@
 #/** @file
-# Timer library implementation
 #  
-#  
-#  Copyright (c) 2011, ARM Ltd. All rights reserved.<BR>
+#  Copyright (c) 2011-2012, ARM Ltd. All rights reserved.<BR>
 #  This program and the accompanying materials
 #  are licensed and made available under the terms and conditions of the BSD License
 #  which accompanies this distribution.  The full text of the license may be found at
@@ -30,6 +28,7 @@
 
 [LibraryClasses]
   BaseLib
+  DebugLib
   PcdLib
 
 [FixedPcd]