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