1 | /** @file
|
---|
2 | Implementation of PcdLib class library for PEI phase.
|
---|
3 |
|
---|
4 | Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
|
---|
5 | This program and the accompanying materials
|
---|
6 | are licensed and made available under the terms and conditions of the BSD License
|
---|
7 | which accompanies this distribution. The full text of the license may be found at
|
---|
8 | http://opensource.org/licenses/bsd-license.php
|
---|
9 |
|
---|
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
---|
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
---|
12 |
|
---|
13 |
|
---|
14 | **/
|
---|
15 |
|
---|
16 |
|
---|
17 |
|
---|
18 |
|
---|
19 | #include <PiPei.h>
|
---|
20 |
|
---|
21 | #include <Ppi/Pcd.h>
|
---|
22 | #include <Ppi/PiPcd.h>
|
---|
23 | #include <Ppi/PcdInfo.h>
|
---|
24 | #include <Ppi/PiPcdInfo.h>
|
---|
25 |
|
---|
26 | #include <Library/PeiServicesLib.h>
|
---|
27 | #include <Library/PcdLib.h>
|
---|
28 | #include <Library/DebugLib.h>
|
---|
29 | #include <Library/BaseMemoryLib.h>
|
---|
30 |
|
---|
31 | /**
|
---|
32 | Retrieve the PCD_PPI pointer.
|
---|
33 |
|
---|
34 | This function is to locate PCD_PPI PPI via PeiService.
|
---|
35 | If fail to locate PCD_PPI, then ASSERT_EFI_ERROR().
|
---|
36 |
|
---|
37 | @retval PCD_PPI * The pointer to the PCD_PPI.
|
---|
38 |
|
---|
39 | **/
|
---|
40 | PCD_PPI *
|
---|
41 | GetPcdPpiPointer (
|
---|
42 | VOID
|
---|
43 | )
|
---|
44 | {
|
---|
45 | EFI_STATUS Status;
|
---|
46 | PCD_PPI *PcdPpi;
|
---|
47 |
|
---|
48 | Status = PeiServicesLocatePpi (&gPcdPpiGuid, 0, NULL, (VOID **)&PcdPpi);
|
---|
49 | ASSERT_EFI_ERROR (Status);
|
---|
50 |
|
---|
51 | return PcdPpi;
|
---|
52 | }
|
---|
53 |
|
---|
54 | /**
|
---|
55 | Retrieve the pointer of EFI_PEI_PCD_PPI defined in PI 1.2 Vol 3.
|
---|
56 |
|
---|
57 | This function is to locate EFI_PEI_PCD_PPI PPI via PeiService.
|
---|
58 | If fail to locate EFI_PEI_PCD_PPI, then ASSERT_EFI_ERROR().
|
---|
59 |
|
---|
60 | @retval EFI_PEI_PCD_PPI * The pointer to the EFI_PEI_PCD_PPI.
|
---|
61 |
|
---|
62 | **/
|
---|
63 | EFI_PEI_PCD_PPI *
|
---|
64 | GetPiPcdPpiPointer (
|
---|
65 | VOID
|
---|
66 | )
|
---|
67 | {
|
---|
68 | EFI_STATUS Status;
|
---|
69 | EFI_PEI_PCD_PPI *PiPcdPpi;
|
---|
70 |
|
---|
71 | Status = PeiServicesLocatePpi (&gEfiPeiPcdPpiGuid, 0, NULL, (VOID **)&PiPcdPpi);
|
---|
72 | ASSERT_EFI_ERROR (Status);
|
---|
73 |
|
---|
74 | return PiPcdPpi;
|
---|
75 | }
|
---|
76 |
|
---|
77 | /**
|
---|
78 | Retrieve the GET_PCD_INFO_PPI pointer.
|
---|
79 |
|
---|
80 | This function is to locate GET_PCD_INFO_PPI PPI via PeiService.
|
---|
81 | If fail to locate GET_PCD_INFO_PPI, then ASSERT_EFI_ERROR().
|
---|
82 |
|
---|
83 | @retval GET_PCD_INFO_PPI * The pointer to the GET_PCD_INFO_PPI.
|
---|
84 |
|
---|
85 | **/
|
---|
86 | GET_PCD_INFO_PPI *
|
---|
87 | GetPcdInfoPpiPointer (
|
---|
88 | VOID
|
---|
89 | )
|
---|
90 | {
|
---|
91 | EFI_STATUS Status;
|
---|
92 | GET_PCD_INFO_PPI *PcdInfoPpi;
|
---|
93 |
|
---|
94 | Status = PeiServicesLocatePpi (&gGetPcdInfoPpiGuid, 0, NULL, (VOID **)&PcdInfoPpi);
|
---|
95 | ASSERT_EFI_ERROR (Status);
|
---|
96 |
|
---|
97 | return PcdInfoPpi;
|
---|
98 | }
|
---|
99 |
|
---|
100 | /**
|
---|
101 | Retrieve the pointer of EFI_GET_PCD_INFO_PPI defined in PI 1.2.1 Vol 3.
|
---|
102 |
|
---|
103 | This function is to locate EFI_GET_PCD_INFO_PPI PPI via PeiService.
|
---|
104 | If fail to locate EFI_GET_PCD_INFO_PPI, then ASSERT_EFI_ERROR().
|
---|
105 |
|
---|
106 | @retval EFI_GET_PCD_INFO_PPI * The pointer to the EFI_GET_PCD_INFO_PPI.
|
---|
107 |
|
---|
108 | **/
|
---|
109 | EFI_GET_PCD_INFO_PPI *
|
---|
110 | GetPiPcdInfoPpiPointer (
|
---|
111 | VOID
|
---|
112 | )
|
---|
113 | {
|
---|
114 | EFI_STATUS Status;
|
---|
115 | EFI_GET_PCD_INFO_PPI *PiPcdInfoPpi;
|
---|
116 |
|
---|
117 | Status = PeiServicesLocatePpi (&gEfiGetPcdInfoPpiGuid, 0, NULL, (VOID **)&PiPcdInfoPpi);
|
---|
118 | ASSERT_EFI_ERROR (Status);
|
---|
119 |
|
---|
120 | return PiPcdInfoPpi;
|
---|
121 | }
|
---|
122 |
|
---|
123 | /**
|
---|
124 | This function provides a means by which SKU support can be established in the PCD infrastructure.
|
---|
125 |
|
---|
126 | Sets the current SKU in the PCD database to the value specified by SkuId. SkuId is returned.
|
---|
127 | If SkuId >= PCD_MAX_SKU_ID, then ASSERT().
|
---|
128 |
|
---|
129 | @param SkuId The SKU value that will be used when the PCD service retrieves
|
---|
130 | and sets values associated with a PCD token.
|
---|
131 |
|
---|
132 | @return Return the SKU ID that just be set.
|
---|
133 |
|
---|
134 | **/
|
---|
135 | UINTN
|
---|
136 | EFIAPI
|
---|
137 | LibPcdSetSku (
|
---|
138 | IN UINTN SkuId
|
---|
139 | )
|
---|
140 | {
|
---|
141 |
|
---|
142 | ASSERT (SkuId < PCD_MAX_SKU_ID);
|
---|
143 |
|
---|
144 | GetPiPcdPpiPointer()->SetSku (SkuId);
|
---|
145 |
|
---|
146 | return SkuId;
|
---|
147 | }
|
---|
148 |
|
---|
149 |
|
---|
150 |
|
---|
151 | /**
|
---|
152 | This function provides a means by which to retrieve a value for a given PCD token.
|
---|
153 |
|
---|
154 | Returns the 8-bit value for the token specified by TokenNumber.
|
---|
155 |
|
---|
156 | @param[in] TokenNumber The PCD token number to retrieve a current value for.
|
---|
157 |
|
---|
158 | @return Returns the 8-bit value for the token specified by TokenNumber.
|
---|
159 |
|
---|
160 | **/
|
---|
161 | UINT8
|
---|
162 | EFIAPI
|
---|
163 | LibPcdGet8 (
|
---|
164 | IN UINTN TokenNumber
|
---|
165 | )
|
---|
166 | {
|
---|
167 | return (GetPcdPpiPointer ())->Get8 (TokenNumber);
|
---|
168 | }
|
---|
169 |
|
---|
170 |
|
---|
171 |
|
---|
172 | /**
|
---|
173 | This function provides a means by which to retrieve a value for a given PCD token.
|
---|
174 |
|
---|
175 | Returns the 16-bit value for the token specified by TokenNumber.
|
---|
176 |
|
---|
177 | @param[in] TokenNumber The PCD token number to retrieve a current value for.
|
---|
178 |
|
---|
179 | @return Returns the 16-bit value for the token specified by TokenNumber.
|
---|
180 |
|
---|
181 | **/
|
---|
182 | UINT16
|
---|
183 | EFIAPI
|
---|
184 | LibPcdGet16 (
|
---|
185 | IN UINTN TokenNumber
|
---|
186 | )
|
---|
187 | {
|
---|
188 | return (GetPcdPpiPointer ())->Get16 (TokenNumber);
|
---|
189 | }
|
---|
190 |
|
---|
191 |
|
---|
192 |
|
---|
193 | /**
|
---|
194 | This function provides a means by which to retrieve a value for a given PCD token.
|
---|
195 |
|
---|
196 | Returns the 32-bit value for the token specified by TokenNumber.
|
---|
197 |
|
---|
198 | @param[in] TokenNumber The PCD token number to retrieve a current value for.
|
---|
199 |
|
---|
200 | @return Returns the 32-bit value for the token specified by TokenNumber.
|
---|
201 |
|
---|
202 | **/
|
---|
203 | UINT32
|
---|
204 | EFIAPI
|
---|
205 | LibPcdGet32 (
|
---|
206 | IN UINTN TokenNumber
|
---|
207 | )
|
---|
208 | {
|
---|
209 | return (GetPcdPpiPointer ())->Get32 (TokenNumber);
|
---|
210 | }
|
---|
211 |
|
---|
212 |
|
---|
213 |
|
---|
214 | /**
|
---|
215 | This function provides a means by which to retrieve a value for a given PCD token.
|
---|
216 |
|
---|
217 | Returns the 64-bit value for the token specified by TokenNumber.
|
---|
218 |
|
---|
219 | @param[in] TokenNumber The PCD token number to retrieve a current value for.
|
---|
220 |
|
---|
221 | @return Returns the 64-bit value for the token specified by TokenNumber.
|
---|
222 |
|
---|
223 | **/
|
---|
224 | UINT64
|
---|
225 | EFIAPI
|
---|
226 | LibPcdGet64 (
|
---|
227 | IN UINTN TokenNumber
|
---|
228 | )
|
---|
229 | {
|
---|
230 | return (GetPcdPpiPointer ())->Get64 (TokenNumber);
|
---|
231 | }
|
---|
232 |
|
---|
233 |
|
---|
234 |
|
---|
235 | /**
|
---|
236 | This function provides a means by which to retrieve a value for a given PCD token.
|
---|
237 |
|
---|
238 | Returns the pointer to the buffer of the token specified by TokenNumber.
|
---|
239 |
|
---|
240 | @param[in] TokenNumber The PCD token number to retrieve a current value for.
|
---|
241 |
|
---|
242 | @return Returns the pointer to the token specified by TokenNumber.
|
---|
243 |
|
---|
244 | **/
|
---|
245 | VOID *
|
---|
246 | EFIAPI
|
---|
247 | LibPcdGetPtr (
|
---|
248 | IN UINTN TokenNumber
|
---|
249 | )
|
---|
250 | {
|
---|
251 | return (GetPcdPpiPointer ())->GetPtr (TokenNumber);
|
---|
252 | }
|
---|
253 |
|
---|
254 |
|
---|
255 |
|
---|
256 | /**
|
---|
257 | This function provides a means by which to retrieve a value for a given PCD token.
|
---|
258 |
|
---|
259 | Returns the Boolean value of the token specified by TokenNumber.
|
---|
260 |
|
---|
261 | @param[in] TokenNumber The PCD token number to retrieve a current value for.
|
---|
262 |
|
---|
263 | @return Returns the Boolean value of the token specified by TokenNumber.
|
---|
264 |
|
---|
265 | **/
|
---|
266 | BOOLEAN
|
---|
267 | EFIAPI
|
---|
268 | LibPcdGetBool (
|
---|
269 | IN UINTN TokenNumber
|
---|
270 | )
|
---|
271 | {
|
---|
272 | return (GetPcdPpiPointer ())->GetBool (TokenNumber);
|
---|
273 | }
|
---|
274 |
|
---|
275 |
|
---|
276 |
|
---|
277 | /**
|
---|
278 | This function provides a means by which to retrieve the size of a given PCD token.
|
---|
279 |
|
---|
280 | @param[in] TokenNumber The PCD token number to retrieve a current value for.
|
---|
281 |
|
---|
282 | @return Returns the size of the token specified by TokenNumber.
|
---|
283 |
|
---|
284 | **/
|
---|
285 | UINTN
|
---|
286 | EFIAPI
|
---|
287 | LibPcdGetSize (
|
---|
288 | IN UINTN TokenNumber
|
---|
289 | )
|
---|
290 | {
|
---|
291 | return (GetPcdPpiPointer ())->GetSize (TokenNumber);
|
---|
292 | }
|
---|
293 |
|
---|
294 |
|
---|
295 |
|
---|
296 | /**
|
---|
297 | This function provides a means by which to retrieve a value for a given PCD token.
|
---|
298 |
|
---|
299 | Returns the 8-bit value for the token specified by TokenNumber and Guid.
|
---|
300 |
|
---|
301 | If Guid is NULL, then ASSERT().
|
---|
302 |
|
---|
303 | @param[in] Guid The pointer to a 128-bit unique value that designates
|
---|
304 | which namespace to retrieve a value from.
|
---|
305 | @param[in] TokenNumber The PCD token number to retrieve a current value for.
|
---|
306 |
|
---|
307 | @return Return the UINT8.
|
---|
308 |
|
---|
309 | **/
|
---|
310 | UINT8
|
---|
311 | EFIAPI
|
---|
312 | LibPcdGetEx8 (
|
---|
313 | IN CONST GUID *Guid,
|
---|
314 | IN UINTN TokenNumber
|
---|
315 | )
|
---|
316 | {
|
---|
317 | ASSERT (Guid != NULL);
|
---|
318 |
|
---|
319 | return (GetPiPcdPpiPointer ())->Get8 (Guid, TokenNumber);
|
---|
320 | }
|
---|
321 |
|
---|
322 |
|
---|
323 |
|
---|
324 | /**
|
---|
325 | This function provides a means by which to retrieve a value for a given PCD token.
|
---|
326 |
|
---|
327 | Returns the 16-bit value for the token specified by TokenNumber and Guid.
|
---|
328 |
|
---|
329 | If Guid is NULL, then ASSERT().
|
---|
330 |
|
---|
331 | @param[in] Guid The pointer to a 128-bit unique value that designates
|
---|
332 | which namespace to retrieve a value from.
|
---|
333 | @param[in] TokenNumber The PCD token number to retrieve a current value for.
|
---|
334 |
|
---|
335 | @return Return the UINT16.
|
---|
336 |
|
---|
337 | **/
|
---|
338 | UINT16
|
---|
339 | EFIAPI
|
---|
340 | LibPcdGetEx16 (
|
---|
341 | IN CONST GUID *Guid,
|
---|
342 | IN UINTN TokenNumber
|
---|
343 | )
|
---|
344 | {
|
---|
345 |
|
---|
346 | ASSERT (Guid != NULL);
|
---|
347 |
|
---|
348 | return (GetPiPcdPpiPointer ())->Get16 (Guid, TokenNumber);
|
---|
349 | }
|
---|
350 |
|
---|
351 |
|
---|
352 |
|
---|
353 | /**
|
---|
354 | Returns the 32-bit value for the token specified by TokenNumber and Guid.
|
---|
355 | If Guid is NULL, then ASSERT().
|
---|
356 |
|
---|
357 | @param[in] Guid The pointer to a 128-bit unique value that designates
|
---|
358 | which namespace to retrieve a value from.
|
---|
359 | @param[in] TokenNumber The PCD token number to retrieve a current value for.
|
---|
360 |
|
---|
361 | @return Return the UINT32.
|
---|
362 |
|
---|
363 | **/
|
---|
364 | UINT32
|
---|
365 | EFIAPI
|
---|
366 | LibPcdGetEx32 (
|
---|
367 | IN CONST GUID *Guid,
|
---|
368 | IN UINTN TokenNumber
|
---|
369 | )
|
---|
370 | {
|
---|
371 | ASSERT (Guid != NULL);
|
---|
372 |
|
---|
373 | return (GetPiPcdPpiPointer ())->Get32 (Guid, TokenNumber);
|
---|
374 | }
|
---|
375 |
|
---|
376 |
|
---|
377 |
|
---|
378 |
|
---|
379 | /**
|
---|
380 | This function provides a means by which to retrieve a value for a given PCD token.
|
---|
381 |
|
---|
382 | Returns the 64-bit value for the token specified by TokenNumber and Guid.
|
---|
383 |
|
---|
384 | If Guid is NULL, then ASSERT().
|
---|
385 |
|
---|
386 | @param[in] Guid The pointer to a 128-bit unique value that designates
|
---|
387 | which namespace to retrieve a value from.
|
---|
388 | @param[in] TokenNumber The PCD token number to retrieve a current value for.
|
---|
389 |
|
---|
390 | @return Return the UINT64.
|
---|
391 |
|
---|
392 | **/
|
---|
393 | UINT64
|
---|
394 | EFIAPI
|
---|
395 | LibPcdGetEx64 (
|
---|
396 | IN CONST GUID *Guid,
|
---|
397 | IN UINTN TokenNumber
|
---|
398 | )
|
---|
399 | {
|
---|
400 | ASSERT (Guid != NULL);
|
---|
401 | return (GetPiPcdPpiPointer ())->Get64 (Guid, TokenNumber);
|
---|
402 | }
|
---|
403 |
|
---|
404 |
|
---|
405 |
|
---|
406 | /**
|
---|
407 | This function provides a means by which to retrieve a value for a given PCD token.
|
---|
408 |
|
---|
409 | Returns the pointer to the buffer of token specified by TokenNumber and Guid.
|
---|
410 |
|
---|
411 | If Guid is NULL, then ASSERT().
|
---|
412 |
|
---|
413 | @param[in] Guid The pointer to a 128-bit unique value that designates
|
---|
414 | which namespace to retrieve a value from.
|
---|
415 | @param[in] TokenNumber The PCD token number to retrieve a current value for.
|
---|
416 |
|
---|
417 | @return Return the VOID* pointer.
|
---|
418 |
|
---|
419 | **/
|
---|
420 | VOID *
|
---|
421 | EFIAPI
|
---|
422 | LibPcdGetExPtr (
|
---|
423 | IN CONST GUID *Guid,
|
---|
424 | IN UINTN TokenNumber
|
---|
425 | )
|
---|
426 | {
|
---|
427 | ASSERT (Guid != NULL);
|
---|
428 |
|
---|
429 | return (GetPiPcdPpiPointer ())->GetPtr (Guid, TokenNumber);
|
---|
430 | }
|
---|
431 |
|
---|
432 |
|
---|
433 |
|
---|
434 | /**
|
---|
435 | This function provides a means by which to retrieve a value for a given PCD token.
|
---|
436 |
|
---|
437 | Returns the Boolean value of the token specified by TokenNumber and Guid.
|
---|
438 |
|
---|
439 | If Guid is NULL, then ASSERT().
|
---|
440 |
|
---|
441 | @param[in] Guid The pointer to a 128-bit unique value that designates
|
---|
442 | which namespace to retrieve a value from.
|
---|
443 | @param[in] TokenNumber The PCD token number to retrieve a current value for.
|
---|
444 |
|
---|
445 | @return Return the BOOLEAN.
|
---|
446 |
|
---|
447 | **/
|
---|
448 | BOOLEAN
|
---|
449 | EFIAPI
|
---|
450 | LibPcdGetExBool (
|
---|
451 | IN CONST GUID *Guid,
|
---|
452 | IN UINTN TokenNumber
|
---|
453 | )
|
---|
454 | {
|
---|
455 | ASSERT (Guid != NULL);
|
---|
456 | return (GetPiPcdPpiPointer ())->GetBool (Guid, TokenNumber);
|
---|
457 | }
|
---|
458 |
|
---|
459 |
|
---|
460 |
|
---|
461 | /**
|
---|
462 | This function provides a means by which to retrieve the size of a given PCD token.
|
---|
463 |
|
---|
464 | Returns the size of the token specified by TokenNumber and Guid.
|
---|
465 |
|
---|
466 | If Guid is NULL, then ASSERT().
|
---|
467 |
|
---|
468 | @param[in] Guid The pointer to a 128-bit unique value that designates
|
---|
469 | which namespace to retrieve a value from.
|
---|
470 | @param[in] TokenNumber The PCD token number to retrieve a current value for.
|
---|
471 |
|
---|
472 | @return Return the size.
|
---|
473 |
|
---|
474 | **/
|
---|
475 | UINTN
|
---|
476 | EFIAPI
|
---|
477 | LibPcdGetExSize (
|
---|
478 | IN CONST GUID *Guid,
|
---|
479 | IN UINTN TokenNumber
|
---|
480 | )
|
---|
481 | {
|
---|
482 | ASSERT (Guid != NULL);
|
---|
483 | return (GetPiPcdPpiPointer ())->GetSize (Guid, TokenNumber);
|
---|
484 | }
|
---|
485 |
|
---|
486 |
|
---|
487 |
|
---|
488 | /**
|
---|
489 | This function provides a means by which to set a value for a given PCD token.
|
---|
490 |
|
---|
491 | Sets the 8-bit value for the token specified by TokenNumber
|
---|
492 | to the value specified by Value. Value is returned.
|
---|
493 |
|
---|
494 | If the set operation was not correctly performed, then ASSERT().
|
---|
495 |
|
---|
496 | @param[in] TokenNumber The PCD token number to set a current value for.
|
---|
497 | @param[in] Value The 8-bit value to set.
|
---|
498 |
|
---|
499 | @return Return the value that was set.
|
---|
500 |
|
---|
501 | **/
|
---|
502 | UINT8
|
---|
503 | EFIAPI
|
---|
504 | LibPcdSet8 (
|
---|
505 | IN UINTN TokenNumber,
|
---|
506 | IN UINT8 Value
|
---|
507 | )
|
---|
508 | {
|
---|
509 | EFI_STATUS Status;
|
---|
510 |
|
---|
511 | Status = (GetPcdPpiPointer ())->Set8 (TokenNumber, Value);
|
---|
512 |
|
---|
513 | ASSERT_EFI_ERROR (Status);
|
---|
514 |
|
---|
515 | return Value;
|
---|
516 | }
|
---|
517 |
|
---|
518 |
|
---|
519 |
|
---|
520 | /**
|
---|
521 | This function provides a means by which to set a value for a given PCD token.
|
---|
522 |
|
---|
523 | Sets the 16-bit value for the token specified by TokenNumber
|
---|
524 | to the value specified by Value. Value is returned.
|
---|
525 |
|
---|
526 | If the set operation was not correctly performed, then ASSERT().
|
---|
527 |
|
---|
528 | @param[in] TokenNumber The PCD token number to set a current value for.
|
---|
529 | @param[in] Value The 16-bit value to set.
|
---|
530 |
|
---|
531 | @return Return the value that was set.
|
---|
532 |
|
---|
533 | **/
|
---|
534 | UINT16
|
---|
535 | EFIAPI
|
---|
536 | LibPcdSet16 (
|
---|
537 | IN UINTN TokenNumber,
|
---|
538 | IN UINT16 Value
|
---|
539 | )
|
---|
540 | {
|
---|
541 | EFI_STATUS Status;
|
---|
542 |
|
---|
543 | Status = (GetPcdPpiPointer ())->Set16 (TokenNumber, Value);
|
---|
544 |
|
---|
545 | ASSERT_EFI_ERROR (Status);
|
---|
546 |
|
---|
547 | return Value;
|
---|
548 | }
|
---|
549 |
|
---|
550 |
|
---|
551 |
|
---|
552 | /**
|
---|
553 | This function provides a means by which to set a value for a given PCD token.
|
---|
554 |
|
---|
555 | Sets the 32-bit value for the token specified by TokenNumber
|
---|
556 | to the value specified by Value. Value is returned.
|
---|
557 |
|
---|
558 | If the set operation was not correctly performed, then ASSERT().
|
---|
559 |
|
---|
560 | @param[in] TokenNumber The PCD token number to set a current value for.
|
---|
561 | @param[in] Value The 32-bit value to set.
|
---|
562 |
|
---|
563 | @return Return the value that was set.
|
---|
564 |
|
---|
565 | **/
|
---|
566 | UINT32
|
---|
567 | EFIAPI
|
---|
568 | LibPcdSet32 (
|
---|
569 | IN UINTN TokenNumber,
|
---|
570 | IN UINT32 Value
|
---|
571 | )
|
---|
572 | {
|
---|
573 | EFI_STATUS Status;
|
---|
574 |
|
---|
575 | Status = (GetPcdPpiPointer ())->Set32 (TokenNumber, Value);
|
---|
576 |
|
---|
577 | ASSERT_EFI_ERROR (Status);
|
---|
578 |
|
---|
579 | return Value;
|
---|
580 | }
|
---|
581 |
|
---|
582 |
|
---|
583 |
|
---|
584 | /**
|
---|
585 | This function provides a means by which to set a value for a given PCD token.
|
---|
586 |
|
---|
587 | Sets the 64-bit value for the token specified by TokenNumber
|
---|
588 | to the value specified by Value. Value is returned.
|
---|
589 |
|
---|
590 | If the set operation was not correctly performed, then ASSERT().
|
---|
591 |
|
---|
592 | @param[in] TokenNumber The PCD token number to set a current value for.
|
---|
593 | @param[in] Value The 64-bit value to set.
|
---|
594 |
|
---|
595 | @return Return the value that was set.
|
---|
596 |
|
---|
597 | **/
|
---|
598 | UINT64
|
---|
599 | EFIAPI
|
---|
600 | LibPcdSet64 (
|
---|
601 | IN UINTN TokenNumber,
|
---|
602 | IN UINT64 Value
|
---|
603 | )
|
---|
604 | {
|
---|
605 | EFI_STATUS Status;
|
---|
606 |
|
---|
607 | Status = (GetPcdPpiPointer ())->Set64 (TokenNumber, Value);
|
---|
608 |
|
---|
609 | ASSERT_EFI_ERROR (Status);
|
---|
610 |
|
---|
611 | return Value;
|
---|
612 | }
|
---|
613 |
|
---|
614 |
|
---|
615 |
|
---|
616 | /**
|
---|
617 | This function provides a means by which to set a value for a given PCD token.
|
---|
618 |
|
---|
619 | Sets a buffer for the token specified by TokenNumber to the value
|
---|
620 | specified by Buffer and SizeOfBuffer. Buffer is returned.
|
---|
621 | If SizeOfBuffer is greater than the maximum size support by TokenNumber,
|
---|
622 | then set SizeOfBuffer to the maximum size supported by TokenNumber and
|
---|
623 | return NULL to indicate that the set operation was not actually performed,
|
---|
624 | or ASSERT() if the set operation was not corretly performed.
|
---|
625 |
|
---|
626 | If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to the
|
---|
627 | maximum size supported by TokenName and NULL must be returned.
|
---|
628 |
|
---|
629 | If SizeOfBuffer is NULL, then ASSERT().
|
---|
630 | If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
|
---|
631 |
|
---|
632 | @param[in] TokenNumber The PCD token number to set a current value for.
|
---|
633 | @param[in, out] SizeOfBuffer The size, in bytes, of Buffer.
|
---|
634 | @param[in] Buffer A pointer to the buffer to set.
|
---|
635 |
|
---|
636 | @return Return the pointer for the buffer been set.
|
---|
637 |
|
---|
638 | **/
|
---|
639 | VOID *
|
---|
640 | EFIAPI
|
---|
641 | LibPcdSetPtr (
|
---|
642 | IN UINTN TokenNumber,
|
---|
643 | IN OUT UINTN *SizeOfBuffer,
|
---|
644 | IN CONST VOID *Buffer
|
---|
645 | )
|
---|
646 | {
|
---|
647 | EFI_STATUS Status;
|
---|
648 | UINTN InputSizeOfBuffer;
|
---|
649 |
|
---|
650 | ASSERT (SizeOfBuffer != NULL);
|
---|
651 |
|
---|
652 | if (*SizeOfBuffer > 0) {
|
---|
653 | ASSERT (Buffer != NULL);
|
---|
654 | }
|
---|
655 |
|
---|
656 | InputSizeOfBuffer = *SizeOfBuffer;
|
---|
657 | Status = (GetPcdPpiPointer ())->SetPtr (TokenNumber, SizeOfBuffer, (VOID *) Buffer);
|
---|
658 | if (EFI_ERROR (Status) && (*SizeOfBuffer < InputSizeOfBuffer)) {
|
---|
659 | return NULL;
|
---|
660 | }
|
---|
661 | ASSERT_EFI_ERROR (Status);
|
---|
662 |
|
---|
663 | return (VOID *) Buffer;
|
---|
664 | }
|
---|
665 |
|
---|
666 |
|
---|
667 |
|
---|
668 | /**
|
---|
669 | This function provides a means by which to set a value for a given PCD token.
|
---|
670 |
|
---|
671 | Sets the Boolean value for the token specified by TokenNumber
|
---|
672 | to the value specified by Value. Value is returned.
|
---|
673 |
|
---|
674 | If the set operation was not correctly performed, then ASSERT().
|
---|
675 |
|
---|
676 | @param[in] TokenNumber The PCD token number to set a current value for.
|
---|
677 | @param[in] Value The boolean value to set.
|
---|
678 |
|
---|
679 | @return Return the value that was set.
|
---|
680 |
|
---|
681 | **/
|
---|
682 | BOOLEAN
|
---|
683 | EFIAPI
|
---|
684 | LibPcdSetBool (
|
---|
685 | IN UINTN TokenNumber,
|
---|
686 | IN BOOLEAN Value
|
---|
687 | )
|
---|
688 | {
|
---|
689 | EFI_STATUS Status;
|
---|
690 |
|
---|
691 | Status = (GetPcdPpiPointer ())->SetBool (TokenNumber, Value);
|
---|
692 |
|
---|
693 | ASSERT_EFI_ERROR (Status);
|
---|
694 |
|
---|
695 | return Value;
|
---|
696 | }
|
---|
697 |
|
---|
698 |
|
---|
699 |
|
---|
700 | /**
|
---|
701 | This function provides a means by which to set a value for a given PCD token.
|
---|
702 |
|
---|
703 | Sets the 8-bit value for the token specified by TokenNumber and
|
---|
704 | Guid to the value specified by Value. Value is returned.
|
---|
705 |
|
---|
706 | If Guid is NULL, then ASSERT().
|
---|
707 | If the set operation was not correctly performed, then ASSERT().
|
---|
708 |
|
---|
709 | @param[in] Guid The pointer to a 128-bit unique value that
|
---|
710 | designates which namespace to set a value from.
|
---|
711 | @param[in] TokenNumber The PCD token number to set a current value for.
|
---|
712 | @param[in] Value The 8-bit value to set.
|
---|
713 |
|
---|
714 | @return Return the value that was set.
|
---|
715 |
|
---|
716 | **/
|
---|
717 | UINT8
|
---|
718 | EFIAPI
|
---|
719 | LibPcdSetEx8 (
|
---|
720 | IN CONST GUID *Guid,
|
---|
721 | IN UINTN TokenNumber,
|
---|
722 | IN UINT8 Value
|
---|
723 | )
|
---|
724 | {
|
---|
725 | EFI_STATUS Status;
|
---|
726 |
|
---|
727 | ASSERT (Guid != NULL);
|
---|
728 |
|
---|
729 | Status = (GetPiPcdPpiPointer ())->Set8 (Guid, TokenNumber, Value);
|
---|
730 |
|
---|
731 | ASSERT_EFI_ERROR (Status);
|
---|
732 |
|
---|
733 | return Value;
|
---|
734 | }
|
---|
735 |
|
---|
736 |
|
---|
737 |
|
---|
738 | /**
|
---|
739 | This function provides a means by which to set a value for a given PCD token.
|
---|
740 |
|
---|
741 | Sets the 16-bit value for the token specified by TokenNumber and
|
---|
742 | Guid to the value specified by Value. Value is returned.
|
---|
743 |
|
---|
744 | If Guid is NULL, then ASSERT().
|
---|
745 | If the set operation was not correctly performed, then ASSERT().
|
---|
746 |
|
---|
747 | @param[in] Guid The pointer to a 128-bit unique value that
|
---|
748 | designates which namespace to set a value from.
|
---|
749 | @param[in] TokenNumber The PCD token number to set a current value for.
|
---|
750 | @param[in] Value The 16-bit value to set.
|
---|
751 |
|
---|
752 | @return Return the value that was set.
|
---|
753 |
|
---|
754 | **/
|
---|
755 | UINT16
|
---|
756 | EFIAPI
|
---|
757 | LibPcdSetEx16 (
|
---|
758 | IN CONST GUID *Guid,
|
---|
759 | IN UINTN TokenNumber,
|
---|
760 | IN UINT16 Value
|
---|
761 | )
|
---|
762 | {
|
---|
763 | EFI_STATUS Status;
|
---|
764 | ASSERT (Guid != NULL);
|
---|
765 | Status = (GetPiPcdPpiPointer ())->Set16 (Guid, TokenNumber, Value);
|
---|
766 |
|
---|
767 | ASSERT_EFI_ERROR (Status);
|
---|
768 |
|
---|
769 | return Value;
|
---|
770 | }
|
---|
771 |
|
---|
772 |
|
---|
773 |
|
---|
774 | /**
|
---|
775 | This function provides a means by which to set a value for a given PCD token.
|
---|
776 |
|
---|
777 | Sets the 32-bit value for the token specified by TokenNumber and
|
---|
778 | Guid to the value specified by Value. Value is returned.
|
---|
779 |
|
---|
780 | If Guid is NULL, then ASSERT().
|
---|
781 | If the set operation was not correctly performed, then ASSERT().
|
---|
782 |
|
---|
783 | @param[in] Guid The pointer to a 128-bit unique value that
|
---|
784 | designates which namespace to set a value from.
|
---|
785 | @param[in] TokenNumber The PCD token number to set a current value for.
|
---|
786 | @param[in] Value The 32-bit value to set.
|
---|
787 |
|
---|
788 | @return Return the value that was set.
|
---|
789 |
|
---|
790 | **/
|
---|
791 | UINT32
|
---|
792 | EFIAPI
|
---|
793 | LibPcdSetEx32 (
|
---|
794 | IN CONST GUID *Guid,
|
---|
795 | IN UINTN TokenNumber,
|
---|
796 | IN UINT32 Value
|
---|
797 | )
|
---|
798 | {
|
---|
799 | EFI_STATUS Status;
|
---|
800 |
|
---|
801 | ASSERT (Guid != NULL);
|
---|
802 |
|
---|
803 | Status = (GetPiPcdPpiPointer ())->Set32 (Guid, TokenNumber, Value);
|
---|
804 |
|
---|
805 | ASSERT_EFI_ERROR (Status);
|
---|
806 |
|
---|
807 | return Value;
|
---|
808 | }
|
---|
809 |
|
---|
810 |
|
---|
811 |
|
---|
812 | /**
|
---|
813 | This function provides a means by which to set a value for a given PCD token.
|
---|
814 |
|
---|
815 | Sets the 64-bit value for the token specified by TokenNumber and
|
---|
816 | Guid to the value specified by Value. Value is returned.
|
---|
817 |
|
---|
818 | If Guid is NULL, then ASSERT().
|
---|
819 | If the set operation was not correctly performed, then ASSERT().
|
---|
820 |
|
---|
821 | @param[in] Guid The pointer to a 128-bit unique value that
|
---|
822 | designates which namespace to set a value from.
|
---|
823 | @param[in] TokenNumber The PCD token number to set a current value for.
|
---|
824 | @param[in] Value The 64-bit value to set.
|
---|
825 |
|
---|
826 | @return Return the value that was set.
|
---|
827 |
|
---|
828 | **/
|
---|
829 | UINT64
|
---|
830 | EFIAPI
|
---|
831 | LibPcdSetEx64 (
|
---|
832 | IN CONST GUID *Guid,
|
---|
833 | IN UINTN TokenNumber,
|
---|
834 | IN UINT64 Value
|
---|
835 | )
|
---|
836 | {
|
---|
837 | EFI_STATUS Status;
|
---|
838 | ASSERT (Guid != NULL);
|
---|
839 |
|
---|
840 | Status = (GetPiPcdPpiPointer ())->Set64 (Guid, TokenNumber, Value);
|
---|
841 |
|
---|
842 | ASSERT_EFI_ERROR (Status);
|
---|
843 |
|
---|
844 | return Value;
|
---|
845 | }
|
---|
846 |
|
---|
847 |
|
---|
848 |
|
---|
849 | /**
|
---|
850 | This function provides a means by which to set a value for a given PCD token.
|
---|
851 |
|
---|
852 | Sets a buffer for the token specified by TokenNumber to the value specified by
|
---|
853 | Buffer and SizeOfBuffer. Buffer is returned. If SizeOfBuffer is greater than
|
---|
854 | the maximum size support by TokenNumber, then set SizeOfBuffer to the maximum size
|
---|
855 | supported by TokenNumber and return NULL to indicate that the set operation
|
---|
856 | was not actually performed, or ASSERT() if the set operation was not corretly performed.
|
---|
857 |
|
---|
858 | If Guid is NULL, then ASSERT().
|
---|
859 | If SizeOfBuffer is NULL, then ASSERT().
|
---|
860 | If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
|
---|
861 |
|
---|
862 | @param[in] Guid The pointer to a 128-bit unique value that
|
---|
863 | designates which namespace to set a value from.
|
---|
864 | @param[in] TokenNumber The PCD token number to set a current value for.
|
---|
865 | @param[in, out] SizeOfBuffer The size, in bytes, of Buffer.
|
---|
866 | @param[in] Buffer A pointer to the buffer to set.
|
---|
867 |
|
---|
868 | @return Return the pinter to the buffer been set.
|
---|
869 |
|
---|
870 | **/
|
---|
871 | VOID *
|
---|
872 | EFIAPI
|
---|
873 | LibPcdSetExPtr (
|
---|
874 | IN CONST GUID *Guid,
|
---|
875 | IN UINTN TokenNumber,
|
---|
876 | IN OUT UINTN *SizeOfBuffer,
|
---|
877 | IN VOID *Buffer
|
---|
878 | )
|
---|
879 | {
|
---|
880 | EFI_STATUS Status;
|
---|
881 | UINTN InputSizeOfBuffer;
|
---|
882 |
|
---|
883 |
|
---|
884 | ASSERT (SizeOfBuffer != NULL);
|
---|
885 | if (*SizeOfBuffer > 0) {
|
---|
886 | ASSERT (Buffer != NULL);
|
---|
887 | }
|
---|
888 | ASSERT (Guid != NULL);
|
---|
889 |
|
---|
890 | InputSizeOfBuffer = *SizeOfBuffer;
|
---|
891 | Status = (GetPiPcdPpiPointer ())->SetPtr (Guid, TokenNumber, SizeOfBuffer, Buffer);
|
---|
892 | if (EFI_ERROR (Status) && (*SizeOfBuffer < InputSizeOfBuffer)) {
|
---|
893 | return NULL;
|
---|
894 | }
|
---|
895 | ASSERT_EFI_ERROR (Status);
|
---|
896 |
|
---|
897 | return Buffer;
|
---|
898 | }
|
---|
899 |
|
---|
900 |
|
---|
901 |
|
---|
902 | /**
|
---|
903 | This function provides a means by which to set a value for a given PCD token.
|
---|
904 |
|
---|
905 | Sets the Boolean value for the token specified by TokenNumber and
|
---|
906 | Guid to the value specified by Value. Value is returned.
|
---|
907 |
|
---|
908 | If Guid is NULL, then ASSERT().
|
---|
909 | If the set operation was not correctly performed, then ASSERT().
|
---|
910 |
|
---|
911 | @param[in] Guid The pointer to a 128-bit unique value that
|
---|
912 | designates which namespace to set a value from.
|
---|
913 | @param[in] TokenNumber The PCD token number to set a current value for.
|
---|
914 | @param[in] Value The Boolean value to set.
|
---|
915 |
|
---|
916 | @return Return the value that was set.
|
---|
917 |
|
---|
918 | **/
|
---|
919 | BOOLEAN
|
---|
920 | EFIAPI
|
---|
921 | LibPcdSetExBool (
|
---|
922 | IN CONST GUID *Guid,
|
---|
923 | IN UINTN TokenNumber,
|
---|
924 | IN BOOLEAN Value
|
---|
925 | )
|
---|
926 | {
|
---|
927 | EFI_STATUS Status;
|
---|
928 |
|
---|
929 | ASSERT (Guid != NULL);
|
---|
930 | Status = (GetPiPcdPpiPointer ())->SetBool (Guid, TokenNumber, Value);
|
---|
931 |
|
---|
932 | ASSERT_EFI_ERROR (Status);
|
---|
933 |
|
---|
934 | return Value;
|
---|
935 | }
|
---|
936 |
|
---|
937 |
|
---|
938 |
|
---|
939 | /**
|
---|
940 | Set up a notification function that is called when a specified token is set.
|
---|
941 |
|
---|
942 | When the token specified by TokenNumber and Guid is set,
|
---|
943 | then notification function specified by NotificationFunction is called.
|
---|
944 | If Guid is NULL, then the default token space is used.
|
---|
945 | If NotificationFunction is NULL, then ASSERT().
|
---|
946 |
|
---|
947 | @param[in] Guid The pointer to a 128-bit unique value that
|
---|
948 | designates which namespace to set a value from.
|
---|
949 | If NULL, then the default token space is used.
|
---|
950 | @param[in] TokenNumber The PCD token number to monitor.
|
---|
951 | @param[in] NotificationFunction The function to call when the token
|
---|
952 | specified by Guid and TokenNumber is set.
|
---|
953 |
|
---|
954 | **/
|
---|
955 | VOID
|
---|
956 | EFIAPI
|
---|
957 | LibPcdCallbackOnSet (
|
---|
958 | IN CONST GUID *Guid, OPTIONAL
|
---|
959 | IN UINTN TokenNumber,
|
---|
960 | IN PCD_CALLBACK NotificationFunction
|
---|
961 | )
|
---|
962 | {
|
---|
963 | EFI_STATUS Status;
|
---|
964 |
|
---|
965 | ASSERT (NotificationFunction != NULL);
|
---|
966 |
|
---|
967 | Status = (GetPiPcdPpiPointer ())->CallbackOnSet (Guid, TokenNumber, (EFI_PEI_PCD_PPI_CALLBACK) NotificationFunction);
|
---|
968 |
|
---|
969 | ASSERT_EFI_ERROR (Status);
|
---|
970 |
|
---|
971 | return;
|
---|
972 | }
|
---|
973 |
|
---|
974 |
|
---|
975 |
|
---|
976 | /**
|
---|
977 | Disable a notification function that was established with LibPcdCallbackonSet().
|
---|
978 |
|
---|
979 | Disable a notification function that was previously established with LibPcdCallbackOnSet().
|
---|
980 | If NotificationFunction is NULL, then ASSERT().
|
---|
981 | If LibPcdCallbackOnSet() was not previously called with Guid, TokenNumber,
|
---|
982 | and NotificationFunction, then ASSERT().
|
---|
983 |
|
---|
984 | @param[in] Guid Specify the GUID token space.
|
---|
985 | @param[in] TokenNumber Specify the token number.
|
---|
986 | @param[in] NotificationFunction The callback function to be unregistered.
|
---|
987 |
|
---|
988 | **/
|
---|
989 | VOID
|
---|
990 | EFIAPI
|
---|
991 | LibPcdCancelCallback (
|
---|
992 | IN CONST GUID *Guid, OPTIONAL
|
---|
993 | IN UINTN TokenNumber,
|
---|
994 | IN PCD_CALLBACK NotificationFunction
|
---|
995 | )
|
---|
996 | {
|
---|
997 | EFI_STATUS Status;
|
---|
998 |
|
---|
999 | ASSERT (NotificationFunction != NULL);
|
---|
1000 |
|
---|
1001 | Status = (GetPiPcdPpiPointer ())->CancelCallback (Guid, TokenNumber, (EFI_PEI_PCD_PPI_CALLBACK) NotificationFunction);
|
---|
1002 |
|
---|
1003 | ASSERT_EFI_ERROR (Status);
|
---|
1004 |
|
---|
1005 | return;
|
---|
1006 | }
|
---|
1007 |
|
---|
1008 |
|
---|
1009 |
|
---|
1010 | /**
|
---|
1011 | Retrieves the next token in a token space.
|
---|
1012 |
|
---|
1013 | Retrieves the next PCD token number from the token space specified by Guid.
|
---|
1014 | If Guid is NULL, then the default token space is used. If TokenNumber is 0,
|
---|
1015 | then the first token number is returned. Otherwise, the token number that
|
---|
1016 | follows TokenNumber in the token space is returned. If TokenNumber is the last
|
---|
1017 | token number in the token space, then 0 is returned.
|
---|
1018 |
|
---|
1019 | If TokenNumber is not 0 and is not in the token space specified by Guid, then ASSERT().
|
---|
1020 |
|
---|
1021 | @param[in] Guid The pointer to a 128-bit unique value that designates which namespace
|
---|
1022 | to set a value from. If NULL, then the default token space is used.
|
---|
1023 | @param[in] TokenNumber The previous PCD token number. If 0, then retrieves the first PCD
|
---|
1024 | token number.
|
---|
1025 |
|
---|
1026 | @return The next valid token number.
|
---|
1027 |
|
---|
1028 | **/
|
---|
1029 | UINTN
|
---|
1030 | EFIAPI
|
---|
1031 | LibPcdGetNextToken (
|
---|
1032 | IN CONST GUID *Guid, OPTIONAL
|
---|
1033 | IN UINTN TokenNumber
|
---|
1034 | )
|
---|
1035 | {
|
---|
1036 | EFI_STATUS Status;
|
---|
1037 |
|
---|
1038 | Status = (GetPiPcdPpiPointer ())->GetNextToken (Guid, &TokenNumber);
|
---|
1039 | ASSERT (!EFI_ERROR (Status) || TokenNumber == 0);
|
---|
1040 |
|
---|
1041 | return TokenNumber;
|
---|
1042 | }
|
---|
1043 |
|
---|
1044 |
|
---|
1045 | /**
|
---|
1046 | Used to retrieve the list of available PCD token space GUIDs.
|
---|
1047 |
|
---|
1048 | Returns the PCD token space GUID that follows TokenSpaceGuid in the list of token spaces
|
---|
1049 | in the platform.
|
---|
1050 | If TokenSpaceGuid is NULL, then a pointer to the first PCD token spaces returned.
|
---|
1051 | If TokenSpaceGuid is the last PCD token space GUID in the list, then NULL is returned.
|
---|
1052 |
|
---|
1053 | @param TokenSpaceGuid The pointer to the a PCD token space GUID
|
---|
1054 |
|
---|
1055 | @return The next valid token namespace.
|
---|
1056 |
|
---|
1057 | **/
|
---|
1058 | GUID *
|
---|
1059 | EFIAPI
|
---|
1060 | LibPcdGetNextTokenSpace (
|
---|
1061 | IN CONST GUID *TokenSpaceGuid
|
---|
1062 | )
|
---|
1063 | {
|
---|
1064 | (GetPiPcdPpiPointer ())->GetNextTokenSpace (&TokenSpaceGuid);
|
---|
1065 |
|
---|
1066 | return (GUID *) TokenSpaceGuid;
|
---|
1067 | }
|
---|
1068 |
|
---|
1069 |
|
---|
1070 |
|
---|
1071 | /**
|
---|
1072 | Sets a value of a patchable PCD entry that is type pointer.
|
---|
1073 |
|
---|
1074 | Sets the PCD entry specified by PatchVariable to the value specified by Buffer
|
---|
1075 | and SizeOfBuffer. Buffer is returned. If SizeOfBuffer is greater than
|
---|
1076 | MaximumDatumSize, then set SizeOfBuffer to MaximumDatumSize and return
|
---|
1077 | NULL to indicate that the set operation was not actually performed.
|
---|
1078 | If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to
|
---|
1079 | MaximumDatumSize and NULL must be returned.
|
---|
1080 |
|
---|
1081 | If PatchVariable is NULL, then ASSERT().
|
---|
1082 | If SizeOfBuffer is NULL, then ASSERT().
|
---|
1083 | If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
|
---|
1084 |
|
---|
1085 | @param[in] PatchVariable A pointer to the global variable in a module that is
|
---|
1086 | the target of the set operation.
|
---|
1087 | @param[in] MaximumDatumSize The maximum size allowed for the PCD entry specified by PatchVariable.
|
---|
1088 | @param[in, out] SizeOfBuffer A pointer to the size, in bytes, of Buffer.
|
---|
1089 | @param[in] Buffer A pointer to the buffer to used to set the target variable.
|
---|
1090 |
|
---|
1091 | @return Return the pointer to the buffer been set.
|
---|
1092 |
|
---|
1093 | **/
|
---|
1094 | VOID *
|
---|
1095 | EFIAPI
|
---|
1096 | LibPatchPcdSetPtr (
|
---|
1097 | IN VOID *PatchVariable,
|
---|
1098 | IN UINTN MaximumDatumSize,
|
---|
1099 | IN OUT UINTN *SizeOfBuffer,
|
---|
1100 | IN CONST VOID *Buffer
|
---|
1101 | )
|
---|
1102 | {
|
---|
1103 | ASSERT (PatchVariable != NULL);
|
---|
1104 | ASSERT (SizeOfBuffer != NULL);
|
---|
1105 |
|
---|
1106 | if (*SizeOfBuffer > 0) {
|
---|
1107 | ASSERT (Buffer != NULL);
|
---|
1108 | }
|
---|
1109 |
|
---|
1110 | if ((*SizeOfBuffer > MaximumDatumSize) ||
|
---|
1111 | (*SizeOfBuffer == MAX_ADDRESS)) {
|
---|
1112 | *SizeOfBuffer = MaximumDatumSize;
|
---|
1113 | return NULL;
|
---|
1114 | }
|
---|
1115 |
|
---|
1116 | CopyMem (PatchVariable, Buffer, *SizeOfBuffer);
|
---|
1117 |
|
---|
1118 | return (VOID *) Buffer;
|
---|
1119 | }
|
---|
1120 |
|
---|
1121 | /**
|
---|
1122 | Retrieve additional information associated with a PCD token.
|
---|
1123 |
|
---|
1124 | This includes information such as the type of value the TokenNumber is associated with as well as possible
|
---|
1125 | human readable name that is associated with the token.
|
---|
1126 |
|
---|
1127 | If TokenNumber is not in the default token space specified, then ASSERT().
|
---|
1128 |
|
---|
1129 | @param[in] TokenNumber The PCD token number.
|
---|
1130 | @param[out] PcdInfo The returned information associated with the requested TokenNumber.
|
---|
1131 | The caller is responsible for freeing the buffer that is allocated by callee for PcdInfo->PcdName.
|
---|
1132 | **/
|
---|
1133 | VOID
|
---|
1134 | EFIAPI
|
---|
1135 | LibPcdGetInfo (
|
---|
1136 | IN UINTN TokenNumber,
|
---|
1137 | OUT PCD_INFO *PcdInfo
|
---|
1138 | )
|
---|
1139 | {
|
---|
1140 | EFI_STATUS Status;
|
---|
1141 |
|
---|
1142 | Status = GetPcdInfoPpiPointer()->GetInfo (TokenNumber, (EFI_PCD_INFO *) PcdInfo);
|
---|
1143 | ASSERT_EFI_ERROR (Status);
|
---|
1144 | }
|
---|
1145 |
|
---|
1146 | /**
|
---|
1147 | Retrieve additional information associated with a PCD token.
|
---|
1148 |
|
---|
1149 | This includes information such as the type of value the TokenNumber is associated with as well as possible
|
---|
1150 | human readable name that is associated with the token.
|
---|
1151 |
|
---|
1152 | If TokenNumber is not in the token space specified by Guid, then ASSERT().
|
---|
1153 |
|
---|
1154 | @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
|
---|
1155 | @param[in] TokenNumber The PCD token number.
|
---|
1156 | @param[out] PcdInfo The returned information associated with the requested TokenNumber.
|
---|
1157 | The caller is responsible for freeing the buffer that is allocated by callee for PcdInfo->PcdName.
|
---|
1158 | **/
|
---|
1159 | VOID
|
---|
1160 | EFIAPI
|
---|
1161 | LibPcdGetInfoEx (
|
---|
1162 | IN CONST GUID *Guid,
|
---|
1163 | IN UINTN TokenNumber,
|
---|
1164 | OUT PCD_INFO *PcdInfo
|
---|
1165 | )
|
---|
1166 | {
|
---|
1167 | EFI_STATUS Status;
|
---|
1168 |
|
---|
1169 | Status = GetPiPcdInfoPpiPointer()->GetInfo (Guid, TokenNumber, (EFI_PCD_INFO *) PcdInfo);
|
---|
1170 | ASSERT_EFI_ERROR (Status);
|
---|
1171 | }
|
---|
1172 |
|
---|
1173 | /**
|
---|
1174 | Retrieve the currently set SKU Id.
|
---|
1175 |
|
---|
1176 | If the sku id got >= PCD_MAX_SKU_ID, then ASSERT().
|
---|
1177 |
|
---|
1178 | @return The currently set SKU Id. If the platform has not set at a SKU Id, then the
|
---|
1179 | default SKU Id value of 0 is returned. If the platform has set a SKU Id, then the currently set SKU
|
---|
1180 | Id is returned.
|
---|
1181 | **/
|
---|
1182 | UINTN
|
---|
1183 | EFIAPI
|
---|
1184 | LibPcdGetSku (
|
---|
1185 | VOID
|
---|
1186 | )
|
---|
1187 | {
|
---|
1188 | UINTN SkuId;
|
---|
1189 |
|
---|
1190 | SkuId = GetPiPcdInfoPpiPointer()->GetSku ();
|
---|
1191 | ASSERT (SkuId < PCD_MAX_SKU_ID);
|
---|
1192 |
|
---|
1193 | return SkuId;
|
---|
1194 | }
|
---|