summaryrefslogtreecommitdiffstats
path: root/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Library/PeiDebugPrintHobLib
diff options
context:
space:
mode:
Diffstat (limited to 'src/VBox/Devices/EFI/Firmware/MdeModulePkg/Library/PeiDebugPrintHobLib')
-rw-r--r--src/VBox/Devices/EFI/Firmware/MdeModulePkg/Library/PeiDebugPrintHobLib/PeiDebugPrintHobLib.c72
-rw-r--r--src/VBox/Devices/EFI/Firmware/MdeModulePkg/Library/PeiDebugPrintHobLib/PeiDebugPrintHobLib.inf45
-rw-r--r--src/VBox/Devices/EFI/Firmware/MdeModulePkg/Library/PeiDebugPrintHobLib/PeiDebugPrintHobLib.uni17
3 files changed, 134 insertions, 0 deletions
diff --git a/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Library/PeiDebugPrintHobLib/PeiDebugPrintHobLib.c b/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Library/PeiDebugPrintHobLib/PeiDebugPrintHobLib.c
new file mode 100644
index 00000000..847b1674
--- /dev/null
+++ b/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Library/PeiDebugPrintHobLib/PeiDebugPrintHobLib.c
@@ -0,0 +1,72 @@
+/** @file
+ NULL Library class that reads Debug Mask variable and if it exists makes a
+ HOB that contains the debug mask.
+
+ Copyright (c) 2011, Apple, Inc. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <PiPei.h>
+
+#include <Library/HobLib.h>
+#include <Library/DebugLib.h>
+#include <Library/PeiServicesLib.h>
+
+#include <Ppi/ReadOnlyVariable2.h>
+#include <Guid/DebugMask.h>
+
+
+/**
+ The constructor reads variable and sets HOB
+
+ @param FileHandle The handle of FFS header the loaded driver.
+ @param PeiServices The pointer to the PEI services.
+
+ @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.
+
+**/
+EFI_STATUS
+EFIAPI
+PeiDebugPrintHobLibConstructor (
+ IN EFI_PEI_FILE_HANDLE FileHandle,
+ IN CONST EFI_PEI_SERVICES **PeiServices
+ )
+{
+ EFI_STATUS Status;
+ EFI_PEI_READ_ONLY_VARIABLE2_PPI *Variable;
+ UINTN Size;
+ UINT64 GlobalErrorLevel;
+ UINT32 HobErrorLevel;
+
+ Status = PeiServicesLocatePpi (
+ &gEfiPeiReadOnlyVariable2PpiGuid,
+ 0,
+ NULL,
+ (VOID **)&Variable
+ );
+ if (!EFI_ERROR (Status)) {
+ Size = sizeof (GlobalErrorLevel);
+ Status = Variable->GetVariable (
+ Variable,
+ DEBUG_MASK_VARIABLE_NAME,
+ &gEfiGenericVariableGuid,
+ NULL,
+ &Size,
+ &GlobalErrorLevel
+ );
+ if (!EFI_ERROR (Status)) {
+ //
+ // Build the GUID'ed HOB for DXE
+ //
+ HobErrorLevel = (UINT32)GlobalErrorLevel;
+ BuildGuidDataHob (
+ &gEfiGenericVariableGuid,
+ &HobErrorLevel,
+ sizeof (HobErrorLevel)
+ );
+ }
+ }
+
+ return EFI_SUCCESS;
+}
diff --git a/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Library/PeiDebugPrintHobLib/PeiDebugPrintHobLib.inf b/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Library/PeiDebugPrintHobLib/PeiDebugPrintHobLib.inf
new file mode 100644
index 00000000..63c9411b
--- /dev/null
+++ b/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Library/PeiDebugPrintHobLib/PeiDebugPrintHobLib.inf
@@ -0,0 +1,45 @@
+## @file
+# NULL Library class that reads Debug Mask variable and if it exists makes a
+# HOB that contains the debug mask.
+#
+# Copyright (c) 2011, Apple, Inc. All rights reserved.<BR>
+# Copyright (c) 2012 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+#
+##
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = PeiDebugPrintHobLib
+ MODULE_UNI_FILE = PeiDebugPrintHobLib.uni
+ FILE_GUID = EB0BDD73-DABB-E74B-BF51-62DC1DA521E1
+ MODULE_TYPE = PEIM
+ VERSION_STRING = 1.0
+ LIBRARY_CLASS = NULL|PEIM
+ CONSTRUCTOR = PeiDebugPrintHobLibConstructor
+
+
+[Sources]
+ PeiDebugPrintHobLib.c
+
+
+[Packages]
+ MdePkg/MdePkg.dec
+ MdeModulePkg/MdeModulePkg.dec
+
+[LibraryClasses]
+ PeiServicesLib
+ DebugLib
+
+[Ppis]
+ gEfiPeiReadOnlyVariable2PpiGuid ## CONSUMES
+
+[Guids]
+ ## SOMETIMES_CONSUMES ## Variable:L"EFIDebug"
+ ## SOMETIMES_PRODUCES ## HOB
+ gEfiGenericVariableGuid
+
+[Depex]
+ gEfiPeiReadOnlyVariable2PpiGuid
diff --git a/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Library/PeiDebugPrintHobLib/PeiDebugPrintHobLib.uni b/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Library/PeiDebugPrintHobLib/PeiDebugPrintHobLib.uni
new file mode 100644
index 00000000..bdc221b7
--- /dev/null
+++ b/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Library/PeiDebugPrintHobLib/PeiDebugPrintHobLib.uni
@@ -0,0 +1,17 @@
+// /** @file
+// NULL Library class that reads Debug Mask variable and if it exists makes a
+//
+// HOB that contains the debug mask.
+//
+// Copyright (c) 2011, Apple, Inc. All rights reserved.<BR>
+// Copyright (c) 2012 - 2014, Intel Corporation. All rights reserved.<BR>
+//
+// SPDX-License-Identifier: BSD-2-Clause-Patent
+//
+// **/
+
+
+#string STR_MODULE_ABSTRACT #language en-US "Reads Debug Mask variable and if it exists makes a HOB that contains the debug mask"
+
+#string STR_MODULE_DESCRIPTION #language en-US "NULL Library class that reads Debug Mask variable and if it exists makes a HOB that contains the debug mask."
+