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