]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPlatformPkg/Sec: Allowed the Secondary Cores to set the Secure/Non Secure bits...
authoroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 26 Mar 2012 11:03:36 +0000 (11:03 +0000)
committeroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 26 Mar 2012 11:03:36 +0000 (11:03 +0000)
The GICD_IGROUPR0 is banked for each connected processor. It means the
Non-Secure bits for the PPIs (Private Peripheral Interrupts) must be
configured for every processor.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13135 6f19259b-4bc3-4df7-8a09-765794883524

12 files changed:
ArmPkg/Drivers/PL390Gic/PL390GicSec.c
ArmPkg/Drivers/PL390Gic/PL390GicSecLib.inf
ArmPkg/Include/Library/ArmGicLib.h
ArmPlatformPkg/ArmRealViewEbPkg/Library/ArmRealViewEbLibRTSM/ArmRealViewEbSec.c
ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/ArmVExpressSecLib.inf
ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/CTA9x4Sec.c
ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/RTSMSec.c
ArmPlatformPkg/Include/Library/ArmPlatformLib.h
ArmPlatformPkg/Library/ArmPlatformLibNull/ArmPlatformLibNullSec.c
ArmPlatformPkg/Library/ArmPlatformLibNull/ArmPlatformLibNullSec.inf
ArmPlatformPkg/Sec/Sec.c
BeagleBoardPkg/Library/BeagleBoardLib/BeagleBoard.c

index 4f10e4e5129ded2c4aad6bf40be238404e15e476..12f9e3e3fcacdcc12659173a5a59a88a735bafa8 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
 *\r
 /** @file\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
@@ -13,6 +13,7 @@
 **/\r
 \r
 #include <Base.h>\r
 **/\r
 \r
 #include <Base.h>\r
+#include <Library/ArmLib.h>\r
 #include <Library/DebugLib.h>\r
 #include <Library/IoLib.h>\r
 #include <Library/ArmGicLib.h>\r
 #include <Library/DebugLib.h>\r
 #include <Library/IoLib.h>\r
 #include <Library/ArmGicLib.h>\r
@@ -24,6 +25,7 @@
 VOID\r
 EFIAPI\r
 ArmGicSetupNonSecure (\r
 VOID\r
 EFIAPI\r
 ArmGicSetupNonSecure (\r
+  IN  UINTN         MpId,\r
   IN  INTN          GicDistributorBase,\r
   IN  INTN          GicInterruptInterfaceBase\r
   )\r
   IN  INTN          GicDistributorBase,\r
   IN  INTN          GicInterruptInterfaceBase\r
   )\r
@@ -47,9 +49,15 @@ ArmGicSetupNonSecure (
     MmioWrite32 (GicInterruptInterfaceBase + ARM_GIC_ICCEIOR, InterruptId);\r
   }\r
 \r
     MmioWrite32 (GicInterruptInterfaceBase + ARM_GIC_ICCEIOR, InterruptId);\r
   }\r
 \r
-  // Ensure all GIC interrupts are Non-Secure\r
-  for (Index = 0; Index < (PcdGet32(PcdGicNumInterrupts) / 32); Index++) {\r
-    MmioWrite32 (GicDistributorBase + ARM_GIC_ICDISR + (Index * 4), 0xffffffff);\r
+  // Only the primary core should set the Non Secure bit to the SPIs (Shared Peripheral Interrupt).\r
+  if (IS_PRIMARY_CORE(MpId)) {\r
+    // Ensure all GIC interrupts are Non-Secure\r
+    for (Index = 0; Index < (PcdGet32(PcdGicNumInterrupts) / 32); Index++) {\r
+      MmioWrite32 (GicDistributorBase + ARM_GIC_ICDISR + (Index * 4), 0xffffffff);\r
+    }\r
+  } else {\r
+    // The secondary cores only set the Non Secure bit to their banked PPIs\r
+    MmioWrite32 (GicDistributorBase + ARM_GIC_ICDISR, 0xffffffff);\r
   }\r
 \r
   // Ensure all interrupts can get through the priority mask\r
   }\r
 \r
   // Ensure all interrupts can get through the priority mask\r
