]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/CTA9x4.c
ArmPlatformPkg/ArmPlatformLib: Renamed ArmPlatformInitialize into ArmPlatformSecIniti...
[mirror_edk2.git] / ArmPlatformPkg / ArmVExpressPkg / Library / ArmVExpressLibCTA9x4 / CTA9x4.c
index 497e0da0665ea6b82aa9b4869dbfbeaea1e5c0ff..82b4ae14cb63f4eba95f595f1afd5a99aa38ec47 100644 (file)
 #include <Library/DebugLib.h>
 #include <Library/PcdLib.h>
 #include <Drivers/PL341Dmc.h>
+#include <Drivers/PL301Axi.h>
+#include <Library/L2X0CacheLib.h>
+#include <Library/SerialPortLib.h>
+
+#define SerialPrint(txt)  SerialPortWrite (txt, AsciiStrLen(txt)+1);
 
 // DDR2 timings
 struct pl341_dmc_config ddr_timings = {
@@ -58,8 +63,12 @@ struct pl341_dmc_config ddr_timings = {
   @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);
 }
 
 /**
@@ -132,6 +141,22 @@ VOID ArmPlatformTrustzoneInit(VOID) {
         TZASC_REGION_SIZE_256MB, TZASC_REGION_SECURITY_NSRW);
 }
 
+/**
+  Return the current Boot Mode
+
+  This function returns the boot reason on the platform
+
+  @return   Return the current Boot Mode of the platform
+
+**/
+EFI_BOOT_MODE
+ArmPlatformGetBootMode (
+  VOID
+  )
+{
+  return BOOT_WITH_FULL_CONFIGURATION;
+}
+
 /**
   Remap the memory at 0x0
 
@@ -139,19 +164,57 @@ VOID ArmPlatformTrustzoneInit(VOID) {
   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);
 }
 
+/**
+  Initialize controllers that must setup at the early stage
+
+  Some peripherals must be initialized in Secure World.
+  For example, some L2x0 requires to be initialized in Secure World
+
+**/
+VOID
+ArmPlatformSecInitialize (
+  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.
 
 **/
-VOID ArmPlatformInitializeSystemMemory(VOID) {
-    PL341DmcInit(&ddr_timings);
-    PL301AxiInit(ARM_VE_FAXI_BASE);
+VOID
+ArmPlatformInitializeSystemMemory (
+  VOID
+  )
+{
+  PL341DmcInit(&ddr_timings);
+  PL301AxiInit(ARM_VE_FAXI_BASE);
 }