1. add EdkSerialPortLibNull.inf
[mirror_edk2.git] / IntelFrameworkModulePkg / Universal / StatusCode / Dxe / DxeStatusCode.h
1 /*++
2
3 Copyright (c) 2006, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
8
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11
12 Module Name:
13
14 DxeStatusCode.h
15
16 Abstract:
17
18 Header file of EFI DXE/RT Status Code.
19
20 --*/
21
22 #ifndef __DXE_STATUS_CODE_H__
23 #define __DXE_STATUS_CODE_H__
24
25 //
26 // Include common header file for this module.
27 //
28 #include "CommonHeader.h"
29
30 //
31 // Data hub worker definition
32 //
33 #define MAX_NUMBER_DATAHUB_RECORDS 1000
34 #define DATAHUB_BYTES_PER_RECORD EFI_STATUS_CODE_DATA_MAX_SIZE
35 #define EMPTY_RECORD_TAG 0xFF
36 #define DATAHUB_STATUS_CODE_SIGNATURE EFI_SIGNATURE_32 ('B', 'D', 'H', 'S')
37
38 //
39 // Address type of pointer.
40 // The point type always equal to PHYSICAL_MODE on IA32/X64/EBC architecture
41 // Otherwise, VIRTUAL_MODE/PHYSICAL_MODE would be used on Ipf architecture,
42 //
43 typedef enum {
44 PHYSICAL_MODE,
45 VIRTUAL_MODE
46 } PROCESSOR_MODE;
47
48 typedef struct {
49 UINTN Signature;
50 LIST_ENTRY Node;
51 EFI_STATUS_CODE_TYPE CodeType;
52 EFI_STATUS_CODE_VALUE Value;
53 UINT32 Instance;
54 EFI_GUID CallerId;
55 EFI_STATUS_CODE_DATA Data;
56 UINT8 ExtendData[EFI_STATUS_CODE_DATA_MAX_SIZE];
57 } DATAHUB_STATUSCODE_RECORD;
58
59
60 //
61 // Runtime memory status code worker definition
62 //
63 typedef struct {
64 UINT32 RecordIndex;
65 UINT32 NumberOfRecords;
66 UINT32 MaxRecordsNumber;
67 } RUNTIME_MEMORY_STATUSCODE_HEADER;
68
69
70 typedef struct {
71 //
72 // Report operation nest status.
73 // If it is set, then the report operation has nested.
74 //
75 UINT32 StatusCodeNestStatus;
76 //
77 // Runtime status code management header, the records buffer is following it.
78 //
79 RUNTIME_MEMORY_STATUSCODE_HEADER *RtMemoryStatusCodeTable[2];
80 } DXE_STATUS_CODE_CONTROLLER;
81
82
83 /**
84
85 Dispatch initialization request to sub status code devices based on
86 customized feature flags.
87
88 **/
89 VOID
90 InitializationDispatcherWorker (
91 VOID
92 );
93
94
95 /**
96 Initialize serial status code worker.
97
98 @return The function always return EFI_SUCCESS
99
100 **/
101 EFI_STATUS
102 EfiSerialStatusCodeInitializeWorker (
103 VOID
104 );
105
106
107 /**
108 Convert status code value and extended data to readable ASCII string, send string to serial I/O device.
109
110 @param CodeType Indicates the type of status code being reported. Type EFI_STATUS_CODE_TYPE is defined in "Related Definitions" below.
111
112 @param Value Describes the current status of a hardware or software entity.
113 This included information about the class and subclass that is used to classify the entity
114 as well as an operation. For progress codes, the operation is the current activity.
115 For error codes, it is the exception. For debug codes, it is not defined at this time.
116 Type EFI_STATUS_CODE_VALUE is defined in "Related Definitions" below.
117 Specific values are discussed in the Intel? Platform Innovation Framework for EFI Status Code Specification.
118
119 @param Instance The enumeration of a hardware or software entity within the system.
120 A system may contain multiple entities that match a class/subclass pairing.
121 The instance differentiates between them. An instance of 0 indicates that instance information is unavailable,
122 not meaningful, or not relevant. Valid instance numbers start with 1.
123
124
125 @param CallerId This optional parameter may be used to identify the caller.
126 This parameter allows the status code driver to apply different rules to different callers.
127 Type EFI_GUID is defined in InstallProtocolInterface() in the EFI 1.10 Specification.
128
129
130 @param Data This optional parameter may be used to pass additional data
131
132 @retval EFI_SUCCESS Success to report status code to serial I/O.
133 @retval EFI_DEVICE_ERROR EFI serial device can not work after ExitBootService() is called .
134
135 **/
136 EFI_STATUS
137 SerialStatusCodeReportWorker (
138 IN EFI_STATUS_CODE_TYPE CodeType,
139 IN EFI_STATUS_CODE_VALUE Value,
140 IN UINT32 Instance,
141 IN EFI_GUID *CallerId,
142 IN EFI_STATUS_CODE_DATA *Data OPTIONAL
143 );
144
145 /**
146 Initialize runtime memory status code.
147
148 @return The function always return EFI_SUCCESS
149
150 **/
151 EFI_STATUS
152 RtMemoryStatusCodeInitializeWorker (
153 VOID
154 );
155
156 /**
157 Report status code into runtime memory. If the runtime pool is full, roll back to the
158 first record and overwrite it.
159
160 @param RtMemoryStatusCodeTable
161 Point to Runtime memory table header.
162
163 @param CodeType Indicates the type of status code being reported. Type EFI_STATUS_CODE_TYPE is defined in "Related Definitions" below.
164
165 @param Value Describes the current status of a hardware or software entity.
166 This included information about the class and subclass that is used to classify the entity
167 as well as an operation. For progress codes, the operation is the current activity.
168 For error codes, it is the exception. For debug codes, it is not defined at this time.
169 Type EFI_STATUS_CODE_VALUE is defined in "Related Definitions" below.
170 Specific values are discussed in the Intel? Platform Innovation Framework for EFI Status Code Specification.
171
172 @param Instance The enumeration of a hardware or software entity within the system.
173 A system may contain multiple entities that match a class/subclass pairing.
174 The instance differentiates between them. An instance of 0 indicates that instance information is unavailable,
175 not meaningful, or not relevant. Valid instance numbers start with 1.
176
177 @return The function always return EFI_SUCCESS.
178
179 **/
180 EFI_STATUS
181 RtMemoryStatusCodeReportWorker (
182 RUNTIME_MEMORY_STATUSCODE_HEADER *RtMemoryStatusCodeTable,
183 IN EFI_STATUS_CODE_TYPE CodeType,
184 IN EFI_STATUS_CODE_VALUE Value,
185 IN UINT32 Instance
186 );
187
188 /**
189 Initialize data hubstatus code.
190 Create a data hub listener.
191
192 @return The function always return EFI_SUCCESS
193
194 **/
195 EFI_STATUS
196 DataHubStatusCodeInitializeWorker (
197 VOID
198 );
199
200
201 /**
202 Report status code into DataHub.
203
204 @param CodeType Indicates the type of status code being reported. Type EFI_STATUS_CODE_TYPE is defined in "Related Definitions" below.
205
206 @param Value Describes the current status of a hardware or software entity.
207 This included information about the class and subclass that is used to classify the entity
208 as well as an operation. For progress codes, the operation is the current activity.
209 For error codes, it is the exception. For debug codes, it is not defined at this time.
210 Type EFI_STATUS_CODE_VALUE is defined in "Related Definitions" below.
211 Specific values are discussed in the Intel? Platform Innovation Framework for EFI Status Code Specification.
212
213 @param Instance The enumeration of a hardware or software entity within the system.
214 A system may contain multiple entities that match a class/subclass pairing.
215 The instance differentiates between them. An instance of 0 indicates that instance information is unavailable,
216 not meaningful, or not relevant. Valid instance numbers start with 1.
217
218
219 @param CallerId This optional parameter may be used to identify the caller.
220 This parameter allows the status code driver to apply different rules to different callers.
221 Type EFI_GUID is defined in InstallProtocolInterface() in the EFI 1.10 Specification.
222
223
224 @param Data This optional parameter may be used to pass additional data
225
226 @retval EFI_OUT_OF_RESOURCES Can not acquire record buffer.
227 @retval EFI_DEVICE_ERROR EFI serial device can not work after ExitBootService() is called .
228 @retval EFI_SUCCESS Success to cache status code and signal log data event.
229
230 **/
231 EFI_STATUS
232 DataHubStatusCodeReportWorker (
233 IN EFI_STATUS_CODE_TYPE CodeType,
234 IN EFI_STATUS_CODE_VALUE Value,
235 IN UINT32 Instance,
236 IN EFI_GUID *CallerId,
237 IN EFI_STATUS_CODE_DATA *Data OPTIONAL
238 );
239
240 //
241 // declaration of DXE status code controller.
242 //
243 extern DXE_STATUS_CODE_CONTROLLER gDxeStatusCode;
244
245 #endif