index 13085221ca83dba8ff09fed29275fdd70fcb8c9f..ff89103393192f21e6e2857cb0bdbcc1201edf19 100644 (file)
@@ -1,5 +1,5 @@
 #/* @file\r
 #/* @file\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
@@ -28,6 +28,7 @@
   MdePkg/MdePkg.dec\r
 \r
 [LibraryClasses]\r
   MdePkg/MdePkg.dec\r
 \r
 [LibraryClasses]\r
+  ArmLib\r
   DebugLib\r
   IoLib\r
   PcdLib\r
   DebugLib\r
   IoLib\r
   PcdLib\r
@@ -35,3 +36,6 @@
 [FixedPcd.common]\r
   gArmTokenSpaceGuid.PcdGicNumInterrupts\r
   gArmTokenSpaceGuid.PcdGicSgiIntId\r
 [FixedPcd.common]\r
   gArmTokenSpaceGuid.PcdGicNumInterrupts\r
   gArmTokenSpaceGuid.PcdGicSgiIntId\r
+\r
+  gArmTokenSpaceGuid.PcdArmPrimaryCoreMask\r
+  gArmTokenSpaceGuid.PcdArmPrimaryCore\r
index 66e12dad59f631af97a4b89b0f88ef5aaf07cc82..44cc89c353b64e90796270839d87c8b2393d2c2f 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
 *\r
 /** @file\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
@@ -77,6 +77,7 @@
 VOID\r
 EFIAPI\r
 ArmGicSetupNonSecure (\r
 VOID\r
 EFIAPI\r
 ArmGicSetupNonSecure (\r
+  IN  UINTN         MpId,\r
   IN  INTN          GicDistributorBase,\r
   IN  INTN          GicInterruptInterfaceBase\r
   );\r
   IN  INTN          GicDistributorBase,\r
   IN  INTN          GicInterruptInterfaceBase\r
   );\r
index 5eb667d6ebb3752e8e6310140f294b54e3095558..7191835a61b3e69dcfc375cb7a7c60adf92e6ecf 100755 (executable)
@@ -31,7 +31,7 @@
 **/
 VOID
 ArmPlatformTrustzoneInit (
 **/
 VOID
 ArmPlatformTrustzoneInit (
-  VOID
+  IN  UINTN                     MpId
   )
 {
   ASSERT(FALSE);
   )
 {
   ASSERT(FALSE);
index 03aee0378ab3d91a41cb5243bc03c886a44236f3..47ad7396ada042aca0f8158e625679d518f8009c 100644 (file)
@@ -52,3 +52,6 @@
   gArmTokenSpaceGuid.PcdTrustzoneSupport\r
 \r
   gArmTokenSpaceGuid.PcdL2x0ControllerBase\r
   gArmTokenSpaceGuid.PcdTrustzoneSupport\r
 \r
   gArmTokenSpaceGuid.PcdL2x0ControllerBase\r
+\r
+  gArmTokenSpaceGuid.PcdArmPrimaryCoreMask\r
+  gArmTokenSpaceGuid.PcdArmPrimaryCore\r
index 0cf07a3caf2cc7df11bebe4f62d2977f17ec4bcf..37140a4a58076c77df8c33325e8da294f8f552bb 100644 (file)
 **/
 VOID
 ArmPlatformTrustzoneInit (
 **/
 VOID
 ArmPlatformTrustzoneInit (
-  VOID
+  IN  UINTN                     MpId
   )
 {
   )
 {
+  // Nothing to do
+  if (!IS_PRIMARY_CORE(MpId)) {
+    return;
+  }
+
   //
   // Setup TZ Protection Controller
   //
   //
   // Setup TZ Protection Controller
   //
index deba6893602d6f441b34b0fab0732b78e689456a..c65c28c1fa0fe34939b3d4e14e40437a03c7776c 100644 (file)
@@ -31,7 +31,7 @@
 **/
 VOID
 ArmPlatformTrustzoneInit (
 **/
 VOID
 ArmPlatformTrustzoneInit (
-  VOID
+  IN  UINTN                     MpId
   )
 {
   // No TZPC or TZASC on RTSM to initialize
   )
 {
   // No TZPC or TZASC on RTSM to initialize
index 852eb236ce31cc4daffd79d82647f6f5ac67df9a..7dd39fef8c0889e943ab26abdc46e6b26ea01c7d 100644 (file)
@@ -140,7 +140,7 @@ ArmPlatformInitializeSystemMemory (
 **/
 VOID
 ArmPlatformTrustzoneInit (
 **/
 VOID
 ArmPlatformTrustzoneInit (
-  VOID
+  IN  UINTN                     MpId
   );
 
 /**
   );
 
 /**
index 11183e9393dc65dc75dcac2c1d0549fb0fb5445e..9622a322917d09b3846995867eda5b87c0da83cc 100644 (file)
 **/
 VOID
 ArmPlatformTrustzoneInit (
 **/
 VOID
 ArmPlatformTrustzoneInit (
-  VOID
+  IN  UINTN                     MpId
   )
 {
   )
 {
+  // Secondary cores might have to set the Secure SGIs into the GICD_IGROUPR0
+  if (!IS_PRIMARY_CORE(MpId)) {
+    return;
+  }
+
   ASSERT(FALSE);
 }
 
   ASSERT(FALSE);
 }
 
index 80ac1a6045e41a017c4590ffd86049db6026ebe9..bd3dc4958cfc18fb19eabaa24260c13207b90413 100644 (file)
@@ -1,5 +1,5 @@
 #/* @file\r
 #/* @file\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
@@ -37,3 +37,6 @@
 \r
 [FixedPcd]\r
   gArmTokenSpaceGuid.PcdFvBaseAddress\r
 \r
 [FixedPcd]\r
   gArmTokenSpaceGuid.PcdFvBaseAddress\r
+\r
+  gArmTokenSpaceGuid.PcdArmPrimaryCoreMask\r
+  gArmTokenSpaceGuid.PcdArmPrimaryCore\r
index 6b478ac0b4324911570cb171a9c2bb8463699b5c..d12c359d4f762f14c6ef2fa499b0370b797e408b 100644 (file)
@@ -144,14 +144,14 @@ TrustedWorldInitialization (
   // Set up Monitor World (Vector Table, etc)
   ArmSecureMonitorWorldInitialize ();
 
   // Set up Monitor World (Vector Table, etc)
   ArmSecureMonitorWorldInitialize ();
 
-  // Setup the Trustzone Chipsets
-  if (IS_PRIMARY_CORE(MpId)) {
-    // Transfer the interrupt to Non-secure World
-    ArmGicSetupNonSecure (PcdGet32(PcdGicDistributorBase), PcdGet32(PcdGicInterruptInterfaceBase));
+  // Transfer the interrupt to Non-secure World
+  ArmGicSetupNonSecure (MpId, PcdGet32(PcdGicDistributorBase), PcdGet32(PcdGicInterruptInterfaceBase));
 
 
-    // Initialize platform specific security policy
-    ArmPlatformTrustzoneInit ();
+  // Initialize platform specific security policy
+  ArmPlatformTrustzoneInit (MpId);
 
 
+  // Setup the Trustzone Chipsets
+  if (IS_PRIMARY_CORE(MpId)) {
     if (ArmIsMpCore()) {
       // Waiting for the Primary Core to have finished to initialize the Secure World
       ArmCpuSynchronizeSignal (ARM_CPU_EVENT_SECURE_INIT);
     if (ArmIsMpCore()) {
       // Waiting for the Primary Core to have finished to initialize the Secure World
       ArmCpuSynchronizeSignal (ARM_CPU_EVENT_SECURE_INIT);
index 8acb6d9710dcb1ae8b9cc1c406ffd597ed535be0..a806848ad5ae889396f7b23caaa3eb84488ada7b 100755 (executable)
@@ -74,21 +74,6 @@ ArmPlatformTrustzoneSupported (
        return FALSE;
 }
 
        return FALSE;
 }
 
-/**
-  Initialize the Secure peripherals and memory regions
-
-  If Trustzone is supported by your platform then this function makes the required initialization
-  of the secure peripherals and memory regions.
-
-**/
-VOID
-ArmPlatformTrustzoneInit (
-  VOID
-  )
-{
-       ASSERT(FALSE);
-}
-
 /**
   Remap the memory at 0x0
 
 /**
   Remap the memory at 0x0