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