]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPlatformPkg/ArmPlatformLib: Renamed ArmPlatformInitialize into ArmPlatformSecIniti...
authoroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 26 Apr 2011 18:27:15 +0000 (18:27 +0000)
committeroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 26 Apr 2011 18:27:15 +0000 (18:27 +0000)
Some platforms require some of their controllers to be initialized in Secure world.
This function make the difference between Secure and Normal world platform initialization.

ArmPlatformPkg/ArmPlatformLib: Introduce ArmPlatformNormalInitialize

Contain the code that initializes platform controllers that would be initialized in Normal World
by PlatformPei.

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

ArmPlatformPkg/ArmRealViewEbPkg/Library/ArmRealViewEbLibRTSM/ArmRealViewEb.c
ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/CTA9x4.c
ArmPlatformPkg/Include/Library/ArmPlatformLib.h
ArmPlatformPkg/PlatformPei/PlatformPei.c
ArmPlatformPkg/Sec/Sec.c

index 070db6ab59b20f67759f5274002fc5928f71f2c7..8be95ce38fde01716f7b9deed04b97e46492268c 100644 (file)
   @return   A non-zero value if Trustzone supported.
 
 **/
   @return   A non-zero value if Trustzone supported.
 
 **/
-UINTN ArmPlatformTrustzoneSupported(VOID) {
+UINTN
+ArmPlatformTrustzoneSupported (
+  VOID
+  )
+{
   // There is no Trustzone controllers (TZPC & TZASC) and no Secure Memory on RTSM
   // There is no Trustzone controllers (TZPC & TZASC) and no Secure Memory on RTSM
-       return FALSE;
+  return FALSE;
 }
 
 /**
 }
 
 /**
@@ -41,8 +45,12 @@ UINTN ArmPlatformTrustzoneSupported(VOID) {
   of the secure peripherals and memory regions.
 
 **/
   of the secure peripherals and memory regions.
 
 **/
-VOID ArmPlatformTrustzoneInit(VOID) {
-       ASSERT(FALSE);
+VOID
+ArmPlatformTrustzoneInit (
+  VOID
+  )
+{
+  ASSERT(FALSE);
 }
 
 /**
 }
 
 /**
@@ -52,9 +60,13 @@ VOID ArmPlatformTrustzoneInit(VOID) {
   This function can do nothing if this feature is not relevant to your platform.
 
 **/
   This function can do nothing if this feature is not relevant to your platform.
 
 **/
-VOID ArmPlatformBootRemapping(VOID) {
+VOID
+ArmPlatformBootRemapping (
+  VOID
+  )
+{
   // Disable memory remapping and return to normal mapping
   // Disable memory remapping and return to normal mapping
-       MmioOr32 (ARM_EB_SYSCTRL, BIT8); //EB_SP810_CTRL_BASE
+  MmioOr32 (ARM_EB_SYSCTRL, BIT8); //EB_SP810_CTRL_BASE
 }
 
 /**
 }
 
 /**
@@ -79,18 +91,37 @@ ArmPlatformGetBootMode (
 
 **/
 VOID
 
 **/
 VOID
-ArmPlatformInitialize (
+ArmPlatformSecInitialize (
   VOID
   ) {
   // Do nothing yet
 }
 
   VOID
   ) {
   // Do nothing yet
 }
 
+/**
+  Initialize controllers that must setup in the normal world
+
+  This function is called by the ArmPlatformPkg/Pei or ArmPlatformPkg/Pei/PlatformPeim
+  in the PEI phase.
+
+**/
+VOID
+ArmPlatformNormalInitialize (
+  VOID
+  )
+{
+  // Nothing to do here
+}
+
 /**
   Initialize the system (or sometimes called permanent) memory
 
   This memory is generally represented by the DRAM.
 
 **/
 /**
   Initialize the system (or sometimes called permanent) memory
 
   This memory is generally represented by the DRAM.
 
 **/
-VOID ArmPlatformInitializeSystemMemory(VOID) {
-    // We do not need to initialize the System Memory on RTSM
+VOID
+ArmPlatformInitializeSystemMemory (
+  VOID
+  )
+{
+  // We do not need to initialize the System Memory on RTSM
 }
 }
index 490dda1a9229f82e9dccd1587b2c2ae53c5b8bb8..82b4ae14cb63f4eba95f595f1afd5a99aa38ec47 100644 (file)
@@ -63,8 +63,12 @@ struct pl341_dmc_config ddr_timings = {
   @return   A non-zero value if Trustzone supported.
 
 **/
   @return   A non-zero value if Trustzone supported.
 
 **/
-UINTN ArmPlatformTrustzoneSupported(VOID) {
-    return (MmioRead32(ARM_VE_SYS_CFGRW1_REG) & ARM_VE_CFGRW1_TZASC_EN_BIT_MASK);
+UINTN
+ArmPlatformTrustzoneSupported (
+  VOID
+  )
+{
+  return (MmioRead32(ARM_VE_SYS_CFGRW1_REG) & ARM_VE_CFGRW1_TZASC_EN_BIT_MASK);
 }
 
 /**
 }
 
 /**
@@ -160,7 +164,11 @@ ArmPlatformGetBootMode (
   This function can do nothing if this feature is not relevant to your platform.
 
 **/
   This function can do nothing if this feature is not relevant to your platform.
 
 **/
-VOID ArmPlatformBootRemapping(VOID) {
+VOID
+ArmPlatformBootRemapping (
+  VOID
+  )
+{
     UINT32 val32  = MmioRead32(ARM_VE_SYS_CFGRW1_REG); //Scc - CFGRW1
     // we remap the DRAM to 0x0
     MmioWrite32(ARM_VE_SYS_CFGRW1_REG, (val32 & 0x0FFFFFFF) | ARM_VE_CFGRW1_REMAP_DRAM);
     UINT32 val32  = MmioRead32(ARM_VE_SYS_CFGRW1_REG); //Scc - CFGRW1
     // we remap the DRAM to 0x0
     MmioWrite32(ARM_VE_SYS_CFGRW1_REG, (val32 & 0x0FFFFFFF) | ARM_VE_CFGRW1_REMAP_DRAM);
@@ -174,20 +182,39 @@ VOID ArmPlatformBootRemapping(VOID) {
 
 **/
 VOID
 
 **/
 VOID
-ArmPlatformInitialize (
+ArmPlatformSecInitialize (
   VOID
   ) {
   // The L2x0 controller must be intialize in Secure World
   L2x0CacheInit(PcdGet32(PcdL2x0ControllerBase), FALSE);
 }
 
   VOID
   ) {
   // The L2x0 controller must be intialize in Secure World
   L2x0CacheInit(PcdGet32(PcdL2x0ControllerBase), FALSE);
 }
 
+/**
+  Initialize controllers that must setup in the normal world
+
+  This function is called by the ArmPlatformPkg/Pei or ArmPlatformPkg/Pei/PlatformPeim
+  in the PEI phase.
+
+**/
+VOID
+ArmPlatformNormalInitialize (
+  VOID
+  )
+{
+  // Nothing to do here
+}
+
 /**
   Initialize the system (or sometimes called permanent) memory
 
   This memory is generally represented by the DRAM.
 
 **/
 /**
   Initialize the system (or sometimes called permanent) memory
 
   This memory is generally represented by the DRAM.
 
 **/
-VOID ArmPlatformInitializeSystemMemory(VOID) {
-    PL341DmcInit(&ddr_timings);
-    PL301AxiInit(ARM_VE_FAXI_BASE);
+VOID
+ArmPlatformInitializeSystemMemory (
+  VOID
+  )
+{
+  PL341DmcInit(&ddr_timings);
+  PL301AxiInit(ARM_VE_FAXI_BASE);
 }
 }
index ec95941b51fb28a5c4e2f18ff1df70064e872559..3fec90298c54179501a301033da78dd5afbd1ab3 100644 (file)
@@ -65,7 +65,10 @@ VOID ArmPlatformIsMemoryInitialized(VOID);
   pointer is not used (probably required to use assembly language)
 
 **/
   pointer is not used (probably required to use assembly language)
 
 **/
-VOID ArmPlatformInitializeBootMemory(VOID);
+VOID
+ArmPlatformInitializeBootMemory (
+  VOID
+  );
 
 /**
   Return the current Boot Mode
 
 /**
   Return the current Boot Mode
@@ -88,7 +91,19 @@ ArmPlatformGetBootMode (
 
 **/
 VOID
 
 **/
 VOID
-ArmPlatformInitialize (
+ArmPlatformSecInitialize (
+  VOID
+  );
+
+/**
+  Initialize controllers that must setup in the normal world
+
+  This function is called by the ArmPlatformPkg/Pei or ArmPlatformPkg/Pei/PlatformPeim
+  in the PEI phase.
+
+**/
+VOID
+ArmPlatformNormalInitialize (
   VOID
   );
 
   VOID
   );
 
@@ -98,7 +113,10 @@ ArmPlatformInitialize (
   This memory is generally represented by the DRAM.
 
 **/
   This memory is generally represented by the DRAM.
 
 **/
-VOID ArmPlatformInitializeSystemMemory(VOID);
+VOID
+ArmPlatformInitializeSystemMemory (
+  VOID
+  );
 
 /**
   Remap the memory at 0x0
 
 /**
   Remap the memory at 0x0
@@ -107,7 +125,10 @@ VOID ArmPlatformInitializeSystemMemory(VOID);
   This function can do nothing if this feature is not relevant to your platform.
 
 **/
   This function can do nothing if this feature is not relevant to your platform.
 
 **/
-VOID ArmPlatformBootRemapping(VOID);
+VOID
+ArmPlatformBootRemapping (
+  VOID
+  );
 
 /**
   Return if Trustzone is supported by your platform
 
 /**
   Return if Trustzone is supported by your platform
@@ -120,7 +141,10 @@ VOID ArmPlatformBootRemapping(VOID);
   @return   A non-zero value if Trustzone supported.
 
 **/
   @return   A non-zero value if Trustzone supported.
 
 **/
-UINTN ArmPlatformTrustzoneSupported(VOID);
+UINTN
+ArmPlatformTrustzoneSupported (
+  VOID
+  );
 
 /**
   Initialize the Secure peripherals and memory regions
 
 /**
   Initialize the Secure peripherals and memory regions
@@ -129,7 +153,10 @@ UINTN ArmPlatformTrustzoneSupported(VOID);
   of the secure peripherals and memory regions.
 
 **/
   of the secure peripherals and memory regions.
 
 **/
-VOID ArmPlatformTrustzoneInit(VOID);
+VOID
+ArmPlatformTrustzoneInit (
+  VOID
+  );
 
 /**
   Return the information about the memory region in permanent memory used by PEI
 
 /**
   Return the information about the memory region in permanent memory used by PEI
@@ -156,9 +183,10 @@ VOID ArmPlatformGetPeiMemory (
                                     entry
 
 **/
                                     entry
 
 **/
-VOID ArmPlatformGetVirtualMemoryMap (
-    OUT ARM_MEMORY_REGION_DESCRIPTOR** VirtualMemoryMap
-);
+VOID
+ArmPlatformGetVirtualMemoryMap (
+  OUT ARM_MEMORY_REGION_DESCRIPTOR** VirtualMemoryMap
+  );
 
 /**
   Return the EFI Memory Map of your platform
 
 /**
   Return the EFI Memory Map of your platform
index 0d901736702170dcd3e6f22998cd8ec8b0bcee44..f3e96782f1e66a355f2e897096385ebfd853c242 100644 (file)
@@ -73,6 +73,9 @@ Returns:
 \r
   DEBUG ((EFI_D_ERROR, "Platform PEIM Loaded\n"));\r
 \r
 \r
   DEBUG ((EFI_D_ERROR, "Platform PEIM Loaded\n"));\r
 \r
+  // Initialize the platform specific controllers\r
+  ArmPlatformNormalInitialize ();\r
+\r
   BuildCpuHob (PcdGet8 (PcdPrePiCpuMemorySize), PcdGet8 (PcdPrePiCpuIoSize));\r
   \r
   BuildFvHob (FixedPcdGet32(PcdFlashFvMainBase), FixedPcdGet32(PcdFlashFvMainSize));\r
   BuildCpuHob (PcdGet8 (PcdPrePiCpuMemorySize), PcdGet8 (PcdPrePiCpuIoSize));\r
   \r
   BuildFvHob (FixedPcdGet32(PcdFlashFvMainBase), FixedPcdGet32(PcdFlashFvMainSize));\r
index 508f418ce33cef4a65bc5bbfcab8ef6b4ff554a9..b8e52255207af7d7db171e40d5d916f6e37eccbc 100644 (file)
@@ -115,7 +115,7 @@ CEntryPoint (
   if (CoreId == ARM_PRIMARY_CORE) {
     // Initialize peripherals that must be done at the early stage
     // Example: Some L2x0 controllers must be initialized in Secure World
   if (CoreId == ARM_PRIMARY_CORE) {
     // Initialize peripherals that must be done at the early stage
     // Example: Some L2x0 controllers must be initialized in Secure World
-    ArmPlatformInitialize ();
+    ArmPlatformSecInitialize ();
 
     // If we skip the PEI Core we could want to initialize the DRAM in the SEC phase.
     // If we are in standalone, we need the initialization to copy the UEFI firmware into DRAM
 
     // If we skip the PEI Core we could want to initialize the DRAM in the SEC phase.
     // If we are in standalone, we need the initialization to copy the UEFI firmware into DRAM