]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Ppi/PiPcd.h
Update the copyright notice format
[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 - 2010, Intel Corporation. All rights reserved.<BR>
16 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_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_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_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 UINT64
118 (EFIAPI *EFI_PEI_PCD_PPI_GET_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_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_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_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_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_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_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_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. If too large of a length is
275 specified, upon return from this function the value of SizeOfValue will reflect the
276 maximum size for the PCD token.
277 @param[in] Buffer A pointer to the buffer containing the value to set for the PCD token.
278
279 @retval EFI_SUCCESS The PCD service has set the value requested
280 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data being set was
281 incompatible with a call to this function. Use GetSizeEx() to
282 retrieve the size of the target data.
283 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
284 **/
285 typedef
286 EFI_STATUS
287 (EFIAPI *EFI_PEI_PCD_PPI_SET_POINTER)(
288 IN CONST EFI_GUID *Guid,
289 IN UINTN TokenNumber,
290 IN OUT UINTN *SizeOfValue,
291 IN VOID *Buffer
292 );
293
294 /**
295 Sets a Boolean value for a given PCD token.
296
297 When the PCD service sets a value, it will check to ensure that the size of the value being set is
298 compatible with the Token's existing definition. If it is not, an error will be returned.
299
300 @param[in] Guid The 128-bit unique value that designates which namespace to extract the value from.
301 @param[in] TokenNumber The PCD token number.
302 @param[in] Value The value to set for the PCD token.
303
304 @retval EFI_SUCCESS The PCD service has set the value requested
305 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data being set was
306 incompatible with a call to this function. Use GetSizeEx() to
307 retrieve the size of the target data.
308 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
309 **/
310 typedef
311 EFI_STATUS
312 (EFIAPI *EFI_PEI_PCD_PPI_SET_BOOLEAN)(
313 IN CONST EFI_GUID *Guid,
314 IN UINTN TokenNumber,
315 IN BOOLEAN Value
316 );
317
318 typedef
319 VOID
320 (EFIAPI *EFI_PEI_PCD_PPI_CALLBACK)(
321 IN EFI_GUID *Guid OPTIONAL,
322 IN UINTN CallBackToken,
323 IN OUT VOID *TokenData,
324 IN UINTN TokenDatSize
325 );
326
327 /**
328 Specifies a function to be called anytime the value of a designated token is changed.
329
330 @param[in] Guid The 128-bit unique value that designates which namespace to monitor. If NULL, use
331 the standard platform namespace.
332 @param[in] CallBackToken The PCD token number to monitor.
333 @param[in] CallBackFunction The function prototype that will be called when the value associated with the
334 CallBackToken is set.
335
336 @retval EFI_SUCCESS The PCD service has successfully established a call event for the
337 CallBackToken requested.
338 @retval EFI_NOT_FOUND The PCD service could not find the referenced token number.
339 **/
340 typedef
341 EFI_STATUS
342 (EFIAPI *EFI_PEI_PCD_PPI_CALLBACK_ON_SET)(
343 IN CONST EFI_GUID *Guid OPTIONAL,
344 IN UINTN CallBackToken,
345 IN EFI_PEI_PCD_PPI_CALLBACK CallBackFunction
346 );
347
348 /**
349 Cancels a previously set callback function for a particular PCD token number.
350
351 @param[in] Guid The 128-bit unique value that designates which namespace to monitor. If NULL, use
352 the standard platform namespace.
353 @param[in] CallBackToken The PCD token number to cancel monitoring.
354 @param[in] CallBackFunction The function prototype that was originally passed to the CallBackOnSet function.
355
356 @retval EFI_SUCCESS The PCD service has cancelled the call event associated with the
357 CallBackToken.
358 @retval EFI_INVALID_PARAMETER The PCD service did not match the CallBackFunction to one
359 that is currently being monitored.
360 @retval EFI_NOT_FOUND The PCD service could not find data the requested token number.
361 **/
362 typedef
363 EFI_STATUS
364 (EFIAPI *EFI_PEI_PCD_PPI_CANCEL_CALLBACK)(
365 IN CONST EFI_GUID *Guid OPTIONAL,
366 IN UINTN CallBackToken,
367 IN EFI_PEI_PCD_PPI_CALLBACK CallBackFunction
368 );
369
370 /**
371 Retrieves the next valid PCD token for a given namespace.
372
373 This provides a means by which to get the next valid token number in a given namespace. This is
374 useful since the PCD infrastructure has a sparse list of token numbers in it, and one cannot a priori
375 know what token numbers are valid in the database.
376
377 @param[in] Guid The 128-bit unique value that designates which namespace to extract the value from.
378 @param[in] TokenNumber The PCD token number.
379
380 @retval EFI_SUCCESS The PCD service has retrieved the value requested.
381 @retval EFI_NOT_FOUND The PCD service could not find data from the requested token number.
382 **/
383 typedef
384 EFI_STATUS
385 (EFIAPI *EFI_PEI_PCD_PPI_GET_NEXT_TOKEN)(
386 IN CONST EFI_GUID *Guid OPTIONAL,
387 IN UINTN *TokenNumber
388 );
389
390 /**
391 Retrieves the next valid PCD token namespace for a given namespace.
392
393 Gets the next valid token namespace for a given namespace. This is useful to traverse the valid
394 token namespaces on a platform.
395
396 @param[in, out] Guid An indirect pointer to EFI_GUID. On input it designates a known token
397 namespace from which the search will start. On output, it designates the next valid
398 token namespace on the platform. If *Guid is NULL, then the GUID of the first token
399 space of the current platform is returned. If the search cannot locate the next valid
400 token namespace, an error is returned and the value of *Guid is undefined.
401
402 @retval EFI_SUCCESS The PCD service retrieved the value requested.
403 @retval EFI_NOT_FOUND The PCD service could not find the next valid token namespace.
404 **/
405 typedef
406 EFI_STATUS
407 (EFIAPI *EFI_PEI_PCD_PPI_GET_NEXT_TOKEN_SPACE)(
408 IN OUT CONST EFI_GUID **Guid
409 );
410
411 typedef struct {
412 EFI_PEI_PCD_PPI_SET_SKU SetSku;
413 EFI_PEI_PCD_PPI_GET_8 Get8;
414 EFI_PEI_PCD_PPI_GET_16 Get16;
415 EFI_PEI_PCD_PPI_GET_32 Get32;
416 EFI_PEI_PCD_PPI_GET_64 Get64;
417 EFI_PEI_PCD_PPI_GET_POINTER GetPtr;
418 EFI_PEI_PCD_PPI_GET_BOOLEAN GetBool;
419 EFI_PEI_PCD_PPI_GET_SIZE GetSize;
420 EFI_PEI_PCD_PPI_SET_8 Set8;
421 EFI_PEI_PCD_PPI_SET_16 Set16;
422 EFI_PEI_PCD_PPI_SET_32 Set32;
423 EFI_PEI_PCD_PPI_SET_64 Set64;
424 EFI_PEI_PCD_PPI_SET_POINTER SetPtr;
425 EFI_PEI_PCD_PPI_SET_BOOLEAN SetBool;
426 EFI_PEI_PCD_PPI_CALLBACK_ON_SET CallbackOnSet;
427 EFI_PEI_PCD_PPI_CANCEL_CALLBACK CancelCallback;
428 EFI_PEI_PCD_PPI_GET_NEXT_TOKEN GetNextToken;
429 EFI_PEI_PCD_PPI_GET_NEXT_TOKEN_SPACE GetNextTokenSpace;
430 } EFI_PEI_PCD_PPI;
431
432 #endif