]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Ppi/PiPcd.h
1, Correct the name of PCD_PPI_CALLBACK to EFI_PCD_PPI_CALLBACK
[mirror_edk2.git] / MdePkg / Include / Ppi / PiPcd.h
1 /** @file
2 Platform Configuration Database (PCD) Protocol defined in PI 1.2 Vol3
3
4 A platform database that contains a variety of current platform settings or
5 directives that can be accessed by a driver or application.
6 PI PCD protocol only provide the accessing interfaces for Dynamic-Ex type PCD.
7
8 Callers to this protocol must be at a TPL_APPLICATION task priority level.
9 This is the base PCD service API that provides an abstraction for accessing configuration content in
10 the platform. It a seamless mechanism for extracting information regardless of where the
11 information is stored (such as in Read-only data, or an EFI Variable).
12 This protocol allows access to data through size-granular APIs and provides a mechanism for a
13 firmware component to monitor specific settings and be alerted when a setting is changed.
14
15 Copyright (c) 2009, Intel Corporation
16 All rights reserved. This program and the accompanying materials
17 are licensed and made available under the terms and conditions of the BSD License
18 which accompanies this distribution. The full text of the license may be found at
19 http://opensource.org/licenses/bsd-license.php
20
21 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
22 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
23
24 @par Revision Reference:
25 PI Version 1.2 Vol 3.
26 **/
27
28 #ifndef __PI_PCD_PPI_H__
29 #define __PI_PCD_PPI_H__
30
31 extern EFI_GUID gEfiPeiPcdPpiGuid;
32
33 #define EFI_PEI_PCD_PPI_GUID \
34 { 0x1f34d25, 0x4de2, 0x23ad, { 0x3f, 0xf3, 0x36, 0x35, 0x3f, 0xf3, 0x23, 0xf1 } }
35
36 #define EFI_PCD_INVALID_TOKEN_NUMBER ((UINTN) 0)
37
38 /**
39 SetSku() sets the SKU Id to be used for subsequent calls to set or get PCD values. SetSku() is
40 normally called only once by the system.
41 For each item (token), the database can hold a single value that applies to all SKUs, or multiple
42 values, where each value is associated with a specific SKU Id. Items with multiple, SKU-specific
43 values are called SKU enabled.
44 The SKU Id of zero is reserved as a default. The valid SkuId range is 1 to 255. For tokens that are
45 not SKU enabled, the system ignores any set SKU Id and works with the single value for that token.
46 For SKU-enabled tokens, the system will use the SKU Id set by the last call to SetSku(). If no
47 SKU Id is set or the currently set SKU Id isn't valid for the specified token, the system uses the
48 default SKU Id. If the system attempts to use the default SKU Id and no value has been set for that
49 Id, the results are unpredictable.
50
51 @param[in] SkuId The SKU value to set.
52 **/
53 typedef
54 VOID
55 (EFIAPI *EFI_PEI_PCD_PPI_SET_SKU)(
56 IN UINTN SkuId
57 );
58
59 /**
60 Retrieves the current byte-sized value for a PCD token number. If the TokenNumber is invalid,
61 the results are unpredictable.
62
63 @param[in] Guid The 128-bit unique value that designates which namespace to extract the value from.
64 @param[in] TokenNumber The PCD token number.
65
66 @return 8-bit value for a given PCD token.
67 **/
68 typedef
69 UINT8
70 (EFIAPI *EFI_PEI_PCD_PPI_GET_EX_8)(
71 IN CONST EFI_GUID *Guid,
72 IN UINTN TokenNumber
73 );
74
75 /**
76 Retrieves the current byte-sized value for a PCD token number. If the TokenNumber is invalid,
77 the results are unpredictable.
78
79 @param[in] Guid The 128-bit unique value that designates which namespace to extract the value from.
80 @param[in] TokenNumber The PCD token number.
81
82 @return 16-bit value for a given PCD token.
83 **/
84 typedef
85 UINT16
86 (EFIAPI *EFI_PEI_PCD_PPI_GET_EX_16)(
87 IN CONST EFI_GUID *Guid,
88 IN UINTN TokenNumber
89 );
90
91 /**
92 Retrieves the current 32-bit value for a PCD token number. If the TokenNumber is invalid, the
93 results are unpredictable.
94
95 @param[in] Guid The 128-bit unique value that designates which namespace to extract the value from.
96 @param[in] TokenNumber The PCD token number.
97
98 @return 32-bit value for a given PCD token.
99 **/
100 typedef
101 UINT32
102 (EFIAPI *EFI_PEI_PCD_PPI_GET_EX_32)(
103 IN CONST EFI_GUID *Guid,
104 IN UINTN TokenNumber
105 );
106
107 /**
108 Retrieves the current 64-bit value for a PCD token number. If the TokenNumber is invalid, the
109 results are unpredictable.
110
111 @param[in] Guid The 128-bit unique value that designates which namespace to extract the value from.
112 @param[in] TokenNumber The PCD token number.
113
114 @return 64-bit value for a given PCD token.
115 **/
116 typedef
117 UINT32
118 (EFIAPI *EFI_PEI_PCD_PPI_GET_EX_64)(
119 IN CONST EFI_GUID *Guid,
120 IN UINTN TokenNumber
121 );
122
123 /**
124 Retrieves the current pointer to the value for a PCD token number. There should not be any
125 alignment assumptions about the pointer that is returned by this function call. If the TokenNumber
126 is invalid, the results are unpredictable.
127
128 @param[in] Guid The 128-bit unique value that designates which namespace to extract the value from.
129 @param[in] TokenNumber The PCD token number.
130 **/
131 typedef
132 VOID *
133 (EFIAPI *EFI_PEI_PCD_PPI_GET_EX_POINTER)(
134 IN CONST EFI_GUID *Guid,
135 IN UINTN TokenNumber
136 );
137
138 /**
139 Retrieves the current Boolean-sized value for a PCD token number. If the TokenNumber is
140 invalid, the results are unpredictable.
141
142 @param[in] Guid The 128-bit unique value that designates which namespace to extract the value from.
143 @param[in] TokenNumber The PCD token number.
144
145 @return Boolean value for a given PCD token.
146 **/
147 typedef
148 BOOLEAN
149 (EFIAPI *EFI_PEI_PCD_PPI_GET_EX_BOOLEAN)(
150 IN CONST EFI_GUID *Guid,
151 IN UINTN TokenNumber
152 );
153
154 /**
155 Retrieves the current size of a particular PCD token. If the TokenNumber is invalid, the results are
156 unpredictable.
157
158 @param[in] Guid The 128-bit unique value that designates which namespace to extract the value from.
159 @param[in] TokenNumber The PCD token number.
160
161 @return the size of the value for a given PCD token.
162 **/
163 typedef
164 UINTN
165 (EFIAPI *EFI_PEI_PCD_PPI_GET_EX_SIZE)(
166 IN CONST EFI_GUID *Guid,
167 IN UINTN TokenNumber
168 );
169
170 /**
171 Sets an 8-bit value for a given PCD token.
172
173 When the PCD service sets a value, it will check to ensure that the size of the value being set is
174 compatible with the Token's existing definition. If it is not, an error will be returned.
175
176 @param[in] Guid The 128-bit unique value that designates which namespace to extract the value from.
177 @param[in] TokenNumber The PCD token number.
178 @param[in] Value The value to set for the PCD token.
179
180 @retval EFI_SUCCESS The PCD service has set the value requested
181 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data being set was
182 incompatible with a call to this function. Use GetSizeEx() to
183 retrieve the size of the target data.
184 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
185 **/
186 typedef
187 EFI_STATUS
188 (EFIAPI *EFI_PEI_PCD_PPI_SET_EX_8)(
189 IN CONST EFI_GUID *Guid,
190 IN UINTN TokenNumber,
191 IN UINT8 Value
192 );
193
194 /**
195 Sets an 16-bit value for a given PCD token.
196
197 When the PCD service sets a value, it will check to ensure that the size of the value being set is
198 compatible with the Token's existing definition. If it is not, an error will be returned.
199
200 @param[in] Guid The 128-bit unique value that designates which namespace to extract the value from.
201 @param[in] TokenNumber The PCD token number.
202 @param[in] Value The value to set for the PCD token.
203
204 @retval EFI_SUCCESS The PCD service has set the value requested
205 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data being set was
206 incompatible with a call to this function. Use GetSizeEx() to
207 retrieve the size of the target data.
208 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
209 **/
210 typedef
211 EFI_STATUS
212 (EFIAPI *EFI_PEI_PCD_PPI_SET_EX_16)(
213 IN CONST EFI_GUID *Guid,
214 IN UINTN TokenNumber,
215 IN UINT16 Value
216 );
217
218 /**
219 Sets an 32-bit value for a given PCD token.
220
221 When the PCD service sets a value, it will check to ensure that the size of the value being set is
222 compatible with the Token's existing definition. If it is not, an error will be returned.
223
224 @param[in] Guid The 128-bit unique value that designates which namespace to extract the value from.
225 @param[in] TokenNumber The PCD token number.
226 @param[in] Value The value to set for the PCD token.
227
228 @retval EFI_SUCCESS The PCD service has set the value requested
229 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data being set was
230 incompatible with a call to this function. Use GetSizeEx() to
231 retrieve the size of the target data.
232 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
233 **/
234 typedef
235 EFI_STATUS
236 (EFIAPI *EFI_PEI_PCD_PPI_SET_EX_32)(
237 IN CONST EFI_GUID *Guid,
238 IN UINTN TokenNumber,
239 IN UINT32 Value
240 );
241
242 /**
243 Sets an 64-bit value for a given PCD token.
244
245 When the PCD service sets a value, it will check to ensure that the size of the value being set is
246 compatible with the Token's existing definition. If it is not, an error will be returned.
247
248 @param[in] Guid The 128-bit unique value that designates which namespace to extract the value from.
249 @param[in] TokenNumber The PCD token number.
250 @param[in] Value The value to set for the PCD token.
251
252 @retval EFI_SUCCESS The PCD service has set the value requested
253 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data being set was
254 incompatible with a call to this function. Use GetSizeEx() to
255 retrieve the size of the target data.
256 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
257 **/
258 typedef
259 EFI_STATUS
260 (EFIAPI *EFI_PEI_PCD_PPI_SET_EX_64)(
261 IN CONST EFI_GUID *Guid,
262 IN UINTN TokenNumber,
263 IN UINT64 Value
264 );
265
266 /**
267 Sets a value of the specified size for a given PCD token.
268
269 When the PCD service sets a value, it will check to ensure that the size of the value being set is
270 compatible with the Token's existing definition. If it is not, an error will be returned.
271
272 @param[in] Guid The 128-bit unique value that designates which namespace to extract the value from.
273 @param[in] TokenNumber The PCD token number.
274 @param[in] SizeOfValue The length of the Value being set for the PCD token.
275 @param[in] Buffer A pointer to the buffer containing the value to set for the PCD token.
276
277 @retval EFI_SUCCESS The PCD service has set the value requested
278 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data being set was
279 incompatible with a call to this function. Use GetSizeEx() to
280 retrieve the size of the target data.
281 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
282 **/
283 typedef
284 EFI_STATUS
285 (EFIAPI *EFI_PEI_PCD_PPI_SET_EX_POINTER)(
286 IN CONST EFI_GUID *Guid,
287 IN UINTN TokenNumber,
288 IN UINTN SizeOfValue,
289 IN VOID *Buffer
290 );
291
292 /**
293 Sets a Boolean value for a given PCD token.
294
295 When the PCD service sets a value, it will check to ensure that the size of the value being set is
296 compatible with the Token's existing definition. If it is not, an error will be returned.
297
298 @param[in] Guid The 128-bit unique value that designates which namespace to extract the value from.
299 @param[in] TokenNumber The PCD token number.
300 @param[in] Value The value to set for the PCD token.
301
302 @retval EFI_SUCCESS The PCD service has set the value requested
303 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data being set was
304 incompatible with a call to this function. Use GetSizeEx() to
305 retrieve the size of the target data.
306 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
307 **/
308 typedef
309 EFI_STATUS
310 (EFIAPI *EFI_PEI_PCD_PPI_SET_EX_BOOLEAN)(
311 IN CONST EFI_GUID *Guid,
312 IN UINTN TokenNumber,
313 IN BOOLEAN Value
314 );
315
316 typedef
317 VOID
318 (EFIAPI *EFI_PCD_PPI_CALLBACK)(
319 IN EFI_GUID *Guid OPTIONAL,
320 IN UINTN CallBackToken,
321 IN VOID *TokenData,
322 IN UINTN TokenDatSize
323 );
324
325 /**
326 Specifies a function to be called anytime the value of a designated token is changed.
327
328 @param[in] Guid The 128-bit unique value that designates which namespace to monitor. If NULL, use
329 the standard platform namespace.
330 @param[in] CallBackToken The PCD token number to monitor.
331 @param[in] CallBackFunction The function prototype that will be called when the value associated with the
332 CallBackToken is set.
333
334 @retval EFI_SUCCESS The PCD service has successfully established a call event for the
335 CallBackToken requested.
336 @retval EFI_NOT_FOUND The PCD service could not find the referenced token number.
337 **/
338 typedef
339 EFI_STATUS
340 (EFIAPI *EFI_PEI_PCD_PPI_CALLBACK_ON_SET)(
341 IN CONST EFI_GUID *Guid OPTIONAL,
342 IN UINTN CallBackToken,
343 IN EFI_PCD_PPI_CALLBACK CallBackFunction
344 );
345
346 /**
347 Cancels a previously set callback function for a particular PCD token number.
348
349 @param[in] Guid The 128-bit unique value that designates which namespace to monitor. If NULL, use
350 the standard platform namespace.
351 @param[in] CallBackToken The PCD token number to cancel monitoring.
352 @param[in] CallBackFunction The function prototype that was originally passed to the CallBackOnSet function.
353
354 @retval EFI_SUCCESS The PCD service has cancelled the call event associated with the
355 CallBackToken.
356 @retval EFI_INVALID_PARAMETER The PCD service did not match the CallBackFunction to one
357 that is currently being monitored.
358 @retval EFI_NOT_FOUND The PCD service could not find data the requested token number.
359 **/
360 typedef
361 EFI_STATUS
362 (EFIAPI *EFI_PEI_PCD_PPI_CANCEL_CALLBACK)(
363 IN CONST EFI_GUID *Guid OPTIONAL,
364 IN UINTN CallBackToken,
365 IN EFI_PCD_PPI_CALLBACK CallBackFunction
366 );
367
368 /**
369 Retrieves the next valid PCD token for a given namespace.
370
371 This provides a means by which to get the next valid token number in a given namespace. This is
372 useful since the PCD infrastructure has a sparse list of token numbers in it, and one cannot a priori
373 know what token numbers are valid in the database.
374
375 @param[in] Guid The 128-bit unique value that designates which namespace to extract the value from.
376 @param[in] TokenNumber The PCD token number.
377
378 @retval EFI_SUCCESS The PCD service has retrieved the value requested.
379 @retval EFI_NOT_FOUND The PCD service could not find data from the requested token number.
380 **/
381 typedef
382 EFI_STATUS
383 (EFIAPI *EFI_PEI_PCD_PPI_GET_NEXT_TOKEN)(
384 IN CONST EFI_GUID *Guid OPTIONAL,
385 IN UINTN *TokenNumber
386 );
387
388 /**
389 Retrieves the next valid PCD token namespace for a given namespace.
390
391 Gets the next valid token namespace for a given namespace. This is useful to traverse the valid
392 token namespaces on a platform.
393
394 @param[in, out] Guid An indirect pointer to EFI_GUID. On input it designates a known token
395 namespace from which the search will start. On output, it designates the next valid
396 token namespace on the platform. If *Guid is NULL, then the GUID of the first token
397 space of the current platform is returned. If the search cannot locate the next valid
398 token namespace, an error is returned and the value of *Guid is undefined.
399
400 @retval EFI_SUCCESS The PCD service retrieved the value requested.
401 @retval EFI_NOT_FOUND The PCD service could not find the next valid token namespace.
402 **/
403 typedef
404 EFI_STATUS
405 (EFIAPI *EFI_PEI_PCD_PPI_GET_NEXT_TOKEN_SPACE)(
406 IN OUT CONST EFI_GUID **Guid
407 );
408
409 typedef struct {
410 EFI_PEI_PCD_PPI_SET_SKU SetSku;
411 EFI_PEI_PCD_PPI_GET_EX_8 GetEx8;
412 EFI_PEI_PCD_PPI_GET_EX_16 GetEx16;
413 EFI_PEI_PCD_PPI_GET_EX_32 GetEx32;
414 EFI_PEI_PCD_PPI_GET_EX_64 GetEx64;
415 EFI_PEI_PCD_PPI_GET_EX_POINTER GetExPtr;
416 EFI_PEI_PCD_PPI_GET_EX_BOOLEAN GetExBool;
417 EFI_PEI_PCD_PPI_GET_EX_SIZE GetExSize;
418 EFI_PEI_PCD_PPI_SET_EX_8 SetEx8;
419 EFI_PEI_PCD_PPI_SET_EX_16 SetEx16;
420 EFI_PEI_PCD_PPI_SET_EX_32 SetEx32;
421 EFI_PEI_PCD_PPI_SET_EX_64 SetEx64;
422 EFI_PEI_PCD_PPI_SET_EX_POINTER SetExPtr;
423 EFI_PEI_PCD_PPI_SET_EX_BOOLEAN SetExBool;
424 EFI_PEI_PCD_PPI_CALLBACK_ON_SET CallbackOnSet;
425 EFI_PEI_PCD_PPI_CANCEL_CALLBACK CancelCallback;
426 EFI_PEI_PCD_PPI_GET_NEXT_TOKEN GetNextToken;
427 EFI_PEI_PCD_PPI_GET_NEXT_TOKEN_SPACE GetNextTokenSpace;
428 } EFI_PEI_PCD_PPI;
429
430 #endif