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