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