1) Fix bug reported on the PcdSetEx* Macro.
[mirror_edk2.git] / MdePkg / Include / Protocol / Pcd.h
1 /** @file
2 Platform Configuration Database (PCD) Protocol
3
4 Copyright (c) 2006, Intel Corporation
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13 Module Name: Pcd.h
14
15 **/
16
17 #ifndef __PCD_H__
18 #define __PCD_H__
19
20 extern EFI_GUID gPcdProtocolGuid;
21
22 #define PCD_PROTOCOL_GUID \
23 { 0x11b34006, 0xd85b, 0x4d0a, { 0xa2, 0x90, 0xd5, 0xa5, 0x71, 0x31, 0xe, 0xf7 } }
24
25 typedef UINT8 SKU_ID;
26
27 typedef
28 EFI_STATUS
29 (EFIAPI *PCD_PROTOCOL_SET_SKU) (
30 IN UINTN SkuId
31 );
32
33 typedef
34 UINT8
35 (EFIAPI *PCD_PROTOCOL_GET8) (
36 IN UINTN TokenNumber
37 );
38
39 typedef
40 UINT16
41 (EFIAPI *PCD_PROTOCOL_GET16) (
42 IN UINTN TokenNumber
43 );
44
45 typedef
46 UINT32
47 (EFIAPI *PCD_PROTOCOL_GET32) (
48 IN UINTN TokenNumber
49 );
50
51 typedef
52 UINT64
53 (EFIAPI *PCD_PROTOCOL_GET64) (
54 IN UINTN TokenNumber
55 );
56
57 typedef
58 VOID *
59 (EFIAPI *PCD_PROTOCOL_GET_POINTER) (
60 IN UINTN TokenNumber
61 );
62
63 typedef
64 BOOLEAN
65 (EFIAPI *PCD_PROTOCOL_GET_BOOLEAN) (
66 IN UINTN TokenNumber
67 );
68
69 typedef
70 UINTN
71 (EFIAPI *PCD_PROTOCOL_GET_SIZE) (
72 IN UINTN TokenNumber
73 );
74
75 typedef
76 UINT8
77 (EFIAPI *PCD_PROTOCOL_GET_EX_8) (
78 IN CONST EFI_GUID *Guid,
79 IN UINTN TokenNumber
80 );
81
82 typedef
83 UINT16
84 (EFIAPI *PCD_PROTOCOL_GET_EX_16) (
85 IN CONST EFI_GUID *Guid,
86 IN UINTN TokenNumber
87 );
88
89 typedef
90 UINT32
91 (EFIAPI *PCD_PROTOCOL_GET_EX_32) (
92 IN CONST EFI_GUID *Guid,
93 IN UINTN TokenNumber
94 );
95
96 typedef
97 UINT64
98 (EFIAPI *PCD_PROTOCOL_GET_EX_64) (
99 IN CONST EFI_GUID *Guid,
100 IN UINTN TokenNumber
101 );
102
103 typedef
104 VOID *
105 (EFIAPI *PCD_PROTOCOL_GET_EX_POINTER) (
106 IN CONST EFI_GUID *Guid,
107 IN UINTN TokenNumber
108 );
109
110 typedef
111 BOOLEAN
112 (EFIAPI *PCD_PROTOCOL_GET_EX_BOOLEAN) (
113 IN CONST EFI_GUID *Guid,
114 IN UINTN TokenNumber
115 );
116
117 typedef
118 UINTN
119 (EFIAPI *PCD_PROTOCOL_GET_EX_SIZE) (
120 IN CONST EFI_GUID *Guid,
121 IN UINTN TokenNumber
122 );
123
124 typedef
125 EFI_STATUS
126 (EFIAPI *PCD_PROTOCOL_SET8) (
127 IN UINTN TokenNumber,
128 IN UINT8 Value
129 );
130
131 typedef
132 EFI_STATUS
133 (EFIAPI *PCD_PROTOCOL_SET16) (
134 IN UINTN TokenNumber,
135 IN UINT16 Value
136 );
137
138 typedef
139 EFI_STATUS
140 (EFIAPI *PCD_PROTOCOL_SET32) (
141 IN UINTN TokenNumber,
142 IN UINT32 Value
143 );
144
145 typedef
146 EFI_STATUS
147 (EFIAPI *PCD_PROTOCOL_SET64) (
148 IN UINTN TokenNumber,
149 IN UINT64 Value
150 );
151
152 typedef
153 EFI_STATUS
154 (EFIAPI *PCD_PROTOCOL_SET_POINTER) (
155 IN UINTN TokenNumber,
156 IN CONST VOID *Value
157 );
158
159 typedef
160 EFI_STATUS
161 (EFIAPI *PCD_PROTOCOL_SET_BOOLEAN) (
162 IN UINTN TokenNumber,
163 IN BOOLEAN Value
164 );
165
166 typedef
167 EFI_STATUS
168 (EFIAPI *PCD_PROTOCOL_SET_EX_8) (
169 IN CONST EFI_GUID *Guid,
170 IN UINTN TokenNumber,
171 IN UINT8 Value
172 );
173
174 typedef
175 EFI_STATUS
176 (EFIAPI *PCD_PROTOCOL_SET_EX_16) (
177 IN CONST EFI_GUID *Guid,
178 IN UINTN TokenNumber,
179 IN UINT16 Value
180 );
181
182 typedef
183 EFI_STATUS
184 (EFIAPI *PCD_PROTOCOL_SET_EX_32) (
185 IN CONST EFI_GUID *Guid,
186 IN UINTN TokenNumber,
187 IN UINT32 Value
188 );
189
190 typedef
191 EFI_STATUS
192 (EFIAPI *PCD_PROTOCOL_SET_EX_64) (
193 IN CONST EFI_GUID *Guid,
194 IN UINTN TokenNumber,
195 IN UINT64 Value
196 );
197
198 typedef
199 EFI_STATUS
200 (EFIAPI *PCD_PROTOCOL_SET_EX_POINTER) (
201 IN CONST EFI_GUID *Guid,
202 IN UINTN TokenNumber,
203 IN CONST VOID *Value
204 );
205
206 typedef
207 EFI_STATUS
208 (EFIAPI *PCD_PROTOCOL_SET_EX_BOOLEAN) (
209 IN CONST EFI_GUID *Guid,
210 IN UINTN TokenNumber,
211 IN BOOLEAN Value
212 );
213
214 /**
215 Callback on SET function prototype definition.
216
217 @param[in] CallBackGuid The PCD token GUID being set.
218 @param[in] CallBackToken The PCD token number being set.
219 @param[in] TokenData A pointer to the token data being set.
220 @param[in] TokenDataSize The size, in bytes, of the data being set.
221
222 @retval VOID
223
224 --*/
225 typedef
226 VOID
227 (EFIAPI *PCD_PROTOCOL_CALLBACK) (
228 IN CONST EFI_GUID *CallBackGuid, OPTIONAL
229 IN UINTN CallBackToken,
230 IN VOID *TokenData,
231 IN UINTN TokenDataSize
232 );
233
234 typedef
235 EFI_STATUS
236 (EFIAPI *PCD_PROTOCOL_CALLBACK_ONSET) (
237 IN UINTN TokenNumber,
238 IN CONST EFI_GUID *Guid, OPTIONAL
239 IN PCD_PROTOCOL_CALLBACK CallBackFunction
240 );
241
242 typedef
243 EFI_STATUS
244 (EFIAPI *PCD_PROTOCOL_CANCEL_CALLBACK) (
245 IN UINTN TokenNumber,
246 IN CONST EFI_GUID *Guid, OPTIONAL
247 IN PCD_PROTOCOL_CALLBACK CallBackFunction
248 );
249
250 typedef
251 EFI_STATUS
252 (EFIAPI *PCD_PROTOCOL_GET_NEXT_TOKEN) (
253 IN CONST EFI_GUID *Guid, OPTIONAL
254 IN OUT UINTN *TokenNumber
255 );
256
257 typedef struct {
258 PCD_PROTOCOL_SET_SKU SetSku;
259
260 PCD_PROTOCOL_GET8 Get8;
261 PCD_PROTOCOL_GET16 Get16;
262 PCD_PROTOCOL_GET32 Get32;
263 PCD_PROTOCOL_GET64 Get64;
264 PCD_PROTOCOL_GET_POINTER GetPtr;
265 PCD_PROTOCOL_GET_BOOLEAN GetBool;
266 PCD_PROTOCOL_GET_SIZE GetSize;
267
268 PCD_PROTOCOL_GET_EX_8 Get8Ex;
269 PCD_PROTOCOL_GET_EX_16 Get16Ex;
270 PCD_PROTOCOL_GET_EX_32 Get32Ex;
271 PCD_PROTOCOL_GET_EX_64 Get64Ex;
272 PCD_PROTOCOL_GET_EX_POINTER GetPtrEx;
273 PCD_PROTOCOL_GET_EX_BOOLEAN GetBoolEx;
274 PCD_PROTOCOL_GET_EX_SIZE GetSizeEx;
275
276 PCD_PROTOCOL_SET8 Set8;
277 PCD_PROTOCOL_SET16 Set16;
278 PCD_PROTOCOL_SET32 Set32;
279 PCD_PROTOCOL_SET64 Set64;
280 PCD_PROTOCOL_SET_POINTER SetPtr;
281 PCD_PROTOCOL_SET_BOOLEAN SetBool;
282
283 PCD_PROTOCOL_SET_EX_8 Set8Ex;
284 PCD_PROTOCOL_SET_EX_16 Set16Ex;
285 PCD_PROTOCOL_SET_EX_32 Set32Ex;
286 PCD_PROTOCOL_SET_EX_64 Set64Ex;
287 PCD_PROTOCOL_SET_EX_POINTER SetPtrEx;
288 PCD_PROTOCOL_SET_EX_BOOLEAN SetBoolEx;
289
290 PCD_PROTOCOL_CALLBACK_ONSET CallbackOnSet;
291 PCD_PROTOCOL_CANCEL_CALLBACK CancelCallback;
292 PCD_PROTOCOL_GET_NEXT_TOKEN GetNextToken;
293 } PCD_PROTOCOL;
294
295 #endif