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