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