]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPlatformPkg: Move the Secure Monitor initialization into a separate 'ArmTrustedMon...
authoroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 28 Feb 2012 17:27:15 +0000 (17:27 +0000)
committeroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 28 Feb 2012 17:27:15 +0000 (17:27 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13059 6f19259b-4bc3-4df7-8a09-765794883524

12 files changed:
ArmPlatformPkg/ArmPlatformPkg.dsc
ArmPlatformPkg/ArmRealViewEbPkg/ArmRealViewEb.dsc.inc
ArmPlatformPkg/ArmVExpressPkg/ArmVExpress.dsc.inc
ArmPlatformPkg/Include/Library/ArmTrustedMonitorLib.h [new file with mode: 0644]
ArmPlatformPkg/Library/ArmTrustedMonitorLibNull/ArmTrustedMonitorLibNull.c [new file with mode: 0644]
ArmPlatformPkg/Library/ArmTrustedMonitorLibNull/ArmTrustedMonitorLibNull.inf [new file with mode: 0644]
ArmPlatformPkg/Library/ArmTrustedMonitorLibNull/MonitorTable.S [new file with mode: 0644]
ArmPlatformPkg/Library/ArmTrustedMonitorLibNull/MonitorTable.asm [new file with mode: 0644]
ArmPlatformPkg/Sec/Helper.S
ArmPlatformPkg/Sec/Helper.asm
ArmPlatformPkg/Sec/Sec.c
ArmPlatformPkg/Sec/Sec.inf

index 551e7393689574bbf3b70c5aaa3f2d49e6ac2697..a268c4c96a074c50691384f5866f1240f335a519 100644 (file)
 [LibraryClasses.common.SEC]\r
   ArmLib|ArmPkg/Library/ArmLib/ArmV7/ArmV7LibSec.inf\r
   ArmPlatformLib|ArmPlatformPkg/Library/ArmPlatformLibNull/ArmPlatformLibNullSec.inf\r
 [LibraryClasses.common.SEC]\r
   ArmLib|ArmPkg/Library/ArmLib/ArmV7/ArmV7LibSec.inf\r
   ArmPlatformLib|ArmPlatformPkg/Library/ArmPlatformLibNull/ArmPlatformLibNullSec.inf\r
+  ArmTrustedMonitorLib|ArmPlatformPkg/Library/ArmTrustedMonitorLibNull/ArmTrustedMonitorLibNull.inf\r
 \r
   ArmPlatformSecExtraActionLib|ArmPlatformPkg/Library/DebugSecExtraActionLib/DebugSecExtraActionLib.inf\r
   ArmPlatformGlobalVariableLib|ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/Sec/SecArmPlatformGlobalVariableLib.inf\r
 \r
   ArmPlatformSecExtraActionLib|ArmPlatformPkg/Library/DebugSecExtraActionLib/DebugSecExtraActionLib.inf\r
   ArmPlatformGlobalVariableLib|ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/Sec/SecArmPlatformGlobalVariableLib.inf\r
index 1ef593f0860d59ce7e4c280cce839d779b185fdd..0821dc2237e36cf23857fbe9664e89e5144a76e9 100644 (file)
@@ -1,5 +1,5 @@
 #\r
 #\r
-#  Copyright (c) 2011, ARM Limited. All rights reserved.\r
+#  Copyright (c) 2011-2012, ARM Limited. All rights reserved.\r
 #  \r
 #  This program and the accompanying materials                          \r
 #  are licensed and made available under the terms and conditions of the BSD License         \r
 #  \r
 #  This program and the accompanying materials                          \r
 #  are licensed and made available under the terms and conditions of the BSD License         \r
 [LibraryClasses.common.SEC]\r
   ArmPlatformSecExtraActionLib|ArmPlatformPkg/Library/DebugSecExtraActionLib/DebugSecExtraActionLib.inf\r
   ArmPlatformGlobalVariableLib|ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/Sec/SecArmPlatformGlobalVariableLib.inf\r
 [LibraryClasses.common.SEC]\r
   ArmPlatformSecExtraActionLib|ArmPlatformPkg/Library/DebugSecExtraActionLib/DebugSecExtraActionLib.inf\r
   ArmPlatformGlobalVariableLib|ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/Sec/SecArmPlatformGlobalVariableLib.inf\r
+  ArmTrustedMonitorLib|ArmPlatformPkg/Library/ArmTrustedMonitorLibNull/ArmTrustedMonitorLibNull.inf\r
 \r
   DebugAgentLib|ArmPkg/Library/DebugAgentSymbolsOnlyLib/DebugAgentSymbolsOnlyLib.inf\r
   # Uncomment to turn on GDB stub in SEC. \r
 \r
   DebugAgentLib|ArmPkg/Library/DebugAgentSymbolsOnlyLib/DebugAgentSymbolsOnlyLib.inf\r
   # Uncomment to turn on GDB stub in SEC. \r
index 6242891c57b40f9cc5875ff36d214c37e2d2be79..0bec286141c1729c49eff0d585c86ba0ae785836 100644 (file)
@@ -1,5 +1,5 @@
 #\r
 #\r
-#  Copyright (c) 2011, ARM Limited. All rights reserved.\r
+#  Copyright (c) 2011-2012, ARM Limited. All rights reserved.\r
 #  \r
 #  This program and the accompanying materials                          \r
 #  are licensed and made available under the terms and conditions of the BSD License         \r
 #  \r
 #  This program and the accompanying materials                          \r
 #  are licensed and made available under the terms and conditions of the BSD License         \r
   MemoryInitPeiLib|ArmPlatformPkg/MemoryInitPei/MemoryInitPeiLib.inf\r
 !endif\r
 \r
   MemoryInitPeiLib|ArmPlatformPkg/MemoryInitPei/MemoryInitPeiLib.inf\r
 !endif\r
 \r
+  # Trustzone Support\r
+  ArmTrustedMonitorLib|ArmPlatformPkg/Library/ArmTrustedMonitorLibNull/ArmTrustedMonitorLibNull.inf\r
+\r
 [LibraryClasses.common.PEI_CORE]\r
   HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf\r
   PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf\r
 [LibraryClasses.common.PEI_CORE]\r
   HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf\r
   PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf\r
diff --git a/ArmPlatformPkg/Include/Library/ArmTrustedMonitorLib.h b/ArmPlatformPkg/Include/Library/ArmTrustedMonitorLib.h
new file mode 100644 (file)
index 0000000..5368697
--- /dev/null
@@ -0,0 +1,24 @@
+/** @file\r
+*  Main file supporting the Monitor World on ARM PLatforms\r
+*\r
+*  Copyright (c) 2011, ARM Limited. All rights reserved.\r
+*\r
+*  This program and the accompanying materials\r
+*  are licensed and made available under the terms and conditions of the BSD License\r
+*  which accompanies this distribution.  The full text of the license may be found at\r
+*  http://opensource.org/licenses/bsd-license.php\r
+*\r
+*  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+*  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+*\r
+**/\r
+\r
+#ifndef __ARM_TRUSTED_MONITOR_LIB_H_\r
+#define __ARM_TRUSTED_MONITOR_LIB_H_\r
+\r
+VOID\r
+ArmSecureMonitorWorldInitialize (\r
+  VOID\r
+  );\r
+\r
+#endif\r
diff --git a/ArmPlatformPkg/Library/ArmTrustedMonitorLibNull/ArmTrustedMonitorLibNull.c b/ArmPlatformPkg/Library/ArmTrustedMonitorLibNull/ArmTrustedMonitorLibNull.c
new file mode 100644 (file)
index 0000000..b6eff6e
--- /dev/null
@@ -0,0 +1,37 @@
+/** @file\r
+*  Main file supporting the Monitor World on ARM PLatforms\r
+*\r
+*  Copyright (c) 2011, ARM Limited. All rights reserved.\r
+*\r
+*  This program and the accompanying materials\r
+*  are licensed and made available under the terms and conditions of the BSD License\r
+*  which accompanies this distribution.  The full text of the license may be found at\r
+*  http://opensource.org/licenses/bsd-license.php\r
+*\r
+*  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+*  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+*\r
+**/\r
+\r
+#include <Library/ArmLib.h>\r
+#include <Library/ArmTrustedMonitorLib.h>\r
+#include <Library/DebugLib.h>\r
+\r
+#define IS_ALIGNED(Address, Align) (((UINTN)Address & (Align-1)) == 0)\r
+\r
+VOID\r
+MonitorVectorTable (\r
+  VOID\r
+  );\r
+\r
+VOID\r
+ArmSecureMonitorWorldInitialize (\r
+  VOID\r
+  )\r
+{\r
+  // Ensure the Monitor Table is 32bit aligned\r
+  ASSERT (IS_ALIGNED(MonitorVectorTable, BIT5));\r
+\r
+  // Write the Monitor Mode Vector Table Address\r
+  ArmWriteVMBar ((UINT32) &MonitorVectorTable);\r
+}\r
diff --git a/ArmPlatformPkg/Library/ArmTrustedMonitorLibNull/ArmTrustedMonitorLibNull.inf b/ArmPlatformPkg/Library/ArmTrustedMonitorLibNull/ArmTrustedMonitorLibNull.inf
new file mode 100644 (file)
index 0000000..39bd97c
--- /dev/null
@@ -0,0 +1,37 @@
+#/* @file\r
+#  Copyright (c) 2011, ARM Limited. All rights reserved.\r
+#  \r
+#  This program and the accompanying materials                          \r
+#  are licensed and made available under the terms and conditions of the BSD License         \r
+#  which accompanies this distribution.  The full text of the license may be found at        \r
+#  http://opensource.org/licenses/bsd-license.php                                            \r
+#\r
+#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+#  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+#\r
+#*/\r
+\r
+[Defines]\r
+  INF_VERSION                    = 0x00010005\r
+  BASE_NAME                      = ArmTrustedMonitorLibNull\r
+  FILE_GUID                      = c4b50eb2-ed16-4283-a5b0-a7341c3f997b\r
+  MODULE_TYPE                    = BASE\r
+  VERSION_STRING                 = 1.0\r
+  LIBRARY_CLASS                  = ArmTrustedMonitorLib\r
+\r
+[Sources.common]\r
+  ArmTrustedMonitorLibNull.c\r
+  MonitorTable.asm     | RVCT\r
+  MonitorTable.S       | GCC\r
+\r
+[Packages]\r
+  ArmPkg/ArmPkg.dec\r
+  ArmPlatformPkg/ArmPlatformPkg.dec\r
+  MdePkg/MdePkg.dec\r
+\r
+[LibraryClasses]\r
+  ArmLib\r
+  BaseLib\r
+  DebugLib\r
+  PcdLib\r
+  
\ No newline at end of file
diff --git a/ArmPlatformPkg/Library/ArmTrustedMonitorLibNull/MonitorTable.S b/ArmPlatformPkg/Library/ArmTrustedMonitorLibNull/MonitorTable.S
new file mode 100644 (file)
index 0000000..3e75bee
--- /dev/null
@@ -0,0 +1,41 @@
+//\r
+//  Copyright (c) 2011, ARM Limited. All rights reserved.\r
+//\r
+//  This program and the accompanying materials\r
+//  are licensed and made available under the terms and conditions of the BSD License\r
+//  which accompanies this distribution.  The full text of the license may be found at\r
+//  http://opensource.org/licenses/bsd-license.php\r
+//\r
+//  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+//  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+//\r
+//\r
+\r
+#include <AsmMacroIoLib.h>\r
+#include <AutoGen.h>\r
+#include <Library/PcdLib.h>\r
+\r
+.text\r
+.align 5\r
+\r
+GCC_ASM_EXPORT(MonitorVectorTable)\r
+\r
+ASM_PFX(MonitorVectorTable):\r
+\r
+_MonitorResetEntry:\r
+  b   _MonitorResetEntry\r
+_MonitorUndefinedEntry:\r
+  b   _MonitorUndefinedEntry\r
+_MonitorSmcEntry:\r
+  b   _MonitorSmcEntry\r
+_MonitorPrefetchEntry:\r
+  b   _MonitorPrefetchEntry\r
+_MonitorDataAbortEntry:\r
+  b   _MonitorDataAbortEntry\r
+_MonitorReservedEntry:\r
+  b   _MonitorReservedEntry\r
+_MonitorIrqEntry:\r
+  b   _MonitorIrqEntry\r
+_MonitorFiqEntry:\r
+  b   _MonitorFiqEntry\r
+\r
diff --git a/ArmPlatformPkg/Library/ArmTrustedMonitorLibNull/MonitorTable.asm b/ArmPlatformPkg/Library/ArmTrustedMonitorLibNull/MonitorTable.asm
new file mode 100644 (file)
index 0000000..f4f515d
--- /dev/null
@@ -0,0 +1,40 @@
+//\r
+//  Copyright (c) 2011, ARM Limited. All rights reserved.\r
+//\r
+//  This program and the accompanying materials\r
+//  are licensed and made available under the terms and conditions of the BSD License\r
+//  which accompanies this distribution.  The full text of the license may be found at\r
+//  http://opensource.org/licenses/bsd-license.php\r
+//\r
+//  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+//  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+//\r
+//\r
+\r
+#include <Library/PcdLib.h>\r
+\r
+    EXPORT  MonitorVectorTable\r
+\r
+    PRESERVE8\r
+    AREA    MonitoVectorTableArea, CODE, READONLY, CODEALIGN, ALIGN=5\r
+\r
+MonitorVectorTable\r
+\r
+_MonitorResetEntry\r
+  b   _MonitorResetEntry\r
+_MonitorUndefinedEntry\r
+  b   _MonitorUndefinedEntry\r
+_MonitorSmcEntry\r
+  b   _MonitorSmcEntry\r
+_MonitorPrefetchEntry\r
+  b   _MonitorPrefetchEntry\r
+_MonitorDataAbortEntry\r
+  b   _MonitorDataAbortEntry\r
+_MonitorReservedEntry\r
+  b   _MonitorReservedEntry\r
+_MonitorIrqEntry\r
+  b   _MonitorIrqEntry\r
+_MonitorFiqEntry\r
+  b   _MonitorFiqEntry\r
+\r
+  END\r
index 61491b565561c211fa588f688ba56dddcd8d93df..50cd733f97c1fc2ebf2d51346788b2924ccbdd9e 100644 (file)
@@ -1,5 +1,5 @@
 #========================================================================================\r
 #========================================================================================\r
-#  Copyright (c) 2011, ARM Limited. All rights reserved.\r
+#  Copyright (c) 2011-2012, ARM Limited. All rights reserved.\r
 #  \r
 #  This program and the accompanying materials                          \r
 #  are licensed and made available under the terms and conditions of the BSD License         \r
 #  \r
 #  This program and the accompanying materials                          \r
 #  are licensed and made available under the terms and conditions of the BSD License         \r
 .text \r
 .align 3\r
 \r
 .text \r
 .align 3\r
 \r
-GCC_ASM_EXPORT(monitor_vector_table)\r
 GCC_ASM_EXPORT(return_from_exception)\r
 GCC_ASM_EXPORT(enter_monitor_mode)\r
 GCC_ASM_EXPORT(copy_cpsr_into_spsr)\r
 GCC_ASM_EXPORT(set_non_secure_mode)\r
 \r
 GCC_ASM_EXPORT(return_from_exception)\r
 GCC_ASM_EXPORT(enter_monitor_mode)\r
 GCC_ASM_EXPORT(copy_cpsr_into_spsr)\r
 GCC_ASM_EXPORT(set_non_secure_mode)\r
 \r
-ASM_PFX(monitor_vector_table):\r
-    ldr pc, dead\r
-    ldr pc, dead\r
-    ldr pc, dead\r
-    ldr pc, dead\r
-    ldr pc, dead\r
-    ldr pc, dead\r
-    ldr pc, dead\r
-    ldr pc, dead\r
-\r
 # arg0: Secure Monitor mode stack\r
 ASM_PFX(enter_monitor_mode):\r
     mov     r2, lr                      @ Save current lr\r
 # arg0: Secure Monitor mode stack\r
 ASM_PFX(enter_monitor_mode):\r
     mov     r2, lr                      @ Save current lr\r
index cd9603c7a02370cd613b3ffad8aab42760af8e03..1ba7b434e7ac7a87d97e6245aae0cea0df34ee9c 100644 (file)
@@ -1,5 +1,5 @@
 //\r
 //\r
-//  Copyright (c) 2011, ARM Limited. All rights reserved.\r
+//  Copyright (c) 2011-2012, ARM Limited. All rights reserved.\r
 //  \r
 //  This program and the accompanying materials                          \r
 //  are licensed and made available under the terms and conditions of the BSD License         \r
 //  \r
 //  This program and the accompanying materials                          \r
 //  are licensed and made available under the terms and conditions of the BSD License         \r
@@ -11,7 +11,6 @@
 //\r
 //\r
 \r
 //\r
 //\r
 \r
-    EXPORT  monitor_vector_table\r
     EXPORT  return_from_exception\r
     EXPORT  enter_monitor_mode\r
     EXPORT  copy_cpsr_into_spsr\r
     EXPORT  return_from_exception\r
     EXPORT  enter_monitor_mode\r
     EXPORT  copy_cpsr_into_spsr\r
     \r
     AREA   Helper, CODE, READONLY\r
 \r
     \r
     AREA   Helper, CODE, READONLY\r
 \r
-    ALIGN 32\r
-monitor_vector_table\r
-    ldr pc, dead\r
-    ldr pc, dead\r
-    ldr pc, dead\r
-    ldr pc, dead\r
-    ldr pc, dead\r
-    ldr pc, dead\r
-    ldr pc, dead\r
-    ldr pc, dead\r
-\r
 // arg0: Secure Monitor mode stack\r
 enter_monitor_mode\r
     mov     r2, lr                      // Save current lr\r
 // arg0: Secure Monitor mode stack\r
 enter_monitor_mode\r
     mov     r2, lr                      // Save current lr\r
index a32cd3857e3975b56771cdb21c65f21f95455cb5..59012a12663615a7ba74e9789495c7c14286b3ac 100644 (file)
@@ -1,7 +1,7 @@
 /** @file
 *  Main file supporting the SEC Phase on ARM Platforms
 *
 /** @file
 *  Main file supporting the SEC Phase on ARM Platforms
 *
-*  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         
 *  
 *  This program and the accompanying materials                          
 *  are licensed and made available under the terms and conditions of the BSD License         
@@ -13,6 +13,7 @@
 *
 **/
 
 *
 **/
 
+#include <Library/ArmTrustedMonitorLib.h>
 #include <Library/DebugAgentLib.h>
 #include <Library/PrintLib.h>
 #include <Library/BaseMemoryLib.h>
 #include <Library/DebugAgentLib.h>
 #include <Library/PrintLib.h>
 #include <Library/BaseMemoryLib.h>
@@ -24,8 +25,6 @@
 
 #define SerialPrint(txt)  SerialPortWrite ((UINT8*)txt, AsciiStrLen(txt)+1);
 
 
 #define SerialPrint(txt)  SerialPortWrite ((UINT8*)txt, AsciiStrLen(txt)+1);
 
-extern VOID *monitor_vector_table;
-
 VOID
 CEntryPoint (
   IN  UINTN                     MpId
 VOID
 CEntryPoint (
   IN  UINTN                     MpId
@@ -114,10 +113,11 @@ CEntryPoint (
     // Enter Monitor Mode
     enter_monitor_mode ((VOID*)(PcdGet32(PcdCPUCoresSecMonStackBase) + (PcdGet32(PcdCPUCoreSecMonStackSize) * (GET_CORE_POS(MpId) + 1))));
 
     // Enter Monitor Mode
     enter_monitor_mode ((VOID*)(PcdGet32(PcdCPUCoresSecMonStackBase) + (PcdGet32(PcdCPUCoreSecMonStackSize) * (GET_CORE_POS(MpId) + 1))));
 
-    //Write the monitor mode vector table address
-    ArmWriteVMBar((UINT32) &monitor_vector_table);
+  //-------------------- Monitor Mode ---------------------
+
+  // Set up Monitor World (Vector Table, etc)
+  ArmSecureMonitorWorldInitialize ();
 
 
-    //-------------------- Monitor Mode ---------------------
     // Setup the Trustzone Chipsets
     if (IS_PRIMARY_CORE(MpId)) {
       ArmPlatformTrustzoneInit ();
     // Setup the Trustzone Chipsets
     if (IS_PRIMARY_CORE(MpId)) {
       ArmPlatformTrustzoneInit ();
index f80db4a630797f4ea0e78375367ed6d32473e435..7a7a61251e90b890eda47448662fd7351a9fb845 100644 (file)
@@ -1,7 +1,7 @@
 #/** @file\r
 #  SEC - Reset vector code that jumps to C and loads DXE core\r
 #  \r
 #/** @file\r
 #  SEC - Reset vector code that jumps to C and loads DXE core\r
 #  \r
-#  Copyright (c) 2011, ARM Limited. All rights reserved.\r
+#  Copyright (c) 2011-2012, ARM Limited. All rights reserved.\r
 #  \r
 #  This program and the accompanying materials                          \r
 #  are licensed and made available under the terms and conditions of the BSD License         \r
 #  \r
 #  This program and the accompanying materials                          \r
 #  are licensed and made available under the terms and conditions of the BSD License         \r
@@ -39,6 +39,7 @@
   ArmCpuLib\r
   ArmLib\r
   ArmPlatformLib\r
   ArmCpuLib\r
   ArmLib\r
   ArmPlatformLib\r
+  ArmTrustedMonitorLib\r
   BaseLib\r
   DebugLib\r
   DebugAgentLib\r
   BaseLib\r
   DebugLib\r
   DebugAgentLib\r