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