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