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