]>
Commit | Line | Data |
---|---|---|
3dbba770 | 1 | /** @file\r |
ad1a1798 | 2 | \r |
ececc2eb | 3 | Copyright (c) 2006, Intel Corporation\r |
4 | All rights reserved. This program and the accompanying materials\r | |
5 | are licensed and made available under the terms and conditions of the BSD License\r | |
6 | which accompanies this distribution. The full text of the license may be found at\r | |
7 | http://opensource.org/licenses/bsd-license.php\r | |
8 | \r | |
9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
ad1a1798 | 11 | \r |
3dbba770 | 12 | **/\r |
ad1a1798 | 13 | \r |
14 | #ifndef __DXE_STATUS_CODE_H__\r | |
15 | #define __DXE_STATUS_CODE_H__\r | |
16 | \r | |
ed7748fe | 17 | \r |
6f2b45bb | 18 | #include <FrameworkDxe.h>\r |
551ed06f | 19 | #include <FrameworkModuleDxe.h>\r |
29941df6 | 20 | #include <Guid/DataHubStatusCodeRecord.h>\r |
6f2b45bb | 21 | #include <Protocol/DataHub.h>\r |
22 | #include <Protocol/SerialIo.h>\r | |
23 | #include <Guid/MemoryStatusCodeRecord.h>\r | |
24 | #include <Protocol/StatusCode.h>\r | |
25 | #include <Guid/StatusCodeDataTypeId.h>\r | |
6a27a4eb | 26 | #include <Guid/EventGroup.h>\r |
ed7748fe | 27 | \r |
6f2b45bb | 28 | #include <Library/BaseLib.h>\r |
16f3deb0 | 29 | #include <Library/SynchronizationLib.h>\r |
6f2b45bb | 30 | #include <Library/BaseMemoryLib.h>\r |
31 | #include <Library/DebugLib.h>\r | |
32 | #include <Library/ReportStatusCodeLib.h>\r | |
33 | #include <Library/PrintLib.h>\r | |
34 | #include <Library/PcdLib.h>\r | |
35 | #include <Library/HobLib.h>\r | |
36 | #include <Library/UefiDriverEntryPoint.h>\r | |
37 | #include <Library/UefiBootServicesTableLib.h>\r | |
38 | #include <Library/UefiLib.h>\r | |
39 | #include <Library/MemoryAllocationLib.h>\r | |
40 | #include <Library/UefiRuntimeLib.h>\r | |
41 | #include <Library/SerialPortLib.h>\r | |
42 | #include <Library/OemHookStatusCodeLib.h>\r | |
ad1a1798 | 43 | \r |
44 | //\r | |
ececc2eb | 45 | // Data hub worker definition\r |
ad1a1798 | 46 | //\r |
47 | #define MAX_NUMBER_DATAHUB_RECORDS 1000\r | |
48 | #define DATAHUB_BYTES_PER_RECORD EFI_STATUS_CODE_DATA_MAX_SIZE\r | |
49 | #define EMPTY_RECORD_TAG 0xFF\r | |
f02bd376 | 50 | #define DATAHUB_STATUS_CODE_SIGNATURE SIGNATURE_32 ('B', 'D', 'H', 'S')\r |
ad1a1798 | 51 | \r |
52 | //\r | |
53 | // Address type of pointer.\r | |
54 | // The point type always equal to PHYSICAL_MODE on IA32/X64/EBC architecture\r | |
ececc2eb | 55 | // Otherwise, VIRTUAL_MODE/PHYSICAL_MODE would be used on Ipf architecture,\r |
56 | //\r | |
ad1a1798 | 57 | typedef enum {\r |
58 | PHYSICAL_MODE,\r | |
59 | VIRTUAL_MODE\r | |
60 | } PROCESSOR_MODE;\r | |
61 | \r | |
62 | typedef struct {\r | |
6f2b45bb | 63 | UINTN Signature;\r |
64 | LIST_ENTRY Node;\r | |
65 | \r | |
66 | UINT8 Data[sizeof (DATA_HUB_STATUS_CODE_DATA_RECORD) + EFI_STATUS_CODE_DATA_MAX_SIZE];\r | |
ad1a1798 | 67 | } DATAHUB_STATUSCODE_RECORD;\r |
68 | \r | |
69 | \r | |
70 | //\r | |
ececc2eb | 71 | // Runtime memory status code worker definition\r |
72 | //\r | |
ad1a1798 | 73 | typedef struct {\r |
74 | UINT32 RecordIndex;\r | |
75 | UINT32 NumberOfRecords;\r | |
76 | UINT32 MaxRecordsNumber;\r | |
77 | } RUNTIME_MEMORY_STATUSCODE_HEADER;\r | |
78 | \r | |
79 | \r | |
80 | typedef struct {\r | |
81 | //\r | |
ececc2eb | 82 | // Report operation nest status.\r |
ad1a1798 | 83 | // If it is set, then the report operation has nested.\r |
ececc2eb | 84 | //\r |
ad1a1798 | 85 | UINT32 StatusCodeNestStatus;\r |
86 | //\r | |
87 | // Runtime status code management header, the records buffer is following it.\r | |
ececc2eb | 88 | //\r |
ad1a1798 | 89 | RUNTIME_MEMORY_STATUSCODE_HEADER *RtMemoryStatusCodeTable[2];\r |
90 | } DXE_STATUS_CODE_CONTROLLER;\r | |
91 | \r | |
92 | \r | |
93 | /**\r | |
ececc2eb | 94 | \r |
95 | Dispatch initialization request to sub status code devices based on\r | |
ad1a1798 | 96 | customized feature flags.\r |
ececc2eb | 97 | \r |
ad1a1798 | 98 | **/\r |
99 | VOID\r | |
100 | InitializationDispatcherWorker (\r | |
101 | VOID\r | |
102 | );\r | |
103 | \r | |
104 | \r | |
105 | /**\r | |
106 | Initialize serial status code worker.\r | |
ececc2eb | 107 | \r |
ad1a1798 | 108 | @return The function always return EFI_SUCCESS\r |
109 | \r | |
110 | **/\r | |
111 | EFI_STATUS\r | |
112 | EfiSerialStatusCodeInitializeWorker (\r | |
113 | VOID\r | |
114 | );\r | |
115 | \r | |
116 | \r | |
117 | /**\r | |
118 | Convert status code value and extended data to readable ASCII string, send string to serial I/O device.\r | |
ececc2eb | 119 | \r |
ad1a1798 | 120 | @param CodeType Indicates the type of status code being reported. Type EFI_STATUS_CODE_TYPE is defined in "Related Definitions" below.\r |
ececc2eb | 121 | \r |
122 | @param Value Describes the current status of a hardware or software entity.\r | |
123 | This included information about the class and subclass that is used to classify the entity\r | |
124 | as well as an operation. For progress codes, the operation is the current activity.\r | |
125 | For error codes, it is the exception. For debug codes, it is not defined at this time.\r | |
126 | Type EFI_STATUS_CODE_VALUE is defined in "Related Definitions" below.\r | |
ad1a1798 | 127 | Specific values are discussed in the Intel? Platform Innovation Framework for EFI Status Code Specification.\r |
ececc2eb | 128 | \r |
129 | @param Instance The enumeration of a hardware or software entity within the system.\r | |
130 | A system may contain multiple entities that match a class/subclass pairing.\r | |
131 | The instance differentiates between them. An instance of 0 indicates that instance information is unavailable,\r | |
ad1a1798 | 132 | not meaningful, or not relevant. Valid instance numbers start with 1.\r |
133 | \r | |
134 | \r | |
ececc2eb | 135 | @param CallerId This optional parameter may be used to identify the caller.\r |
136 | This parameter allows the status code driver to apply different rules to different callers.\r | |
8a7d75b0 | 137 | Type EFI_GUID is defined in InstallProtocolInterface() in the UEFI 2.0 Specification.\r |
ad1a1798 | 138 | \r |
139 | \r | |
140 | @param Data This optional parameter may be used to pass additional data\r | |
ececc2eb | 141 | \r |
ad1a1798 | 142 | @retval EFI_SUCCESS Success to report status code to serial I/O.\r |
143 | @retval EFI_DEVICE_ERROR EFI serial device can not work after ExitBootService() is called .\r | |
144 | \r | |
145 | **/\r | |
146 | EFI_STATUS\r | |
147 | SerialStatusCodeReportWorker (\r | |
148 | IN EFI_STATUS_CODE_TYPE CodeType,\r | |
149 | IN EFI_STATUS_CODE_VALUE Value,\r | |
150 | IN UINT32 Instance,\r | |
151 | IN EFI_GUID *CallerId,\r | |
152 | IN EFI_STATUS_CODE_DATA *Data OPTIONAL\r | |
153 | );\r | |
154 | \r | |
155 | /**\r | |
156 | Initialize runtime memory status code.\r | |
ececc2eb | 157 | \r |
ad1a1798 | 158 | @return The function always return EFI_SUCCESS\r |
159 | \r | |
160 | **/\r | |
161 | EFI_STATUS\r | |
162 | RtMemoryStatusCodeInitializeWorker (\r | |
163 | VOID\r | |
164 | );\r | |
165 | \r | |
166 | /**\r | |
ececc2eb | 167 | Report status code into runtime memory. If the runtime pool is full, roll back to the\r |
ad1a1798 | 168 | first record and overwrite it.\r |
ececc2eb | 169 | \r |
170 | @param RtMemoryStatusCodeTable\r | |
ad1a1798 | 171 | Point to Runtime memory table header.\r |
172 | \r | |
173 | @param CodeType Indicates the type of status code being reported. Type EFI_STATUS_CODE_TYPE is defined in "Related Definitions" below.\r | |
ececc2eb | 174 | \r |
175 | @param Value Describes the current status of a hardware or software entity.\r | |
176 | This included information about the class and subclass that is used to classify the entity\r | |
177 | as well as an operation. For progress codes, the operation is the current activity.\r | |
178 | For error codes, it is the exception. For debug codes, it is not defined at this time.\r | |
179 | Type EFI_STATUS_CODE_VALUE is defined in "Related Definitions" below.\r | |
ad1a1798 | 180 | Specific values are discussed in the Intel? Platform Innovation Framework for EFI Status Code Specification.\r |
ececc2eb | 181 | \r |
182 | @param Instance The enumeration of a hardware or software entity within the system.\r | |
183 | A system may contain multiple entities that match a class/subclass pairing.\r | |
184 | The instance differentiates between them. An instance of 0 indicates that instance information is unavailable,\r | |
ad1a1798 | 185 | not meaningful, or not relevant. Valid instance numbers start with 1.\r |
ececc2eb | 186 | \r |
ad1a1798 | 187 | @return The function always return EFI_SUCCESS.\r |
188 | \r | |
189 | **/\r | |
190 | EFI_STATUS\r | |
191 | RtMemoryStatusCodeReportWorker (\r | |
192 | RUNTIME_MEMORY_STATUSCODE_HEADER *RtMemoryStatusCodeTable,\r | |
193 | IN EFI_STATUS_CODE_TYPE CodeType,\r | |
194 | IN EFI_STATUS_CODE_VALUE Value,\r | |
195 | IN UINT32 Instance\r | |
196 | );\r | |
197 | \r | |
198 | /**\r | |
199 | Initialize data hubstatus code.\r | |
200 | Create a data hub listener.\r | |
ececc2eb | 201 | \r |
ad1a1798 | 202 | @return The function always return EFI_SUCCESS\r |
203 | \r | |
204 | **/\r | |
205 | EFI_STATUS\r | |
206 | DataHubStatusCodeInitializeWorker (\r | |
207 | VOID\r | |
208 | );\r | |
209 | \r | |
210 | \r | |
211 | /**\r | |
212 | Report status code into DataHub.\r | |
ececc2eb | 213 | \r |
ad1a1798 | 214 | @param CodeType Indicates the type of status code being reported. Type EFI_STATUS_CODE_TYPE is defined in "Related Definitions" below.\r |
ececc2eb | 215 | \r |
216 | @param Value Describes the current status of a hardware or software entity.\r | |
217 | This included information about the class and subclass that is used to classify the entity\r | |
218 | as well as an operation. For progress codes, the operation is the current activity.\r | |
219 | For error codes, it is the exception. For debug codes, it is not defined at this time.\r | |
220 | Type EFI_STATUS_CODE_VALUE is defined in "Related Definitions" below.\r | |
ad1a1798 | 221 | Specific values are discussed in the Intel? Platform Innovation Framework for EFI Status Code Specification.\r |
ececc2eb | 222 | \r |
223 | @param Instance The enumeration of a hardware or software entity within the system.\r | |
224 | A system may contain multiple entities that match a class/subclass pairing.\r | |
225 | The instance differentiates between them. An instance of 0 indicates that instance information is unavailable,\r | |
ad1a1798 | 226 | not meaningful, or not relevant. Valid instance numbers start with 1.\r |
227 | \r | |
228 | \r | |
ececc2eb | 229 | @param CallerId This optional parameter may be used to identify the caller.\r |
230 | This parameter allows the status code driver to apply different rules to different callers.\r | |
8a7d75b0 | 231 | Type EFI_GUID is defined in InstallProtocolInterface() in the UEFI 2.0 Specification.\r |
ad1a1798 | 232 | \r |
233 | \r | |
234 | @param Data This optional parameter may be used to pass additional data\r | |
ececc2eb | 235 | \r |
ad1a1798 | 236 | @retval EFI_OUT_OF_RESOURCES Can not acquire record buffer.\r |
237 | @retval EFI_DEVICE_ERROR EFI serial device can not work after ExitBootService() is called .\r | |
238 | @retval EFI_SUCCESS Success to cache status code and signal log data event.\r | |
239 | \r | |
240 | **/\r | |
241 | EFI_STATUS\r | |
242 | DataHubStatusCodeReportWorker (\r | |
243 | IN EFI_STATUS_CODE_TYPE CodeType,\r | |
244 | IN EFI_STATUS_CODE_VALUE Value,\r | |
245 | IN UINT32 Instance,\r | |
246 | IN EFI_GUID *CallerId,\r | |
247 | IN EFI_STATUS_CODE_DATA *Data OPTIONAL\r | |
248 | );\r | |
249 | \r | |
6f2b45bb | 250 | \r |
251 | //\r | |
252 | // Declaration for callback Event.\r | |
253 | //\r | |
254 | VOID\r | |
255 | EFIAPI\r | |
256 | VirtualAddressChangeCallBack (\r | |
257 | IN EFI_EVENT Event,\r | |
258 | IN VOID *Context\r | |
259 | );\r | |
260 | \r | |
261 | //\r | |
262 | // Declaration for original Entry Point.\r | |
263 | //\r | |
264 | EFI_STATUS\r | |
265 | EFIAPI\r | |
266 | DxeStatusCodeDriverEntry (\r | |
267 | IN EFI_HANDLE ImageHandle,\r | |
268 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
269 | );\r | |
270 | \r | |
ad1a1798 | 271 | //\r |
272 | // declaration of DXE status code controller.\r | |
ececc2eb | 273 | //\r |
ad1a1798 | 274 | extern DXE_STATUS_CODE_CONTROLLER gDxeStatusCode;\r |
ad1a1798 | 275 | #endif\r |