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