]>
Commit | Line | Data |
---|---|---|
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 SKU_ID 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 | \r | |
71 | ASSERT (SkuId < 0x100);\r | |
72 | \r | |
73 | GetPcdPpiPtr()->SetSku (SkuId);;\r | |
74 | \r | |
75 | return SkuId;\r | |
76 | }\r | |
77 | \r | |
78 | \r | |
79 | \r | |
80 | /**\r | |
81 | Returns the 8-bit value for the token specified by TokenNumber. \r | |
82 | \r | |
83 | @param[in] The PCD token number to retrieve a current value for.\r | |
84 | \r | |
85 | @retval UINT8 Returns the 8-bit value for the token specified by TokenNumber. \r | |
86 | \r | |
87 | **/\r | |
88 | UINT8\r | |
89 | EFIAPI\r | |
90 | LibPcdGet8 (\r | |
91 | IN UINTN TokenNumber\r | |
92 | )\r | |
93 | {\r | |
94 | PCD_PPI * PcdPpi;\r | |
95 | \r | |
96 | PcdPpi = GetPcdPpiPtr ();\r | |
97 | \r | |
98 | return PcdPpi->Get8 (TokenNumber);\r | |
99 | }\r | |
100 | \r | |
101 | \r | |
102 | \r | |
103 | /**\r | |
104 | Returns the 16-bit value for the token specified by TokenNumber. \r | |
105 | \r | |
106 | @param[in] The PCD token number to retrieve a current value for.\r | |
107 | \r | |
108 | @retval UINT16 Returns the 16-bit value for the token specified by TokenNumber. \r | |
109 | \r | |
110 | **/\r | |
111 | UINT16\r | |
112 | EFIAPI\r | |
113 | LibPcdGet16 (\r | |
114 | IN UINTN TokenNumber\r | |
115 | )\r | |
116 | {\r | |
117 | PCD_PPI *PcdPpi;\r | |
118 | \r | |
119 | PcdPpi = GetPcdPpiPtr ();\r | |
120 | \r | |
121 | return PcdPpi->Get16 (TokenNumber);\r | |
122 | }\r | |
123 | \r | |
124 | \r | |
125 | \r | |
126 | /**\r | |
127 | Returns the 32-bit value for the token specified by TokenNumber. \r | |
128 | \r | |
129 | @param[in] TokenNumber The PCD token number to retrieve a current value for.\r | |
130 | \r | |
131 | @retval UINT32 Returns the 32-bit value for the token specified by TokenNumber.\r | |
132 | \r | |
133 | **/\r | |
134 | UINT32\r | |
135 | EFIAPI\r | |
136 | LibPcdGet32 (\r | |
137 | IN UINTN TokenNumber\r | |
138 | )\r | |
139 | {\r | |
140 | PCD_PPI * PcdPpi;\r | |
141 | \r | |
142 | PcdPpi = GetPcdPpiPtr ();\r | |
143 | \r | |
144 | return PcdPpi->Get32 (TokenNumber);\r | |
145 | }\r | |
146 | \r | |
147 | \r | |
148 | \r | |
149 | /**\r | |
150 | Returns the 64-bit value for the token specified by TokenNumber.\r | |
151 | \r | |
152 | @param[in] TokenNumber The PCD token number to retrieve a current value for.\r | |
153 | \r | |
154 | @retval UINT64 Returns the 64-bit value for the token specified by TokenNumber.\r | |
155 | \r | |
156 | **/\r | |
157 | UINT64\r | |
158 | EFIAPI\r | |
159 | LibPcdGet64 (\r | |
160 | IN UINTN TokenNumber\r | |
161 | )\r | |
162 | {\r | |
163 | PCD_PPI * PcdPpi;\r | |
164 | \r | |
165 | PcdPpi = GetPcdPpiPtr ();\r | |
166 | \r | |
167 | return PcdPpi->Get64 (TokenNumber);\r | |
168 | }\r | |
169 | \r | |
170 | \r | |
171 | \r | |
172 | /**\r | |
173 | Returns the pointer to the buffer of the token specified by TokenNumber.\r | |
174 | \r | |
175 | @param[in] TokenNumber The PCD token number to retrieve a current value for.\r | |
176 | \r | |
177 | @retval VOID* Returns the pointer to the token specified by TokenNumber.\r | |
178 | \r | |
179 | **/\r | |
180 | VOID *\r | |
181 | EFIAPI\r | |
182 | LibPcdGetPtr (\r | |
183 | IN UINTN TokenNumber\r | |
184 | )\r | |
185 | {\r | |
186 | PCD_PPI * PcdPpi;\r | |
187 | \r | |
188 | PcdPpi = GetPcdPpiPtr ();\r | |
189 | \r | |
190 | return PcdPpi->GetPtr (TokenNumber);\r | |
191 | }\r | |
192 | \r | |
193 | \r | |
194 | \r | |
195 | /**\r | |
196 | Returns the Boolean value of the token specified by TokenNumber. \r | |
197 | \r | |
198 | @param[in] TokenNumber The PCD token number to retrieve a current value for.\r | |
199 | \r | |
200 | @retval BOOLEAN Returns the Boolean value of the token specified by TokenNumber. \r | |
201 | \r | |
202 | **/\r | |
203 | BOOLEAN \r | |
204 | EFIAPI\r | |
205 | LibPcdGetBool (\r | |
206 | IN UINTN TokenNumber\r | |
207 | )\r | |
208 | {\r | |
209 | PCD_PPI * PcdPpi;\r | |
210 | \r | |
211 | PcdPpi = GetPcdPpiPtr ();\r | |
212 | \r | |
213 | return PcdPpi->GetBool (TokenNumber);\r | |
214 | }\r | |
215 | \r | |
216 | \r | |
217 | \r | |
218 | /**\r | |
219 | Returns the size of the token specified by TokenNumber. \r | |
220 | \r | |
221 | @param[in] TokenNumber The PCD token number to retrieve a current value for.\r | |
222 | \r | |
223 | @retval UINTN Returns the size of the token specified by TokenNumber. \r | |
224 | \r | |
225 | **/\r | |
226 | UINTN\r | |
227 | EFIAPI\r | |
228 | LibPcdGetSize (\r | |
229 | IN UINTN TokenNumber\r | |
230 | )\r | |
231 | {\r | |
232 | PCD_PPI * PcdPpi;\r | |
233 | \r | |
234 | PcdPpi = GetPcdPpiPtr ();\r | |
235 | \r | |
236 | return PcdPpi->GetSize (TokenNumber);\r | |
237 | }\r | |
238 | \r | |
239 | \r | |
240 | \r | |
241 | /**\r | |
242 | Returns the 8-bit value for the token specified by TokenNumber and Guid.\r | |
243 | If Guid is NULL, then ASSERT(). \r | |
244 | \r | |
245 | @param[in] Guid Pointer to a 128-bit unique value that designates \r | |
246 | which namespace to retrieve a value from.\r | |
247 | @param[in] TokenNumber The PCD token number to retrieve a current value for.\r | |
248 | \r | |
249 | @retval UINT8 Return the UINT8.\r | |
250 | \r | |
251 | **/\r | |
252 | UINT8\r | |
253 | EFIAPI\r | |
254 | LibPcdGetEx8 (\r | |
255 | IN CONST GUID *Guid,\r | |
256 | IN UINTN TokenNumber\r | |
257 | )\r | |
258 | {\r | |
259 | PCD_PPI * PcdPpi;\r | |
260 | \r | |
261 | ASSERT (Guid != NULL);\r | |
262 | \r | |
263 | PcdPpi = GetPcdPpiPtr ();\r | |
264 | \r | |
265 | return PcdPpi->Get8Ex (Guid, TokenNumber);\r | |
266 | }\r | |
267 | \r | |
268 | \r | |
269 | \r | |
270 | /**\r | |
271 | Returns the 16-bit value for the token specified by TokenNumber and Guid.\r | |
272 | If Guid is NULL, then ASSERT(). \r | |
273 | \r | |
274 | @param[in] Guid Pointer to a 128-bit unique value that designates \r | |
275 | which namespace to retrieve a value from.\r | |
276 | @param[in] TokenNumber The PCD token number to retrieve a current value for.\r | |
277 | \r | |
278 | @retval UINT16 Return the UINT16.\r | |
279 | \r | |
280 | **/\r | |
281 | UINT16\r | |
282 | EFIAPI\r | |
283 | LibPcdGetEx16 (\r | |
284 | IN CONST GUID *Guid,\r | |
285 | IN UINTN TokenNumber\r | |
286 | )\r | |
287 | {\r | |
288 | PCD_PPI * PcdPpi;\r | |
289 | \r | |
290 | ASSERT (Guid != NULL);\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 | ASSERT (Guid != NULL);\r | |
320 | \r | |
321 | PcdPpi = GetPcdPpiPtr ();\r | |
322 | \r | |
323 | return PcdPpi->Get32Ex (Guid, TokenNumber);\r | |
324 | }\r | |
325 | \r | |
326 | \r | |
327 | \r | |
328 | \r | |
329 | /**\r | |
330 | Returns the 64-bit value for the token specified by TokenNumber and Guid.\r | |
331 | If Guid is NULL, then ASSERT(). \r | |
332 | \r | |
333 | @param[in] Guid Pointer to a 128-bit unique value that designates \r | |
334 | which namespace to retrieve a value from.\r | |
335 | @param[in] TokenNumber The PCD token number to retrieve a current value for.\r | |
336 | \r | |
337 | @retval UINT64 Return the UINT64.\r | |
338 | \r | |
339 | **/\r | |
340 | UINT64\r | |
341 | EFIAPI\r | |
342 | LibPcdGetEx64 (\r | |
343 | IN CONST GUID *Guid,\r | |
344 | IN UINTN TokenNumber\r | |
345 | )\r | |
346 | {\r | |
347 | PCD_PPI * PcdPpi;\r | |
348 | \r | |
349 | ASSERT (Guid != NULL);\r | |
350 | \r | |
351 | PcdPpi = GetPcdPpiPtr ();\r | |
352 | \r | |
353 | return PcdPpi->Get64Ex (Guid, TokenNumber);\r | |
354 | }\r | |
355 | \r | |
356 | \r | |
357 | \r | |
358 | /**\r | |
359 | Returns the pointer to the token specified by TokenNumber and Guid.\r | |
360 | If Guid is NULL, then ASSERT(). \r | |
361 | \r | |
362 | @param[in] Guid Pointer to a 128-bit unique value that designates \r | |
363 | which namespace to retrieve a value from.\r | |
364 | @param[in] TokenNumber The PCD token number to retrieve a current value for.\r | |
365 | \r | |
366 | @retval VOID* Return the VOID* pointer.\r | |
367 | \r | |
368 | **/\r | |
369 | VOID *\r | |
370 | EFIAPI\r | |
371 | LibPcdGetExPtr (\r | |
372 | IN CONST GUID *Guid,\r | |
373 | IN UINTN TokenNumber\r | |
374 | )\r | |
375 | {\r | |
376 | PCD_PPI * PcdPpi;\r | |
377 | \r | |
378 | ASSERT (Guid != NULL);\r | |
379 | \r | |
380 | PcdPpi = GetPcdPpiPtr ();\r | |
381 | \r | |
382 | return PcdPpi->GetPtrEx (Guid, TokenNumber);\r | |
383 | }\r | |
384 | \r | |
385 | \r | |
386 | \r | |
387 | /**\r | |
388 | Returns the Boolean value of the token specified by TokenNumber and Guid. \r | |
389 | If Guid is NULL, then ASSERT(). \r | |
390 | \r | |
391 | @param[in] Guid Pointer to a 128-bit unique value that designates \r | |
392 | which namespace to retrieve a value from.\r | |
393 | @param[in] TokenNumber The PCD token number to retrieve a current value for.\r | |
394 | \r | |
395 | @retval BOOLEAN Return the BOOLEAN.\r | |
396 | \r | |
397 | **/\r | |
398 | BOOLEAN\r | |
399 | EFIAPI\r | |
400 | LibPcdGetExBool (\r | |
401 | IN CONST GUID *Guid,\r | |
402 | IN UINTN TokenNumber\r | |
403 | )\r | |
404 | {\r | |
405 | PCD_PPI * PcdPpi;\r | |
406 | \r | |
407 | ASSERT (Guid != NULL);\r | |
408 | \r | |
409 | PcdPpi = GetPcdPpiPtr ();\r | |
410 | \r | |
411 | return PcdPpi->GetBoolEx (Guid, TokenNumber);\r | |
412 | }\r | |
413 | \r | |
414 | \r | |
415 | \r | |
416 | /**\r | |
417 | Returns the size of the token specified by TokenNumber and Guid. \r | |
418 | If Guid is NULL, then ASSERT(). \r | |
419 | \r | |
420 | @param[in] Guid Pointer to a 128-bit unique value that designates \r | |
421 | which namespace to retrieve a value from.\r | |
422 | @param[in] TokenNumber The PCD token number to retrieve a current value for.\r | |
423 | \r | |
424 | @retval UINTN Return the size.\r | |
425 | \r | |
426 | **/\r | |
427 | UINTN\r | |
428 | EFIAPI\r | |
429 | LibPcdGetExSize (\r | |
430 | IN CONST GUID *Guid,\r | |
431 | IN UINTN TokenNumber\r | |
432 | )\r | |
433 | {\r | |
434 | PCD_PPI * PcdPpi;\r | |
435 | \r | |
436 | ASSERT (Guid != NULL);\r | |
437 | \r | |
438 | PcdPpi = GetPcdPpiPtr ();\r | |
439 | \r | |
440 | return PcdPpi->GetSizeEx (Guid, TokenNumber);\r | |
441 | }\r | |
442 | \r | |
443 | \r | |
444 | \r | |
445 | /**\r | |
446 | Sets the 8-bit value for the token specified by TokenNumber \r | |
447 | to the value specified by Value. Value is returned.\r | |
448 | \r | |
449 | @param[in] TokenNumber The PCD token number to set a current value for.\r | |
450 | @param[in] Value The 8-bit value to set.\r | |
451 | \r | |
452 | @retval UINT8 Return the value been set.\r | |
453 | \r | |
454 | **/\r | |
455 | UINT8\r | |
456 | EFIAPI\r | |
457 | LibPcdSet8 (\r | |
458 | IN UINTN TokenNumber,\r | |
459 | IN UINT8 Value\r | |
460 | )\r | |
461 | {\r | |
462 | EFI_STATUS Status;\r | |
463 | PCD_PPI * PcdPpi;\r | |
464 | \r | |
465 | PcdPpi = GetPcdPpiPtr ();\r | |
466 | \r | |
467 | Status = PcdPpi->Set8 (TokenNumber, Value);\r | |
468 | \r | |
469 | ASSERT_EFI_ERROR (Status);\r | |
470 | \r | |
471 | return Value;\r | |
472 | }\r | |
473 | \r | |
474 | \r | |
475 | \r | |
476 | /**\r | |
477 | Sets the 16-bit value for the token specified by TokenNumber \r | |
478 | to the value specified by Value. Value is returned.\r | |
479 | \r | |
480 | @param[in] TokenNumber The PCD token number to set a current value for.\r | |
481 | @param[in] Value The 16-bit value to set.\r | |
482 | \r | |
483 | @retval UINT16 Return the value been set.\r | |
484 | \r | |
485 | **/\r | |
486 | UINT16\r | |
487 | EFIAPI\r | |
488 | LibPcdSet16 (\r | |
489 | IN UINTN TokenNumber,\r | |
490 | IN UINT16 Value\r | |
491 | )\r | |
492 | {\r | |
493 | EFI_STATUS Status;\r | |
494 | PCD_PPI * PcdPpi;\r | |
495 | \r | |
496 | PcdPpi = GetPcdPpiPtr ();\r | |
497 | \r | |
498 | Status = PcdPpi->Set16 (TokenNumber, Value);\r | |
499 | \r | |
500 | ASSERT_EFI_ERROR (Status);\r | |
501 | \r | |
502 | return Value;\r | |
503 | }\r | |
504 | \r | |
505 | \r | |
506 | \r | |
507 | /**\r | |
508 | Sets the 32-bit value for the token specified by TokenNumber \r | |
509 | to the value specified by Value. Value is returned.\r | |
510 | \r | |
511 | @param[in] TokenNumber The PCD token number to set a current value for.\r | |
512 | @param[in] Value The 32-bit value to set.\r | |
513 | \r | |
514 | @retval UINT32 Return the value been set.\r | |
515 | \r | |
516 | **/\r | |
517 | UINT32\r | |
518 | EFIAPI\r | |
519 | LibPcdSet32 (\r | |
520 | IN UINTN TokenNumber,\r | |
521 | IN UINT32 Value\r | |
522 | )\r | |
523 | {\r | |
524 | EFI_STATUS Status;\r | |
525 | PCD_PPI * PcdPpi;\r | |
526 | \r | |
527 | PcdPpi = GetPcdPpiPtr ();\r | |
528 | \r | |
529 | Status = PcdPpi->Set32 (TokenNumber, Value);\r | |
530 | \r | |
531 | ASSERT_EFI_ERROR (Status);\r | |
532 | \r | |
533 | return Value;\r | |
534 | }\r | |
535 | \r | |
536 | \r | |
537 | \r | |
538 | /**\r | |
539 | Sets the 64-bit value for the token specified by TokenNumber \r | |
540 | to the value specified by Value. Value is returned.\r | |
541 | \r | |
542 | @param[in] TokenNumber The PCD token number to set a current value for.\r | |
543 | @param[in] Value The 64-bit value to set.\r | |
544 | \r | |
545 | @retval UINT64 Return the value been set.\r | |
546 | \r | |
547 | **/\r | |
548 | UINT64\r | |
549 | EFIAPI\r | |
550 | LibPcdSet64 (\r | |
551 | IN UINTN TokenNumber,\r | |
552 | IN UINT64 Value\r | |
553 | )\r | |
554 | {\r | |
555 | EFI_STATUS Status;\r | |
556 | PCD_PPI * PcdPpi;\r | |
557 | \r | |
558 | PcdPpi = GetPcdPpiPtr ();\r | |
559 | \r | |
560 | Status = PcdPpi->Set64 (TokenNumber, Value);\r | |
561 | \r | |
562 | ASSERT_EFI_ERROR (Status);\r | |
563 | \r | |
564 | return Value;\r | |
565 | }\r | |
566 | \r | |
567 | \r | |
568 | \r | |
569 | /**\r | |
570 | Sets a buffer for the token specified by TokenNumber to \r | |
571 | the value specified by Buffer and SizeOfValue. Buffer to\r | |
572 | be set is returned. The content of the buffer could be \r | |
573 | overwritten if a Callback on SET is registered with this\r | |
574 | TokenNumber.\r | |
575 | \r | |
576 | If SizeOfValue is greater than the maximum \r | |
577 | size support by TokenNumber, then set SizeOfValue to the \r | |
578 | maximum size supported by TokenNumber and return NULL to \r | |
579 | indicate that the set operation was not actually performed. \r | |
580 | \r | |
581 | If SizeOfValue > 0 and Buffer is NULL, then ASSERT().\r | |
582 | \r | |
583 | @param[in] TokenNumber The PCD token number to set a current value for.\r | |
584 | @param[in,out] SizeOfBuffer The size, in bytes, of Buffer.\r | |
585 | @param[in] Value A pointer to the buffer to set.\r | |
586 | \r | |
587 | @retval VOID* Return the pointer for the buffer been set.\r | |
588 | \r | |
589 | **/\r | |
590 | VOID *\r | |
591 | EFIAPI\r | |
592 | LibPcdSetPtr (\r | |
593 | IN UINTN TokenNumber,\r | |
594 | IN OUT UINTN *SizeOfBuffer,\r | |
595 | IN VOID *Buffer\r | |
596 | )\r | |
597 | {\r | |
598 | EFI_STATUS Status;\r | |
599 | PCD_PPI *PcdPpi;\r | |
600 | \r | |
601 | ASSERT (SizeOfBuffer != NULL);\r | |
602 | \r | |
603 | if (*SizeOfBuffer > 0) {\r | |
604 | ASSERT (Buffer != NULL);\r | |
605 | }\r | |
606 | \r | |
607 | PcdPpi = GetPcdPpiPtr ();\r | |
608 | \r | |
609 | Status = PcdPpi->SetPtr (TokenNumber, SizeOfBuffer, Buffer);\r | |
610 | \r | |
611 | if (EFI_ERROR (Status)) {\r | |
612 | return NULL;\r | |
613 | }\r | |
614 | \r | |
615 | return Buffer;\r | |
616 | }\r | |
617 | \r | |
618 | \r | |
619 | \r | |
620 | /**\r | |
621 | Sets the Boolean value for the token specified by TokenNumber \r | |
622 | to the value specified by Value. Value is returned.\r | |
623 | \r | |
624 | @param[in] TokenNumber The PCD token number to set a current value for.\r | |
625 | @param[in] Value The boolean value to set.\r | |
626 | \r | |
627 | @retval BOOLEAN Return the value been set.\r | |
628 | \r | |
629 | **/\r | |
630 | BOOLEAN\r | |
631 | EFIAPI\r | |
632 | LibPcdSetBool (\r | |
633 | IN UINTN TokenNumber,\r | |
634 | IN BOOLEAN Value\r | |
635 | )\r | |
636 | {\r | |
637 | EFI_STATUS Status;\r | |
638 | PCD_PPI * PcdPpi;\r | |
639 | \r | |
640 | PcdPpi = GetPcdPpiPtr ();\r | |
641 | \r | |
642 | Status = PcdPpi->SetBool (TokenNumber, Value);\r | |
643 | \r | |
644 | ASSERT_EFI_ERROR (Status);\r | |
645 | \r | |
646 | return Value;\r | |
647 | }\r | |
648 | \r | |
649 | \r | |
650 | \r | |
651 | /**\r | |
652 | Sets the 8-bit value for the token specified by TokenNumber and \r | |
653 | Guid to the value specified by Value. Value is returned.\r | |
654 | If Guid is NULL, then ASSERT().\r | |
655 | \r | |
656 | @param[in] Guid Pointer to a 128-bit unique value that \r | |
657 | designates which namespace to set a value from.\r | |
658 | @param[in] TokenNumber The PCD token number to set a current value for.\r | |
659 | @param[in] Value The 8-bit value to set.\r | |
660 | \r | |
661 | @retval UINT8 Return the value been set.\r | |
662 | \r | |
663 | **/\r | |
664 | UINT8\r | |
665 | EFIAPI\r | |
666 | LibPcdSetEx8 (\r | |
667 | IN CONST GUID *Guid,\r | |
668 | IN UINTN TokenNumber,\r | |
669 | IN UINT8 Value\r | |
670 | )\r | |
671 | {\r | |
672 | EFI_STATUS Status;\r | |
673 | PCD_PPI * PcdPpi;\r | |
674 | \r | |
675 | PcdPpi = GetPcdPpiPtr ();\r | |
676 | \r | |
677 | ASSERT (Guid != NULL);\r | |
678 | \r | |
679 | Status = PcdPpi->Set8Ex (Guid, TokenNumber, Value);\r | |
680 | \r | |
681 | ASSERT_EFI_ERROR (Status);\r | |
682 | \r | |
683 | return Value;\r | |
684 | }\r | |
685 | \r | |
686 | \r | |
687 | \r | |
688 | /**\r | |
689 | Sets the 16-bit value for the token specified by TokenNumber and \r | |
690 | Guid to the value specified by Value. Value is returned.\r | |
691 | If Guid is NULL, then ASSERT().\r | |
692 | \r | |
693 | @param[in] Guid Pointer to a 128-bit unique value that \r | |
694 | designates which namespace to set a value from.\r | |
695 | @param[in] TokenNumber The PCD token number to set a current value for.\r | |
696 | @param[in] Value The 16-bit value to set.\r | |
697 | \r | |
698 | @retval UINT8 Return the value been set.\r | |
699 | \r | |
700 | **/\r | |
701 | UINT16\r | |
702 | EFIAPI\r | |
703 | LibPcdSetEx16 (\r | |
704 | IN CONST GUID *Guid,\r | |
705 | IN UINTN TokenNumber,\r | |
706 | IN UINT16 Value\r | |
707 | )\r | |
708 | {\r | |
709 | EFI_STATUS Status;\r | |
710 | PCD_PPI * PcdPpi;\r | |
711 | \r | |
712 | PcdPpi = GetPcdPpiPtr ();\r | |
713 | \r | |
714 | ASSERT (Guid != NULL);\r | |
715 | Status = PcdPpi->Set16Ex (Guid, TokenNumber, Value);\r | |
716 | \r | |
717 | ASSERT_EFI_ERROR (Status);\r | |
718 | \r | |
719 | return Value;\r | |
720 | }\r | |
721 | \r | |
722 | \r | |
723 | \r | |
724 | /**\r | |
725 | Sets the 32-bit value for the token specified by TokenNumber and \r | |
726 | Guid to the value specified by Value. Value is returned.\r | |
727 | If Guid is NULL, then ASSERT().\r | |
728 | \r | |
729 | @param[in] Guid Pointer to a 128-bit unique value that \r | |
730 | designates which namespace to set a value from.\r | |
731 | @param[in] TokenNumber The PCD token number to set a current value for.\r | |
732 | @param[in] Value The 32-bit value to set.\r | |
733 | \r | |
734 | @retval UINT32 Return the value been set.\r | |
735 | \r | |
736 | **/\r | |
737 | UINT32\r | |
738 | EFIAPI\r | |
739 | LibPcdSetEx32 (\r | |
740 | IN CONST GUID *Guid,\r | |
741 | IN UINTN TokenNumber,\r | |
742 | IN UINT32 Value\r | |
743 | )\r | |
744 | {\r | |
745 | EFI_STATUS Status;\r | |
746 | PCD_PPI * PcdPpi;\r | |
747 | ASSERT (Guid != NULL);\r | |
748 | PcdPpi = GetPcdPpiPtr ();\r | |
749 | \r | |
750 | \r | |
751 | Status = PcdPpi->Set32Ex (Guid, TokenNumber, Value);\r | |
752 | \r | |
753 | ASSERT_EFI_ERROR (Status);\r | |
754 | \r | |
755 | return Value;\r | |
756 | }\r | |
757 | \r | |
758 | \r | |
759 | \r | |
760 | /**\r | |
761 | Sets the 64-bit value for the token specified by TokenNumber and \r | |
762 | Guid to the value specified by Value. Value is returned.\r | |
763 | If Guid is NULL, then ASSERT().\r | |
764 | \r | |
765 | @param[in] Guid Pointer to a 128-bit unique value that \r | |
766 | designates which namespace to set a value from.\r | |
767 | @param[in] TokenNumber The PCD token number to set a current value for.\r | |
768 | @param[in] Value The 64-bit value to set.\r | |
769 | \r | |
770 | @retval UINT64 Return the value been set.\r | |
771 | \r | |
772 | **/\r | |
773 | UINT64\r | |
774 | EFIAPI\r | |
775 | LibPcdSetEx64 (\r | |
776 | IN CONST GUID *Guid,\r | |
777 | IN UINTN TokenNumber,\r | |
778 | IN UINT64 Value\r | |
779 | )\r | |
780 | {\r | |
781 | EFI_STATUS Status;\r | |
782 | PCD_PPI * PcdPpi;\r | |
783 | ASSERT (Guid != NULL);\r | |
784 | PcdPpi = GetPcdPpiPtr ();\r | |
785 | \r | |
786 | \r | |
787 | Status = PcdPpi->Set64Ex (Guid, TokenNumber, Value);\r | |
788 | \r | |
789 | ASSERT_EFI_ERROR (Status);\r | |
790 | \r | |
791 | return Value;\r | |
792 | }\r | |
793 | \r | |
794 | \r | |
795 | \r | |
796 | /**\r | |
797 | Sets a buffer for the token specified by TokenNumber to the value specified by \r | |
798 | Buffer and SizeOfValue. Buffer is returned. If SizeOfValue is greater than \r | |
799 | the maximum size support by TokenNumber, then set SizeOfValue to the maximum size \r | |
800 | supported by TokenNumber and return NULL to indicate that the set operation \r | |
801 | was not actually performed. \r | |
802 | \r | |
803 | If SizeOfValue > 0 and Buffer is NULL, then ASSERT().\r | |
804 | \r | |
805 | @param[in] Guid Pointer to a 128-bit unique value that \r | |
806 | designates which namespace to set a value from.\r | |
807 | @param[in] TokenNumber The PCD token number to set a current value for.\r | |
808 | @param[in, out] SizeOfBuffer The size, in bytes, of Buffer.\r | |
809 | @param[in] Buffer A pointer to the buffer to set.\r | |
810 | \r | |
811 | @retval VOID * Return the pinter to the buffer been set.\r | |
812 | \r | |
813 | **/\r | |
814 | VOID *\r | |
815 | EFIAPI\r | |
816 | LibPcdSetExPtr (\r | |
817 | IN CONST GUID *Guid,\r | |
818 | IN UINTN TokenNumber,\r | |
819 | IN OUT UINTN *SizeOfBuffer,\r | |
820 | IN VOID *Buffer\r | |
821 | )\r | |
822 | {\r | |
823 | EFI_STATUS Status;\r | |
824 | PCD_PPI *PcdPpi;\r | |
825 | ASSERT (SizeOfBuffer != NULL);\r | |
826 | if (*SizeOfBuffer > 0) {\r | |
827 | ASSERT (Buffer != NULL);\r | |
828 | }\r | |
829 | ASSERT (Guid != NULL);\r | |
830 | PcdPpi = GetPcdPpiPtr ();\r | |
831 | \r | |
832 | Status = PcdPpi->SetPtrEx (Guid, TokenNumber, SizeOfBuffer, Buffer);\r | |
833 | \r | |
834 | if (EFI_ERROR (Status)) {\r | |
835 | return NULL;\r | |
836 | }\r | |
837 | \r | |
838 | return Buffer;\r | |
839 | }\r | |
840 | \r | |
841 | \r | |
842 | \r | |
843 | /**\r | |
844 | Sets the Boolean value for the token specified by TokenNumber and \r | |
845 | Guid to the value specified by Value. Value is returned.\r | |
846 | If Guid is NULL, then ASSERT().\r | |
847 | \r | |
848 | @param[in] Guid Pointer to a 128-bit unique value that \r | |
849 | designates which namespace to set a value from.\r | |
850 | @param[in] TokenNumber The PCD token number to set a current value for.\r | |
851 | @param[in] Value The Boolean value to set.\r | |
852 | \r | |
853 | @retval Boolean Return the value been set.\r | |
854 | \r | |
855 | **/\r | |
856 | BOOLEAN\r | |
857 | EFIAPI\r | |
858 | LibPcdSetExBool (\r | |
859 | IN CONST GUID *Guid,\r | |
860 | IN UINTN TokenNumber,\r | |
861 | IN BOOLEAN Value\r | |
862 | )\r | |
863 | {\r | |
864 | EFI_STATUS Status;\r | |
865 | PCD_PPI * PcdPpi;\r | |
866 | \r | |
867 | PcdPpi = GetPcdPpiPtr ();\r | |
868 | \r | |
869 | ASSERT (Guid != NULL);\r | |
870 | Status = PcdPpi->SetBoolEx (Guid, TokenNumber, Value);\r | |
871 | \r | |
872 | ASSERT_EFI_ERROR (Status);\r | |
873 | \r | |
874 | return Value;\r | |
875 | }\r | |
876 | \r | |
877 | \r | |
878 | \r | |
879 | /**\r | |
880 | When the token specified by TokenNumber and Guid is set, \r | |
881 | then notification function specified by NotificationFunction is called. \r | |
882 | If Guid is NULL, then the default token space is used. \r | |
883 | If NotificationFunction is NULL, then ASSERT().\r | |
884 | \r | |
885 | @param[in] Guid Pointer to a 128-bit unique value that designates which \r | |
886 | namespace to set a value from. If NULL, then the default \r | |
887 | token space is used.\r | |
888 | @param[in] TokenNumber The PCD token number to monitor.\r | |
889 | @param[in] NotificationFunction The function to call when the token \r | |
890 | specified by Guid and TokenNumber is set.\r | |
891 | \r | |
892 | @retval VOID\r | |
893 | \r | |
894 | **/\r | |
895 | VOID\r | |
896 | EFIAPI\r | |
897 | LibPcdCallbackOnSet (\r | |
898 | IN CONST GUID *Guid, OPTIONAL\r | |
899 | IN UINTN TokenNumber,\r | |
900 | IN PCD_CALLBACK NotificationFunction\r | |
901 | )\r | |
902 | {\r | |
903 | EFI_STATUS Status;\r | |
904 | PCD_PPI * PcdPpi;\r | |
905 | \r | |
906 | PcdPpi = GetPcdPpiPtr ();\r | |
907 | \r | |
908 | \r | |
909 | Status = PcdPpi->CallbackOnSet (Guid, TokenNumber, NotificationFunction);\r | |
910 | \r | |
911 | ASSERT_EFI_ERROR (Status);\r | |
912 | \r | |
913 | return;\r | |
914 | }\r | |
915 | \r | |
916 | \r | |
917 | \r | |
918 | /**\r | |
919 | Disable a notification function that was established with LibPcdCallbackonSet().\r | |
920 | If NotificationFunction is NULL, then ASSERT().\r | |
921 | \r | |
922 | @param[in] Guid Specify the GUID token space.\r | |
923 | @param[in] TokenNumber Specify the token number.\r | |
924 | @param[in] NotificationFunction The callback function to be unregistered.\r | |
925 | \r | |
926 | @retval VOID\r | |
927 | \r | |
928 | **/\r | |
929 | VOID\r | |
930 | EFIAPI\r | |
931 | LibPcdCancelCallback (\r | |
932 | IN CONST GUID *Guid, OPTIONAL\r | |
933 | IN UINTN TokenNumber,\r | |
934 | IN PCD_CALLBACK NotificationFunction\r | |
935 | )\r | |
936 | {\r | |
937 | EFI_STATUS Status;\r | |
938 | PCD_PPI * PcdPpi;\r | |
939 | \r | |
940 | PcdPpi = GetPcdPpiPtr ();\r | |
941 | \r | |
942 | \r | |
943 | Status = PcdPpi->CancelCallback (Guid, TokenNumber, NotificationFunction);\r | |
944 | \r | |
945 | ASSERT_EFI_ERROR (Status);\r | |
946 | \r | |
947 | return;\r | |
948 | }\r | |
949 | \r | |
950 | \r | |
951 | \r | |
952 | /**\r | |
953 | Retrieves the next PCD token number from the token space specified by Guid. \r | |
954 | If Guid is NULL, then the default token space is used. If TokenNumber is 0, \r | |
955 | then the first token number is returned. Otherwise, the token number that \r | |
956 | follows TokenNumber in the token space is returned. If TokenNumber is the last \r | |
957 | token number in the token space, then 0 is returned. If TokenNumber is not 0 and \r | |
958 | is not in the token space specified by Guid, then ASSERT().\r | |
959 | \r | |
960 | @param[in] Pointer to a 128-bit unique value that designates which namespace \r | |
961 | to set a value from. If NULL, then the default token space is used.\r | |
962 | @param[in] The previous PCD token number. If 0, then retrieves the first PCD \r | |
963 | token number.\r | |
964 | \r | |
965 | @retval UINTN The next valid token number.\r | |
966 | \r | |
967 | **/\r | |
968 | UINTN \r | |
969 | EFIAPI\r | |
970 | LibPcdGetNextToken (\r | |
971 | IN CONST GUID *Guid, OPTIONAL\r | |
972 | IN UINTN TokenNumber\r | |
973 | )\r | |
974 | {\r | |
975 | EFI_STATUS Status;\r | |
976 | PCD_PPI * PcdPpi;\r | |
977 | \r | |
978 | PcdPpi = GetPcdPpiPtr ();\r | |
979 | \r | |
980 | \r | |
981 | Status = PcdPpi->GetNextToken (Guid, &TokenNumber);\r | |
982 | \r | |
983 | ASSERT_EFI_ERROR (Status);\r | |
984 | \r | |
985 | return TokenNumber;\r | |
986 | }\r | |
987 | \r | |
988 | \r | |
989 | /**\r | |
990 | Retrieves the next PCD token space from a token space specified by Guid.\r | |
991 | Guid of NULL is reserved to mark the default local token namespace on the current\r | |
992 | platform. If Guid is NULL, then the GUID of the first non-local token space of the \r | |
993 | current platform is returned. If Guid is the last non-local token space, \r | |
994 | then NULL is returned. \r | |
995 | \r | |
996 | If Guid is not NULL and is not a valid token space in the current platform, then ASSERT().\r | |
997 | \r | |
998 | \r | |
999 | \r | |
1000 | @param[in] Pointer to a 128-bit unique value that designates from which namespace \r | |
1001 | to start the search.\r | |
1002 | \r | |
1003 | @retval CONST GUID * The next valid token namespace.\r | |
1004 | \r | |
1005 | **/\r | |
1006 | GUID * \r | |
1007 | EFIAPI\r | |
1008 | LibPcdGetNextTokenSpace (\r | |
1009 | IN CONST GUID *Guid\r | |
1010 | )\r | |
1011 | {\r | |
1012 | EFI_STATUS Status;\r | |
1013 | PCD_PPI * PcdPpi;\r | |
1014 | \r | |
1015 | PcdPpi = GetPcdPpiPtr ();\r | |
1016 | \r | |
1017 | \r | |
1018 | Status = PcdPpi->GetNextTokenSpace (&Guid);\r | |
1019 | \r | |
1020 | ASSERT_EFI_ERROR (Status);\r | |
1021 | \r | |
1022 | return (GUID *)Guid;\r | |
1023 | }\r | |
1024 | \r | |
1025 | \r | |
1026 | \r | |
1027 | /**\r | |
1028 | Sets the PCD entry specified by PatchVariable to the value specified by Buffer \r | |
1029 | and SizeOfValue. Buffer is returned. If SizeOfValue is greater than \r | |
1030 | MaximumDatumSize, then set SizeOfValue to MaximumDatumSize and return \r | |
1031 | NULL to indicate that the set operation was not actually performed. \r | |
1032 | If SizeOfValue is set to MAX_ADDRESS, then SizeOfValue must be set to \r | |
1033 | MaximumDatumSize and NULL must be returned.\r | |
1034 | \r | |
1035 | If PatchVariable is NULL, then ASSERT().\r | |
1036 | If SizeOfValue is NULL, then ASSERT().\r | |
1037 | If SizeOfValue > 0 and Buffer is NULL, then ASSERT().\r | |
1038 | \r | |
1039 | @param[in] PatchVariable A pointer to the global variable in a module that is \r | |
1040 | the target of the set operation.\r | |
1041 | @param[in] MaximumDatumSize The maximum size allowed for the PCD entry specified by PatchVariable.\r | |
1042 | @param[in, out] SizeOfBuffer A pointer to the size, in bytes, of Buffer.\r | |
1043 | @param[in] Buffer A pointer to the buffer to used to set the target variable.\r | |
1044 | \r | |
1045 | **/\r | |
1046 | VOID *\r | |
1047 | EFIAPI\r | |
1048 | LibPatchPcdSetPtr (\r | |
1049 | IN VOID *PatchVariable,\r | |
1050 | IN UINTN MaximumDatumSize,\r | |
1051 | IN OUT UINTN *SizeOfBuffer,\r | |
1052 | IN CONST VOID *Buffer\r | |
1053 | )\r | |
1054 | {\r | |
1055 | ASSERT (PatchVariable != NULL);\r | |
1056 | ASSERT (SizeOfBuffer != NULL);\r | |
1057 | \r | |
1058 | if (*SizeOfBuffer > 0) {\r | |
1059 | ASSERT (Buffer != NULL);\r | |
1060 | }\r | |
1061 | \r | |
1062 | if ((*SizeOfBuffer > MaximumDatumSize) ||\r | |
1063 | (*SizeOfBuffer == MAX_ADDRESS)) {\r | |
1064 | *SizeOfBuffer = MaximumDatumSize;\r | |
1065 | return NULL;\r | |
1066 | }\r | |
1067 | \r | |
1068 | CopyMem (PatchVariable, Buffer, *SizeOfBuffer);\r | |
1069 | \r | |
1070 | return (VOID *) Buffer;\r | |
1071 | }\r | |
1072 | \r | |
1073 | \r |