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