TianoCore EDK2 master
Loading...
Searching...
No Matches
DxeDebugPrintErrorLevelLib.c File Reference
#include <PiDxe.h>
#include <Library/DebugPrintErrorLevelLib.h>
#include <Library/PcdLib.h>
#include <Library/HobLib.h>
#include <Guid/DebugMask.h>

Go to the source code of this file.

Functions

EFI_STATUS EFIAPI GetDebugMask (IN EFI_DEBUG_MASK_PROTOCOL *This, IN OUT UINTN *CurrentDebugMask)
 
EFI_STATUS EFIAPI SetDebugMask (IN EFI_DEBUG_MASK_PROTOCOL *This, IN UINTN NewDebugMask)
 
EFI_STATUS EFIAPI DxeDebugPrintErrorLevelLibConstructor (IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
 
EFI_STATUS EFIAPI DxeDebugPrintErrorLevelLibDestructor (IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
 
UINT32 EFIAPI GetDebugPrintErrorLevel (VOID)
 
BOOLEAN EFIAPI SetDebugPrintErrorLevel (UINT32 ErrorLevel)
 

Variables

EFI_DEBUG_MASK_PROTOCOL mDebugMaskProtocol
 
BOOLEAN mGlobalErrorLevelInitialized = FALSE
 
UINT32 mDebugPrintErrorLevel = 0
 
EFI_SYSTEM_TABLEmSystemTable = NULL
 

Detailed Description

Debug Print Error Level library instance that provide compatibility with the "err" shell command. This includes support for the Debug Mask Protocol supports for global debug print error level mask stored in an EFI Variable. This library instance only support DXE Phase modules.

Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file DxeDebugPrintErrorLevelLib.c.

Function Documentation

◆ DxeDebugPrintErrorLevelLibConstructor()

EFI_STATUS EFIAPI DxeDebugPrintErrorLevelLibConstructor ( IN EFI_HANDLE  ImageHandle,
IN EFI_SYSTEM_TABLE SystemTable 
)

The constructor function caches the PCI Express Base Address and creates a Set Virtual Address Map event to convert physical address to virtual addresses.

Parameters
ImageHandleThe firmware allocated handle for the EFI image.
SystemTableA pointer to the EFI System Table.
Return values
EFI_SUCCESSThe constructor completed successfully.
Othervalue The constructor did not complete successfully.

Definition at line 116 of file DxeDebugPrintErrorLevelLib.c.

◆ DxeDebugPrintErrorLevelLibDestructor()

EFI_STATUS EFIAPI DxeDebugPrintErrorLevelLibDestructor ( IN EFI_HANDLE  ImageHandle,
IN EFI_SYSTEM_TABLE SystemTable 
)

The destructor function frees any allocated buffers and closes the Set Virtual Address Map event.

Parameters
ImageHandleThe firmware allocated handle for the EFI image.
SystemTableA pointer to the EFI System Table.
Return values
EFI_SUCCESSThe destructor completed successfully.
Othervalue The destructor did not complete successfully.

Definition at line 164 of file DxeDebugPrintErrorLevelLib.c.

◆ GetDebugMask()

EFI_STATUS EFIAPI GetDebugMask ( IN EFI_DEBUG_MASK_PROTOCOL This,
IN OUT UINTN CurrentDebugMask 
)

Debug Mask Protocol function prototypes Retrieves the current debug print error level mask for a module are returns it in CurrentDebugMask.

Parameters
ThisThe protocol instance pointer.
CurrentDebugMaskPointer to the debug print error level mask that is returned.
Return values
EFI_SUCCESSThe current debug print error level mask was returned in CurrentDebugMask.
EFI_INVALID_PARAMETERCurrentDebugMask is NULL.
EFI_DEVICE_ERRORThe current debug print error level mask could not be retrieved.

Retrieves the current debug print error level mask for a module are returns it in CurrentDebugMask.

Parameters
ThisThe protocol instance pointer.
CurrentDebugMaskPointer to the debug print error level mask that is returned.
Return values
EFI_SUCCESSThe current debug print error level mask was returned in CurrentDebugMask.
EFI_INVALID_PARAMETERCurrentDebugMask is NULL.
EFI_DEVICE_ERRORThe current debug print error level mask could not be retrieved.

Definition at line 344 of file DxeDebugPrintErrorLevelLib.c.

◆ GetDebugPrintErrorLevel()

UINT32 EFIAPI GetDebugPrintErrorLevel ( VOID  )

Returns the debug print error level mask for the current module.

Returns
Debug print error level mask for the current module.

Definition at line 188 of file DxeDebugPrintErrorLevelLib.c.

◆ SetDebugMask()

EFI_STATUS EFIAPI SetDebugMask ( IN EFI_DEBUG_MASK_PROTOCOL This,
IN UINTN  NewDebugMask 
)

Sets the current debug print error level mask for a module to the value specified by NewDebugMask.

Parameters
ThisThe protocol instance pointer.
NewDebugMaskThe new debug print error level mask for this module.
Return values
EFI_SUCCESSThe current debug print error level mask was set to the value specified by NewDebugMask.
EFI_DEVICE_ERRORThe current debug print error level mask could not be set to the value specified by NewDebugMask.

Definition at line 375 of file DxeDebugPrintErrorLevelLib.c.

◆ SetDebugPrintErrorLevel()

BOOLEAN EFIAPI SetDebugPrintErrorLevel ( UINT32  ErrorLevel)

Sets the global debug print error level mask fpr the entire platform.

Parameters
ErrorLevelGlobal debug print error level
Return values
TRUEThe debug print error level mask was sucessfully set.
FALSEThe debug print error level mask could not be set.

Definition at line 278 of file DxeDebugPrintErrorLevelLib.c.

Variable Documentation

◆ mDebugMaskProtocol

EFI_DEBUG_MASK_PROTOCOL mDebugMaskProtocol
Initial value:
= {
EFI_DEBUG_MASK_REVISION,
}
EFI_STATUS EFIAPI GetDebugMask(IN EFI_DEBUG_MASK_PROTOCOL *This, IN OUT UINTN *CurrentDebugMask)
EFI_STATUS EFIAPI SetDebugMask(IN EFI_DEBUG_MASK_PROTOCOL *This, IN UINTN NewDebugMask)

Debug Mask Protocol instance

Definition at line 69 of file DxeDebugPrintErrorLevelLib.c.

◆ mDebugPrintErrorLevel

UINT32 mDebugPrintErrorLevel = 0

Global variable that contains the current debug error level mask for the module that is using this library instance. This variable is initially set to the PcdDebugPrintErrorLevel value. If the EFI Variable exists that contains the global debug print error level mask, then that overrides the PcdDebugPrintErrorLevel value. The EFI Variable can optionally be discovered via a HOB so early DXE drivers can access the variable. If the Debug Mask Protocol SetDebugMask() service is called, then that overrides the PcdDebugPrintErrorLevel and the EFI Variable setting.

Definition at line 93 of file DxeDebugPrintErrorLevelLib.c.

◆ mGlobalErrorLevelInitialized

BOOLEAN mGlobalErrorLevelInitialized = FALSE

Global variable that is set to TRUE after the first attempt is made to retrieve the global error level mask through the EFI Varibale Services. This variable prevents the EFI Variable Services from being called fort every DEBUG() macro.

Definition at line 81 of file DxeDebugPrintErrorLevelLib.c.

◆ mSystemTable

EFI_SYSTEM_TABLE* mSystemTable = NULL

Global variable that is used to cache a pointer to the EFI System Table that is required to access the EFI Variable Services to get and set the global debug print error level mask value. The UefiBootServicesTableLib is not used to prevent a circular dependency between these libraries.

Definition at line 101 of file DxeDebugPrintErrorLevelLib.c.