]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/PeiPcdLib/PeiPcdLib.c
57fa8211562240f0d2c63a8bd2bb60be1ca1173c
[mirror_edk2.git] / MdePkg / Library / PeiPcdLib / PeiPcdLib.c
1 /** @file
2 Implementation of PcdLib class library for PEI phase.
3
4 Copyright (c) 2006, Intel Corporation<BR>
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13
14 Module Name: PeiPcdLib.c
15
16 **/
17
18
19
20 /**
21 The constructor function retrieve the PCD_PPI pointer.
22
23 @param[in] VOID
24
25 @retval PCD_PPI * The pointer to the PCD_PPI.
26
27 **/
28 PCD_PPI *
29 GetPcdPpiPtr (
30 VOID
31 )
32 {
33 EFI_STATUS Status;
34 PCD_PPI *PcdPpi;
35 EFI_PEI_SERVICES **PeiServices;
36
37
38 PeiServices = GetPeiServicesTablePointer ();
39
40 Status = (**PeiServices).LocatePpi (
41 PeiServices,
42 &gPcdPpiGuid,
43 0,
44 NULL,
45 (VOID **)&PcdPpi
46 );
47
48 ASSERT_EFI_ERROR (Status);
49
50 return PcdPpi;
51 }
52
53
54
55 /**
56 Sets the current SKU in the PCD database to the value specified by SkuId. SkuId is returned.
57
58 @param[in] SkuId The SKU value that will be used when the PCD service will retrieve and
59 set values associated with a PCD token.
60
61 @retval SKU_ID Return the SKU ID that just be set.
62
63 **/
64 UINTN
65 EFIAPI
66 LibPcdSetSku (
67 IN UINTN SkuId
68 )
69 {
70
71 ASSERT (SkuId < 0x100);
72
73 GetPcdPpiPtr()->SetSku (SkuId);;
74
75 return SkuId;
76 }
77
78
79
80 /**
81 Returns the 8-bit value for the token specified by TokenNumber.
82
83 @param[in] The PCD token number to retrieve a current value for.
84
85 @retval UINT8 Returns the 8-bit value for the token specified by TokenNumber.
86
87 **/
88 UINT8
89 EFIAPI
90 LibPcdGet8 (
91 IN UINTN TokenNumber
92 )
93 {
94 PCD_PPI * PcdPpi;
95
96 PcdPpi = GetPcdPpiPtr ();
97
98 return PcdPpi->Get8 (TokenNumber);
99 }
100
101
102
103 /**
104 Returns the 16-bit value for the token specified by TokenNumber.
105
106 @param[in] The PCD token number to retrieve a current value for.
107
108 @retval UINT16 Returns the 16-bit value for the token specified by TokenNumber.
109
110 **/
111 UINT16
112 EFIAPI
113 LibPcdGet16 (
114 IN UINTN TokenNumber
115 )
116 {
117 PCD_PPI *PcdPpi;
118
119 PcdPpi = GetPcdPpiPtr ();
120
121 return PcdPpi->Get16 (TokenNumber);
122 }
123
124
125
126 /**
127 Returns the 32-bit value for the token specified by TokenNumber.
128
129 @param[in] TokenNumber The PCD token number to retrieve a current value for.
130
131 @retval UINT32 Returns the 32-bit value for the token specified by TokenNumber.
132
133 **/
134 UINT32
135 EFIAPI
136 LibPcdGet32 (
137 IN UINTN TokenNumber
138 )
139 {
140 PCD_PPI * PcdPpi;
141
142 PcdPpi = GetPcdPpiPtr ();
143
144 return PcdPpi->Get32 (TokenNumber);
145 }
146
147
148
149 /**
150 Returns the 64-bit value for the token specified by TokenNumber.
151
152 @param[in] TokenNumber The PCD token number to retrieve a current value for.
153
154 @retval UINT64 Returns the 64-bit value for the token specified by TokenNumber.
155
156 **/
157 UINT64
158 EFIAPI
159 LibPcdGet64 (
160 IN UINTN TokenNumber
161 )
162 {
163 PCD_PPI * PcdPpi;
164
165 PcdPpi = GetPcdPpiPtr ();
166
167 return PcdPpi->Get64 (TokenNumber);
168 }
169
170
171
172 /**
173 Returns the pointer to the buffer of the token specified by TokenNumber.
174
175 @param[in] TokenNumber The PCD token number to retrieve a current value for.
176
177 @retval VOID* Returns the pointer to the token specified by TokenNumber.
178
179 **/
180 VOID *
181 EFIAPI
182 LibPcdGetPtr (
183 IN UINTN TokenNumber
184 )
185 {
186 PCD_PPI * PcdPpi;
187
188 PcdPpi = GetPcdPpiPtr ();
189
190 return PcdPpi->GetPtr (TokenNumber);
191 }
192
193
194
195 /**
196 Returns the Boolean value of the token specified by TokenNumber.
197
198 @param[in] TokenNumber The PCD token number to retrieve a current value for.
199
200 @retval BOOLEAN Returns the Boolean value of the token specified by TokenNumber.
201
202 **/
203 BOOLEAN
204 EFIAPI
205 LibPcdGetBool (
206 IN UINTN TokenNumber
207 )
208 {
209 PCD_PPI * PcdPpi;
210
211 PcdPpi = GetPcdPpiPtr ();
212
213 return PcdPpi->GetBool (TokenNumber);
214 }
215
216
217
218 /**
219 Returns the size of the token specified by TokenNumber.
220
221 @param[in] TokenNumber The PCD token number to retrieve a current value for.
222
223 @retval UINTN Returns the size of the token specified by TokenNumber.
224
225 **/
226 UINTN
227 EFIAPI
228 LibPcdGetSize (
229 IN UINTN TokenNumber
230 )
231 {
232 PCD_PPI * PcdPpi;
233
234 PcdPpi = GetPcdPpiPtr ();
235
236 return PcdPpi->GetSize (TokenNumber);
237 }
238
239
240
241 /**
242 Returns the 8-bit value for the token specified by TokenNumber and Guid.
243 If Guid is NULL, then ASSERT().
244
245 @param[in] Guid Pointer to a 128-bit unique value that designates
246 which namespace to retrieve a value from.
247 @param[in] TokenNumber The PCD token number to retrieve a current value for.
248
249 @retval UINT8 Return the UINT8.
250
251 **/
252 UINT8
253 EFIAPI
254 LibPcdGetEx8 (
255 IN CONST GUID *Guid,
256 IN UINTN TokenNumber
257 )
258 {
259 PCD_PPI * PcdPpi;
260
261 PcdPpi = GetPcdPpiPtr ();
262
263 return PcdPpi->Get8Ex (Guid, TokenNumber);
264 }
265
266
267
268 /**
269 Returns the 16-bit value for the token specified by TokenNumber and Guid.
270 If Guid is NULL, then ASSERT().
271
272 @param[in] Guid Pointer to a 128-bit unique value that designates
273 which namespace to retrieve a value from.
274 @param[in] TokenNumber The PCD token number to retrieve a current value for.
275
276 @retval UINT16 Return the UINT16.
277
278 **/
279 UINT16
280 EFIAPI
281 LibPcdGetEx16 (
282 IN CONST GUID *Guid,
283 IN UINTN TokenNumber
284 )
285 {
286 PCD_PPI * PcdPpi;
287
288 PcdPpi = GetPcdPpiPtr ();
289
290 return PcdPpi->Get16Ex (Guid, TokenNumber);
291 }
292
293
294
295 /**
296 Returns the 32-bit value for the token specified by TokenNumber and Guid.
297 If Guid is NULL, then ASSERT().
298
299 @param[in] Guid Pointer to a 128-bit unique value that designates
300 which namespace to retrieve a value from.
301 @param[in] TokenNumber The PCD token number to retrieve a current value for.
302
303 @retval UINT32 Return the UINT32.
304
305 **/
306 UINT32
307 EFIAPI
308 LibPcdGetEx32 (
309 IN CONST GUID *Guid,
310 IN UINTN TokenNumber
311 )
312 {
313 PCD_PPI * PcdPpi;
314
315 PcdPpi = GetPcdPpiPtr ();
316
317 return PcdPpi->Get32Ex (Guid, TokenNumber);
318 }
319
320
321
322
323 /**
324 Returns the 64-bit value for the token specified by TokenNumber and Guid.
325 If Guid is NULL, then ASSERT().
326
327 @param[in] Guid Pointer to a 128-bit unique value that designates
328 which namespace to retrieve a value from.
329 @param[in] TokenNumber The PCD token number to retrieve a current value for.
330
331 @retval UINT64 Return the UINT64.
332
333 **/
334 UINT64
335 EFIAPI
336 LibPcdGetEx64 (
337 IN CONST GUID *Guid,
338 IN UINTN TokenNumber
339 )
340 {
341 PCD_PPI * PcdPpi;
342
343 PcdPpi = GetPcdPpiPtr ();
344
345 return PcdPpi->Get64Ex (Guid, TokenNumber);
346 }
347
348
349
350 /**
351 Returns the pointer to the token specified by TokenNumber and Guid.
352 If Guid is NULL, then ASSERT().
353
354 @param[in] Guid Pointer to a 128-bit unique value that designates
355 which namespace to retrieve a value from.
356 @param[in] TokenNumber The PCD token number to retrieve a current value for.
357
358 @retval VOID* Return the VOID* pointer.
359
360 **/
361 VOID *
362 EFIAPI
363 LibPcdGetExPtr (
364 IN CONST GUID *Guid,
365 IN UINTN TokenNumber
366 )
367 {
368 PCD_PPI * PcdPpi;
369
370 PcdPpi = GetPcdPpiPtr ();
371
372 return PcdPpi->GetPtrEx (Guid, TokenNumber);
373 }
374
375
376
377 /**
378 Returns the Boolean value of the token specified by TokenNumber and Guid.
379 If Guid is NULL, then ASSERT().
380
381 @param[in] Guid Pointer to a 128-bit unique value that designates
382 which namespace to retrieve a value from.
383 @param[in] TokenNumber The PCD token number to retrieve a current value for.
384
385 @retval BOOLEAN Return the BOOLEAN.
386
387 **/
388 BOOLEAN
389 EFIAPI
390 LibPcdGetExBool (
391 IN CONST GUID *Guid,
392 IN UINTN TokenNumber
393 )
394 {
395 PCD_PPI * PcdPpi;
396
397 PcdPpi = GetPcdPpiPtr ();
398
399 return PcdPpi->GetBoolEx (Guid, TokenNumber);
400 }
401
402
403
404 /**
405 Returns the size of the token specified by TokenNumber and Guid.
406 If Guid is NULL, then ASSERT().
407
408 @param[in] Guid Pointer to a 128-bit unique value that designates
409 which namespace to retrieve a value from.
410 @param[in] TokenNumber The PCD token number to retrieve a current value for.
411
412 @retval UINTN Return the size.
413
414 **/
415 UINTN
416 EFIAPI
417 LibPcdGetExSize (
418 IN CONST GUID *Guid,
419 IN UINTN TokenNumber
420 )
421 {
422 PCD_PPI * PcdPpi;
423
424 PcdPpi = GetPcdPpiPtr ();
425
426 return PcdPpi->GetSizeEx (Guid, TokenNumber);
427 }
428
429
430
431 /**
432 Sets the 8-bit value for the token specified by TokenNumber
433 to the value specified by Value. Value is returned.
434
435 @param[in] TokenNumber The PCD token number to set a current value for.
436 @param[in] Value The 8-bit value to set.
437
438 @retval UINT8 Return the value been set.
439
440 **/
441 UINT8
442 EFIAPI
443 LibPcdSet8 (
444 IN UINTN TokenNumber,
445 IN UINT8 Value
446 )
447 {
448 EFI_STATUS Status;
449 PCD_PPI * PcdPpi;
450
451 PcdPpi = GetPcdPpiPtr ();
452
453
454 Status = PcdPpi->Set8 (TokenNumber, Value);
455
456 ASSERT_EFI_ERROR (Status);
457
458 return Value;
459 }
460
461
462
463 /**
464 Sets the 16-bit value for the token specified by TokenNumber
465 to the value specified by Value. Value is returned.
466
467 @param[in] TokenNumber The PCD token number to set a current value for.
468 @param[in] Value The 16-bit value to set.
469
470 @retval UINT16 Return the value been set.
471
472 **/
473 UINT16
474 EFIAPI
475 LibPcdSet16 (
476 IN UINTN TokenNumber,
477 IN UINT16 Value
478 )
479 {
480 EFI_STATUS Status;
481 PCD_PPI * PcdPpi;
482
483 PcdPpi = GetPcdPpiPtr ();
484
485
486 Status = PcdPpi->Set16 (TokenNumber, Value);
487
488 ASSERT_EFI_ERROR (Status);
489
490 return Value;
491 }
492
493
494
495 /**
496 Sets the 32-bit value for the token specified by TokenNumber
497 to the value specified by Value. Value is returned.
498
499 @param[in] TokenNumber The PCD token number to set a current value for.
500 @param[in] Value The 32-bit value to set.
501
502 @retval UINT32 Return the value been set.
503
504 **/
505 UINT32
506 EFIAPI
507 LibPcdSet32 (
508 IN UINTN TokenNumber,
509 IN UINT32 Value
510 )
511 {
512 EFI_STATUS Status;
513 PCD_PPI * PcdPpi;
514
515 PcdPpi = GetPcdPpiPtr ();
516
517 Status = PcdPpi->Set32 (TokenNumber, Value);
518
519 ASSERT_EFI_ERROR (Status);
520
521 return Value;
522 }
523
524
525
526 /**
527 Sets the 64-bit value for the token specified by TokenNumber
528 to the value specified by Value. Value is returned.
529
530 @param[in] TokenNumber The PCD token number to set a current value for.
531 @param[in] Value The 64-bit value to set.
532
533 @retval UINT64 Return the value been set.
534
535 **/
536 UINT64
537 EFIAPI
538 LibPcdSet64 (
539 IN UINTN TokenNumber,
540 IN UINT64 Value
541 )
542 {
543 EFI_STATUS Status;
544 PCD_PPI * PcdPpi;
545
546 PcdPpi = GetPcdPpiPtr ();
547
548
549 Status = PcdPpi->Set64 (TokenNumber, Value);
550
551 ASSERT_EFI_ERROR (Status);
552
553 return Value;
554 }
555
556
557
558 /**
559 Sets a buffer for the token specified by TokenNumber to
560 the value specified by Buffer and SizeOfValue. Buffer to
561 be set is returned. The content of the buffer could be
562 overwritten if a Callback on SET is registered with this
563 TokenNumber.
564
565 If SizeOfValue is greater than the maximum
566 size support by TokenNumber, then set SizeOfValue to the
567 maximum size supported by TokenNumber and return NULL to
568 indicate that the set operation was not actually performed.
569
570 If SizeOfValue > 0 and Buffer is NULL, then ASSERT().
571
572 @param[in] TokenNumber The PCD token number to set a current value for.
573 @param[in,out] SizeOfBuffer The size, in bytes, of Buffer.
574 @param[in] Value A pointer to the buffer to set.
575
576 @retval VOID* Return the pointer for the buffer been set.
577
578 **/
579 VOID *
580 EFIAPI
581 LibPcdSetPtr (
582 IN UINTN TokenNumber,
583 IN OUT UINTN *SizeOfBuffer,
584 IN VOID *Buffer
585 )
586 {
587 EFI_STATUS Status;
588 PCD_PPI *PcdPpi;
589 UINTN Size;
590
591 ASSERT (SizeOfBuffer != NULL);
592
593 if (*SizeOfBuffer > 0) {
594 ASSERT (Buffer != NULL);
595 }
596
597 PcdPpi = GetPcdPpiPtr ();
598
599 Size = LibPcdGetSize (TokenNumber);
600
601 if (*SizeOfBuffer > Size) {
602 *SizeOfBuffer = Size;
603 return NULL;
604 }
605
606 Status = PcdPpi->SetPtr (TokenNumber, *SizeOfBuffer, Buffer);
607
608 ASSERT_EFI_ERROR (Status);
609
610 return Buffer;
611 }
612
613
614
615 /**
616 Sets the Boolean value for the token specified by TokenNumber
617 to the value specified by Value. Value is returned.
618
619 @param[in] TokenNumber The PCD token number to set a current value for.
620 @param[in] Value The boolean value to set.
621
622 @retval BOOLEAN Return the value been set.
623
624 **/
625 BOOLEAN
626 EFIAPI
627 LibPcdSetBool (
628 IN UINTN TokenNumber,
629 IN BOOLEAN Value
630 )
631 {
632 EFI_STATUS Status;
633 PCD_PPI * PcdPpi;
634
635 PcdPpi = GetPcdPpiPtr ();
636
637
638 Status = PcdPpi->SetBool (TokenNumber, Value);
639
640 ASSERT_EFI_ERROR (Status);
641
642 return Value;
643 }
644
645
646
647 /**
648 Sets the 8-bit value for the token specified by TokenNumber and
649 Guid to the value specified by Value. Value is returned.
650 If Guid is NULL, then ASSERT().
651
652 @param[in] Guid Pointer to a 128-bit unique value that
653 designates which namespace to set a value from.
654 @param[in] TokenNumber The PCD token number to set a current value for.
655 @param[in] Value The 8-bit value to set.
656
657 @retval UINT8 Return the value been set.
658
659 **/
660 UINT8
661 EFIAPI
662 LibPcdSetEx8 (
663 IN CONST GUID *Guid,
664 IN UINTN TokenNumber,
665 IN UINT8 Value
666 )
667 {
668 EFI_STATUS Status;
669 PCD_PPI * PcdPpi;
670
671 PcdPpi = GetPcdPpiPtr ();
672
673
674 Status = PcdPpi->Set8Ex (Guid, TokenNumber, Value);
675
676 ASSERT_EFI_ERROR (Status);
677
678 return Value;
679 }
680
681
682
683 /**
684 Sets the 16-bit value for the token specified by TokenNumber and
685 Guid to the value specified by Value. Value is returned.
686 If Guid is NULL, then ASSERT().
687
688 @param[in] Guid Pointer to a 128-bit unique value that
689 designates which namespace to set a value from.
690 @param[in] TokenNumber The PCD token number to set a current value for.
691 @param[in] Value The 16-bit value to set.
692
693 @retval UINT8 Return the value been set.
694
695 **/
696 UINT16
697 EFIAPI
698 LibPcdSetEx16 (
699 IN CONST GUID *Guid,
700 IN UINTN TokenNumber,
701 IN UINT16 Value
702 )
703 {
704 EFI_STATUS Status;
705 PCD_PPI * PcdPpi;
706
707 PcdPpi = GetPcdPpiPtr ();
708
709
710 Status = PcdPpi->Set16Ex (Guid, TokenNumber, Value);
711
712 ASSERT_EFI_ERROR (Status);
713
714 return Value;
715 }
716
717
718
719 /**
720 Sets the 32-bit value for the token specified by TokenNumber and
721 Guid to the value specified by Value. Value is returned.
722 If Guid is NULL, then ASSERT().
723
724 @param[in] Guid Pointer to a 128-bit unique value that
725 designates which namespace to set a value from.
726 @param[in] TokenNumber The PCD token number to set a current value for.
727 @param[in] Value The 32-bit value to set.
728
729 @retval UINT32 Return the value been set.
730
731 **/
732 UINT32
733 EFIAPI
734 LibPcdSetEx32 (
735 IN CONST GUID *Guid,
736 IN UINTN TokenNumber,
737 IN UINT32 Value
738 )
739 {
740 EFI_STATUS Status;
741 PCD_PPI * PcdPpi;
742
743 PcdPpi = GetPcdPpiPtr ();
744
745
746 Status = PcdPpi->Set32Ex (Guid, TokenNumber, Value);
747
748 ASSERT_EFI_ERROR (Status);
749
750 return Value;
751 }
752
753
754
755 /**
756 Sets the 64-bit value for the token specified by TokenNumber and
757 Guid to the value specified by Value. Value is returned.
758 If Guid is NULL, then ASSERT().
759
760 @param[in] Guid Pointer to a 128-bit unique value that
761 designates which namespace to set a value from.
762 @param[in] TokenNumber The PCD token number to set a current value for.
763 @param[in] Value The 64-bit value to set.
764
765 @retval UINT64 Return the value been set.
766
767 **/
768 UINT64
769 EFIAPI
770 LibPcdSetEx64 (
771 IN CONST GUID *Guid,
772 IN UINTN TokenNumber,
773 IN UINT64 Value
774 )
775 {
776 EFI_STATUS Status;
777 PCD_PPI * PcdPpi;
778
779 PcdPpi = GetPcdPpiPtr ();
780
781
782 Status = PcdPpi->Set64Ex (Guid, TokenNumber, Value);
783
784 ASSERT_EFI_ERROR (Status);
785
786 return Value;
787 }
788
789
790
791 /**
792 Sets a buffer for the token specified by TokenNumber to the value specified by
793 Buffer and SizeOfValue. Buffer is returned. If SizeOfValue is greater than
794 the maximum size support by TokenNumber, then set SizeOfValue to the maximum size
795 supported by TokenNumber and return NULL to indicate that the set operation
796 was not actually performed.
797
798 If SizeOfValue > 0 and Buffer is NULL, then ASSERT().
799
800 @param[in] Guid Pointer to a 128-bit unique value that
801 designates which namespace to set a value from.
802 @param[in] TokenNumber The PCD token number to set a current value for.
803 @param[in, out] SizeOfBuffer The size, in bytes, of Buffer.
804 @param[in] Buffer A pointer to the buffer to set.
805
806 @retval VOID * Return the pinter to the buffer been set.
807
808 **/
809 VOID *
810 EFIAPI
811 LibPcdSetExPtr (
812 IN CONST GUID *Guid,
813 IN UINTN TokenNumber,
814 IN OUT UINTN *SizeOfBuffer,
815 IN VOID *Buffer
816 )
817 {
818 EFI_STATUS Status;
819 PCD_PPI *PcdPpi;
820 UINTN Size;
821
822 if (*SizeOfBuffer > 0) {
823 ASSERT (Buffer != NULL);
824 }
825
826 PcdPpi = GetPcdPpiPtr ();
827
828 Size = LibPcdGetExSize (Guid, TokenNumber);
829 if (*SizeOfBuffer > Size) {
830 *SizeOfBuffer = Size;
831 return NULL;
832 }
833
834 Status = PcdPpi->SetPtrEx (Guid, TokenNumber, *SizeOfBuffer, Buffer);
835
836 ASSERT_EFI_ERROR (Status);
837
838 return Buffer;
839 }
840
841
842
843 /**
844 Sets the Boolean value for the token specified by TokenNumber and
845 Guid to the value specified by Value. Value is returned.
846 If Guid is NULL, then ASSERT().
847
848 @param[in] Guid Pointer to a 128-bit unique value that
849 designates which namespace to set a value from.
850 @param[in] TokenNumber The PCD token number to set a current value for.
851 @param[in] Value The Boolean value to set.
852
853 @retval Boolean Return the value been set.
854
855 **/
856 BOOLEAN
857 EFIAPI
858 LibPcdSetExBool (
859 IN CONST GUID *Guid,
860 IN UINTN TokenNumber,
861 IN BOOLEAN Value
862 )
863 {
864 EFI_STATUS Status;
865 PCD_PPI * PcdPpi;
866
867 PcdPpi = GetPcdPpiPtr ();
868
869
870 Status = PcdPpi->SetBoolEx (Guid, TokenNumber, Value);
871
872 ASSERT_EFI_ERROR (Status);
873
874 return Value;
875 }
876
877
878
879 /**
880 When the token specified by TokenNumber and Guid is set,
881 then notification function specified by NotificationFunction is called.
882 If Guid is NULL, then the default token space is used.
883 If NotificationFunction is NULL, then ASSERT().
884
885 @param[in] Guid Pointer to a 128-bit unique value that designates which
886 namespace to set a value from. If NULL, then the default
887 token space is used.
888 @param[in] TokenNumber The PCD token number to monitor.
889 @param[in] NotificationFunction The function to call when the token
890 specified by Guid and TokenNumber is set.
891
892 @retval VOID
893
894 **/
895 VOID
896 EFIAPI
897 LibPcdCallbackOnSet (
898 IN CONST GUID *Guid, OPTIONAL
899 IN UINTN TokenNumber,
900 IN PCD_CALLBACK NotificationFunction
901 )
902 {
903 EFI_STATUS Status;
904 PCD_PPI * PcdPpi;
905
906 PcdPpi = GetPcdPpiPtr ();
907
908
909 Status = PcdPpi->CallbackOnSet (TokenNumber, Guid, NotificationFunction);
910
911 ASSERT_EFI_ERROR (Status);
912
913 return;
914 }
915
916
917
918 /**
919 Disable a notification function that was established with LibPcdCallbackonSet().
920 If NotificationFunction is NULL, then ASSERT().
921
922 @param[in] Guid Specify the GUID token space.
923 @param[in] TokenNumber Specify the token number.
924 @param[in] NotificationFunction The callback function to be unregistered.
925
926 @retval VOID
927
928 **/
929 VOID
930 EFIAPI
931 LibPcdCancelCallback (
932 IN CONST GUID *Guid, OPTIONAL
933 IN UINTN TokenNumber,
934 IN PCD_CALLBACK NotificationFunction
935 )
936 {
937 EFI_STATUS Status;
938 PCD_PPI * PcdPpi;
939
940 PcdPpi = GetPcdPpiPtr ();
941
942
943 Status = PcdPpi->CancelCallback (TokenNumber, Guid, NotificationFunction);
944
945 ASSERT_EFI_ERROR (Status);
946
947 return;
948 }
949
950
951
952 /**
953 Retrieves the next PCD token number from the token space specified by Guid.
954 If Guid is NULL, then the default token space is used. If TokenNumber is 0,
955 then the first token number is returned. Otherwise, the token number that
956 follows TokenNumber in the token space is returned. If TokenNumber is the last
957 token number in the token space, then 0 is returned. If TokenNumber is not 0 and
958 is not in the token space specified by Guid, then ASSERT().
959
960 @param[in] Pointer to a 128-bit unique value that designates which namespace
961 to set a value from. If NULL, then the default token space is used.
962 @param[in] The previous PCD token number. If 0, then retrieves the first PCD
963 token number.
964
965 @retval UINTN The next valid token number.
966
967 **/
968 UINTN
969 EFIAPI
970 LibPcdGetNextToken (
971 IN CONST GUID *Guid, OPTIONAL
972 IN UINTN TokenNumber
973 )
974 {
975 EFI_STATUS Status;
976 PCD_PPI * PcdPpi;
977
978 PcdPpi = GetPcdPpiPtr ();
979
980
981 Status = PcdPpi->GetNextToken (Guid, &TokenNumber);
982
983 ASSERT_EFI_ERROR (Status);
984
985 return TokenNumber;
986 }
987
988
989 /**
990 Retrieves the next PCD token space from a token space specified by Guid.
991 Guid of NULL is reserved to mark the default local token namespace on the current
992 platform. If Guid is NULL, then the GUID of the first non-local token space of the
993 current platform is returned. If Guid is the last non-local token space,
994 then NULL is returned.
995
996 If Guid is not NULL and is not a valid token space in the current platform, then ASSERT().
997
998
999
1000 @param[in] Pointer to a 128-bit unique value that designates from which namespace
1001 to start the search.
1002
1003 @retval CONST GUID * The next valid token namespace.
1004
1005 **/
1006 GUID *
1007 EFIAPI
1008 LibPcdGetNextTokenSpace (
1009 IN CONST GUID *Guid
1010 )
1011 {
1012 EFI_STATUS Status;
1013 PCD_PPI * PcdPpi;
1014
1015 PcdPpi = GetPcdPpiPtr ();
1016
1017
1018 Status = PcdPpi->GetNextTokenSpace (&Guid);
1019
1020 ASSERT_EFI_ERROR (Status);
1021
1022 return (GUID *)Guid;
1023 }
1024