]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/PeiPcdLib/PeiPcdLib.c
a73d804797836441a2df70cb6906f4956fe846df
[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 PcdPpi = GetPcdPpiPtr ();
590
591 ASSERT ((*SizeOfBuffer > 0) && Buffer == NULL);
592
593 Size = LibPcdGetSize (TokenNumber);
594
595 if (*SizeOfBuffer > Size) {
596 *SizeOfBuffer = Size;
597 return NULL;
598 }
599
600 Status = PcdPpi->SetPtr (TokenNumber, *SizeOfBuffer, Buffer);
601
602 ASSERT_EFI_ERROR (Status);
603
604 return Buffer;
605 }
606
607
608
609 /**
610 Sets the Boolean value for the token specified by TokenNumber
611 to the value specified by Value. Value is returned.
612
613 @param[in] TokenNumber The PCD token number to set a current value for.
614 @param[in] Value The boolean value to set.
615
616 @retval BOOLEAN Return the value been set.
617
618 **/
619 BOOLEAN
620 EFIAPI
621 LibPcdSetBool (
622 IN UINTN TokenNumber,
623 IN BOOLEAN Value
624 )
625 {
626 EFI_STATUS Status;
627 PCD_PPI * PcdPpi;
628
629 PcdPpi = GetPcdPpiPtr ();
630
631
632 Status = PcdPpi->SetBool (TokenNumber, Value);
633
634 ASSERT_EFI_ERROR (Status);
635
636 return Value;
637 }
638
639
640
641 /**
642 Sets the 8-bit value for the token specified by TokenNumber and
643 Guid to the value specified by Value. Value is returned.
644 If Guid is NULL, then ASSERT().
645
646 @param[in] Guid Pointer to a 128-bit unique value that
647 designates which namespace to set a value from.
648 @param[in] TokenNumber The PCD token number to set a current value for.
649 @param[in] Value The 8-bit value to set.
650
651 @retval UINT8 Return the value been set.
652
653 **/
654 UINT8
655 EFIAPI
656 LibPcdSetEx8 (
657 IN CONST GUID *Guid,
658 IN UINTN TokenNumber,
659 IN UINT8 Value
660 )
661 {
662 EFI_STATUS Status;
663 PCD_PPI * PcdPpi;
664
665 PcdPpi = GetPcdPpiPtr ();
666
667
668 Status = PcdPpi->Set8Ex (Guid, TokenNumber, Value);
669
670 ASSERT_EFI_ERROR (Status);
671
672 return Value;
673 }
674
675
676
677 /**
678 Sets the 16-bit value for the token specified by TokenNumber and
679 Guid to the value specified by Value. Value is returned.
680 If Guid is NULL, then ASSERT().
681
682 @param[in] Guid Pointer to a 128-bit unique value that
683 designates which namespace to set a value from.
684 @param[in] TokenNumber The PCD token number to set a current value for.
685 @param[in] Value The 16-bit value to set.
686
687 @retval UINT8 Return the value been set.
688
689 **/
690 UINT16
691 EFIAPI
692 LibPcdSetEx16 (
693 IN CONST GUID *Guid,
694 IN UINTN TokenNumber,
695 IN UINT16 Value
696 )
697 {
698 EFI_STATUS Status;
699 PCD_PPI * PcdPpi;
700
701 PcdPpi = GetPcdPpiPtr ();
702
703
704 Status = PcdPpi->Set16Ex (Guid, TokenNumber, Value);
705
706 ASSERT_EFI_ERROR (Status);
707
708 return Value;
709 }
710
711
712
713 /**
714 Sets the 32-bit value for the token specified by TokenNumber and
715 Guid to the value specified by Value. Value is returned.
716 If Guid is NULL, then ASSERT().
717
718 @param[in] Guid Pointer to a 128-bit unique value that
719 designates which namespace to set a value from.
720 @param[in] TokenNumber The PCD token number to set a current value for.
721 @param[in] Value The 32-bit value to set.
722
723 @retval UINT32 Return the value been set.
724
725 **/
726 UINT32
727 EFIAPI
728 LibPcdSetEx32 (
729 IN CONST GUID *Guid,
730 IN UINTN TokenNumber,
731 IN UINT32 Value
732 )
733 {
734 EFI_STATUS Status;
735 PCD_PPI * PcdPpi;
736
737 PcdPpi = GetPcdPpiPtr ();
738
739
740 Status = PcdPpi->Set32Ex (Guid, TokenNumber, Value);
741
742 ASSERT_EFI_ERROR (Status);
743
744 return Value;
745 }
746
747
748
749 /**
750 Sets the 64-bit value for the token specified by TokenNumber and
751 Guid to the value specified by Value. Value is returned.
752 If Guid is NULL, then ASSERT().
753
754 @param[in] Guid Pointer to a 128-bit unique value that
755 designates which namespace to set a value from.
756 @param[in] TokenNumber The PCD token number to set a current value for.
757 @param[in] Value The 64-bit value to set.
758
759 @retval UINT64 Return the value been set.
760
761 **/
762 UINT64
763 EFIAPI
764 LibPcdSetEx64 (
765 IN CONST GUID *Guid,
766 IN UINTN TokenNumber,
767 IN UINT64 Value
768 )
769 {
770 EFI_STATUS Status;
771 PCD_PPI * PcdPpi;
772
773 PcdPpi = GetPcdPpiPtr ();
774
775
776 Status = PcdPpi->Set64Ex (Guid, TokenNumber, Value);
777
778 ASSERT_EFI_ERROR (Status);
779
780 return Value;
781 }
782
783
784
785 /**
786 Sets a buffer for the token specified by TokenNumber to the value specified by
787 Buffer and SizeOfValue. Buffer is returned. If SizeOfValue is greater than
788 the maximum size support by TokenNumber, then set SizeOfValue to the maximum size
789 supported by TokenNumber and return NULL to indicate that the set operation
790 was not actually performed.
791
792 If SizeOfValue > 0 and Buffer is NULL, then ASSERT().
793
794 @param[in] Guid Pointer to a 128-bit unique value that
795 designates which namespace to set a value from.
796 @param[in] TokenNumber The PCD token number to set a current value for.
797 @param[in, out] SizeOfBuffer The size, in bytes, of Buffer.
798 @param[in] Buffer A pointer to the buffer to set.
799
800 @retval VOID * Return the pinter to the buffer been set.
801
802 **/
803 VOID *
804 EFIAPI
805 LibPcdSetExPtr (
806 IN CONST GUID *Guid,
807 IN UINTN TokenNumber,
808 IN OUT UINTN *SizeOfBuffer,
809 IN VOID *Buffer
810 )
811 {
812 EFI_STATUS Status;
813 PCD_PPI *PcdPpi;
814 UINTN Size;
815
816 PcdPpi = GetPcdPpiPtr ();
817
818 Size = LibPcdGetExSize (Guid, TokenNumber);
819 if (*SizeOfBuffer > Size) {
820 *SizeOfBuffer = Size;
821 return NULL;
822 }
823
824 Status = PcdPpi->SetPtrEx (Guid, TokenNumber, *SizeOfBuffer, Buffer);
825
826 ASSERT_EFI_ERROR (Status);
827
828 return Buffer;
829 }
830
831
832
833 /**
834 Sets the Boolean value for the token specified by TokenNumber and
835 Guid to the value specified by Value. Value is returned.
836 If Guid is NULL, then ASSERT().
837
838 @param[in] Guid Pointer to a 128-bit unique value that
839 designates which namespace to set a value from.
840 @param[in] TokenNumber The PCD token number to set a current value for.
841 @param[in] Value The Boolean value to set.
842
843 @retval Boolean Return the value been set.
844
845 **/
846 BOOLEAN
847 EFIAPI
848 LibPcdSetExBool (
849 IN CONST GUID *Guid,
850 IN UINTN TokenNumber,
851 IN BOOLEAN Value
852 )
853 {
854 EFI_STATUS Status;
855 PCD_PPI * PcdPpi;
856
857 PcdPpi = GetPcdPpiPtr ();
858
859
860 Status = PcdPpi->SetBoolEx (Guid, TokenNumber, Value);
861
862 ASSERT_EFI_ERROR (Status);
863
864 return Value;
865 }
866
867
868
869 /**
870 When the token specified by TokenNumber and Guid is set,
871 then notification function specified by NotificationFunction is called.
872 If Guid is NULL, then the default token space is used.
873 If NotificationFunction is NULL, then ASSERT().
874
875 @param[in] Guid Pointer to a 128-bit unique value that designates which
876 namespace to set a value from. If NULL, then the default
877 token space is used.
878 @param[in] TokenNumber The PCD token number to monitor.
879 @param[in] NotificationFunction The function to call when the token
880 specified by Guid and TokenNumber is set.
881
882 @retval VOID
883
884 **/
885 VOID
886 EFIAPI
887 LibPcdCallbackOnSet (
888 IN CONST GUID *Guid, OPTIONAL
889 IN UINTN TokenNumber,
890 IN PCD_CALLBACK NotificationFunction
891 )
892 {
893 EFI_STATUS Status;
894 PCD_PPI * PcdPpi;
895
896 PcdPpi = GetPcdPpiPtr ();
897
898
899 Status = PcdPpi->CallbackOnSet (TokenNumber, Guid, NotificationFunction);
900
901 ASSERT_EFI_ERROR (Status);
902
903 return;
904 }
905
906
907
908 /**
909 Disable a notification function that was established with LibPcdCallbackonSet().
910 If NotificationFunction is NULL, then ASSERT().
911
912 @param[in] Guid Specify the GUID token space.
913 @param[in] TokenNumber Specify the token number.
914 @param[in] NotificationFunction The callback function to be unregistered.
915
916 @retval VOID
917
918 **/
919 VOID
920 EFIAPI
921 LibPcdCancelCallback (
922 IN CONST GUID *Guid, OPTIONAL
923 IN UINTN TokenNumber,
924 IN PCD_CALLBACK NotificationFunction
925 )
926 {
927 EFI_STATUS Status;
928 PCD_PPI * PcdPpi;
929
930 PcdPpi = GetPcdPpiPtr ();
931
932
933 Status = PcdPpi->CancelCallback (TokenNumber, Guid, NotificationFunction);
934
935 ASSERT_EFI_ERROR (Status);
936
937 return;
938 }
939
940
941
942 /**
943 Retrieves the next PCD token number from the token space specified by Guid.
944 If Guid is NULL, then the default token space is used. If TokenNumber is 0,
945 then the first token number is returned. Otherwise, the token number that
946 follows TokenNumber in the token space is returned. If TokenNumber is the last
947 token number in the token space, then 0 is returned. If TokenNumber is not 0 and
948 is not in the token space specified by Guid, then ASSERT().
949
950 @param[in] Pointer to a 128-bit unique value that designates which namespace
951 to set a value from. If NULL, then the default token space is used.
952 @param[in] The previous PCD token number. If 0, then retrieves the first PCD
953 token number.
954
955 @retval UINTN The next valid token number.
956
957 **/
958 UINTN
959 EFIAPI
960 LibPcdGetNextToken (
961 IN CONST GUID *Guid, OPTIONAL
962 IN UINTN TokenNumber
963 )
964 {
965 EFI_STATUS Status;
966 PCD_PPI * PcdPpi;
967
968 PcdPpi = GetPcdPpiPtr ();
969
970
971 Status = PcdPpi->GetNextToken (Guid, &TokenNumber);
972
973 ASSERT_EFI_ERROR (Status);
974
975 return TokenNumber;
976 }
977
978
979 /**
980 Retrieves the next PCD token space from a token space specified by Guid.
981 Guid of NULL is reserved to mark the default local token namespace on the current
982 platform. If Guid is NULL, then the GUID of the first non-local token space of the
983 current platform is returned. If Guid is the last non-local token space,
984 then NULL is returned.
985
986 If Guid is not NULL and is not a valid token space in the current platform, then ASSERT().
987
988
989
990 @param[in] Pointer to a 128-bit unique value that designates from which namespace
991 to start the search.
992
993 @retval CONST GUID * The next valid token namespace.
994
995 **/
996 CONST GUID*
997 EFIAPI
998 LibPcdGetNextTokenSpace (
999 IN CONST GUID *Guid
1000 )
1001 {
1002 EFI_STATUS Status;
1003 PCD_PPI * PcdPpi;
1004
1005 PcdPpi = GetPcdPpiPtr ();
1006
1007
1008 Status = PcdPpi->GetNextTokenSpace (&Guid);
1009
1010 ASSERT_EFI_ERROR (Status);
1011
1012 return Guid;
1013 }
1014