/** @file\r
- Debug Print Error Level library instance that provide compatibility with the \r
+ Debug Print Error Level library instance that provide compatibility with the\r
"err" shell command. This includes support for the Debug Mask Protocol\r
supports for global debug print error level mask stored in an EFI Variable.\r
This library instance only support DXE Phase modules.\r
\r
- Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>\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
+ Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>\r
+ SPDX-License-Identifier: BSD-2-Clause-Patent\r
\r
**/\r
\r
it in CurrentDebugMask.\r
\r
@param This The protocol instance pointer.\r
- @param CurrentDebugMask Pointer to the debug print error level mask that \r
+ @param CurrentDebugMask Pointer to the debug print error level mask that\r
is returned.\r
\r
@retval EFI_SUCCESS The current debug print error level mask was\r
EFI_STATUS\r
EFIAPI\r
GetDebugMask (\r
- IN EFI_DEBUG_MASK_PROTOCOL *This, \r
- IN OUT UINTN *CurrentDebugMask \r
+ IN EFI_DEBUG_MASK_PROTOCOL *This,\r
+ IN OUT UINTN *CurrentDebugMask\r
);\r
\r
/**\r
};\r
\r
///\r
-/// Global variable that is set to TRUE after the first attempt is made to \r
+/// Global variable that is set to TRUE after the first attempt is made to\r
/// retrieve the global error level mask through the EFI Varibale Services.\r
/// This variable prevents the EFI Variable Services from being called fort\r
/// every DEBUG() macro.\r
///\r
-BOOLEAN mGlobalErrorLevelInitialized = FALSE;\r
+BOOLEAN mGlobalErrorLevelInitialized = FALSE;\r
\r
///\r
/// Global variable that contains the current debug error level mask for the\r
/// module that is using this library instance. This variable is initially\r
/// set to the PcdDebugPrintErrorLevel value. If the EFI Variable exists that\r
/// contains the global debug print error level mask, then that overrides the\r
-/// PcdDebugPrintErrorLevel value. The EFI Variable can optionally be \r
+/// PcdDebugPrintErrorLevel value. The EFI Variable can optionally be\r
/// discovered via a HOB so early DXE drivers can access the variable. If the\r
-/// Debug Mask Protocol SetDebugMask() service is called, then that overrides \r
+/// Debug Mask Protocol SetDebugMask() service is called, then that overrides\r
/// the PcdDebugPrintErrorLevel and the EFI Variable setting.\r
///\r
-UINT32 mDebugPrintErrorLevel = 0;\r
+UINT32 mDebugPrintErrorLevel = 0;\r
\r
///\r
/// Global variable that is used to cache a pointer to the EFI System Table\r
/// the global debug print error level mask value. The UefiBootServicesTableLib\r
/// is not used to prevent a circular dependency between these libraries.\r
///\r
-EFI_SYSTEM_TABLE *mSystemTable = NULL;\r
+EFI_SYSTEM_TABLE *mSystemTable = NULL;\r
\r
/**\r
- The constructor function caches the PCI Express Base Address and creates a \r
+ The constructor function caches the PCI Express Base Address and creates a\r
Set Virtual Address Map event to convert physical address to virtual addresses.\r
- \r
+\r
@param ImageHandle The firmware allocated handle for the EFI image.\r
@param SystemTable A pointer to the EFI System Table.\r
- \r
+\r
@retval EFI_SUCCESS The constructor completed successfully.\r
@retval Other value The constructor did not complete successfully.\r
\r
IN EFI_SYSTEM_TABLE *SystemTable\r
)\r
{\r
- EFI_STATUS Status;\r
- \r
+ EFI_STATUS Status;\r
+\r
//\r
// Initialize the error level mask from PCD setting.\r
//\r
mDebugPrintErrorLevel = PcdGet32 (PcdDebugPrintErrorLevel);\r
- \r
+\r
//\r
// Install Debug Mask Protocol onto ImageHandle\r
- // \r
+ //\r
mSystemTable = SystemTable;\r
- Status = SystemTable->BootServices->InstallMultipleProtocolInterfaces (\r
- &ImageHandle,\r
- &gEfiDebugMaskProtocolGuid, &mDebugMaskProtocol,\r
- NULL\r
- );\r
+ Status = SystemTable->BootServices->InstallMultipleProtocolInterfaces (\r
+ &ImageHandle,\r
+ &gEfiDebugMaskProtocolGuid,\r
+ &mDebugMaskProtocol,\r
+ NULL\r
+ );\r
\r
//\r
// Attempt to retrieve the global debug print error level mask from the EFI Variable\r
// If the EFI Variable can not be accessed when this module's library constructors are\r
- // executed a HOB can be used to set the global debug print error level. If no value \r
+ // executed a HOB can be used to set the global debug print error level. If no value\r
// was found then the EFI Variable access will be reattempted on every DEBUG() print\r
// from this module until the EFI Variable services are available.\r
//\r
GetDebugPrintErrorLevel ();\r
- \r
+\r
return Status;\r
}\r
\r
/**\r
- The destructor function frees any allocated buffers and closes the Set Virtual \r
+ The destructor function frees any allocated buffers and closes the Set Virtual\r
Address Map event.\r
- \r
+\r
@param ImageHandle The firmware allocated handle for the EFI image.\r
@param SystemTable A pointer to the EFI System Table.\r
- \r
+\r
@retval EFI_SUCCESS The destructor completed successfully.\r
@retval Other value The destructor did not complete successfully.\r
\r
{\r
//\r
// Uninstall the Debug Mask Protocol from ImageHandle\r
- // \r
+ //\r
return SystemTable->BootServices->UninstallMultipleProtocolInterfaces (\r
ImageHandle,\r
- &gEfiDebugMaskProtocolGuid, &mDebugMaskProtocol,\r
+ &gEfiDebugMaskProtocolGuid,\r
+ &mDebugMaskProtocol,\r
NULL\r
);\r
}\r
if (mSystemTable == NULL) {\r
return PcdGet32 (PcdDebugPrintErrorLevel);\r
}\r
- \r
+\r
//\r
- // Check to see if an attempt has been made to retrieve the global debug print \r
+ // Check to see if an attempt has been made to retrieve the global debug print\r
// error level mask. Since this library instance stores the global debug print\r
// error level mask in an EFI Variable, the EFI Variable should only be accessed\r
// once to reduce the overhead of reading the EFI Variable on every debug print\r
- // \r
+ //\r
if (!mGlobalErrorLevelInitialized) {\r
//\r
// Make sure the TPL Level is low enough for EFI Variable Services to be called\r
mSystemTable->BootServices->RestoreTPL (CurrentTpl);\r
if (CurrentTpl <= TPL_CALLBACK) {\r
//\r
- // Attempt to retrieve the global debug print error level mask from the \r
+ // Attempt to retrieve the global debug print error level mask from the\r
// EFI Variable\r
//\r
- Size = sizeof (GlobalErrorLevel);\r
+ Size = sizeof (GlobalErrorLevel);\r
Status = mSystemTable->RuntimeServices->GetVariable (\r
- DEBUG_MASK_VARIABLE_NAME, \r
- &gEfiGenericVariableGuid, \r
- NULL, \r
- &Size, \r
- &GlobalErrorLevel\r
- );\r
+ DEBUG_MASK_VARIABLE_NAME,\r
+ &gEfiGenericVariableGuid,\r
+ NULL,\r
+ &Size,\r
+ &GlobalErrorLevel\r
+ );\r
if (Status != EFI_NOT_AVAILABLE_YET) {\r
//\r
// If EFI Variable Services are available, then set a flag so the EFI\r
Hob = GetFirstGuidHob (&gEfiGenericVariableGuid);\r
if (Hob != NULL) {\r
if (GET_GUID_HOB_DATA_SIZE (Hob) == sizeof (UINT32)) {\r
- mDebugPrintErrorLevel = *(UINT32 *)GET_GUID_HOB_DATA (Hob);\r
+ mDebugPrintErrorLevel = *(UINT32 *)GET_GUID_HOB_DATA (Hob);\r
mGlobalErrorLevelInitialized = TRUE;\r
}\r
}\r
\r
/**\r
Sets the global debug print error level mask fpr the entire platform.\r
- \r
+\r
@param ErrorLevel Global debug print error level\r
- \r
+\r
@retval TRUE The debug print error level mask was sucessfully set.\r
@retval FALSE The debug print error level mask could not be set.\r
\r
// Attempt to store the global debug print error level mask in an EFI Variable\r
//\r
GlobalErrorLevel = (UINTN)ErrorLevel;\r
- Size = sizeof (GlobalErrorLevel);\r
- Status = mSystemTable->RuntimeServices->SetVariable (\r
- DEBUG_MASK_VARIABLE_NAME, \r
- &gEfiGenericVariableGuid, \r
- (EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS),\r
- Size,\r
- &GlobalErrorLevel\r
- );\r
+ Size = sizeof (GlobalErrorLevel);\r
+ Status = mSystemTable->RuntimeServices->SetVariable (\r
+ DEBUG_MASK_VARIABLE_NAME,\r
+ &gEfiGenericVariableGuid,\r
+ (EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS),\r
+ Size,\r
+ &GlobalErrorLevel\r
+ );\r
if (!EFI_ERROR (Status)) {\r
//\r
- // If the EFI Variable was updated, then update the mask value for this \r
+ // If the EFI Variable was updated, then update the mask value for this\r
// module and return TRUE.\r
//\r
- mGlobalErrorLevelInitialized = TRUE; \r
- mDebugPrintErrorLevel = ErrorLevel;\r
+ mGlobalErrorLevelInitialized = TRUE;\r
+ mDebugPrintErrorLevel = ErrorLevel;\r
return TRUE;\r
}\r
}\r
}\r
+\r
//\r
// Return FALSE since the EFI Variable could not be updated.\r
//\r
it in CurrentDebugMask.\r
\r
@param This The protocol instance pointer.\r
- @param CurrentDebugMask Pointer to the debug print error level mask that \r
+ @param CurrentDebugMask Pointer to the debug print error level mask that\r
is returned.\r
\r
@retval EFI_SUCCESS The current debug print error level mask was\r
EFI_STATUS\r
EFIAPI\r
GetDebugMask (\r
- IN EFI_DEBUG_MASK_PROTOCOL *This, \r
- IN OUT UINTN *CurrentDebugMask \r
+ IN EFI_DEBUG_MASK_PROTOCOL *This,\r
+ IN OUT UINTN *CurrentDebugMask\r
)\r
{\r
if (CurrentDebugMask == NULL) {\r
return EFI_INVALID_PARAMETER;\r
}\r
- \r
+\r
//\r
// Retrieve the current debug mask from mDebugPrintErrorLevel\r
//\r