X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=MdePkg%2FLibrary%2FUefiDebugLibDebugPortProtocol%2FDebugLib.c;fp=MdePkg%2FLibrary%2FUefiDebugLibDebugPortProtocol%2FDebugLib.c;h=c25199b53fcf60d7d18f94cb8503423b64097e74;hp=cd7e2abbd3b22c198973cf819fb004b6f944ead7;hb=2f88bd3a1296c522317f1c21377876de63de5be7;hpb=1436aea4d5707e672672a11bda72be2c63c936c3 diff --git a/MdePkg/Library/UefiDebugLibDebugPortProtocol/DebugLib.c b/MdePkg/Library/UefiDebugLibDebugPortProtocol/DebugLib.c index cd7e2abbd3..c25199b53f 100644 --- a/MdePkg/Library/UefiDebugLibDebugPortProtocol/DebugLib.c +++ b/MdePkg/Library/UefiDebugLibDebugPortProtocol/DebugLib.c @@ -25,19 +25,18 @@ // // Define the timeout for EFI_DEBUGPORT_PROTOCOL.Write // -#define WRITE_TIMEOUT 1000 +#define WRITE_TIMEOUT 1000 - -EFI_DEBUGPORT_PROTOCOL *mDebugPort = NULL; +EFI_DEBUGPORT_PROTOCOL *mDebugPort = NULL; // // VA_LIST can not initialize to NULL for all compiler, so we use this to // indicate a null VA_LIST // -VA_LIST mVaListNull; +VA_LIST mVaListNull; -extern BOOLEAN mPostEBS; -extern EFI_BOOT_SERVICES *mDebugBS; +extern BOOLEAN mPostEBS; +extern EFI_BOOT_SERVICES *mDebugBS; /** Send message to DebugPort Protocol. @@ -55,20 +54,20 @@ UefiDebugLibDebugPortProtocolWrite ( IN UINTN BufferLength ) { - UINTN Length; - EFI_STATUS Status; + UINTN Length; + EFI_STATUS Status; if (!mPostEBS) { // // If mDebugPort is NULL, initialize first. // if (mDebugPort == NULL) { - Status = mDebugBS->LocateProtocol (&gEfiDebugPortProtocolGuid, NULL, (VOID **)&mDebugPort); - if (EFI_ERROR (Status)) { - return; - } + Status = mDebugBS->LocateProtocol (&gEfiDebugPortProtocolGuid, NULL, (VOID **)&mDebugPort); + if (EFI_ERROR (Status)) { + return; + } - mDebugPort->Reset (mDebugPort); + mDebugPort->Reset (mDebugPort); } // @@ -77,12 +76,12 @@ UefiDebugLibDebugPortProtocolWrite ( while (BufferLength > 0) { Length = BufferLength; - Status = mDebugPort->Write (mDebugPort, WRITE_TIMEOUT, &Length, (VOID *) Buffer); - if (EFI_ERROR (Status) || BufferLength < Length) { + Status = mDebugPort->Write (mDebugPort, WRITE_TIMEOUT, &Length, (VOID *)Buffer); + if (EFI_ERROR (Status) || (BufferLength < Length)) { break; } - Buffer += Length; + Buffer += Length; BufferLength -= Length; } } @@ -111,14 +110,13 @@ DebugPrint ( ... ) { - VA_LIST Marker; + VA_LIST Marker; VA_START (Marker, Format); DebugVPrint (ErrorLevel, Format, Marker); VA_END (Marker); } - /** Prints a debug message to the debug output device if the specified error level is enabled base on Null-terminated format string and a @@ -138,13 +136,13 @@ DebugPrint ( **/ VOID DebugPrintMarker ( - IN UINTN ErrorLevel, - IN CONST CHAR8 *Format, - IN VA_LIST VaListMarker, - IN BASE_LIST BaseListMarker + IN UINTN ErrorLevel, + IN CONST CHAR8 *Format, + IN VA_LIST VaListMarker, + IN BASE_LIST BaseListMarker ) { - CHAR8 Buffer[MAX_DEBUG_MESSAGE_LENGTH]; + CHAR8 Buffer[MAX_DEBUG_MESSAGE_LENGTH]; if (!mPostEBS) { // @@ -175,7 +173,6 @@ DebugPrintMarker ( } } - /** Prints a debug message to the debug output device if the specified error level is enabled. @@ -194,15 +191,14 @@ DebugPrintMarker ( VOID EFIAPI DebugVPrint ( - IN UINTN ErrorLevel, - IN CONST CHAR8 *Format, - IN VA_LIST VaListMarker + IN UINTN ErrorLevel, + IN CONST CHAR8 *Format, + IN VA_LIST VaListMarker ) { DebugPrintMarker (ErrorLevel, Format, VaListMarker, NULL); } - /** Prints a debug message to the debug output device if the specified error level is enabled. @@ -223,15 +219,14 @@ DebugVPrint ( VOID EFIAPI DebugBPrint ( - IN UINTN ErrorLevel, - IN CONST CHAR8 *Format, - IN BASE_LIST BaseListMarker + IN UINTN ErrorLevel, + IN CONST CHAR8 *Format, + IN BASE_LIST BaseListMarker ) { DebugPrintMarker (ErrorLevel, Format, mVaListNull, BaseListMarker); } - /** Prints an assert message containing a filename, line number, and description. This may be followed by a breakpoint or a dead loop. @@ -287,15 +282,14 @@ DebugAssert ( // // Generate a Breakpoint, DeadLoop, or NOP based on PCD settings // - if ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED) != 0) { + if ((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED) != 0) { CpuBreakpoint (); - } else if ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED) != 0) { + } else if ((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED) != 0) { CpuDeadLoop (); } } } - /** Fills a target buffer with PcdDebugClearMemoryValue, and returns the target buffer. @@ -326,10 +320,9 @@ DebugClearMemory ( // // SetMem() checks for the the ASSERT() condition on Length and returns Buffer // - return SetMem (Buffer, Length, PcdGet8(PcdDebugClearMemoryValue)); + return SetMem (Buffer, Length, PcdGet8 (PcdDebugClearMemoryValue)); } - /** Returns TRUE if ASSERT() macros are enabled. @@ -346,10 +339,9 @@ DebugAssertEnabled ( VOID ) { - return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED) != 0); + return (BOOLEAN)((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED) != 0); } - /** Returns TRUE if DEBUG() macros are enabled. @@ -366,10 +358,9 @@ DebugPrintEnabled ( VOID ) { - return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_PRINT_ENABLED) != 0); + return (BOOLEAN)((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_PRINT_ENABLED) != 0); } - /** Returns TRUE if DEBUG_CODE() macros are enabled. @@ -386,10 +377,9 @@ DebugCodeEnabled ( VOID ) { - return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_CODE_ENABLED) != 0); + return (BOOLEAN)((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_CODE_ENABLED) != 0); } - /** Returns TRUE if DEBUG_CLEAR_MEMORY() macro is enabled. @@ -406,7 +396,7 @@ DebugClearMemoryEnabled ( VOID ) { - return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED) != 0); + return (BOOLEAN)((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED) != 0); } /** @@ -421,9 +411,8 @@ DebugClearMemoryEnabled ( BOOLEAN EFIAPI DebugPrintLevelEnabled ( - IN CONST UINTN ErrorLevel + IN CONST UINTN ErrorLevel ) { - return (BOOLEAN) ((ErrorLevel & PcdGet32(PcdFixedDebugPrintErrorLevel)) != 0); + return (BOOLEAN)((ErrorLevel & PcdGet32 (PcdFixedDebugPrintErrorLevel)) != 0); } -