]>
Commit | Line | Data |
---|---|---|
d4a78455 | 1 | /** @file\r |
2 | NULL Library class that reads Debug Mask variable and if it exists makes a\r | |
3 | HOB that contains the debug mask.\r | |
4 | \r | |
5 | Copyright (c) 2011, Apple, Inc. All rights reserved.<BR>\r | |
6 | This program and the accompanying materials\r | |
7 | are licensed and made available under the terms and conditions of the BSD License\r | |
8 | which accompanies this distribution. The full text of the license may be found at\r | |
9 | http://opensource.org/licenses/bsd-license.php\r | |
10 | \r | |
11 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
12 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
13 | \r | |
14 | **/\r | |
15 | \r | |
16 | #include <PiPei.h>\r | |
17 | \r | |
18 | #include <Library/HobLib.h>\r | |
19 | #include <Library/DebugLib.h>\r | |
20 | #include <Library/PeiServicesLib.h>\r | |
21 | \r | |
22 | #include <Ppi/ReadOnlyVariable2.h>\r | |
23 | #include <Guid/DebugMask.h>\r | |
24 | \r | |
25 | \r | |
26 | /**\r | |
27 | The constructor reads variable and sets HOB\r | |
28 | \r | |
29 | @param FileHandle The handle of FFS header the loaded driver.\r | |
30 | @param PeiServices The pointer to the PEI services.\r | |
31 | \r | |
32 | @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.\r | |
33 | \r | |
34 | **/\r | |
35 | EFI_STATUS\r | |
36 | EFIAPI\r | |
37 | PeiDebugPrintHobLibConstructor (\r | |
38 | IN EFI_PEI_FILE_HANDLE FileHandle,\r | |
39 | IN CONST EFI_PEI_SERVICES **PeiServices\r | |
40 | )\r | |
41 | {\r | |
42 | EFI_STATUS Status;\r | |
43 | EFI_PEI_READ_ONLY_VARIABLE2_PPI *Variable;\r | |
44 | UINTN Size;\r | |
45 | UINT64 GlobalErrorLevel;\r | |
46 | UINT32 HobErrorLevel;\r | |
47 | \r | |
48 | Status = PeiServicesLocatePpi (\r | |
49 | &gEfiPeiReadOnlyVariable2PpiGuid,\r | |
50 | 0,\r | |
51 | NULL,\r | |
52 | (VOID **)&Variable\r | |
53 | );\r | |
54 | if (!EFI_ERROR (Status)) {\r | |
55 | Size = sizeof (GlobalErrorLevel);\r | |
56 | Status = Variable->GetVariable ( \r | |
57 | Variable, \r | |
58 | DEBUG_MASK_VARIABLE_NAME,\r | |
59 | &gEfiGenericVariableGuid,\r | |
60 | NULL,\r | |
61 | &Size,\r | |
62 | &GlobalErrorLevel\r | |
63 | );\r | |
64 | if (!EFI_ERROR (Status)) {\r | |
65 | //\r | |
66 | // Build the GUID'ed HOB for DXE\r | |
67 | //\r | |
68 | HobErrorLevel = (UINT32)GlobalErrorLevel;\r | |
69 | BuildGuidDataHob (\r | |
70 | &gEfiGenericVariableGuid,\r | |
71 | &HobErrorLevel,\r | |
72 | sizeof (HobErrorLevel)\r | |
73 | );\r | |
74 | }\r | |
75 | }\r | |
76 | \r | |
77 | return EFI_SUCCESS;\r | |
78 | }\r |