2 NULL Library class that reads Debug Mask variable and if it exists makes a
3 HOB that contains the debug mask.
5 Copyright (c) 2011, Apple, Inc. All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
12 #include <Library/HobLib.h>
13 #include <Library/DebugLib.h>
14 #include <Library/PeiServicesLib.h>
16 #include <Ppi/ReadOnlyVariable2.h>
17 #include <Guid/DebugMask.h>
21 The constructor reads variable and sets HOB
23 @param FileHandle The handle of FFS header the loaded driver.
24 @param PeiServices The pointer to the PEI services.
26 @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.
31 PeiDebugPrintHobLibConstructor (
32 IN EFI_PEI_FILE_HANDLE FileHandle
,
33 IN CONST EFI_PEI_SERVICES
**PeiServices
37 EFI_PEI_READ_ONLY_VARIABLE2_PPI
*Variable
;
39 UINT64 GlobalErrorLevel
;
42 Status
= PeiServicesLocatePpi (
43 &gEfiPeiReadOnlyVariable2PpiGuid
,
48 if (!EFI_ERROR (Status
)) {
49 Size
= sizeof (GlobalErrorLevel
);
50 Status
= Variable
->GetVariable (
52 DEBUG_MASK_VARIABLE_NAME
,
53 &gEfiGenericVariableGuid
,
58 if (!EFI_ERROR (Status
)) {
60 // Build the GUID'ed HOB for DXE
62 HobErrorLevel
= (UINT32
)GlobalErrorLevel
;
64 &gEfiGenericVariableGuid
,
66 sizeof (HobErrorLevel
)