summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg/Library/DxeDebugPrintErrorLevelLib
diff options
context:
space:
mode:
authorandrewfish <andrewfish@6f19259b-4bc3-4df7-8a09-765794883524>2011-10-08 21:00:13 +0000
committerandrewfish <andrewfish@6f19259b-4bc3-4df7-8a09-765794883524>2011-10-08 21:00:13 +0000
commitd4a78455c6b0d9bd931ea459190e1de3beee70df (patch)
treecb567ea9f11dd48ef87b3c583dc2aff5e3e8ffb6 /MdeModulePkg/Library/DxeDebugPrintErrorLevelLib
parentf2a4d59359499e63bddab4b14d029a92c8b5a418 (diff)
downloadedk2-d4a78455c6b0d9bd931ea459190e1de3beee70df.tar.gz
edk2-d4a78455c6b0d9bd931ea459190e1de3beee70df.tar.bz2
edk2-d4a78455c6b0d9bd931ea459190e1de3beee70df.zip
Add a GUIDed HOB to init Debug Print error level earlier in DXE. Add NULL PEIM library to init HOB.
Debug Print Error level can be controled by an EFI variable. Update the DXE version of the library to use a HOB if the variable services are not yet availilbe. This allows the variable to be used early in the DXE phase. approved-by: andrewfish reviewed-by: lgao4 git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12516 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Library/DxeDebugPrintErrorLevelLib')
-rw-r--r--MdeModulePkg/Library/DxeDebugPrintErrorLevelLib/DxeDebugPrintErrorLevelLib.c38
-rw-r--r--MdeModulePkg/Library/DxeDebugPrintErrorLevelLib/DxeDebugPrintErrorLevelLib.inf1
2 files changed, 28 insertions, 11 deletions
diff --git a/MdeModulePkg/Library/DxeDebugPrintErrorLevelLib/DxeDebugPrintErrorLevelLib.c b/MdeModulePkg/Library/DxeDebugPrintErrorLevelLib/DxeDebugPrintErrorLevelLib.c
index 1182e2eb5b..cad57024cd 100644
--- a/MdeModulePkg/Library/DxeDebugPrintErrorLevelLib/DxeDebugPrintErrorLevelLib.c
+++ b/MdeModulePkg/Library/DxeDebugPrintErrorLevelLib/DxeDebugPrintErrorLevelLib.c
@@ -19,6 +19,7 @@
#include <Library/DebugPrintErrorLevelLib.h>
#include <Library/PcdLib.h>
+#include <Library/HobLib.h>
#include <Guid/DebugMask.h>
@@ -89,10 +90,11 @@ BOOLEAN mGlobalErrorLevelInitialized = FALSE;
/// 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 override the
-/// PcdDebugPrintErrorLevel value. If the Debug Mask Protocol SetDebugMask()
-/// service is called, then that overrides bit the PcdDebugPrintErrorLevel and
-/// the EFI Variable setting.
+/// 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.
///
UINT32 mDebugPrintErrorLevel = 0;
@@ -122,13 +124,13 @@ DxeDebugPrintErrorLevelLibConstructor (
IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
-
+ EFI_STATUS Status;
+
//
// Initialize the error level mask from PCD setting.
//
mDebugPrintErrorLevel = PcdGet32 (PcdDebugPrintErrorLevel);
-
+
//
// Install Debug Mask Protocol onto ImageHandle
//
@@ -142,7 +144,8 @@ DxeDebugPrintErrorLevelLibConstructor (
//
// Attempt to retrieve the global debug print error level mask from the EFI Variable
// If the EFI Variable can not be accessed when this module's library constructors are
- // executed, then the EFI Variable access will be reattempted on every DEBUG() print
+ // executed a HOB can be used to set the global debug print error level. If no value
+ // was found then the EFI Variable access will be reattempted on every DEBUG() print
// from this module until the EFI Variable services are available.
//
GetDebugPrintErrorLevel ();
@@ -194,6 +197,7 @@ GetDebugPrintErrorLevel (
EFI_TPL CurrentTpl;
UINTN Size;
UINTN GlobalErrorLevel;
+ VOID *Hob;
//
// If the constructor has not been executed yet, then just return the PCD value.
@@ -203,10 +207,10 @@ GetDebugPrintErrorLevel (
if (mSystemTable == NULL) {
return PcdGet32 (PcdDebugPrintErrorLevel);
}
-
+
//
- // Check to see if an attempt has been mde to retrieve the global debug print
- // error level mask. Since this libtrary instance stores the global debug print
+ // Check to see if an attempt has been made to retrieve the global debug print
+ // error level mask. Since this library instance stores the global debug print
// error level mask in an EFI Variable, the EFI Variable should only be accessed
// once to reduce the overhead of reading the EFI Variable on every debug print
//
@@ -242,6 +246,18 @@ GetDebugPrintErrorLevel (
//
mDebugPrintErrorLevel = (UINT32)GlobalErrorLevel;
}
+ } else {
+ //
+ // If variable services are not yet availible optionally get the global
+ // debug print error level mask from a HOB.
+ //
+ Hob = GetFirstGuidHob (&gEfiGenericVariableGuid);
+ if (Hob != NULL) {
+ if (GET_GUID_HOB_DATA_SIZE (Hob) == sizeof (UINT32)) {
+ mDebugPrintErrorLevel = *(UINT32 *)GET_GUID_HOB_DATA (Hob);
+ mGlobalErrorLevelInitialized = TRUE;
+ }
+ }
}
}
}
diff --git a/MdeModulePkg/Library/DxeDebugPrintErrorLevelLib/DxeDebugPrintErrorLevelLib.inf b/MdeModulePkg/Library/DxeDebugPrintErrorLevelLib/DxeDebugPrintErrorLevelLib.inf
index a4a44b1c2e..65c0dc0034 100644
--- a/MdeModulePkg/Library/DxeDebugPrintErrorLevelLib/DxeDebugPrintErrorLevelLib.inf
+++ b/MdeModulePkg/Library/DxeDebugPrintErrorLevelLib/DxeDebugPrintErrorLevelLib.inf
@@ -39,6 +39,7 @@
[LibraryClasses]
PcdLib
+ HobLib
[Protocols]
gEfiDebugMaskProtocolGuid