Make public header file #ifndef XXX #define XXX start with __ to avoid collision.
[mirror_edk2.git] / IntelFrameworkPkg / Include / Protocol / DataHub.h
CommitLineData
79964ac8 1/** @file\r
2 The data hub protocol is used both by agents wishing to log\r
3 data and those wishing to be made aware of all information that\r
4 has been logged.\r
5\r
6 For more information please look at Intel Platform Innovation\r
7 Framework for EFI Data Hub Specification.\r
8\r
9 Copyright (c) 2007, Intel Corporation\r
10 All rights reserved. This program and the accompanying materials\r
11 are licensed and made available under the terms and conditions of the BSD License\r
12 which accompanies this distribution. The full text of the license may be found at\r
13 http://opensource.org/licenses/bsd-license.php\r
14\r
15 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
16 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
17\r
18 Module Name: DataHub.h\r
19\r
20 @par Revision Reference:\r
21 This protocol is defined in Framework for EFI Data Hub Specification.\r
22 Version 0.9.\r
23\r
24**/\r
25\r
d2be628f 26#ifndef __DATA_HUB_H__\r
27#define __DATA_HUB_H__\r
79964ac8 28\r
b80fbe85 29#include <PiDxe.h>\r
30\r
79964ac8 31#define EFI_DATA_HUB_PROTOCOL_GUID \\r
32 { \\r
33 0xae80d021, 0x618e, 0x11d4, {0xbc, 0xd7, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } \\r
34 }\r
35\r
36//\r
37// EFI generic Data Hub Header\r
38//\r
39// A Data Record is an EFI_DATA_RECORD_HEADER followed by RecordSize bytes of\r
40// data. The format of the data is defined by the DataRecordGuid.\r
41//\r
42// If EFI_DATA_RECORD_HEADER is extended in the future the Version number must\r
43// change and the HeaderSize will change if the definition of\r
44// EFI_DATA_RECORD_HEADER is extended.\r
45//\r
46// The logger is responcible for initializing:\r
47// Version, HeaderSize, RecordSize, DataRecordGuid, DataRecordClass\r
48//\r
49// The Data Hub driver is responcible for initializing:\r
50// LogTime and LogMonotonicCount.\r
51//\r
52#define EFI_DATA_RECORD_HEADER_VERSION 0x0100\r
53typedef struct {\r
54 UINT16 Version;\r
55 UINT16 HeaderSize;\r
56 UINT32 RecordSize;\r
57 EFI_GUID DataRecordGuid;\r
58 EFI_GUID ProducerName;\r
59 UINT64 DataRecordClass;\r
60 EFI_TIME LogTime;\r
61 UINT64 LogMonotonicCount;\r
62} EFI_DATA_RECORD_HEADER;\r
63\r
64//\r
65// Definition of DataRecordClass. These are used to filter out class types\r
66// at a very high level. The DataRecordGuid still defines the format of\r
67// the data. See DateHub.doc for rules on what can and can not be a\r
68// new DataRecordClass\r
69//\r
70#define EFI_DATA_RECORD_CLASS_DEBUG 0x0000000000000001\r
71#define EFI_DATA_RECORD_CLASS_ERROR 0x0000000000000002\r
72#define EFI_DATA_RECORD_CLASS_DATA 0x0000000000000004\r
73#define EFI_DATA_RECORD_CLASS_PROGRESS_CODE 0x0000000000000008\r
74\r
75//\r
76// Forward reference for pure ANSI compatability\r
77//\r
78typedef struct _EFI_DATA_HUB_PROTOCOL EFI_DATA_HUB_PROTOCOL;\r
79\r
80/**\r
81 Logs a data record to the system event log.\r
82\r
83 @param This The EFI_DATA_HUB_PROTOCOL instance.\r
84 @param description\r
85 @param DataRecordGuid A GUID that indicates the format of the data passed into RawData.\r
86 @param ProducerName A GUID that indicates the identity of the caller to this API.\r
87 @param DataRecordClass This class indicates the generic type of the data record.\r
88 @param RawData The DataRecordGuid-defined data to be logged.\r
89 @param RawDataSize The size in bytes of RawData.\r
90\r
91 @retval EFI_SUCCESS Data was logged.\r
92 @retval EFI_OUT_OF_RESOURCES Data was not logged due to lack of system resources.\r
93\r
94**/\r
95typedef\r
96EFI_STATUS\r
97(EFIAPI *EFI_DATA_HUB_LOG_DATA) (\r
98 IN EFI_DATA_HUB_PROTOCOL *This,\r
99 IN EFI_GUID *DataRecordGuid,\r
100 IN EFI_GUID *ProducerName,\r
101 IN UINT64 DataRecordClass,\r
102 IN VOID *RawData,\r
103 IN UINT32 RawDataSize\r
104 );\r
105\r
106/**\r
107 Allows the system data log to be searched.\r
108\r
109 @param This The EFI_DATA_HUB_PROTOCOL instance.\r
110 @param MonotonicCount On input, it specifies the Record to return.\r
111 An input of zero means to return the first record.\r
112 @param FilterDriver If FilterDriver is not passed in a MonotonicCount of zero,\r
113 it means to return the first data record. If FilterDriver is passed in,\r
114 then a MonotonicCount of zero means to return the first data not yet read\r
115 by FilterDriver.\r
116 @param Record Returns a dynamically allocated memory buffer with a data\r
117 record that matches MonotonicCount.\r
118\r
119 @retval EFI_SUCCESS Data was returned in Record.\r
120 @retval EFI_INVALID_PARAMETER FilterDriver was passed in but does not exist.\r
121 @retval EFI_NOT_FOUND MonotonicCount does not match any data record\r
122 in the system. If a MonotonicCount of zero was passed in, then no\r
123 data records exist in the system.\r
124 @retval EFI_OUT_OF_RESOURCES Record was not returned due to lack\r
125 of system resources.\r
126\r
127**/\r
128typedef\r
129EFI_STATUS\r
130(EFIAPI *EFI_DATA_HUB_GET_NEXT_RECORD) (\r
131 IN EFI_DATA_HUB_PROTOCOL *This,\r
132 IN OUT UINT64 *MonotonicCount,\r
133 IN EFI_EVENT *FilterDriver OPTIONAL,\r
134 OUT EFI_DATA_RECORD_HEADER **Record\r
135 );\r
136\r
137/**\r
138 Registers an event to be signaled every time a data record is logged in the system.\r
139\r
140 @param This The EFI_DATA_HUB_PROTOCOL instance.\r
141 @param FilterEvent The EFI_EVENT to signal whenever data that matches\r
142 FilterClass is logged in the system.\r
143 @param FilterTpl The maximum EFI_TPL at which FilterEvent can be signaled.\r
144 It is strongly recommended that you use the lowest EFI_TPL possible.\r
145 @param FilterClass FilterEvent will be signaled whenever a bit\r
146 in EFI_DATA_RECORD_HEADER.DataRecordClass is also set in FilterClass.\r
147 If FilterClass is zero, no class-based filtering will be performed.\r
148 @param FilterDataRecordGuid FilterEvent will be signaled whenever\r
149 FilterDataRecordGuid matches EFI_DATA_RECORD_HEADER.DataRecordGuid.\r
150 If FilterDataRecordGuid is NULL, then no GUID-based filtering will be performed.\r
151\r
152 @retval EFI_SUCCESS The filter driver event was registered\r
153 @retval EFI_ALREADY_STARTED FilterEvent was previously registered and cannot be registered again.\r
154 @retval EFI_OUT_OF_RESOURCES The filter driver event was not registered\r
155 due to lack of system resources.\r
156\r
157**/\r
158typedef\r
159EFI_STATUS\r
160(EFIAPI *EFI_DATA_HUB_REGISTER_FILTER_DRIVER) (\r
161 IN EFI_DATA_HUB_PROTOCOL *This,\r
162 IN EFI_EVENT FilterEvent,\r
163 IN EFI_TPL FilterTpl,\r
164 IN UINT64 FilterClass,\r
165 IN EFI_GUID *FilterDataRecordGuid OPTIONAL\r
166 );\r
167\r
168/**\r
169 Stops a filter driver from being notified when data records are logged.\r
170\r
171 @param This The EFI_DATA_HUB_PROTOCOL instance.\r
172 @param FilterEvent The EFI_EVENT to remove from the list of events to be\r
173 signaled every time errors are logged.\r
174\r
175 @retval EFI_SUCCESS The filter driver represented by FilterEvent was shut off.\r
176 @retval EFI_NOT_FOUND FilterEvent did not exist.\r
177\r
178**/\r
179typedef\r
180EFI_STATUS\r
181(EFIAPI *EFI_DATA_HUB_UNREGISTER_FILTER_DRIVER) (\r
182 IN EFI_DATA_HUB_PROTOCOL *This,\r
183 IN EFI_EVENT FilterEvent\r
184 );\r
185\r
186/**\r
187 @par Protocol Description:\r
188 This protocol is used to log information and register filter drivers\r
189 to receive data records.\r
190\r
191 @param LogData\r
192 Logs a data record.\r
193\r
194 @param GetNextDataRecord\r
195 Gets a data record. Used both to view the memory-based log and to\r
196 get information about which data records have been consumed by a filter driver.\r
197\r
198 @param RegisterFilterDriver\r
199 Allows the registration of an EFI event to act as a filter driver for all data records that are logged.\r
200\r
201 @param UnregisterFilterDriver\r
202 Used to remove a filter driver that was added with RegisterFilterDriver().\r
203\r
204**/\r
205struct _EFI_DATA_HUB_PROTOCOL {\r
206 EFI_DATA_HUB_LOG_DATA LogData;\r
207 EFI_DATA_HUB_GET_NEXT_RECORD GetNextRecord;\r
208 EFI_DATA_HUB_REGISTER_FILTER_DRIVER RegisterFilterDriver;\r
209 EFI_DATA_HUB_UNREGISTER_FILTER_DRIVER UnregisterFilterDriver;\r
210};\r
211\r
212extern EFI_GUID gEfiDataHubProtocolGuid;\r
213\r
214#endif\r