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