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