]> git.proxmox.com Git - mirror_edk2.git/blob - IntelFrameworkModulePkg/Universal/StatusCode/Dxe/DxeStatusCode.h
dbf356b53b0e8d391bc1cd92c2963ba109b601b6
[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 CodeType 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
172 @retval EFI_SUCCESS Status code successfully recorded in runtime memory status code table.
173
174 **/
175 EFI_STATUS
176 RtMemoryStatusCodeReportWorker (
177 IN EFI_STATUS_CODE_TYPE CodeType,
178 IN EFI_STATUS_CODE_VALUE Value,
179 IN UINT32 Instance
180 );
181
182 /**
183 Locate Data Hub Protocol and create event for logging data
184 as initialization for data hub status code worker.
185
186 @retval EFI_SUCCESS Initialization is successful.
187
188 **/
189 EFI_STATUS
190 DataHubStatusCodeInitializeWorker (
191 VOID
192 );
193
194
195 /**
196 Report status code into DataHub.
197
198 @param CodeType Indicates the type of status code being reported.
199 @param Value Describes the current status of a hardware or software entity.
200 This included information about the class and subclass that is used to
201 classify the entity as well as an operation.
202 @param Instance The enumeration of a hardware or software entity within
203 the system. Valid instance numbers start with 1.
204 @param CallerId This optional parameter may be used to identify the caller.
205 This parameter allows the status code driver to apply different rules to
206 different callers.
207 @param Data This optional parameter may be used to pass additional data.
208
209 @retval EFI_SUCCESS The function completed successfully.
210 @retval EFI_DEVICE_ERROR Function is reentered.
211 @retval EFI_DEVICE_ERROR Function is called at runtime.
212 @retval EFI_OUT_OF_RESOURCES Fail to allocate memory for free record buffer.
213
214 **/
215 EFI_STATUS
216 DataHubStatusCodeReportWorker (
217 IN EFI_STATUS_CODE_TYPE CodeType,
218 IN EFI_STATUS_CODE_VALUE Value,
219 IN UINT32 Instance,
220 IN EFI_GUID *CallerId,
221 IN EFI_STATUS_CODE_DATA *Data OPTIONAL
222 );
223
224
225 /**
226 Virtual address change notification call back. It converts global pointer
227 to virtual address.
228
229 @param Event Event whose notification function is being invoked.
230 @param Context Pointer to the notification function's context, which is
231 always zero in current implementation.
232
233 **/
234 VOID
235 EFIAPI
236 VirtualAddressChangeCallBack (
237 IN EFI_EVENT Event,
238 IN VOID *Context
239 );
240
241 #endif