]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ArmPlatformPkg/PrePeiCore/PrePeiCore.c
ArmPkg: Move ARM Platform drivers from ArmPkg/Drivers/ to ArmPlatformPkg/Drivers/
[mirror_edk2.git] / ArmPlatformPkg / PrePeiCore / PrePeiCore.c
index 51c09223dc3cea53ba7037fd05f2c0d2b1f5056b..ccf0e7d3d453be27bf4c479773d811152a716921 100644 (file)
 *\r
 **/\r
 \r
-#include <PiPei.h>\r
-#include <Ppi/TemporaryRamSupport.h>\r
-#include <Library/DebugLib.h>\r
-#include <Library/PcdLib.h>\r
 #include <Library/IoLib.h>\r
 #include <Library/BaseLib.h>\r
 #include <Library/BaseMemoryLib.h>\r
+#include <Library/PrintLib.h>\r
 #include <Library/ArmLib.h>\r
+#include <Library/SerialPortLib.h>\r
 #include <Chipset/ArmV7.h>\r
 \r
-EFI_STATUS\r
-EFIAPI\r
-SecTemporaryRamSupport (\r
-  IN CONST EFI_PEI_SERVICES   **PeiServices,\r
-  IN EFI_PHYSICAL_ADDRESS     TemporaryMemoryBase,\r
-  IN EFI_PHYSICAL_ADDRESS     PermanentMemoryBase,\r
-  IN UINTN                    CopySize\r
-  );\r
-\r
-VOID\r
-SecSwitchStack (\r
-  INTN    StackDelta\r
-  );\r
+#include "PrePeiCore.h"\r
 \r
-TEMPORARY_RAM_SUPPORT_PPI   mSecTemporaryRamSupportPpi = {SecTemporaryRamSupport};\r
+EFI_PEI_TEMPORARY_RAM_SUPPORT_PPI   mSecTemporaryRamSupportPpi = {SecTemporaryRamSupport};\r
 \r
 EFI_PEI_PPI_DESCRIPTOR      gSecPpiTable[] = {\r
   {\r
@@ -47,10 +33,6 @@ EFI_PEI_PPI_DESCRIPTOR      gSecPpiTable[] = {
   }\r
 };\r
 \r
-// Vector Table for Pei Phase\r
-VOID  PeiVectorTable (VOID);\r
-\r
-\r
 VOID\r
 CEntryPoint (\r
   IN  UINTN                     CoreId,\r
@@ -64,8 +46,8 @@ CEntryPoint (
   ArmInvalidateInstructionCache();\r
 \r
   // Enable Instruction & Data caches\r
-  ArmEnableDataCache();\r
-  ArmEnableInstructionCache();\r
+  ArmEnableDataCache ();\r
+  ArmEnableInstructionCache ();\r
 \r
   //\r
   // Note: Doesn't have to Enable CPU interface in non-secure world,\r
@@ -81,9 +63,9 @@ CEntryPoint (
   //If not primary Jump to Secondary Main\r
   if(0 == CoreId) {\r
     //Goto primary Main.\r
-    primary_main(PeiCoreEntryPoint);\r
+    PrimaryMain (PeiCoreEntryPoint);\r
   } else {\r
-    secondary_main(CoreId);\r
+    SecondaryMain (CoreId);\r
   }\r
 \r
   // PEI Core should always load and never return\r
@@ -101,7 +83,7 @@ SecTemporaryRamSupport (
 {\r
   //\r
   // Migrate the whole temporary memory to permenent memory.\r
-  // \r
+  //\r
   CopyMem (\r
     (VOID*)(UINTN)PermanentMemoryBase, \r
     (VOID*)(UINTN)TemporaryMemoryBase, \r
@@ -113,35 +95,44 @@ SecTemporaryRamSupport (
   return EFI_SUCCESS;\r
 }\r
 \r
-VOID PeiCommonExceptionEntry(UINT32 Entry, UINT32 LR) {\r
+VOID\r
+PeiCommonExceptionEntry (\r
+  IN UINT32 Entry,\r
+  IN UINT32 LR\r
+  )\r
+{\r
+  CHAR8           Buffer[100];\r
+  UINTN           CharCount;\r
+\r
   switch (Entry) {\r
   case 0:\r
-    DEBUG((EFI_D_ERROR,"Reset Exception at 0x%X\n",LR));\r
+    CharCount = AsciiSPrint (Buffer,sizeof (Buffer),"Reset Exception at 0x%X\n\r",LR);\r
     break;\r
   case 1:\r
-    DEBUG((EFI_D_ERROR,"Undefined Exception at 0x%X\n",LR));\r
+    CharCount = AsciiSPrint (Buffer,sizeof (Buffer),"Undefined Exception at 0x%X\n\r",LR);\r
     break;\r
   case 2:\r
-    DEBUG((EFI_D_ERROR,"SWI Exception at 0x%X\n",LR));\r
+    CharCount = AsciiSPrint (Buffer,sizeof (Buffer),"SWI Exception at 0x%X\n\r",LR);\r
     break;\r
   case 3:\r
-    DEBUG((EFI_D_ERROR,"PrefetchAbort Exception at 0x%X\n",LR));\r
+    CharCount = AsciiSPrint (Buffer,sizeof (Buffer),"PrefetchAbort Exception at 0x%X\n\r",LR);\r
     break;\r
   case 4:\r
-    DEBUG((EFI_D_ERROR,"DataAbort Exception at 0x%X\n",LR));\r
+    CharCount = AsciiSPrint (Buffer,sizeof (Buffer),"DataAbort Exception at 0x%X\n\r",LR);\r
     break;\r
   case 5:\r
-    DEBUG((EFI_D_ERROR,"Reserved Exception at 0x%X\n",LR));\r
+    CharCount = AsciiSPrint (Buffer,sizeof (Buffer),"Reserved Exception at 0x%X\n\r",LR);\r
     break;\r
   case 6:\r
-    DEBUG((EFI_D_ERROR,"IRQ Exception at 0x%X\n",LR));\r
+    CharCount = AsciiSPrint (Buffer,sizeof (Buffer),"IRQ Exception at 0x%X\n\r",LR);\r
     break;\r
   case 7:\r
-    DEBUG((EFI_D_ERROR,"FIQ Exception at 0x%X\n",LR));\r
+    CharCount = AsciiSPrint (Buffer,sizeof (Buffer),"FIQ Exception at 0x%X\n\r",LR);\r
     break;\r
   default:\r
-    DEBUG((EFI_D_ERROR,"Unknown Exception at 0x%X\n",LR));\r
+    CharCount = AsciiSPrint (Buffer,sizeof (Buffer),"Unknown Exception at 0x%X\n\r",LR);\r
     break;\r
   }\r
+  SerialPortWrite ((UINT8 *) Buffer, CharCount);\r
   while(1);\r
 }\r