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