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