]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPlatformPkg: Use Serial print function to print out non debugging information
authoroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 31 Mar 2011 12:09:31 +0000 (12:09 +0000)
committeroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 31 Mar 2011 12:09:31 +0000 (12:09 +0000)
Exception errors and early print statements must be also print out in Release builds.
Replace the DEBUG() macro by the SerialPortWrite() function.

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

ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/CTA9x4.c
ArmPlatformPkg/PrePeiCore/PrePeiCore.c
ArmPlatformPkg/PrePeiCore/PrePeiCoreMPCore.inf
ArmPlatformPkg/PrePeiCore/PrePeiCoreUniCore.inf
ArmPlatformPkg/Sec/Sec.c
ArmPlatformPkg/Sec/Sec.inf

index 497e0da0665ea6b82aa9b4869dbfbeaea1e5c0ff..69091d1119faf0a67e27cf2f4bcffd130a565b7a 100644 (file)
@@ -18,6 +18,9 @@
 #include <Library/DebugLib.h>
 #include <Library/PcdLib.h>
 #include <Drivers/PL341Dmc.h>
+#include <Library/SerialPortLib.h>
+
+#define SerialPrint(txt)  SerialPortWrite (txt, AsciiStrLen(txt)+1);
 
 // DDR2 timings
 struct pl341_dmc_config ddr_timings = {
index 51c09223dc3cea53ba7037fd05f2c0d2b1f5056b..40a0e69bc074c50df3a0822dea47d9dfef75b732 100644 (file)
@@ -113,35 +113,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
index 3f133d270af399f677a99483ee80f56a60818749..ed85234b365f2bc8c4417d7ea566076f26d8c5b4 100644 (file)
@@ -45,6 +45,7 @@
   ArmPlatformLib\r
   ArmMPCoreMailBoxLib\r
   PL390GicNonSecLib\r
+  SerialPortLib\r
 \r
 [Ppis]\r
   gEfiTemporaryRamSupportPpiGuid\r
index 3144a7a4601c42ea917419465f54abec2841e847..a7bf3bd98685f69936079fa8db55c749936b2010 100644 (file)
@@ -43,6 +43,7 @@
   IoLib\r
   ArmLib\r
   ArmPlatformLib\r
+  SerialPortLib\r
 \r
 [Ppis]\r
   gEfiTemporaryRamSupportPpiGuid\r
index 2ae01d8e541fccb939ecc8103778b9b54f70d30f..4de49329d45b9e24fb9fa4b3dfef519abe907d5c 100644 (file)
@@ -15,6 +15,7 @@
 
 #include <Library/DebugLib.h>
 #include <Library/PcdLib.h>
+#include <Library/PrintLib.h>
 #include <Library/BaseLib.h>
 #include <Library/BaseMemoryLib.h>
 #include <Library/ArmLib.h>
@@ -24,6 +25,8 @@
 #include <Library/SerialPortLib.h>
 #include <Library/ArmPlatformLib.h>
 
+#define SerialPrint(txt)  SerialPortWrite (txt, AsciiStrLen(txt)+1);
+
 extern VOID *monitor_vector_table;
 
 VOID ArmSetupGicNonSecure (
@@ -58,6 +61,9 @@ CEntryPoint (
   IN  UINTN                     CoreId
   )
 {
+  CHAR8           Buffer[100];
+  UINTN           CharCount;
+
   // Primary CPU clears out the SCU tag RAMs, secondaries wait
   if (CoreId == 0) {
     if (FixedPcdGet32(PcdMPCoreSupport)) {
@@ -67,8 +73,10 @@ CEntryPoint (
     // SEC phase needs to run library constructors by hand. This assumes we are linked against the SerialLib
     // In non SEC modules the init call is in autogenerated code.
     SerialPortInitialize ();
+
     // Start talking
-    DEBUG ((EFI_D_ERROR, "UART Enabled\n"));
+    CharCount = AsciiSPrint (Buffer,sizeof (Buffer),"UEFI firmware built at %a on %a\n\r",__TIME__, __DATE__);
+    SerialPortWrite ((UINT8 *) Buffer, CharCount);
 
     // Now we've got UART, make the check:
     // - The Vector table must be 32-byte aligned
@@ -172,7 +180,7 @@ CEntryPoint (
     ArmWriteScr(SCR_NS | SCR_FW | SCR_AW);
   } else {
     if(0 == CoreId){
-      DEBUG ((EFI_D_ERROR, "Trust Zone Configuration is disabled\n"));
+      SerialPrint ("Trust Zone Configuration is disabled\n\r");
     }
 
     //Trustzone is not enabled, just enable the Distributor and CPU interface
@@ -189,11 +197,12 @@ CEntryPoint (
     if (CoreId == 0) {
       UINTN*   StartAddress = (UINTN*)PcdGet32(PcdEmbeddedFdBaseAddress);
 
-      DEBUG ((EFI_D_ERROR, "Waiting for firmware at 0x%08X ...\n",StartAddress));
-
       // Patch the DRAM to make an infinite loop at the start address
       *StartAddress = 0xEAFFFFFE; // opcode for while(1)
 
+      CharCount = AsciiSPrint (Buffer,sizeof (Buffer),"Waiting for firmware at 0x%08X ...\n\r",StartAddress);
+      SerialPortWrite ((UINT8 *) Buffer, CharCount);
+
       // To enter into Non Secure state, we need to make a return from exception
       return_from_exception(PcdGet32(PcdEmbeddedFdBaseAddress));
     } else {
@@ -208,10 +217,6 @@ CEntryPoint (
       return_from_exception((UINTN)NonSecureWaitForFirmware);
     }
   } else {
-    if (CoreId == 0) {
-      DEBUG ((EFI_D_ERROR, "Standalone Firmware\n"));
-    }
-
     // To enter into Non Secure state, we need to make a return from exception
     return_from_exception(PcdGet32(PcdEmbeddedFdBaseAddress));
   }
@@ -241,35 +246,44 @@ VOID NonSecureWaitForFirmware() {
   ASSERT (FALSE);
 }
 
-VOID SecCommonExceptionEntry(UINT32 Entry, UINT32 LR) {
+VOID
+SecCommonExceptionEntry (
+  IN UINT32 Entry,
+  IN UINT32 LR
+  )
+{
+  CHAR8           Buffer[100];
+  UINTN           CharCount;
+
   switch (Entry) {
   case 0:
-    DEBUG((EFI_D_ERROR,"Reset Exception at 0x%X\n",LR));
+    CharCount = AsciiSPrint (Buffer,sizeof (Buffer),"Reset Exception at 0x%X\n\r",LR);
     break;
   case 1:
-    DEBUG((EFI_D_ERROR,"Undefined Exception at 0x%X\n",LR));
+    CharCount = AsciiSPrint (Buffer,sizeof (Buffer),"Undefined Exception at 0x%X\n\r",LR);
     break;
   case 2:
-    DEBUG((EFI_D_ERROR,"SWI Exception at 0x%X\n",LR));
+    CharCount = AsciiSPrint (Buffer,sizeof (Buffer),"SWI Exception at 0x%X\n\r",LR);
     break;
   case 3:
-    DEBUG((EFI_D_ERROR,"PrefetchAbort Exception at 0x%X\n",LR));
+    CharCount = AsciiSPrint (Buffer,sizeof (Buffer),"PrefetchAbort Exception at 0x%X\n\r",LR);
     break;
   case 4:
-    DEBUG((EFI_D_ERROR,"DataAbort Exception at 0x%X\n",LR));
+    CharCount = AsciiSPrint (Buffer,sizeof (Buffer),"DataAbort Exception at 0x%X\n\r",LR);
     break;
   case 5:
-    DEBUG((EFI_D_ERROR,"Reserved Exception at 0x%X\n",LR));
+    CharCount = AsciiSPrint (Buffer,sizeof (Buffer),"Reserved Exception at 0x%X\n\r",LR);
     break;
   case 6:
-    DEBUG((EFI_D_ERROR,"IRQ Exception at 0x%X\n",LR));
+    CharCount = AsciiSPrint (Buffer,sizeof (Buffer),"IRQ Exception at 0x%X\n\r",LR);
     break;
   case 7:
-    DEBUG((EFI_D_ERROR,"FIQ Exception at 0x%X\n",LR));
+    CharCount = AsciiSPrint (Buffer,sizeof (Buffer),"FIQ Exception at 0x%X\n\r",LR);
     break;
   default:
-    DEBUG((EFI_D_ERROR,"Unknown Exception at 0x%X\n",LR));
+    CharCount = AsciiSPrint (Buffer,sizeof (Buffer),"Unknown Exception at 0x%X\n\r",LR);
     break;
   }
+  SerialPortWrite ((UINT8 *) Buffer, CharCount);
   while(1);
 }
index 7180e1a5ad1732c96c64d67e8627bb4e8361e91a..983d87198e9ffeca4b35850bfc2da60b357ae32f 100644 (file)
@@ -44,6 +44,7 @@
   ArmPlatformLib
   L2X0CacheLib
   PL390GicSecLib
+  SerialPortLib
   
 [FeaturePcd]
   gArmPlatformTokenSpaceGuid.PcdStandalone