#include <Uefi.h>\r
\r
#include <Library/DebugLib.h>\r
-#include <Library/UefiBootServicesTableLib.h>\r
#include <Library/PrintLib.h>\r
#include <Library/PcdLib.h>\r
#include <Library/BaseLib.h>\r
//\r
VA_LIST mVaListNull;\r
\r
+extern BOOLEAN mPostEBS;\r
+extern EFI_BOOT_SERVICES *mDebugBS;\r
+\r
/**\r
Send message to DebugPort Protocol.\r
\r
UINTN Length;\r
EFI_STATUS Status;\r
\r
- //\r
- // If mDebugPort is NULL, initialize first.\r
- //\r
- if (mDebugPort == NULL) {\r
- Status = gBS->LocateProtocol (&gEfiDebugPortProtocolGuid, NULL, (VOID **)&mDebugPort);\r
- if (EFI_ERROR (Status)) {\r
- return;\r
- }\r
+ if (!mPostEBS) {\r
+ //\r
+ // If mDebugPort is NULL, initialize first.\r
+ //\r
+ if (mDebugPort == NULL) {\r
+ Status = mDebugBS->LocateProtocol (&gEfiDebugPortProtocolGuid, NULL, (VOID **)&mDebugPort);\r
+ if (EFI_ERROR (Status)) {\r
+ return;\r
+ }\r
+\r
+ mDebugPort->Reset (mDebugPort);\r
+ }\r
\r
- mDebugPort->Reset (mDebugPort);\r
- }\r
+ //\r
+ // EFI_DEBUGPORT_PROTOCOL.Write is called until all message is sent.\r
+ //\r
+ while (BufferLength > 0) {\r
+ Length = BufferLength;\r
\r
- //\r
- // EFI_DEBUGPORT_PROTOCOL.Write is called until all message is sent.\r
- //\r
- while (BufferLength > 0) {\r
- Length = BufferLength;\r
+ Status = mDebugPort->Write (mDebugPort, WRITE_TIMEOUT, &Length, (VOID *) Buffer);\r
+ if (EFI_ERROR (Status) || BufferLength < Length) {\r
+ break;\r
+ }\r
\r
- Status = mDebugPort->Write (mDebugPort, WRITE_TIMEOUT, &Length, (VOID *) Buffer);\r
- if (EFI_ERROR (Status) || BufferLength < Length) {\r
- break;\r
+ Buffer += Length;\r
+ BufferLength -= Length;\r
}\r
-\r
- Buffer += Length;\r
- BufferLength -= Length;\r
}\r
}\r
\r
{\r
CHAR8 Buffer[MAX_DEBUG_MESSAGE_LENGTH];\r
\r
- //\r
- // If Format is NULL, then ASSERT().\r
- //\r
- ASSERT (Format != NULL);\r
+ if (!mPostEBS) {\r
+ //\r
+ // If Format is NULL, then ASSERT().\r
+ //\r
+ ASSERT (Format != NULL);\r
+\r
+ //\r
+ // Check driver debug mask value and global mask\r
+ //\r
+ if ((ErrorLevel & GetDebugPrintErrorLevel ()) == 0) {\r
+ return;\r
+ }\r
\r
- //\r
- // Check driver debug mask value and global mask\r
- //\r
- if ((ErrorLevel & GetDebugPrintErrorLevel ()) == 0) {\r
- return;\r
- }\r
+ //\r
+ // Convert the DEBUG() message to an ASCII String\r
+ //\r
+ if (BaseListMarker == NULL) {\r
+ AsciiVSPrint (Buffer, sizeof (Buffer), Format, VaListMarker);\r
+ } else {\r
+ AsciiBSPrint (Buffer, sizeof (Buffer), Format, BaseListMarker);\r
+ }\r
\r
- //\r
- // Convert the DEBUG() message to an ASCII String\r
- //\r
- if (BaseListMarker == NULL) {\r
- AsciiVSPrint (Buffer, sizeof (Buffer), Format, VaListMarker);\r
- } else {\r
- AsciiBSPrint (Buffer, sizeof (Buffer), Format, BaseListMarker);\r
+ //\r
+ // Send the print string to EFI_DEBUGPORT_PROTOCOL.Write.\r
+ //\r
+ UefiDebugLibDebugPortProtocolWrite (Buffer, AsciiStrLen (Buffer));\r
}\r
-\r
- //\r
- // Send the print string to EFI_DEBUGPORT_PROTOCOL.Write.\r
- //\r
- UefiDebugLibDebugPortProtocolWrite (Buffer, AsciiStrLen (Buffer));\r
}\r
\r
\r
{\r
CHAR8 Buffer[MAX_DEBUG_MESSAGE_LENGTH];\r
\r
- //\r
- // Generate the ASSERT() message in ASCII format\r
- //\r
- AsciiSPrint (\r
- Buffer,\r
- sizeof (Buffer),\r
- "ASSERT [%a] %a(%d): %a\n",\r
- gEfiCallerBaseName,\r
- FileName,\r
- LineNumber,\r
- Description\r
- );\r
-\r
- //\r
- // Send the print string to EFI_DEBUGPORT_PROTOCOL.Write.\r
- //\r
- UefiDebugLibDebugPortProtocolWrite (Buffer, AsciiStrLen (Buffer));\r
-\r
- //\r
- // Generate a Breakpoint, DeadLoop, or NOP based on PCD settings\r
- //\r
- if ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED) != 0) {\r
- CpuBreakpoint ();\r
- } else if ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED) != 0) {\r
- CpuDeadLoop ();\r
+ if (!mPostEBS) {\r
+ //\r
+ // Generate the ASSERT() message in ASCII format\r
+ //\r
+ AsciiSPrint (\r
+ Buffer,\r
+ sizeof (Buffer),\r
+ "ASSERT [%a] %a(%d): %a\n",\r
+ gEfiCallerBaseName,\r
+ FileName,\r
+ LineNumber,\r
+ Description\r
+ );\r
+\r
+ //\r
+ // Send the print string to EFI_DEBUGPORT_PROTOCOL.Write.\r
+ //\r
+ UefiDebugLibDebugPortProtocolWrite (Buffer, AsciiStrLen (Buffer));\r
+\r
+ //\r
+ // Generate a Breakpoint, DeadLoop, or NOP based on PCD settings\r
+ //\r
+ if ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED) != 0) {\r
+ CpuBreakpoint ();\r
+ } else if ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED) != 0) {\r
+ CpuDeadLoop ();\r
+ }\r
}\r
}\r
\r