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