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