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