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