]>
Commit | Line | Data |
---|---|---|
ad1a1798 | 1 | /** @file\r |
2 | Generic PeiStatusCode Module.\r | |
3 | \r | |
ececc2eb | 4 | Copyright (c) 2006, Intel Corporation\r |
5 | All rights reserved. This program and the accompanying materials\r | |
6 | are licensed and made available under the terms and conditions of the BSD License\r | |
7 | which accompanies this distribution. The full text of the license may be found at\r | |
8 | http://opensource.org/licenses/bsd-license.php\r | |
9 | \r | |
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
ad1a1798 | 12 | \r |
13 | Module Name: PeiStatusCode.c\r | |
14 | \r | |
15 | **/\r | |
16 | \r | |
ad1a1798 | 17 | #include "PeiStatusCode.h"\r |
18 | \r | |
ececc2eb | 19 | EFI_PEI_PROGRESS_CODE_PPI mStatusCodePpi = {\r |
ad1a1798 | 20 | ReportDispatcher\r |
21 | };\r | |
22 | \r | |
ad1a1798 | 23 | EFI_PEI_PPI_DESCRIPTOR mStatusCodePpiDescriptor = {\r |
24 | EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST,\r | |
25 | &gEfiPeiStatusCodePpiGuid,\r | |
26 | &mStatusCodePpi\r | |
27 | };\r | |
28 | \r | |
29 | /**\r | |
30 | Report status code to all supported device.\r | |
ececc2eb | 31 | \r |
32 | \r | |
ad1a1798 | 33 | @param PeiServices\r |
34 | \r | |
ececc2eb | 35 | @param CodeType Indicates the type of status code being reported.\r |
ad1a1798 | 36 | The type EFI_STATUS_CODE_TYPE is defined in "Related Definitions" below.\r |
ececc2eb | 37 | @param Value Describes the current status of a hardware or software entity.\r |
38 | This includes information about the class and subclass that is used to classify the entity\r | |
39 | as well as an operation. For progress codes, the operation is the current activity.\r | |
40 | For error codes, it is the exception. For debug codes, it is not defined at this time.\r | |
41 | Type EFI_STATUS_CODE_VALUE is defined in "Related Definitions" below.\r | |
ad1a1798 | 42 | Specific values are discussed in the Intel? Platform Innovation Framework for EFI Status Code Specification.\r |
ececc2eb | 43 | @param Instance The enumeration of a hardware or software entity within the system.\r |
44 | A system may contain multiple entities that match a class/subclass pairing.\r | |
45 | The instance differentiates between them. An instance of 0 indicates that instance\r | |
ad1a1798 | 46 | information is unavailable, not meaningful, or not relevant. Valid instance numbers start with 1.\r |
ececc2eb | 47 | @param CallerId This optional parameter may be used to identify the caller.\r |
ad1a1798 | 48 | This parameter allows the status code driver to apply different rules to different callers.\r |
ececc2eb | 49 | @param Data This optional parameter may be used to pass additional data.\r |
50 | Type EFI_STATUS_CODE_DATA is defined in "Related Definitions" below.\r | |
51 | The contents of this data type may have additional GUID-specific data. The standard GUIDs and\r | |
ad1a1798 | 52 | their associated data structures are defined in the Intel? Platform Innovation Framework for EFI Status Codes Specification.\r |
53 | \r | |
54 | @return Always return EFI_SUCCESS.\r | |
55 | \r | |
56 | **/\r | |
57 | EFI_STATUS\r | |
58 | EFIAPI\r | |
59 | ReportDispatcher (\r | |
507b36ca | 60 | IN CONST EFI_PEI_SERVICES **PeiServices,\r |
ad1a1798 | 61 | IN EFI_STATUS_CODE_TYPE CodeType,\r |
62 | IN EFI_STATUS_CODE_VALUE Value,\r | |
63 | IN UINT32 Instance,\r | |
507b36ca | 64 | IN CONST EFI_GUID *CallerId OPTIONAL,\r |
65 | IN CONST EFI_STATUS_CODE_DATA *Data OPTIONAL\r | |
ad1a1798 | 66 | )\r |
67 | {\r | |
68 | if (FeaturePcdGet (PcdStatusCodeUseSerial)) {\r | |
69 | SerialStatusCodeReportWorker (\r | |
70 | CodeType,\r | |
71 | Value,\r | |
72 | Instance,\r | |
73 | CallerId,\r | |
74 | Data\r | |
75 | );\r | |
76 | }\r | |
77 | if (FeaturePcdGet (PcdStatusCodeUseMemory)) {\r | |
78 | MemoryStatusCodeReportWorker (\r | |
79 | CodeType,\r | |
80 | Value,\r | |
81 | Instance\r | |
82 | );\r | |
83 | }\r | |
84 | if (FeaturePcdGet (PcdStatusCodeUseOEM)) {\r | |
85 | OemHookStatusCodeReport (\r | |
86 | CodeType,\r | |
87 | Value,\r | |
88 | Instance,\r | |
507b36ca | 89 | (EFI_GUID *)CallerId,\r |
90 | (EFI_STATUS_CODE_DATA *)Data\r | |
ad1a1798 | 91 | );\r |
92 | }\r | |
93 | \r | |
94 | return EFI_SUCCESS;\r | |
95 | }\r | |
96 | \r | |
97 | /**\r | |
ececc2eb | 98 | Initialize PEI status codes and publish the status code\r |
ad1a1798 | 99 | PPI.\r |
100 | \r | |
8bd22b8a LG |
101 | @param FileHandle Handle of the file being invoked.\r |
102 | @param PeiServices Describes the list of possible PEI Services.\r | |
ececc2eb | 103 | \r |
ad1a1798 | 104 | @return The function always returns success.\r |
105 | \r | |
106 | **/\r | |
107 | EFI_STATUS\r | |
6ba0bc7c | 108 | EFIAPI\r |
ad1a1798 | 109 | PeiStatusCodeDriverEntry (\r |
8bd22b8a LG |
110 | IN EFI_PEI_FILE_HANDLE FileHandle,\r |
111 | IN CONST EFI_PEI_SERVICES **PeiServices\r | |
ad1a1798 | 112 | )\r |
113 | {\r | |
114 | EFI_STATUS Status;\r | |
115 | \r | |
116 | //\r | |
117 | // Dispatch initialization request to sub-statuscode-devices.\r | |
118 | // If enable UseSerial, then initialize serial port.\r | |
119 | // if enable UseMemory, then initialize memory status code worker.\r | |
120 | // if enable UseOEM, then initialize Oem status code.\r | |
121 | //\r | |
122 | if (FeaturePcdGet (PcdStatusCodeUseSerial)) {\r | |
123 | Status = SerialPortInitialize();\r | |
124 | ASSERT_EFI_ERROR (Status);\r | |
125 | }\r | |
126 | if (FeaturePcdGet (PcdStatusCodeUseMemory)) {\r | |
127 | Status = MemoryStatusCodeInitializeWorker ();\r | |
128 | ASSERT_EFI_ERROR (Status);\r | |
129 | }\r | |
130 | if (FeaturePcdGet (PcdStatusCodeUseOEM)) {\r | |
131 | Status = OemHookStatusCodeInitialize ();\r | |
132 | ASSERT_EFI_ERROR (Status);\r | |
133 | }\r | |
134 | \r | |
135 | //\r | |
ececc2eb | 136 | // Install PeiStatusCodePpi.\r |
ad1a1798 | 137 | // PeiServices use this Ppi to output status code.\r |
138 | // use library\r | |
ea2d9086 | 139 | Status = PeiServicesInstallPpi (&mStatusCodePpiDescriptor);\r |
140 | ASSERT_EFI_ERROR (Status);\r | |
ececc2eb | 141 | \r |
ad1a1798 | 142 | return EFI_SUCCESS;\r |
143 | }\r | |
144 | \r |