]>
Commit | Line | Data |
---|---|---|
1 | /** @file\r | |
2 | Internal include file of Status Code Runtime DXE Driver.\r | |
3 | \r | |
4 | Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>\r | |
5 | 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 | |
12 | \r | |
13 | **/\r | |
14 | \r | |
15 | #ifndef __STATUS_CODE_RUNTIME_DXE_H__\r | |
16 | #define __STATUS_CODE_RUNTIME_DXE_H__\r | |
17 | \r | |
18 | \r | |
19 | #include <FrameworkDxe.h>\r | |
20 | #include <Guid/DataHubStatusCodeRecord.h>\r | |
21 | #include <Protocol/DataHub.h>\r | |
22 | #include <Guid/MemoryStatusCodeRecord.h>\r | |
23 | #include <Protocol/StatusCode.h>\r | |
24 | #include <Guid/StatusCodeDataTypeId.h>\r | |
25 | #include <Guid/StatusCodeDataTypeDebug.h>\r | |
26 | #include <Guid/EventGroup.h>\r | |
27 | \r | |
28 | #include <Library/BaseLib.h>\r | |
29 | #include <Library/SynchronizationLib.h>\r | |
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 | |
43 | \r | |
44 | //\r | |
45 | // Data hub worker definition\r | |
46 | //\r | |
47 | #define DATAHUB_STATUS_CODE_SIGNATURE SIGNATURE_32 ('B', 'D', 'H', 'S')\r | |
48 | \r | |
49 | typedef struct {\r | |
50 | UINTN Signature;\r | |
51 | LIST_ENTRY Node;\r | |
52 | UINT8 Data[sizeof(DATA_HUB_STATUS_CODE_DATA_RECORD) + EFI_STATUS_CODE_DATA_MAX_SIZE];\r | |
53 | } DATAHUB_STATUSCODE_RECORD;\r | |
54 | \r | |
55 | \r | |
56 | extern RUNTIME_MEMORY_STATUSCODE_HEADER *mRtMemoryStatusCodeTable;\r | |
57 | \r | |
58 | /**\r | |
59 | Report status code to all supported device.\r | |
60 | \r | |
61 | This function implements EFI_STATUS_CODE_PROTOCOL.ReportStatusCode().\r | |
62 | It calls into the workers which dispatches the platform specific listeners.\r | |
63 | \r | |
64 | @param CodeType Indicates the type of status code being reported.\r | |
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 | |
74 | \r | |
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 | |
77 | \r | |
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 | |
93 | **/\r | |
94 | VOID\r | |
95 | InitializationDispatcherWorker (\r | |
96 | VOID\r | |
97 | );\r | |
98 | \r | |
99 | \r | |
100 | /**\r | |
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 | |
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 | |
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 | |
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 | |
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 | |
144 | \r | |
145 | **/\r | |
146 | EFI_STATUS\r | |
147 | RtMemoryStatusCodeInitializeWorker (\r | |
148 | VOID\r | |
149 | );\r | |
150 | \r | |
151 | /**\r | |
152 | Report status code into runtime memory. If the runtime pool is full, roll back to the \r | |
153 | first record and overwrite it.\r | |
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 | |
161 | \r | |
162 | @retval EFI_SUCCESS Status code successfully recorded in runtime memory status code table.\r | |
163 | \r | |
164 | **/\r | |
165 | EFI_STATUS\r | |
166 | RtMemoryStatusCodeReportWorker (\r | |
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 | |
173 | Locate Data Hub Protocol and create event for logging data\r | |
174 | as initialization for data hub status code worker.\r | |
175 | \r | |
176 | @retval EFI_SUCCESS Initialization is successful.\r | |
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 | |
187 | \r | |
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 | |
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 | |
214 | \r | |
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 | |
224 | VOID\r | |
225 | EFIAPI\r | |
226 | VirtualAddressChangeCallBack (\r | |
227 | IN EFI_EVENT Event,\r | |
228 | IN VOID *Context\r | |
229 | );\r | |
230 | \r | |
231 | #endif\r |