Initial directory structure of IntelFrameworkPkg.
[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
26#ifndef _DATA_HUB_H_\r
27#define _DATA_HUB_H_\r
28\r
29#define EFI_DATA_HUB_PROTOCOL_GUID \\r
30 { \\r
31 0xae80d021, 0x618e, 0x11d4, {0xbc, 0xd7, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } \\r
32 }\r
33\r
34//\r
35// EFI generic Data Hub Header\r
36//\r
37// A Data Record is an EFI_DATA_RECORD_HEADER followed by RecordSize bytes of\r
38// data. The format of the data is defined by the DataRecordGuid.\r
39//\r
40// If EFI_DATA_RECORD_HEADER is extended in the future the Version number must\r
41// change and the HeaderSize will change if the definition of\r
42// EFI_DATA_RECORD_HEADER is extended.\r
43//\r
44// The logger is responcible for initializing:\r
45// Version, HeaderSize, RecordSize, DataRecordGuid, DataRecordClass\r
46//\r
47// The Data Hub driver is responcible for initializing:\r
48// LogTime and LogMonotonicCount.\r
49//\r
50#define EFI_DATA_RECORD_HEADER_VERSION 0x0100\r
51typedef struct {\r
52 UINT16 Version;\r
53 UINT16 HeaderSize;\r
54 UINT32 RecordSize;\r
55 EFI_GUID DataRecordGuid;\r
56 EFI_GUID ProducerName;\r
57 UINT64 DataRecordClass;\r
58 EFI_TIME LogTime;\r
59 UINT64 LogMonotonicCount;\r
60} EFI_DATA_RECORD_HEADER;\r
61\r
62//\r
63// Definition of DataRecordClass. These are used to filter out class types\r
64// at a very high level. The DataRecordGuid still defines the format of\r
65// the data. See DateHub.doc for rules on what can and can not be a\r
66// new DataRecordClass\r
67//\r
68#define EFI_DATA_RECORD_CLASS_DEBUG 0x0000000000000001\r
69#define EFI_DATA_RECORD_CLASS_ERROR 0x0000000000000002\r
70#define EFI_DATA_RECORD_CLASS_DATA 0x0000000000000004\r
71#define EFI_DATA_RECORD_CLASS_PROGRESS_CODE 0x0000000000000008\r
72\r
73//\r
74// Forward reference for pure ANSI compatability\r
75//\r
76typedef struct _EFI_DATA_HUB_PROTOCOL EFI_DATA_HUB_PROTOCOL;\r
77\r
78/**\r
79 Logs a data record to the system event log.\r
80\r
81 @param This The EFI_DATA_HUB_PROTOCOL instance.\r
82 @param description\r
83 @param DataRecordGuid A GUID that indicates the format of the data passed into RawData.\r
84 @param ProducerName A GUID that indicates the identity of the caller to this API.\r
85 @param DataRecordClass This class indicates the generic type of the data record.\r
86 @param RawData The DataRecordGuid-defined data to be logged.\r
87 @param RawDataSize The size in bytes of RawData.\r
88\r
89 @retval EFI_SUCCESS Data was logged.\r
90 @retval EFI_OUT_OF_RESOURCES Data was not logged due to lack of system resources.\r
91\r
92**/\r
93typedef\r
94EFI_STATUS\r
95(EFIAPI *EFI_DATA_HUB_LOG_DATA) (\r
96 IN EFI_DATA_HUB_PROTOCOL *This,\r
97 IN EFI_GUID *DataRecordGuid,\r
98 IN EFI_GUID *ProducerName,\r
99 IN UINT64 DataRecordClass,\r
100 IN VOID *RawData,\r
101 IN UINT32 RawDataSize\r
102 );\r
103\r
104/**\r
105 Allows the system data log to be searched.\r
106\r
107 @param This The EFI_DATA_HUB_PROTOCOL instance.\r
108 @param MonotonicCount On input, it specifies the Record to return.\r
109 An input of zero means to return the first record.\r
110 @param FilterDriver If FilterDriver is not passed in a MonotonicCount of zero,\r
111 it means to return the first data record. If FilterDriver is passed in,\r
112 then a MonotonicCount of zero means to return the first data not yet read\r
113 by FilterDriver.\r
114 @param Record Returns a dynamically allocated memory buffer with a data\r
115 record that matches MonotonicCount.\r
116\r
117 @retval EFI_SUCCESS Data was returned in Record.\r
118 @retval EFI_INVALID_PARAMETER FilterDriver was passed in but does not exist.\r
119 @retval EFI_NOT_FOUND MonotonicCount does not match any data record\r
120 in the system. If a MonotonicCount of zero was passed in, then no\r
121 data records exist in the system.\r
122 @retval EFI_OUT_OF_RESOURCES Record was not returned due to lack\r
123 of system resources.\r
124\r
125**/\r
126typedef\r
127EFI_STATUS\r
128(EFIAPI *EFI_DATA_HUB_GET_NEXT_RECORD) (\r
129 IN EFI_DATA_HUB_PROTOCOL *This,\r
130 IN OUT UINT64 *MonotonicCount,\r
131 IN EFI_EVENT *FilterDriver OPTIONAL,\r
132 OUT EFI_DATA_RECORD_HEADER **Record\r
133 );\r
134\r
135/**\r
136 Registers an event to be signaled every time a data record is logged in the system.\r
137\r
138 @param This The EFI_DATA_HUB_PROTOCOL instance.\r
139 @param FilterEvent The EFI_EVENT to signal whenever data that matches\r
140 FilterClass is logged in the system.\r
141 @param FilterTpl The maximum EFI_TPL at which FilterEvent can be signaled.\r
142 It is strongly recommended that you use the lowest EFI_TPL possible.\r
143 @param FilterClass FilterEvent will be signaled whenever a bit\r
144 in EFI_DATA_RECORD_HEADER.DataRecordClass is also set in FilterClass.\r
145 If FilterClass is zero, no class-based filtering will be performed.\r
146 @param FilterDataRecordGuid FilterEvent will be signaled whenever\r
147 FilterDataRecordGuid matches EFI_DATA_RECORD_HEADER.DataRecordGuid.\r
148 If FilterDataRecordGuid is NULL, then no GUID-based filtering will be performed.\r
149\r
150 @retval EFI_SUCCESS The filter driver event was registered\r
151 @retval EFI_ALREADY_STARTED FilterEvent was previously registered and cannot be registered again.\r
152 @retval EFI_OUT_OF_RESOURCES The filter driver event was not registered\r
153 due to lack of system resources.\r
154\r
155**/\r
156typedef\r
157EFI_STATUS\r
158(EFIAPI *EFI_DATA_HUB_REGISTER_FILTER_DRIVER) (\r
159 IN EFI_DATA_HUB_PROTOCOL *This,\r
160 IN EFI_EVENT FilterEvent,\r
161 IN EFI_TPL FilterTpl,\r
162 IN UINT64 FilterClass,\r
163 IN EFI_GUID *FilterDataRecordGuid OPTIONAL\r
164 );\r
165\r
166/**\r
167 Stops a filter driver from being notified when data records are logged.\r
168\r
169 @param This The EFI_DATA_HUB_PROTOCOL instance.\r
170 @param FilterEvent The EFI_EVENT to remove from the list of events to be\r
171 signaled every time errors are logged.\r
172\r
173 @retval EFI_SUCCESS The filter driver represented by FilterEvent was shut off.\r
174 @retval EFI_NOT_FOUND FilterEvent did not exist.\r
175\r
176**/\r
177typedef\r
178EFI_STATUS\r
179(EFIAPI *EFI_DATA_HUB_UNREGISTER_FILTER_DRIVER) (\r
180 IN EFI_DATA_HUB_PROTOCOL *This,\r
181 IN EFI_EVENT FilterEvent\r
182 );\r
183\r
184/**\r
185 @par Protocol Description:\r
186 This protocol is used to log information and register filter drivers\r
187 to receive data records.\r
188\r
189 @param LogData\r
190 Logs a data record.\r
191\r
192 @param GetNextDataRecord\r
193 Gets a data record. Used both to view the memory-based log and to\r
194 get information about which data records have been consumed by a filter driver.\r
195\r
196 @param RegisterFilterDriver\r
197 Allows the registration of an EFI event to act as a filter driver for all data records that are logged.\r
198\r
199 @param UnregisterFilterDriver\r
200 Used to remove a filter driver that was added with RegisterFilterDriver().\r
201\r
202**/\r
203struct _EFI_DATA_HUB_PROTOCOL {\r
204 EFI_DATA_HUB_LOG_DATA LogData;\r
205 EFI_DATA_HUB_GET_NEXT_RECORD GetNextRecord;\r
206 EFI_DATA_HUB_REGISTER_FILTER_DRIVER RegisterFilterDriver;\r
207 EFI_DATA_HUB_UNREGISTER_FILTER_DRIVER UnregisterFilterDriver;\r
208};\r
209\r
210extern EFI_GUID gEfiDataHubProtocolGuid;\r
211\r
212#endif\r