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