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