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