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