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