]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BasePcdLibNull/PcdLib.c
e58965cc686f3f643d10cb5c0c92b5a2f9306ee7
[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 Module Name: PcdLib.c
14
15 **/
16
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 if (*SizeOfBuffer > 0) {
467 ASSERT (Buffer != NULL);
468 }
469
470 return Buffer;
471 }
472
473
474
475 /**
476 Sets the Boolean value for the token specified by TokenNumber
477 to the value specified by Value. Value is returned.
478
479 @param[in] TokenNumber The PCD token number to set a current value for.
480 @param[in] Value The boolean value to set.
481
482 @retval BOOLEAN Return the value been set.
483
484 **/
485 BOOLEAN
486 EFIAPI
487 LibPcdSetBool (
488 IN UINTN TokenNumber,
489 IN BOOLEAN Value
490 )
491 {
492 return Value;
493 }
494
495
496
497 /**
498 Sets the 8-bit value for the token specified by TokenNumber and
499 Guid to the value specified by Value. Value is returned.
500 If Guid is NULL, then ASSERT().
501
502 @param[in] Guid Pointer to a 128-bit unique value that
503 designates which namespace to set a value from.
504 @param[in] TokenNumber The PCD token number to set a current value for.
505 @param[in] Value The 8-bit value to set.
506
507 @retval UINT8 Return the value been set.
508
509 **/
510 UINT8
511 EFIAPI
512 LibPcdSetEx8 (
513 IN CONST GUID *Guid,
514 IN UINTN TokenNumber,
515 IN UINT8 Value
516 )
517 {
518 ASSERT (Guid != NULL);
519
520 return Value;
521 }
522
523
524
525 /**
526 Sets the 16-bit value for the token specified by TokenNumber and
527 Guid to the value specified by Value. Value is returned.
528 If Guid is NULL, then ASSERT().
529
530 @param[in] Guid Pointer to a 128-bit unique value that
531 designates which namespace to set a value from.
532 @param[in] TokenNumber The PCD token number to set a current value for.
533 @param[in] Value The 16-bit value to set.
534
535 @retval UINT8 Return the value been set.
536
537 **/
538 UINT16
539 EFIAPI
540 LibPcdSetEx16 (
541 IN CONST GUID *Guid,
542 IN UINTN TokenNumber,
543 IN UINT16 Value
544 )
545 {
546 ASSERT (Guid != NULL);
547
548 return Value;
549 }
550
551
552
553 /**
554 Sets the 32-bit value for the token specified by TokenNumber and
555 Guid to the value specified by Value. Value is returned.
556 If Guid is NULL, then ASSERT().
557
558 @param[in] Guid Pointer to a 128-bit unique value that
559 designates which namespace to set a value from.
560 @param[in] TokenNumber The PCD token number to set a current value for.
561 @param[in] Value The 32-bit value to set.
562
563 @retval UINT32 Return the value been set.
564
565 **/
566 UINT32
567 EFIAPI
568 LibPcdSetEx32 (
569 IN CONST GUID *Guid,
570 IN UINTN TokenNumber,
571 IN UINT32 Value
572 )
573 {
574 ASSERT (Guid != NULL);
575
576 return Value;
577 }
578
579
580
581 /**
582 Sets the 64-bit value for the token specified by TokenNumber and
583 Guid to the value specified by Value. Value is returned.
584 If Guid is NULL, then ASSERT().
585
586 @param[in] Guid Pointer to a 128-bit unique value that
587 designates which namespace to set a value from.
588 @param[in] TokenNumber The PCD token number to set a current value for.
589 @param[in] Value The 64-bit value to set.
590
591 @retval UINT64 Return the value been set.
592
593 **/
594 UINT64
595 EFIAPI
596 LibPcdSetEx64 (
597 IN CONST GUID *Guid,
598 IN UINTN TokenNumber,
599 IN UINT64 Value
600 )
601 {
602 ASSERT (Guid != NULL);
603
604 return Value;
605 }
606
607
608
609 /**
610 Sets a buffer for the token specified by TokenNumber to the value specified by
611 Buffer and SizeOfValue. Buffer is returned. If SizeOfValue is greater than
612 the maximum size support by TokenNumber, then set SizeOfValue to the maximum size
613 supported by TokenNumber and return NULL to indicate that the set operation
614 was not actually performed.
615
616 If SizeOfValue > 0 and Buffer is NULL, then ASSERT().
617
618 @param[in] Guid Pointer to a 128-bit unique value that
619 designates which namespace to set a value from.
620 @param[in] TokenNumber The PCD token number to set a current value for.
621 @param[in, out] SizeOfBuffer The size, in bytes, of Buffer.
622 @param[in] Buffer A pointer to the buffer to set.
623
624 @retval VOID * Return the pinter to the buffer been set.
625
626 **/
627 VOID *
628 EFIAPI
629 LibPcdSetExPtr (
630 IN CONST GUID *Guid,
631 IN UINTN TokenNumber,
632 IN OUT UINTN *SizeOfBuffer,
633 IN VOID *Buffer
634 )
635 {
636 ASSERT (Guid != NULL);
637
638 ASSERT (SizeOfBuffer != NULL);
639
640 if (*SizeOfBuffer > 0) {
641 ASSERT (Buffer != NULL);
642 }
643
644 return Buffer;
645 }
646
647
648
649 /**
650 Sets the Boolean value for the token specified by TokenNumber and
651 Guid to the value specified by Value. Value is returned.
652 If Guid is NULL, then ASSERT().
653
654 @param[in] Guid Pointer to a 128-bit unique value that
655 designates which namespace to set a value from.
656 @param[in] TokenNumber The PCD token number to set a current value for.
657 @param[in] Value The Boolean value to set.
658
659 @retval Boolean Return the value been set.
660
661 **/
662 BOOLEAN
663 EFIAPI
664 LibPcdSetExBool (
665 IN CONST GUID *Guid,
666 IN UINTN TokenNumber,
667 IN BOOLEAN Value
668 )
669 {
670 ASSERT (Guid != NULL);
671
672 return Value;
673 }
674
675
676
677 /**
678 When the token specified by TokenNumber and Guid is set,
679 then notification function specified by NotificationFunction is called.
680 If Guid is NULL, then the default token space is used.
681 If NotificationFunction is NULL, then ASSERT().
682
683 @param[in] Guid Pointer to a 128-bit unique value that designates which
684 namespace to set a value from. If NULL, then the default
685 token space is used.
686 @param[in] TokenNumber The PCD token number to monitor.
687 @param[in] NotificationFunction The function to call when the token
688 specified by Guid and TokenNumber is set.
689
690 @retval VOID
691
692 **/
693 VOID
694 EFIAPI
695 LibPcdCallbackOnSet (
696 IN CONST GUID *Guid, OPTIONAL
697 IN UINTN TokenNumber,
698 IN PCD_CALLBACK NotificationFunction
699 )
700 {
701 ASSERT (NotificationFunction != NULL);
702 }
703
704
705
706 /**
707 Disable a notification function that was established with LibPcdCallbackonSet().
708 If NotificationFunction is NULL, then ASSERT().
709
710 @param[in] Guid Specify the GUID token space.
711 @param[in] TokenNumber Specify the token number.
712 @param[in] NotificationFunction The callback function to be unregistered.
713
714 @retval VOID
715
716 **/
717 VOID
718 EFIAPI
719 LibPcdCancelCallback (
720 IN CONST GUID *Guid, OPTIONAL
721 IN UINTN TokenNumber,
722 IN PCD_CALLBACK NotificationFunction
723 )
724 {
725 ASSERT (NotificationFunction != NULL);
726 }
727
728
729
730 /**
731 Retrieves the next PCD token number from the token space specified by Guid.
732 If Guid is NULL, then the default token space is used. If TokenNumber is 0,
733 then the first token number is returned. Otherwise, the token number that
734 follows TokenNumber in the token space is returned. If TokenNumber is the last
735 token number in the token space, then 0 is returned. If TokenNumber is not 0 and
736 is not in the token space specified by Guid, then ASSERT().
737
738 @param[in] Pointer to a 128-bit unique value that designates which namespace
739 to set a value from. If NULL, then the default token space is used.
740 @param[in] The previous PCD token number. If 0, then retrieves the first PCD
741 token number.
742
743 @retval UINTN The next valid token number.
744
745 **/
746 UINTN
747 EFIAPI
748 LibPcdGetNextToken (
749 IN CONST GUID *Guid, OPTIONAL
750 IN UINTN TokenNumber
751 )
752 {
753 return 0;
754 }
755
756
757
758 /**
759 Retrieves the next PCD token space from a token space specified by Guid.
760 Guid of NULL is reserved to mark the default local token namespace on the current
761 platform. If Guid is NULL, then the GUID of the first non-local token space of the
762 current platform is returned. If Guid is the last non-local token space,
763 then NULL is returned.
764
765 If Guid is not NULL and is not a valid token space in the current platform, then ASSERT().
766
767
768
769 @param[in] Pointer to a 128-bit unique value that designates from which namespace
770 to start the search.
771
772 @retval CONST GUID * The next valid token namespace.
773
774 **/
775 GUID *
776 EFIAPI
777 LibPcdGetNextTokenSpace (
778 IN CONST GUID *Guid
779 )
780 {
781 return NULL;
782 }
783
784
785
786 /**
787 Sets the PCD entry specified by PatchVariable to the value specified by Buffer
788 and SizeOfValue. Buffer is returned. If SizeOfValue is greater than
789 MaximumDatumSize, then set SizeOfValue to MaximumDatumSize and return
790 NULL to indicate that the set operation was not actually performed.
791 If SizeOfValue is set to MAX_ADDRESS, then SizeOfValue must be set to
792 MaximumDatumSize and NULL must be returned.
793
794 If PatchVariable is NULL, then ASSERT().
795 If SizeOfValue is NULL, then ASSERT().
796 If SizeOfValue > 0 and Buffer is NULL, then ASSERT().
797
798 @param[in] PatchVariable A pointer to the global variable in a module that is
799 the target of the set operation.
800 @param[in] MaximumDatumSize The maximum size allowed for the PCD entry specified by PatchVariable.
801 @param[in, out] SizeOfBuffer A pointer to the size, in bytes, of Buffer.
802 @param[in] Buffer A pointer to the buffer to used to set the target variable.
803
804 **/
805 VOID *
806 EFIAPI
807 LibPatchPcdSetPtr (
808 IN VOID *PatchVariable,
809 IN UINTN MaximumDatumSize,
810 IN OUT UINTN *SizeOfBuffer,
811 IN CONST VOID *Buffer
812 )
813 {
814 ASSERT (PatchVariable != NULL);
815 ASSERT (SizeOfBuffer != NULL);
816
817 if (*SizeOfBuffer > 0) {
818 ASSERT (Buffer != NULL);
819 }
820
821 if ((*SizeOfBuffer > MaximumDatumSize) ||
822 (*SizeOfBuffer == MAX_ADDRESS)) {
823 *SizeOfBuffer = MaximumDatumSize;
824 return NULL;
825 }
826
827 CopyMem (PatchVariable, Buffer, *SizeOfBuffer);
828
829 return (VOID *) Buffer;
830 }
831