]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Protocol/Pcd.h
MdePkg/Include: LoongArch definitions.
[mirror_edk2.git] / MdePkg / Include / Protocol / Pcd.h
CommitLineData
d1f95000 1/** @file\r
9dbad162 2 Native Platform Configuration Database (PCD) Protocol\r
d1f95000 3\r
9dbad162 4 Different with the EFI_PCD_PROTOCOL defined in PI 1.2 specification, the native\r
9095d37b 5 PCD protocol provide interfaces for dynamic and dynamic-ex type PCD.\r
9dbad162 6 The interfaces in dynamic type PCD do not require the token space guid as parameter,\r
7 but interfaces in dynamic-ex type PCD require token space guid as parameter.\r
9095d37b
LG
8\r
9Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
9344f092 10SPDX-License-Identifier: BSD-2-Clause-Patent\r
d1f95000 11\r
497a5fb1
SZ
12 @par Revision Reference:\r
13 This Protocol was introduced in PI Specification 1.2.\r
14\r
d1f95000 15**/\r
16\r
17#ifndef __PCD_H__\r
18#define __PCD_H__\r
19\r
2f88bd3a 20extern EFI_GUID gPcdProtocolGuid;\r
d1f95000 21\r
22#define PCD_PROTOCOL_GUID \\r
23 { 0x11b34006, 0xd85b, 0x4d0a, { 0xa2, 0x90, 0xd5, 0xa5, 0x71, 0x31, 0xe, 0xf7 } }\r
24\r
2f88bd3a 25#define PCD_INVALID_TOKEN_NUMBER ((UINTN) 0)\r
19fd6450 26\r
d1f95000 27/**\r
28 Sets the SKU value for subsequent calls to set or get PCD token values.\r
29\r
9095d37b 30 SetSku() sets the SKU Id to be used for subsequent calls to set or get PCD values.\r
d1f95000 31 SetSku() is normally called only once by the system.\r
32\r
9095d37b
LG
33 For each item (token), the database can hold a single value that applies to all SKUs,\r
34 or multiple values, where each value is associated with a specific SKU Id. Items with multiple,\r
35 SKU-specific values are called SKU enabled.\r
36\r
37 The SKU Id of zero is reserved as a default. The valid SkuId range is 1 to 255.\r
38 For tokens that are not SKU enabled, the system ignores any set SKU Id and works with the\r
39 single value for that token. For SKU-enabled tokens, the system will use the SKU Id set by the\r
40 last call to SetSku(). If no SKU Id is set or the currently set SKU Id isn't valid for the specified token,\r
41 the system uses the default SKU Id. If the system attempts to use the default SKU Id and no value has been\r
d1f95000 42 set for that Id, the results are unpredictable.\r
43\r
9095d37b 44 @param[in] SkuId The SKU value that will be used when the PCD service will retrieve and\r
4ca9b6c4 45 set values associated with a PCD token.\r
d1f95000 46\r
d1f95000 47\r
48**/\r
9095d37b 49typedef\r
d1f95000 50VOID\r
8b13229b 51(EFIAPI *PCD_PROTOCOL_SET_SKU)(\r
d1f95000 52 IN UINTN SkuId\r
53 );\r
54\r
d1f95000 55/**\r
56 Retrieves an 8-bit value for a given PCD token.\r
57\r
9095d37b 58 Retrieves the current byte-sized value for a PCD token number.\r
d1f95000 59 If the TokenNumber is invalid, the results are unpredictable.\r
9095d37b
LG
60\r
61 @param[in] TokenNumber The PCD token number.\r
d1f95000 62\r
63 @return The UINT8 value.\r
9095d37b 64\r
d1f95000 65**/\r
66typedef\r
67UINT8\r
8b13229b 68(EFIAPI *PCD_PROTOCOL_GET8)(\r
d1f95000 69 IN UINTN TokenNumber\r
70 );\r
71\r
d1f95000 72/**\r
630b4187 73 Retrieves a 16-bit value for a given PCD token.\r
d1f95000 74\r
9095d37b 75 Retrieves the current 16-bit value for a PCD token number.\r
d1f95000 76 If the TokenNumber is invalid, the results are unpredictable.\r
9095d37b
LG
77\r
78 @param[in] TokenNumber The PCD token number.\r
d1f95000 79\r
80 @return The UINT16 value.\r
9095d37b 81\r
d1f95000 82**/\r
83typedef\r
84UINT16\r
8b13229b 85(EFIAPI *PCD_PROTOCOL_GET16)(\r
d1f95000 86 IN UINTN TokenNumber\r
87 );\r
88\r
d1f95000 89/**\r
630b4187 90 Retrieves a 32-bit value for a given PCD token.\r
d1f95000 91\r
9095d37b 92 Retrieves the current 32-bit value for a PCD token number.\r
d1f95000 93 If the TokenNumber is invalid, the results are unpredictable.\r
9095d37b
LG
94\r
95 @param[in] TokenNumber The PCD token number.\r
d1f95000 96\r
97 @return The UINT32 value.\r
9095d37b 98\r
d1f95000 99**/\r
100typedef\r
101UINT32\r
8b13229b 102(EFIAPI *PCD_PROTOCOL_GET32)(\r
d1f95000 103 IN UINTN TokenNumber\r
104 );\r
105\r
d1f95000 106/**\r
630b4187 107 Retrieves a 64-bit value for a given PCD token.\r
d1f95000 108\r
9095d37b 109 Retrieves the current 64-bit value for a PCD token number.\r
d1f95000 110 If the TokenNumber is invalid, the results are unpredictable.\r
9095d37b
LG
111\r
112 @param[in] TokenNumber The PCD token number.\r
d1f95000 113\r
114 @return The UINT64 value.\r
9095d37b 115\r
d1f95000 116**/\r
117typedef\r
118UINT64\r
8b13229b 119(EFIAPI *PCD_PROTOCOL_GET64)(\r
d1f95000 120 IN UINTN TokenNumber\r
121 );\r
122\r
d1f95000 123/**\r
124 Retrieves a pointer to a value for a given PCD token.\r
125\r
9095d37b
LG
126 Retrieves the current pointer to the buffer for a PCD token number.\r
127 Do not make any assumptions about the alignment of the pointer that\r
128 is returned by this function call. If the TokenNumber is invalid,\r
d1f95000 129 the results are unpredictable.\r
130\r
9095d37b 131 @param[in] TokenNumber The PCD token number.\r
d1f95000 132\r
133 @return The pointer to the buffer to be retrived.\r
9095d37b 134\r
d1f95000 135**/\r
136typedef\r
137VOID *\r
8b13229b 138(EFIAPI *PCD_PROTOCOL_GET_POINTER)(\r
d1f95000 139 IN UINTN TokenNumber\r
140 );\r
141\r
d1f95000 142/**\r
143 Retrieves a Boolean value for a given PCD token.\r
144\r
9095d37b
LG
145 Retrieves the current boolean value for a PCD token number.\r
146 Do not make any assumptions about the alignment of the pointer that\r
147 is returned by this function call. If the TokenNumber is invalid,\r
d1f95000 148 the results are unpredictable.\r
149\r
9095d37b 150 @param[in] TokenNumber The PCD token number.\r
d1f95000 151\r
152 @return The Boolean value.\r
9095d37b 153\r
d1f95000 154**/\r
155typedef\r
156BOOLEAN\r
8b13229b 157(EFIAPI *PCD_PROTOCOL_GET_BOOLEAN)(\r
d1f95000 158 IN UINTN TokenNumber\r
159 );\r
160\r
d1f95000 161/**\r
162 Retrieves the size of the value for a given PCD token.\r
163\r
9095d37b 164 Retrieves the current size of a particular PCD token.\r
d1f95000 165 If the TokenNumber is invalid, the results are unpredictable.\r
166\r
9095d37b 167 @param[in] TokenNumber The PCD token number.\r
d1f95000 168\r
169 @return The size of the value for the PCD token.\r
9095d37b 170\r
d1f95000 171**/\r
172typedef\r
173UINTN\r
8b13229b 174(EFIAPI *PCD_PROTOCOL_GET_SIZE)(\r
d1f95000 175 IN UINTN TokenNumber\r
176 );\r
177\r
d1f95000 178/**\r
179 Retrieves an 8-bit value for a given PCD token.\r
180\r
9095d37b 181 Retrieves the 8-bit value of a particular PCD token.\r
d1f95000 182 If the TokenNumber is invalid or the token space\r
9095d37b 183 specified by Guid does not exist, the results are\r
d1f95000 184 unpredictable.\r
185\r
4ca9b6c4 186 @param[in] Guid The token space for the token number.\r
9095d37b 187 @param[in] TokenNumber The PCD token number.\r
d1f95000 188\r
189 @return The size 8-bit value for the PCD token.\r
9095d37b 190\r
d1f95000 191**/\r
192typedef\r
193UINT8\r
8b13229b 194(EFIAPI *PCD_PROTOCOL_GET_EX_8)(\r
d1f95000 195 IN CONST EFI_GUID *Guid,\r
196 IN UINTN TokenNumber\r
197 );\r
198\r
d1f95000 199/**\r
630b4187 200 Retrieves a 16-bit value for a given PCD token.\r
d1f95000 201\r
9095d37b 202 Retrieves the 16-bit value of a particular PCD token.\r
d1f95000 203 If the TokenNumber is invalid or the token space\r
9095d37b 204 specified by Guid does not exist, the results are\r
d1f95000 205 unpredictable.\r
206\r
4ca9b6c4 207 @param[in] Guid The token space for the token number.\r
9095d37b 208 @param[in] TokenNumber The PCD token number.\r
d1f95000 209\r
210 @return The size 16-bit value for the PCD token.\r
9095d37b 211\r
d1f95000 212**/\r
213typedef\r
214UINT16\r
8b13229b 215(EFIAPI *PCD_PROTOCOL_GET_EX_16)(\r
d1f95000 216 IN CONST EFI_GUID *Guid,\r
217 IN UINTN TokenNumber\r
218 );\r
219\r
d1f95000 220/**\r
630b4187 221 Retrieves a 32-bit value for a given PCD token.\r
d1f95000 222\r
9095d37b 223 Retrieves the 32-bit value of a particular PCD token.\r
d1f95000 224 If the TokenNumber is invalid or the token space\r
9095d37b 225 specified by Guid does not exist, the results are\r
d1f95000 226 unpredictable.\r
227\r
4ca9b6c4 228 @param[in] Guid The token space for the token number.\r
9095d37b 229 @param[in] TokenNumber The PCD token number.\r
d1f95000 230\r
231 @return The size 32-bit value for the PCD token.\r
9095d37b 232\r
63e4dba9 233**/\r
234typedef\r
d1f95000 235UINT32\r
8b13229b 236(EFIAPI *PCD_PROTOCOL_GET_EX_32)(\r
d1f95000 237 IN CONST EFI_GUID *Guid,\r
238 IN UINTN TokenNumber\r
239 );\r
240\r
d1f95000 241/**\r
242 Retrieves an 64-bit value for a given PCD token.\r
243\r
9095d37b 244 Retrieves the 64-bit value of a particular PCD token.\r
d1f95000 245 If the TokenNumber is invalid or the token space\r
9095d37b 246 specified by Guid does not exist, the results are\r
d1f95000 247 unpredictable.\r
248\r
4ca9b6c4 249 @param[in] Guid The token space for the token number.\r
9095d37b 250 @param[in] TokenNumber The PCD token number.\r
d1f95000 251\r
252 @return The size 64-bit value for the PCD token.\r
9095d37b 253\r
d1f95000 254**/\r
255typedef\r
256UINT64\r
8b13229b 257(EFIAPI *PCD_PROTOCOL_GET_EX_64)(\r
d1f95000 258 IN CONST EFI_GUID *Guid,\r
259 IN UINTN TokenNumber\r
260 );\r
261\r
d1f95000 262/**\r
263 Retrieves a pointer to a value for a given PCD token.\r
264\r
9095d37b
LG
265 Retrieves the current pointer to the buffer for a PCD token number.\r
266 Do not make any assumptions about the alignment of the pointer that\r
267 is returned by this function call. If the TokenNumber is invalid,\r
d1f95000 268 the results are unpredictable.\r
269\r
4ca9b6c4 270 @param[in] Guid The token space for the token number.\r
9095d37b 271 @param[in] TokenNumber The PCD token number.\r
d1f95000 272\r
630b4187 273 @return The pointer to the buffer to be retrieved.\r
9095d37b 274\r
d1f95000 275**/\r
276typedef\r
277VOID *\r
8b13229b 278(EFIAPI *PCD_PROTOCOL_GET_EX_POINTER)(\r
d1f95000 279 IN CONST EFI_GUID *Guid,\r
280 IN UINTN TokenNumber\r
281 );\r
282\r
d1f95000 283/**\r
630b4187 284 Retrieves a Boolean value for a given PCD token.\r
d1f95000 285\r
9095d37b 286 Retrieves the Boolean value of a particular PCD token.\r
d1f95000 287 If the TokenNumber is invalid or the token space\r
9095d37b 288 specified by Guid does not exist, the results are\r
d1f95000 289 unpredictable.\r
290\r
4ca9b6c4 291 @param[in] Guid The token space for the token number.\r
9095d37b 292 @param[in] TokenNumber The PCD token number.\r
d1f95000 293\r
294 @return The size Boolean value for the PCD token.\r
9095d37b 295\r
d1f95000 296**/\r
297typedef\r
298BOOLEAN\r
8b13229b 299(EFIAPI *PCD_PROTOCOL_GET_EX_BOOLEAN)(\r
d1f95000 300 IN CONST EFI_GUID *Guid,\r
301 IN UINTN TokenNumber\r
302 );\r
303\r
d1f95000 304/**\r
305 Retrieves the size of the value for a given PCD token.\r
306\r
9095d37b 307 Retrieves the current size of a particular PCD token.\r
d1f95000 308 If the TokenNumber is invalid, the results are unpredictable.\r
309\r
4ca9b6c4 310 @param[in] Guid The token space for the token number.\r
9095d37b 311 @param[in] TokenNumber The PCD token number.\r
d1f95000 312\r
313 @return The size of the value for the PCD token.\r
9095d37b 314\r
d1f95000 315**/\r
316typedef\r
317UINTN\r
8b13229b 318(EFIAPI *PCD_PROTOCOL_GET_EX_SIZE)(\r
d1f95000 319 IN CONST EFI_GUID *Guid,\r
320 IN UINTN TokenNumber\r
321 );\r
322\r
d1f95000 323/**\r
324 Sets an 8-bit value for a given PCD token.\r
325\r
9095d37b
LG
326 When the PCD service sets a value, it will check to ensure that the\r
327 size of the value being set is compatible with the Token's existing definition.\r
d1f95000 328 If it is not, an error will be returned.\r
329\r
9095d37b 330 @param[in] TokenNumber The PCD token number.\r
4ca9b6c4 331 @param[in] Value The value to set for the PCD token.\r
d1f95000 332\r
af2dc6a7 333 @retval EFI_SUCCESS The procedure returned successfully.\r
9095d37b
LG
334 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data\r
335 being set was incompatible with a call to this function.\r
d1f95000 336 Use GetSize() to retrieve the size of the target data.\r
337 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
9095d37b 338\r
d1f95000 339**/\r
340typedef\r
341EFI_STATUS\r
8b13229b 342(EFIAPI *PCD_PROTOCOL_SET8)(\r
d1f95000 343 IN UINTN TokenNumber,\r
344 IN UINT8 Value\r
345 );\r
346\r
d1f95000 347/**\r
630b4187 348 Sets a 16-bit value for a given PCD token.\r
d1f95000 349\r
9095d37b
LG
350 When the PCD service sets a value, it will check to ensure that the\r
351 size of the value being set is compatible with the Token's existing definition.\r
d1f95000 352 If it is not, an error will be returned.\r
353\r
9095d37b 354 @param[in] TokenNumber The PCD token number.\r
4ca9b6c4 355 @param[in] Value The value to set for the PCD token.\r
d1f95000 356\r
af2dc6a7 357 @retval EFI_SUCCESS The procedure returned successfully.\r
9095d37b
LG
358 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data\r
359 being set was incompatible with a call to this function.\r
d1f95000 360 Use GetSize() to retrieve the size of the target data.\r
361 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
9095d37b 362\r
d1f95000 363**/\r
364typedef\r
365EFI_STATUS\r
8b13229b 366(EFIAPI *PCD_PROTOCOL_SET16)(\r
d1f95000 367 IN UINTN TokenNumber,\r
368 IN UINT16 Value\r
369 );\r
370\r
d1f95000 371/**\r
630b4187 372 Sets a 32-bit value for a given PCD token.\r
d1f95000 373\r
9095d37b
LG
374 When the PCD service sets a value, it will check to ensure that the\r
375 size of the value being set is compatible with the Token's existing definition.\r
d1f95000 376 If it is not, an error will be returned.\r
377\r
9095d37b 378 @param[in] TokenNumber The PCD token number.\r
4ca9b6c4 379 @param[in] Value The value to set for the PCD token.\r
d1f95000 380\r
af2dc6a7 381 @retval EFI_SUCCESS The procedure returned successfully.\r
9095d37b
LG
382 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data\r
383 being set was incompatible with a call to this function.\r
d1f95000 384 Use GetSize() to retrieve the size of the target data.\r
385 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
9095d37b 386\r
d1f95000 387**/\r
388typedef\r
389EFI_STATUS\r
8b13229b 390(EFIAPI *PCD_PROTOCOL_SET32)(\r
d1f95000 391 IN UINTN TokenNumber,\r
392 IN UINT32 Value\r
393 );\r
394\r
d1f95000 395/**\r
630b4187 396 Sets a 64-bit value for a given PCD token.\r
d1f95000 397\r
9095d37b
LG
398 When the PCD service sets a value, it will check to ensure that the\r
399 size of the value being set is compatible with the Token's existing definition.\r
d1f95000 400 If it is not, an error will be returned.\r
401\r
9095d37b 402 @param[in] TokenNumber The PCD token number.\r
4ca9b6c4 403 @param[in] Value The value to set for the PCD token.\r
d1f95000 404\r
af2dc6a7 405 @retval EFI_SUCCESS The procedure returned successfully.\r
9095d37b
LG
406 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data\r
407 being set was incompatible with a call to this function.\r
d1f95000 408 Use GetSize() to retrieve the size of the target data.\r
409 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
9095d37b 410\r
d1f95000 411**/\r
412typedef\r
413EFI_STATUS\r
8b13229b 414(EFIAPI *PCD_PROTOCOL_SET64)(\r
d1f95000 415 IN UINTN TokenNumber,\r
416 IN UINT64 Value\r
417 );\r
418\r
d1f95000 419/**\r
420 Sets a value of a specified size for a given PCD token.\r
421\r
9095d37b
LG
422 When the PCD service sets a value, it will check to ensure that the\r
423 size of the value being set is compatible with the Token's existing definition.\r
d1f95000 424 If it is not, an error will be returned.\r
425\r
9095d37b
LG
426 @param[in] TokenNumber The PCD token number.\r
427 @param[in, out] SizeOfBuffer A pointer to the length of the value being set for the PCD token.\r
428 On input, if the SizeOfValue is greater than the maximum size supported\r
429 for this TokenNumber then the output value of SizeOfValue will reflect\r
4ca9b6c4
LG
430 the maximum size supported for this TokenNumber.\r
431 @param[in] Buffer The buffer to set for the PCD token.\r
d1f95000 432\r
af2dc6a7 433 @retval EFI_SUCCESS The procedure returned successfully.\r
9095d37b
LG
434 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data\r
435 being set was incompatible with a call to this function.\r
d1f95000 436 Use GetSize() to retrieve the size of the target data.\r
437 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
9095d37b 438\r
d1f95000 439**/\r
440typedef\r
441EFI_STATUS\r
8b13229b 442(EFIAPI *PCD_PROTOCOL_SET_POINTER)(\r
d1f95000 443 IN UINTN TokenNumber,\r
444 IN OUT UINTN *SizeOfBuffer,\r
445 IN VOID *Buffer\r
446 );\r
447\r
d1f95000 448/**\r
630b4187 449 Sets a Boolean value for a given PCD token.\r
d1f95000 450\r
9095d37b
LG
451 When the PCD service sets a value, it will check to ensure that the\r
452 size of the value being set is compatible with the Token's existing definition.\r
d1f95000 453 If it is not, an error will be returned.\r
454\r
9095d37b 455 @param[in] TokenNumber The PCD token number.\r
4ca9b6c4 456 @param[in] Value The value to set for the PCD token.\r
d1f95000 457\r
af2dc6a7 458 @retval EFI_SUCCESS The procedure returned successfully.\r
9095d37b
LG
459 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data\r
460 being set was incompatible with a call to this function.\r
d1f95000 461 Use GetSize() to retrieve the size of the target data.\r
462 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
9095d37b 463\r
d1f95000 464**/\r
465typedef\r
466EFI_STATUS\r
8b13229b 467(EFIAPI *PCD_PROTOCOL_SET_BOOLEAN)(\r
d1f95000 468 IN UINTN TokenNumber,\r
469 IN BOOLEAN Value\r
470 );\r
471\r
d1f95000 472/**\r
473 Sets an 8-bit value for a given PCD token.\r
474\r
9095d37b
LG
475 When the PCD service sets a value, it will check to ensure that the\r
476 size of the value being set is compatible with the Token's existing definition.\r
d1f95000 477 If it is not, an error will be returned.\r
478\r
4ca9b6c4 479 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
9095d37b 480 @param[in] TokenNumber The PCD token number.\r
4ca9b6c4 481 @param[in] Value The value to set for the PCD token.\r
d1f95000 482\r
af2dc6a7 483 @retval EFI_SUCCESS The procedure returned successfully.\r
9095d37b
LG
484 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data\r
485 being set was incompatible with a call to this function.\r
d1f95000 486 Use GetSize() to retrieve the size of the target data.\r
487 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
9095d37b 488\r
d1f95000 489**/\r
490typedef\r
491EFI_STATUS\r
8b13229b 492(EFIAPI *PCD_PROTOCOL_SET_EX_8)(\r
d1f95000 493 IN CONST EFI_GUID *Guid,\r
494 IN UINTN TokenNumber,\r
495 IN UINT8 Value\r
496 );\r
497\r
d1f95000 498/**\r
499 Sets an 16-bit value for a given PCD token.\r
500\r
9095d37b
LG
501 When the PCD service sets a value, it will check to ensure that the\r
502 size of the value being set is compatible with the Token's existing definition.\r
d1f95000 503 If it is not, an error will be returned.\r
504\r
4ca9b6c4 505 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
9095d37b 506 @param[in] TokenNumber The PCD token number.\r
4ca9b6c4 507 @param[in] Value The value to set for the PCD token.\r
d1f95000 508\r
af2dc6a7 509 @retval EFI_SUCCESS The procedure returned successfully.\r
9095d37b
LG
510 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data\r
511 being set was incompatible with a call to this function.\r
d1f95000 512 Use GetSize() to retrieve the size of the target data.\r
513 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
9095d37b 514\r
d1f95000 515**/\r
516typedef\r
517EFI_STATUS\r
8b13229b 518(EFIAPI *PCD_PROTOCOL_SET_EX_16)(\r
d1f95000 519 IN CONST EFI_GUID *Guid,\r
520 IN UINTN TokenNumber,\r
521 IN UINT16 Value\r
522 );\r
523\r
d1f95000 524/**\r
630b4187 525 Sets a 32-bit value for a given PCD token.\r
d1f95000 526\r
9095d37b
LG
527 When the PCD service sets a value, it will check to ensure that the\r
528 size of the value being set is compatible with the Token's existing definition.\r
d1f95000 529 If it is not, an error will be returned.\r
530\r
4ca9b6c4 531 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
9095d37b 532 @param[in] TokenNumber The PCD token number.\r
4ca9b6c4 533 @param[in] Value The value to set for the PCD token.\r
d1f95000 534\r
af2dc6a7 535 @retval EFI_SUCCESS The procedure returned successfully.\r
9095d37b
LG
536 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data\r
537 being set was incompatible with a call to this function.\r
d1f95000 538 Use GetSize() to retrieve the size of the target data.\r
539 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
9095d37b 540\r
d1f95000 541**/\r
542typedef\r
543EFI_STATUS\r
8b13229b 544(EFIAPI *PCD_PROTOCOL_SET_EX_32)(\r
d1f95000 545 IN CONST EFI_GUID *Guid,\r
546 IN UINTN TokenNumber,\r
547 IN UINT32 Value\r
548 );\r
549\r
d1f95000 550/**\r
630b4187 551 Sets a 64-bit value for a given PCD token.\r
d1f95000 552\r
9095d37b
LG
553 When the PCD service sets a value, it will check to ensure that the\r
554 size of the value being set is compatible with the Token's existing definition.\r
d1f95000 555 If it is not, an error will be returned.\r
556\r
4ca9b6c4 557 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
9095d37b 558 @param[in] TokenNumber The PCD token number.\r
4ca9b6c4 559 @param[in] Value The value to set for the PCD token.\r
d1f95000 560\r
af2dc6a7 561 @retval EFI_SUCCESS The procedure returned successfully.\r
9095d37b
LG
562 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data\r
563 being set was incompatible with a call to this function.\r
d1f95000 564 Use GetSize() to retrieve the size of the target data.\r
565 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
9095d37b 566\r
d1f95000 567**/\r
568typedef\r
569EFI_STATUS\r
8b13229b 570(EFIAPI *PCD_PROTOCOL_SET_EX_64)(\r
d1f95000 571 IN CONST EFI_GUID *Guid,\r
572 IN UINTN TokenNumber,\r
573 IN UINT64 Value\r
574 );\r
575\r
d1f95000 576/**\r
577 Sets a value of a specified size for a given PCD token.\r
578\r
9095d37b
LG
579 When the PCD service sets a value, it will check to ensure that the\r
580 size of the value being set is compatible with the Token's existing definition.\r
d1f95000 581 If it is not, an error will be returned.\r
582\r
4ca9b6c4 583 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
9095d37b
LG
584 @param[in] TokenNumber The PCD token number.\r
585 @param[in, out] SizeOfBuffer A pointer to the length of the value being set for the PCD token.\r
586 On input, if the SizeOfValue is greater than the maximum size supported\r
587 for this TokenNumber then the output value of SizeOfValue will reflect\r
d1f95000 588 the maximum size supported for this TokenNumber.\r
4ca9b6c4 589 @param[in] Buffer The buffer to set for the PCD token.\r
d1f95000 590\r
af2dc6a7 591 @retval EFI_SUCCESS The procedure returned successfully.\r
9095d37b
LG
592 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data\r
593 being set was incompatible with a call to this function.\r
d1f95000 594 Use GetSize() to retrieve the size of the target data.\r
595 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
9095d37b 596\r
d1f95000 597**/\r
598typedef\r
599EFI_STATUS\r
8b13229b 600(EFIAPI *PCD_PROTOCOL_SET_EX_POINTER)(\r
19fd6450 601 IN CONST EFI_GUID *Guid,\r
602 IN UINTN TokenNumber,\r
603 IN OUT UINTN *SizeOfBuffer,\r
604 IN VOID *Buffer\r
d1f95000 605 );\r
606\r
d1f95000 607/**\r
630b4187 608 Sets a Boolean value for a given PCD token.\r
d1f95000 609\r
9095d37b
LG
610 When the PCD service sets a value, it will check to ensure that the\r
611 size of the value being set is compatible with the Token's existing definition.\r
d1f95000 612 If it is not, an error will be returned.\r
613\r
4ca9b6c4 614 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
9095d37b 615 @param[in] TokenNumber The PCD token number.\r
4ca9b6c4 616 @param[in] Value The value to set for the PCD token.\r
d1f95000 617\r
af2dc6a7 618 @retval EFI_SUCCESS The procedure returned successfully.\r
9095d37b
LG
619 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data\r
620 being set was incompatible with a call to this function.\r
d1f95000 621 Use GetSize() to retrieve the size of the target data.\r
622 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
9095d37b 623\r
d1f95000 624**/\r
625typedef\r
626EFI_STATUS\r
8b13229b 627(EFIAPI *PCD_PROTOCOL_SET_EX_BOOLEAN)(\r
d1f95000 628 IN CONST EFI_GUID *Guid,\r
629 IN UINTN TokenNumber,\r
630 IN BOOLEAN Value\r
631 );\r
9095d37b 632\r
d1f95000 633/**\r
634 Callback on SET function prototype definition.\r
635\r
9095d37b
LG
636 This notification function serves two purposes.\r
637 Firstly, it notifies the module which did the registration that the value\r
638 of this PCD token has been set. Secondly, it provides a mechanism for the\r
639 module that did the registration to intercept the set operation and override\r
640 the value that has been set, if necessary. After the invocation of the callback function,\r
641 TokenData will be used by PCD service DXE driver to modify the internal data in\r
d1f95000 642 PCD database.\r
643\r
4ca9b6c4
LG
644 @param[in] CallBackGuid The PCD token GUID being set.\r
645 @param[in] CallBackToken The PCD token number being set.\r
646 @param[in, out] TokenData A pointer to the token data being set.\r
647 @param[in] TokenDataSize The size, in bytes, of the data being set.\r
d1f95000 648\r
649 @retval VOID\r
650\r
651**/\r
652typedef\r
653VOID\r
8b13229b 654(EFIAPI *PCD_PROTOCOL_CALLBACK)(\r
d0e2f823 655 IN CONST EFI_GUID *CallBackGuid OPTIONAL,\r
19fd6450 656 IN UINTN CallBackToken,\r
657 IN OUT VOID *TokenData,\r
658 IN UINTN TokenDataSize\r
d1f95000 659 );\r
660\r
d1f95000 661/**\r
662 Specifies a function to be called anytime the value of a designated token is changed.\r
663\r
9095d37b 664 @param[in] TokenNumber The PCD token number.\r
4ca9b6c4 665 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
9095d37b 666 @param[in] CallBackFunction The function prototype called when the value associated with the CallBackToken is set.\r
d1f95000 667\r
9095d37b 668 @retval EFI_SUCCESS The PCD service has successfully established a call event\r
d1f95000 669 for the CallBackToken requested.\r
670 @retval EFI_NOT_FOUND The PCD service could not find the referenced token number.\r
671\r
672**/\r
673typedef\r
674EFI_STATUS\r
8b13229b 675(EFIAPI *PCD_PROTOCOL_CALLBACK_ONSET)(\r
d0e2f823 676 IN CONST EFI_GUID *Guid OPTIONAL,\r
d1f95000 677 IN UINTN TokenNumber,\r
678 IN PCD_PROTOCOL_CALLBACK CallBackFunction\r
679 );\r
680\r
d1f95000 681/**\r
682 Cancels a previously set callback function for a particular PCD token number.\r
683\r
9095d37b 684 @param[in] TokenNumber The PCD token number.\r
4ca9b6c4 685 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
9095d37b 686 @param[in] CallBackFunction The function prototype called when the value associated with the CallBackToken is set.\r
d1f95000 687\r
9095d37b 688 @retval EFI_SUCCESS The PCD service has successfully established a call event\r
d1f95000 689 for the CallBackToken requested.\r
690 @retval EFI_NOT_FOUND The PCD service could not find the referenced token number.\r
691\r
692**/\r
693typedef\r
694EFI_STATUS\r
8b13229b 695(EFIAPI *PCD_PROTOCOL_CANCEL_CALLBACK)(\r
d0e2f823 696 IN CONST EFI_GUID *Guid OPTIONAL,\r
d1f95000 697 IN UINTN TokenNumber,\r
698 IN PCD_PROTOCOL_CALLBACK CallBackFunction\r
699 );\r
700\r
d1f95000 701/**\r
9095d37b
LG
702 Retrieves the next valid token number in a given namespace.\r
703\r
704 This is useful since the PCD infrastructure contains a sparse list of token numbers,\r
419db80b 705 and one cannot a priori know what token numbers are valid in the database.\r
9095d37b
LG
706\r
707 If TokenNumber is 0 and Guid is not NULL, then the first token from the token space specified by Guid is returned.\r
708 If TokenNumber is not 0 and Guid is not NULL, then the next token in the token space specified by Guid is returned.\r
709 If TokenNumber is 0 and Guid is NULL, then the first token in the default token space is returned.\r
710 If TokenNumber is not 0 and Guid is NULL, then the next token in the default token space is returned.\r
711 The token numbers in the default token space may not be related to token numbers in token spaces that are named by Guid.\r
712 If the next token number can be retrieved, then it is returned in TokenNumber, and EFI_SUCCESS is returned.\r
713 If TokenNumber represents the last token number in the token space specified by Guid, then EFI_NOT_FOUND is returned.\r
75070952 714 If TokenNumber is not present in the token space specified by Guid, then EFI_NOT_FOUND is returned.\r
715\r
d1f95000 716\r
9095d37b
LG
717 @param[in] Guid The 128-bit unique value that designates the namespace from which to retrieve the next token.\r
718 This is an optional parameter that may be NULL. If this parameter is NULL, then a request is\r
75070952 719 being made to retrieve tokens from the default token space.\r
9095d37b
LG
720 @param[in,out] TokenNumber\r
721 A pointer to the PCD token number to use to find the subsequent token number.\r
4ca9b6c4 722\r
419db80b
BF
723 @retval EFI_SUCCESS The PCD service has retrieved the next valid token number.\r
724 @retval EFI_NOT_FOUND The PCD service could not find data from the requested token number.\r
d1f95000 725\r
726**/\r
9095d37b 727typedef\r
d1f95000 728EFI_STATUS\r
8b13229b 729(EFIAPI *PCD_PROTOCOL_GET_NEXT_TOKEN)(\r
d0e2f823 730 IN CONST EFI_GUID *Guid OPTIONAL,\r
d1f95000 731 IN OUT UINTN *TokenNumber\r
732 );\r
733\r
d1f95000 734/**\r
735 Retrieves the next valid PCD token namespace for a given namespace.\r
736\r
419db80b
BF
737 Gets the next valid token namespace for a given namespace. This is useful to traverse the valid\r
738 token namespaces on a platform.\r
739\r
740 @param[in, out] Guid An indirect pointer to EFI_GUID. On input it designates a known token namespace\r
741 from which the search will start. On output, it designates the next valid token\r
742 namespace on the platform. If *Guid is NULL, then the GUID of the first token\r
743 space of the current platform is returned. If the search cannot locate the next valid\r
744 token namespace, an error is returned and the value of *Guid is undefined.\r
745\r
746 @retval EFI_SUCCESS The PCD service retrieved the value requested.\r
747 @retval EFI_NOT_FOUND The PCD service could not find the next valid token namespace.\r
d1f95000 748\r
749**/\r
9095d37b 750typedef\r
d1f95000 751EFI_STATUS\r
8b13229b 752(EFIAPI *PCD_PROTOCOL_GET_NEXT_TOKENSPACE)(\r
d1f95000 753 IN OUT CONST EFI_GUID **Guid\r
754 );\r
755\r
44717a39 756///\r
757/// This service abstracts the ability to set/get Platform Configuration Database (PCD).\r
758///\r
d1f95000 759typedef struct {\r
2f88bd3a
MK
760 PCD_PROTOCOL_SET_SKU SetSku;\r
761\r
762 PCD_PROTOCOL_GET8 Get8;\r
763 PCD_PROTOCOL_GET16 Get16;\r
764 PCD_PROTOCOL_GET32 Get32;\r
765 PCD_PROTOCOL_GET64 Get64;\r
766 PCD_PROTOCOL_GET_POINTER GetPtr;\r
767 PCD_PROTOCOL_GET_BOOLEAN GetBool;\r
768 PCD_PROTOCOL_GET_SIZE GetSize;\r
769\r
770 PCD_PROTOCOL_GET_EX_8 Get8Ex;\r
771 PCD_PROTOCOL_GET_EX_16 Get16Ex;\r
772 PCD_PROTOCOL_GET_EX_32 Get32Ex;\r
773 PCD_PROTOCOL_GET_EX_64 Get64Ex;\r
774 PCD_PROTOCOL_GET_EX_POINTER GetPtrEx;\r
775 PCD_PROTOCOL_GET_EX_BOOLEAN GetBoolEx;\r
776 PCD_PROTOCOL_GET_EX_SIZE GetSizeEx;\r
777\r
778 PCD_PROTOCOL_SET8 Set8;\r
779 PCD_PROTOCOL_SET16 Set16;\r
780 PCD_PROTOCOL_SET32 Set32;\r
781 PCD_PROTOCOL_SET64 Set64;\r
782 PCD_PROTOCOL_SET_POINTER SetPtr;\r
783 PCD_PROTOCOL_SET_BOOLEAN SetBool;\r
784\r
785 PCD_PROTOCOL_SET_EX_8 Set8Ex;\r
786 PCD_PROTOCOL_SET_EX_16 Set16Ex;\r
787 PCD_PROTOCOL_SET_EX_32 Set32Ex;\r
788 PCD_PROTOCOL_SET_EX_64 Set64Ex;\r
789 PCD_PROTOCOL_SET_EX_POINTER SetPtrEx;\r
790 PCD_PROTOCOL_SET_EX_BOOLEAN SetBoolEx;\r
791\r
792 PCD_PROTOCOL_CALLBACK_ONSET CallbackOnSet;\r
793 PCD_PROTOCOL_CANCEL_CALLBACK CancelCallback;\r
794 PCD_PROTOCOL_GET_NEXT_TOKEN GetNextToken;\r
795 PCD_PROTOCOL_GET_NEXT_TOKENSPACE GetNextTokenSpace;\r
d1f95000 796} PCD_PROTOCOL;\r
797\r
798#endif\r