]>
Commit | Line | Data |
---|---|---|
3dbba770 | 1 | /** @file\r |
a8cbf345 | 2 | Internal include file of Status Code Runtime DXE Driver.\r |
ad1a1798 | 3 | \r |
a8cbf345 | 4 | Copyright (c) 2006 - 2009, Intel Corporation\r |
ececc2eb | 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 |
3dbba770 | 13 | **/\r |
ad1a1798 | 14 | \r |
a8cbf345 | 15 | #ifndef __STATUS_CODE_RUNTIME_DXE_H__\r |
16 | #define __STATUS_CODE_RUNTIME_DXE_H__\r | |
ad1a1798 | 17 | \r |
ed7748fe | 18 | \r |
6f2b45bb | 19 | #include <FrameworkDxe.h>\r |
551ed06f | 20 | #include <FrameworkModuleDxe.h>\r |
29941df6 | 21 | #include <Guid/DataHubStatusCodeRecord.h>\r |
6f2b45bb | 22 | #include <Protocol/DataHub.h>\r |
23 | #include <Protocol/SerialIo.h>\r | |
24 | #include <Guid/MemoryStatusCodeRecord.h>\r | |
25 | #include <Protocol/StatusCode.h>\r | |
26 | #include <Guid/StatusCodeDataTypeId.h>\r | |
6a27a4eb | 27 | #include <Guid/EventGroup.h>\r |
ed7748fe | 28 | \r |
6f2b45bb | 29 | #include <Library/BaseLib.h>\r |
16f3deb0 | 30 | #include <Library/SynchronizationLib.h>\r |
6f2b45bb | 31 | #include <Library/BaseMemoryLib.h>\r |
32 | #include <Library/DebugLib.h>\r | |
33 | #include <Library/ReportStatusCodeLib.h>\r | |
34 | #include <Library/PrintLib.h>\r | |
35 | #include <Library/PcdLib.h>\r | |
36 | #include <Library/HobLib.h>\r | |
37 | #include <Library/UefiDriverEntryPoint.h>\r | |
38 | #include <Library/UefiBootServicesTableLib.h>\r | |
39 | #include <Library/UefiLib.h>\r | |
40 | #include <Library/MemoryAllocationLib.h>\r | |
41 | #include <Library/UefiRuntimeLib.h>\r | |
42 | #include <Library/SerialPortLib.h>\r | |
43 | #include <Library/OemHookStatusCodeLib.h>\r | |
ad1a1798 | 44 | \r |
45 | //\r | |
ececc2eb | 46 | // Data hub worker definition\r |
ad1a1798 | 47 | //\r |
f02bd376 | 48 | #define DATAHUB_STATUS_CODE_SIGNATURE SIGNATURE_32 ('B', 'D', 'H', 'S')\r |
ad1a1798 | 49 | \r |
ad1a1798 | 50 | typedef struct {\r |
6f2b45bb | 51 | UINTN Signature;\r |
52 | LIST_ENTRY Node;\r | |
a8cbf345 | 53 | UINT8 Data[sizeof(DATA_HUB_STATUS_CODE_DATA_RECORD) + EFI_STATUS_CODE_DATA_MAX_SIZE];\r |
ad1a1798 | 54 | } DATAHUB_STATUSCODE_RECORD;\r |
55 | \r | |
56 | \r | |
57 | //\r | |
ececc2eb | 58 | // Runtime memory status code worker definition\r |
59 | //\r | |
ad1a1798 | 60 | typedef struct {\r |
61 | UINT32 RecordIndex;\r | |
62 | UINT32 NumberOfRecords;\r | |
63 | UINT32 MaxRecordsNumber;\r | |
64 | } RUNTIME_MEMORY_STATUSCODE_HEADER;\r | |
65 | \r | |
a8cbf345 | 66 | extern RUNTIME_MEMORY_STATUSCODE_HEADER *mRtMemoryStatusCodeTable;\r |
ad1a1798 | 67 | \r |
a8cbf345 | 68 | /**\r |
69 | Report status code to all supported device.\r | |
ad1a1798 | 70 | \r |
a8cbf345 | 71 | This function implements EFI_STATUS_CODE_PROTOCOL.ReportStatusCode().\r |
72 | It calls into the workers which dispatches the platform specific listeners.\r | |
ad1a1798 | 73 | \r |
a8cbf345 | 74 | @param Type Indicates the type of status code being reported.\r |
75 | @param Value Describes the current status of a hardware or software entity.\r | |
76 | This included information about the class and subclass that is used to\r | |
77 | classify the entity as well as an operation.\r | |
78 | @param Instance The enumeration of a hardware or software entity within\r | |
79 | the system. Valid instance numbers start with 1.\r | |
80 | @param CallerId This optional parameter may be used to identify the caller.\r | |
81 | This parameter allows the status code driver to apply different rules to\r | |
82 | different callers.\r | |
83 | @param Data This optional parameter may be used to pass additional data.\r | |
ececc2eb | 84 | \r |
a8cbf345 | 85 | @retval EFI_SUCCESS The function completed successfully\r |
86 | @retval EFI_DEVICE_ERROR The function should not be completed due to a device error.\r | |
ececc2eb | 87 | \r |
a8cbf345 | 88 | **/\r |
89 | EFI_STATUS\r | |
90 | EFIAPI\r | |
91 | ReportDispatcher (\r | |
92 | IN EFI_STATUS_CODE_TYPE CodeType,\r | |
93 | IN EFI_STATUS_CODE_VALUE Value,\r | |
94 | IN UINT32 Instance,\r | |
95 | IN EFI_GUID *CallerId OPTIONAL,\r | |
96 | IN EFI_STATUS_CODE_DATA *Data OPTIONAL\r | |
97 | );\r | |
98 | \r | |
99 | /**\r | |
100 | Dispatch initialization request to sub status code devices based on \r | |
101 | customized feature flags.\r | |
102 | \r | |
ad1a1798 | 103 | **/\r |
104 | VOID\r | |
105 | InitializationDispatcherWorker (\r | |
106 | VOID\r | |
107 | );\r | |
108 | \r | |
109 | \r | |
110 | /**\r | |
a8cbf345 | 111 | Locates Serial I/O Protocol as initialization for serial status code worker.\r |
112 | \r | |
113 | @retval EFI_SUCCESS Serial I/O Protocol is successfully located.\r | |
ad1a1798 | 114 | \r |
115 | **/\r | |
116 | EFI_STATUS\r | |
117 | EfiSerialStatusCodeInitializeWorker (\r | |
118 | VOID\r | |
119 | );\r | |
120 | \r | |
121 | \r | |
122 | /**\r | |
123 | Convert status code value and extended data to readable ASCII string, send string to serial I/O device.\r | |
a8cbf345 | 124 | \r |
125 | @param CodeType Indicates the type of status code being reported.\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\r | |
128 | classify the entity as well as an operation.\r | |
129 | @param Instance The enumeration of a hardware or software entity within\r | |
130 | the system. Valid instance numbers start with 1.\r | |
131 | @param CallerId This optional parameter may be used to identify the caller.\r | |
132 | This parameter allows the status code driver to apply different rules to\r | |
133 | different callers.\r | |
134 | @param Data This optional parameter may be used to pass additional data.\r | |
135 | \r | |
136 | @retval EFI_SUCCESS Status code reported to serial I/O successfully.\r | |
137 | @retval EFI_DEVICE_ERROR EFI serial device cannot work after ExitBootService() is called.\r | |
138 | @retval EFI_DEVICE_ERROR EFI serial device cannot work with TPL higher than TPL_CALLBACK.\r | |
ad1a1798 | 139 | \r |
140 | **/\r | |
141 | EFI_STATUS\r | |
142 | SerialStatusCodeReportWorker (\r | |
143 | IN EFI_STATUS_CODE_TYPE CodeType,\r | |
144 | IN EFI_STATUS_CODE_VALUE Value,\r | |
145 | IN UINT32 Instance,\r | |
146 | IN EFI_GUID *CallerId,\r | |
147 | IN EFI_STATUS_CODE_DATA *Data OPTIONAL\r | |
148 | );\r | |
149 | \r | |
150 | /**\r | |
a8cbf345 | 151 | Initialize runtime memory status code table as initialization for runtime memory status code worker\r |
152 | \r | |
153 | @retval EFI_SUCCESS Runtime memory status code table successfully initialized.\r | |
ad1a1798 | 154 | \r |
155 | **/\r | |
156 | EFI_STATUS\r | |
157 | RtMemoryStatusCodeInitializeWorker (\r | |
158 | VOID\r | |
159 | );\r | |
160 | \r | |
161 | /**\r | |
a8cbf345 | 162 | Report status code into runtime memory. If the runtime pool is full, roll back to the \r |
ad1a1798 | 163 | first record and overwrite it.\r |
a8cbf345 | 164 | \r |
165 | @param CodeType Indicates the type of status code being reported.\r | |
166 | @param Value Describes the current status of a hardware or software entity.\r | |
167 | This included information about the class and subclass that is used to\r | |
168 | classify the entity as well as an operation.\r | |
169 | @param Instance The enumeration of a hardware or software entity within\r | |
170 | the system. Valid instance numbers start with 1.\r | |
171 | @param CallerId This optional parameter may be used to identify the caller.\r | |
172 | This parameter allows the status code driver to apply different rules to\r | |
173 | different callers.\r | |
174 | \r | |
175 | @retval EFI_SUCCESS Status code successfully recorded in runtime memory status code table.\r | |
ad1a1798 | 176 | \r |
177 | **/\r | |
178 | EFI_STATUS\r | |
179 | RtMemoryStatusCodeReportWorker (\r | |
ad1a1798 | 180 | IN EFI_STATUS_CODE_TYPE CodeType,\r |
181 | IN EFI_STATUS_CODE_VALUE Value,\r | |
182 | IN UINT32 Instance\r | |
183 | );\r | |
184 | \r | |
185 | /**\r | |
a8cbf345 | 186 | Locate Data Hub Protocol and create event for logging data\r |
187 | as initialization for data hub status code worker.\r | |
ececc2eb | 188 | \r |
a8cbf345 | 189 | @retval EFI_SUCCESS Initialization is successful.\r |
ad1a1798 | 190 | \r |
191 | **/\r | |
192 | EFI_STATUS\r | |
193 | DataHubStatusCodeInitializeWorker (\r | |
194 | VOID\r | |
195 | );\r | |
196 | \r | |
197 | \r | |
198 | /**\r | |
199 | Report status code into DataHub.\r | |
ececc2eb | 200 | \r |
a8cbf345 | 201 | @param CodeType Indicates the type of status code being reported.\r |
202 | @param Value Describes the current status of a hardware or software entity.\r | |
203 | This included information about the class and subclass that is used to\r | |
204 | classify the entity as well as an operation.\r | |
205 | @param Instance The enumeration of a hardware or software entity within\r | |
206 | the system. Valid instance numbers start with 1.\r | |
207 | @param CallerId This optional parameter may be used to identify the caller.\r | |
208 | This parameter allows the status code driver to apply different rules to\r | |
209 | different callers.\r | |
210 | @param Data This optional parameter may be used to pass additional data.\r | |
211 | \r | |
212 | @retval EFI_SUCCESS The function completed successfully.\r | |
213 | @retval EFI_DEVICE_ERROR Function is reentered.\r | |
214 | @retval EFI_DEVICE_ERROR Function is called at runtime.\r | |
215 | @retval EFI_OUT_OF_RESOURCES Fail to allocate memory for free record buffer.\r | |
ad1a1798 | 216 | \r |
217 | **/\r | |
218 | EFI_STATUS\r | |
219 | DataHubStatusCodeReportWorker (\r | |
220 | IN EFI_STATUS_CODE_TYPE CodeType,\r | |
221 | IN EFI_STATUS_CODE_VALUE Value,\r | |
222 | IN UINT32 Instance,\r | |
223 | IN EFI_GUID *CallerId,\r | |
224 | IN EFI_STATUS_CODE_DATA *Data OPTIONAL\r | |
225 | );\r | |
226 | \r | |
6f2b45bb | 227 | \r |
a8cbf345 | 228 | /**\r |
229 | Virtual address change notification call back. It converts global pointer\r | |
230 | to virtual address.\r | |
231 | \r | |
232 | @param Event Event whose notification function is being invoked.\r | |
233 | @param Context Pointer to the notification function's context, which is\r | |
234 | always zero in current implementation.\r | |
235 | \r | |
236 | **/\r | |
6f2b45bb | 237 | VOID\r |
238 | EFIAPI\r | |
239 | VirtualAddressChangeCallBack (\r | |
240 | IN EFI_EVENT Event,\r | |
241 | IN VOID *Context\r | |
242 | );\r | |
243 | \r | |
ad1a1798 | 244 | #endif\r |