]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/CTA9x4Helper.S
ArmPkg/PL35xSmc: Split the SMC initialization in multiple Chip Select initialization...
[mirror_edk2.git] / ArmPlatformPkg / ArmVExpressPkg / Library / ArmVExpressLibCTA9x4 / CTA9x4Helper.S
index fe63904d62c00837802a43900ab1d0de3ff125cf..2987cbee53c9ea1260c11f071acdefc06b901beb 100644 (file)
@@ -1,36 +1,32 @@
-#------------------------------------------------------------------------------ \r
-#\r
-# ARM VE Entry point. Reset vector in FV header will brach to\r
-# _ModuleEntryPoint. \r
-#\r
-# We use crazy macros, like LoadConstantToReg, since Xcode assembler \r
-# does not support = assembly syntax for ldr.\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
+//  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 <Base.h>\r
 #include <Library/PcdLib.h>\r
 #include <Library/ArmPlatformLib.h>\r
+#include <Drivers/PL354Smc.h>\r
 #include <AutoGen.h>\r
 \r
-#Start of Code section\r
 .text\r
 .align 3\r
 \r
 GCC_ASM_EXPORT(ArmPlatformIsMemoryInitialized)\r
 GCC_ASM_EXPORT(ArmPlatformInitializeBootMemory)\r
-.extern ASM_PFX(InitializeSMC)\r
+.extern ASM_PFX(SMCInitializeNOR)\r
+.extern ASM_PFX(SMCInitializeSRAM)\r
+.extern ASM_PFX(SMCInitializePeripherals)\r
+.extern ASM_PFX(SMCInitializeVRAM)\r
 \r
 /**\r
   Called at the early stage of the Boot phase to know if the memory has already been initialized\r
@@ -65,10 +61,32 @@ ASM_PFX(ArmPlatformIsMemoryInitialized):
 **/\r
 ASM_PFX(ArmPlatformInitializeBootMemory):\r
   mov   r5, lr\r
+\r
+  //\r
   // Initialize PL354 SMC\r
+  //\r
   LoadConstantToReg (ARM_VE_SMC_CTRL_BASE, r1)\r
+\r
+  // NOR Flash 0\r
+  LoadConstantToReg (PL354_SMC_DIRECT_CMD_ADDR_CS(0,0), r2)\r
+  blx   ASM_PFX(SMCInitializeNOR)\r
+\r
+  // NOR Flash 1\r
+  LoadConstantToReg (PL354_SMC_DIRECT_CMD_ADDR_CS(1,0), r2)\r
+  blx   ASM_PFX(SMCInitializeNOR)\r
+\r
+  // Setup SRAM\r
+  blx   ASM_PFX(SMCInitializeSRAM)\r
+\r
+  // Memory Mapped Peripherals\r
+  blx   ASM_PFX(SMCInitializePeripherals)\r
+\r
+  // Initialize VRAM\r
+  //TODO: Check if we really must inititialize Video SRAM in UEFI. Does Linux can do it ? Does the Video driver can do it ?\r
+  //      It will be faster (only initialize if required) and easier (remove assembly code because of a stack available) to move this initialization.\r
   LoadConstantToReg (VRAM_MOTHERBOARD_BASE, r2)\r
-  blx   ASM_PFX(InitializeSMC)\r
+  blx   ASM_PFX(SMCInitializeVRAM)\r
+\r
   bx   r5\r
 \r
 .end\r