\r
Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>\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
+ SPDX-License-Identifier: BSD-2-Clause-Patent\r
\r
**/\r
\r
...\r
)\r
{\r
- VA_LIST Marker;\r
+ VA_LIST Marker;\r
\r
VA_START (Marker, Format);\r
DebugVPrint (ErrorLevel, Format, Marker);\r
VA_END (Marker);\r
}\r
\r
-\r
/**\r
Prints a debug message to the debug output device if the specified\r
error level is enabled.\r
VOID\r
EFIAPI\r
DebugBPrint (\r
- IN UINTN ErrorLevel,\r
- IN CONST CHAR8 *Format,\r
- IN BASE_LIST BaseListMarker\r
+ IN UINTN ErrorLevel,\r
+ IN CONST CHAR8 *Format,\r
+ IN BASE_LIST BaseListMarker\r
)\r
{\r
- EFI_STATUS Status;\r
- EDKII_DEBUG_PPI *DebugPpi;\r
+ EFI_STATUS Status;\r
+ EDKII_DEBUG_PPI *DebugPpi;\r
\r
//\r
// If Format is NULL, then ASSERT().\r
}\r
\r
Status = PeiServicesLocatePpi (\r
- &gEdkiiDebugPpiGuid,\r
- 0,\r
- NULL,\r
- (VOID **)&DebugPpi\r
- );\r
+ &gEdkiiDebugPpiGuid,\r
+ 0,\r
+ NULL,\r
+ (VOID **)&DebugPpi\r
+ );\r
if (EFI_ERROR (Status)) {\r
return;\r
}\r
);\r
}\r
\r
-\r
/**\r
Worker function that convert a VA_LIST to a BASE_LIST based on a\r
Null-terminated format string.\r
IN UINTN Size\r
)\r
{\r
- BASE_LIST BaseListStart;\r
- BOOLEAN Long;\r
+ BASE_LIST BaseListStart;\r
+ BOOLEAN Long;\r
\r
ASSERT (Format != NULL);\r
\r
\r
BaseListStart = BaseListMarker;\r
\r
- for (; *Format != '\0'; Format++) {\r
+ for ( ; *Format != '\0'; Format++) {\r
//\r
// Only format with prefix % is processed.\r
//\r
// Parse Flags and Width\r
//\r
for (Format++; TRUE; Format++) {\r
- if (*Format == '.' || *Format == '-' || *Format == '+' || *Format == ' ') {\r
+ if ((*Format == '.') || (*Format == '-') || (*Format == '+') || (*Format == ' ')) {\r
//\r
// These characters in format field are omitted.\r
//\r
continue;\r
}\r
- if (*Format >= '0' && *Format <= '9') {\r
+\r
+ if ((*Format >= '0') && (*Format <= '9')) {\r
//\r
// These characters in format field are omitted.\r
//\r
continue;\r
}\r
- if (*Format == 'L' || *Format == 'l') {\r
+\r
+ if ((*Format == 'L') || (*Format == 'l')) {\r
//\r
// 'L" or "l" in format field means the number being printed is a UINT64\r
//\r
Long = TRUE;\r
continue;\r
}\r
+\r
if (*Format == '*') {\r
//\r
// '*' in format field means the precision of the field is specified by\r
BASE_ARG (BaseListMarker, UINTN) = VA_ARG (VaListMarker, UINTN);\r
continue;\r
}\r
+\r
if (*Format == '\0') {\r
//\r
// Make no output if Format string terminates unexpectedly when\r
//\r
Format--;\r
}\r
+\r
//\r
// When valid argument type detected or format string terminates unexpectedly,\r
// the inner loop is done.\r
if ((*Format == 'p') && (sizeof (VOID *) > 4)) {\r
Long = TRUE;\r
}\r
- if (*Format == 'p' || *Format == 'X' || *Format == 'x' || *Format == 'd' || *Format == 'u') {\r
+\r
+ if ((*Format == 'p') || (*Format == 'X') || (*Format == 'x') || (*Format == 'd') || (*Format == 'u')) {\r
if (Long) {\r
BASE_ARG (BaseListMarker, INT64) = VA_ARG (VaListMarker, INT64);\r
} else {\r
BASE_ARG (BaseListMarker, int) = VA_ARG (VaListMarker, int);\r
}\r
- } else if (*Format == 's' || *Format == 'S' || *Format == 'a' || *Format == 'g' || *Format == 't') {\r
+ } else if ((*Format == 's') || (*Format == 'S') || (*Format == 'a') || (*Format == 'g') || (*Format == 't')) {\r
BASE_ARG (BaseListMarker, VOID *) = VA_ARG (VaListMarker, VOID *);\r
} else if (*Format == 'c') {\r
BASE_ARG (BaseListMarker, UINTN) = VA_ARG (VaListMarker, UINTN);\r
return TRUE;\r
}\r
\r
-\r
/**\r
Prints a debug message to the debug output device if the specified\r
error level is enabled.\r
VOID\r
EFIAPI\r
DebugVPrint (\r
- IN UINTN ErrorLevel,\r
- IN CONST CHAR8 *Format,\r
- IN VA_LIST VaListMarker\r
+ IN UINTN ErrorLevel,\r
+ IN CONST CHAR8 *Format,\r
+ IN VA_LIST VaListMarker\r
)\r
{\r
- UINT64 BaseListMarker[256 / sizeof (UINT64)];\r
- BOOLEAN Converted;\r
+ UINT64 BaseListMarker[256 / sizeof (UINT64)];\r
+ BOOLEAN Converted;\r
\r
//\r
// Convert the VaList to BaseList\r
DebugBPrint (ErrorLevel, Format, (BASE_LIST)BaseListMarker);\r
}\r
\r
-\r
/**\r
Prints an assert message containing a filename, line number, and description.\r
This may be followed by a breakpoint or a dead loop.\r
IN CONST CHAR8 *Description\r
)\r
{\r
- EFI_STATUS Status;\r
- EDKII_DEBUG_PPI *DebugPpi;\r
+ EFI_STATUS Status;\r
+ EDKII_DEBUG_PPI *DebugPpi;\r
\r
Status = PeiServicesLocatePpi (\r
- &gEdkiiDebugPpiGuid,\r
- 0,\r
- NULL,\r
- (VOID **)&DebugPpi\r
- );\r
+ &gEdkiiDebugPpiGuid,\r
+ 0,\r
+ NULL,\r
+ (VOID **)&DebugPpi\r
+ );\r
if (EFI_ERROR (Status)) {\r
//\r
// Generate a Breakpoint, DeadLoop, or NOP based on PCD settings\r
}\r
}\r
\r
-\r
/**\r
Fills a target buffer with PcdDebugClearMemoryValue, and returns the target buffer.\r
\r
return SetMem (Buffer, Length, PcdGet8 (PcdDebugClearMemoryValue));\r
}\r
\r
-\r
/**\r
Returns TRUE if ASSERT() macros are enabled.\r
\r
VOID\r
)\r
{\r
- return (BOOLEAN) ((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED) != 0);\r
+ return (BOOLEAN)((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED) != 0);\r
}\r
\r
-\r
/**\r
Returns TRUE if DEBUG() macros are enabled.\r
\r
VOID\r
)\r
{\r
- return (BOOLEAN) ((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_PRINT_ENABLED) != 0);\r
+ return (BOOLEAN)((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_PRINT_ENABLED) != 0);\r
}\r
\r
-\r
/**\r
Returns TRUE if DEBUG_CODE() macros are enabled.\r
\r
VOID\r
)\r
{\r
- return (BOOLEAN) ((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_CODE_ENABLED) != 0);\r
+ return (BOOLEAN)((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_CODE_ENABLED) != 0);\r
}\r
\r
-\r
/**\r
Returns TRUE if DEBUG_CLEAR_MEMORY() macro is enabled.\r
\r
VOID\r
)\r
{\r
- return (BOOLEAN) ((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED) != 0);\r
+ return (BOOLEAN)((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED) != 0);\r
}\r
\r
-\r
/**\r
Returns TRUE if any one of the bit is set both in ErrorLevel and PcdFixedDebugPrintErrorLevel.\r
\r
BOOLEAN\r
EFIAPI\r
DebugPrintLevelEnabled (\r
- IN CONST UINTN ErrorLevel\r
+ IN CONST UINTN ErrorLevel\r
)\r
{\r
- return (BOOLEAN) ((ErrorLevel & PcdGet32(PcdFixedDebugPrintErrorLevel)) != 0);\r
+ return (BOOLEAN)((ErrorLevel & PcdGet32 (PcdFixedDebugPrintErrorLevel)) != 0);\r
}\r
-\r