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