]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Library/PcdLib.h
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / MdePkg / Include / Library / PcdLib.h
1 /** @file
2 Provides library services to get and set Platform Configuration Database entries.
3
4 PCD Library Class provides a PCD usage macro interface for all PCD types.
5 It should be included in any module that uses PCD. If a module uses dynamic/dynamicex
6 PCD, module should be linked to a PEIM/DXE library instance to access that PCD.
7 If a module uses PatchableInModule type PCD, it also needs the library instance to produce
8 LibPatchPcdSetPtr() interface. For FeatureFlag/Fixed PCD, the macro interface is
9 translated to a variable or macro that is auto-generated by build tool in
10 module's autogen.h/autogen.c.
11 The PcdGetXX(), PcdSetXX(), PcdToken(), and PcdGetNextTokenSpace() operations are
12 only available prior to ExitBootServices(). If access to PCD values are required
13 at runtime, then their values must be collected prior to ExitBootServices().
14 There are no restrictions on the use of FeaturePcd(), FixedPcdGetXX(),
15 PatchPcdGetXX(), and PatchPcdSetXX().
16
17 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
18 SPDX-License-Identifier: BSD-2-Clause-Patent
19
20 **/
21
22 #ifndef __PCD_LIB_H__
23 #define __PCD_LIB_H__
24
25 /**
26 Retrieves a token number based on a token name.
27
28 Returns the token number associated with the PCD token specified by TokenName.
29 If TokenName is not a valid token in the token space, then the module will not build.
30
31 @param TokenName The name of the PCD token to retrieve the token number for.
32
33 @return The token number associated with the PCD.
34
35 **/
36 #define PcdToken(TokenName) _PCD_TOKEN_##TokenName
37
38 /**
39 Retrieves a Boolean PCD feature flag based on a token name.
40
41 Returns the Boolean value for the PCD feature flag specified by TokenName.
42 If TokenName is not a valid token in the token space, then the module will not build.
43 If TokenName is not a feature flag PCD, then the module will not build.
44
45 @param TokenName The name of the PCD token to retrieve a current value for.
46
47 @return Boolean value for the PCD feature flag.
48
49 **/
50 #define FeaturePcdGet(TokenName) _PCD_GET_MODE_BOOL_##TokenName
51
52 /**
53 Retrieves an 8-bit fixed PCD token value based on a token name.
54
55 Returns the 8-bit value for the token specified by TokenName.
56 If TokenName is not a valid token in the token space, then the module will not build.
57 If TokenName is not a fixed at build PCD, then the module will not build.
58
59 @param TokenName The name of the PCD token to retrieve a current value for.
60
61 @return 8-bit value for the token specified by TokenName.
62
63 **/
64 #define FixedPcdGet8(TokenName) _PCD_VALUE_##TokenName
65
66 /**
67 Retrieves a 16-bit fixed PCD token value based on a token name.
68
69 Returns the 16-bit value for the token specified by TokenName.
70 If TokenName is not a valid token in the token space, then the module will not build.
71 If TokenName is not a fixed at build PCD, then the module will not build.
72
73 @param TokenName The name of the PCD token to retrieve a current value for.
74
75 @return 16-bit value for the token specified by TokenName.
76
77 **/
78 #define FixedPcdGet16(TokenName) _PCD_VALUE_##TokenName
79
80 /**
81 Retrieves a 32-bit fixed PCD token value based on a token name.
82
83 Returns the 32-bit value for the token specified by TokenName.
84 If TokenName is not a valid token in the token space, then the module will not build.
85 If TokenName is not a fixed at build PCD, then the module will not build.
86
87 @param TokenName The name of the PCD token to retrieve a current value for.
88
89 @return 32-bit value for the token specified by TokenName.
90
91 **/
92 #define FixedPcdGet32(TokenName) _PCD_VALUE_##TokenName
93
94 /**
95 Retrieves a 64-bit fixed PCD token value based on a token name.
96
97 Returns the 64-bit value for the token specified by TokenName.
98 If TokenName is not a valid token in the token space, then the module will not build.
99 If TokenName is not a fixed at build PCD, then the module will not build.
100
101 @param TokenName The name of the PCD token to retrieve a current value for.
102
103 @return 64-bit value for the token specified by TokenName.
104
105 **/
106 #define FixedPcdGet64(TokenName) _PCD_VALUE_##TokenName
107
108 /**
109 Retrieves a Boolean fixed PCD token value based on a token name.
110
111 Returns the Boolean value for the token specified by TokenName.
112 If TokenName is not a valid token in the token space, then the module will not build.
113 If TokenName is not a fixed at build PCD, then the module will not build.
114
115 @param TokenName The name of the PCD token to retrieve a current value for.
116
117 @return The Boolean value for the token.
118
119 **/
120 #define FixedPcdGetBool(TokenName) _PCD_VALUE_##TokenName
121
122 /**
123 Retrieves a pointer to a fixed PCD token buffer based on a token name.
124
125 Returns a pointer to the buffer for the token specified by TokenName.
126 If TokenName is not a valid token in the token space, then the module will not build.
127 If TokenName is not a fixed at build PCD, then the module will not build.
128
129 @param TokenName The name of the PCD token to retrieve a current value for.
130
131 @return A pointer to the buffer.
132
133 **/
134 #define FixedPcdGetPtr(TokenName) ((VOID *)_PCD_VALUE_##TokenName)
135
136 /**
137 Retrieves an 8-bit binary patchable PCD token value based on a token name.
138
139 Returns the 8-bit value for the token specified by TokenName.
140 If TokenName is not a valid token in the token space, then the module will not build.
141 If TokenName is not a patchable in module PCD, then the module will not build.
142
143 @param TokenName The name of the PCD token to retrieve a current value for.
144
145 @return An 8-bit binary patchable PCD token value.
146
147 **/
148 #define PatchPcdGet8(TokenName) _gPcd_BinaryPatch_##TokenName
149
150 /**
151 Retrieves a 16-bit binary patchable PCD token value based on a token name.
152
153 Returns the 16-bit value for the token specified by TokenName.
154 If TokenName is not a valid token in the token space, then the module will not build.
155 If TokenName is not a patchable in module PCD, then the module will not build.
156
157 @param TokenName The name of the PCD token to retrieve a current value for.
158
159 @return A 16-bit binary patchable PCD token value.
160
161 **/
162 #define PatchPcdGet16(TokenName) _gPcd_BinaryPatch_##TokenName
163
164 /**
165 Retrieves a 32-bit binary patchable PCD token value based on a token name.
166
167 Returns the 32-bit value for the token specified by TokenName.
168 If TokenName is not a valid token in the token space, then the module will not build.
169 If TokenName is not a patchable in module PCD, then the module will not build.
170
171 @param TokenName The name of the PCD token to retrieve a current value for.
172
173 @return A 32-bit binary patchable PCD token value.
174
175 **/
176 #define PatchPcdGet32(TokenName) _gPcd_BinaryPatch_##TokenName
177
178 /**
179 Retrieves a 64-bit binary patchable PCD token value based on a token name.
180
181 Returns the 64-bit value for the token specified by TokenName.
182 If TokenName is not a valid token in the token space, then the module will not build.
183 If TokenName is not a patchable in module PCD, then the module will not build.
184
185 @param TokenName The name of the PCD token to retrieve a current value for.
186
187 @return A 64-bit binary patchable PCD token value.
188
189 **/
190 #define PatchPcdGet64(TokenName) _gPcd_BinaryPatch_##TokenName
191
192 /**
193 Retrieves a Boolean binary patchable PCD token value based on a token name.
194
195 Returns the Boolean value for the token specified by TokenName.
196 If TokenName is not a valid token in the token space, then the module will not build.
197 If TokenName is not a patchable in module PCD, then the module will not build.
198
199 @param TokenName The name of the PCD token to retrieve a current value for.
200
201 @return The Boolean value for the token.
202
203 **/
204 #define PatchPcdGetBool(TokenName) _gPcd_BinaryPatch_##TokenName
205
206 /**
207 Retrieves a pointer to a binary patchable PCD token buffer based on a token name.
208
209 Returns a pointer to the buffer for the token specified by TokenName.
210 If TokenName is not a valid token in the token space, then the module will not build.
211 If TokenName is not a patchable in module PCD, then the module will not build.
212
213 @param TokenName The name of the PCD token to retrieve a current value for.
214
215 @return A pointer to the buffer for the token.
216
217 **/
218 #define PatchPcdGetPtr(TokenName) ((VOID *)_gPcd_BinaryPatch_##TokenName)
219
220 /**
221 Sets an 8-bit binary patchable PCD token value based on a token name.
222
223 Sets the 8-bit value for the token specified by TokenName. Value is returned.
224 If TokenName is not a valid token in the token space, then the module will not build.
225 If TokenName is not a patchable in module PCD, then the module will not build.
226
227 @param TokenName The name of the binary patchable PCD token to set the current value for.
228 @param Value The 8-bit value to set.
229
230 @return Return the Value that was set.
231
232 **/
233 #define PatchPcdSet8(TokenName, Value) (_gPcd_BinaryPatch_##TokenName = (Value))
234
235 /**
236 Sets a 16-bit binary patchable PCD token value based on a token name.
237
238 Sets the 16-bit value for the token specified by TokenName. Value is returned.
239 If TokenName is not a valid token in the token space, then the module will not build.
240 If TokenName is not a patchable in module PCD, then the module will not build.
241
242 @param TokenName The name of the binary patchable PCD token to set the current value for.
243 @param Value The 16-bit value to set.
244
245 @return Return the Value that was set.
246
247 **/
248 #define PatchPcdSet16(TokenName, Value) (_gPcd_BinaryPatch_##TokenName = (Value))
249
250 /**
251 Sets a 32-bit binary patchable PCD token value based on a token name.
252
253 Sets the 32-bit value for the token specified by TokenName. Value is returned.
254 If TokenName is not a valid token in the token space, then the module will not build.
255 If TokenName is not a patchable in module PCD, then the module will not build.
256
257 @param TokenName The name of the binary patchable PCD token to set the current value for.
258 @param Value The 32-bit value to set.
259
260 @return Return the Value that was set.
261
262 **/
263 #define PatchPcdSet32(TokenName, Value) (_gPcd_BinaryPatch_##TokenName = (Value))
264
265 /**
266 Sets a 64-bit binary patchable PCD token value based on a token name.
267
268 Sets the 64-bit value for the token specified by TokenName. Value is returned.
269 If TokenName is not a valid token in the token space, then the module will not build.
270 If TokenName is not a patchable in module PCD, then the module will not build.
271
272 @param TokenName The name of the binary patchable PCD token to set the current value for.
273 @param Value The 64-bit value to set.
274
275 @return Return the Value that was set.
276
277 **/
278 #define PatchPcdSet64(TokenName, Value) (_gPcd_BinaryPatch_##TokenName = (Value))
279
280 /**
281 Sets a Boolean binary patchable PCD token value based on a token name.
282
283 Sets the Boolean value for the token specified by TokenName. Value is returned.
284 If TokenName is not a valid token in the token space, then the module will not build.
285 If TokenName is not a patchable in module PCD, then the module will not build.
286
287 @param TokenName The name of the binary patchable PCD token to set the current value for.
288 @param Value The boolean value to set.
289
290 @return Return the Value that was set.
291
292 **/
293 #define PatchPcdSetBool(TokenName, Value) (_gPcd_BinaryPatch_##TokenName = (Value))
294
295 /**
296 Sets a pointer to a binary patchable PCD token buffer based on a token name.
297
298 Sets the buffer for the token specified by TokenName. Buffer is returned.
299 If SizeOfBuffer is greater than the maximum size supported by TokenName, then set SizeOfBuffer
300 to the maximum size supported by TokenName and return NULL to indicate that the set operation
301 was not actually performed. If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be
302 set to the maximum size supported by TokenName and NULL must be returned.
303 If TokenName is not a valid token in the token space, then the module will not build.
304 If TokenName is not a patchable in module PCD, then the module will not build.
305
306 If SizeOfBuffer is NULL, then ASSERT().
307 If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
308
309 @param TokenName The name of the binary patchable PCD token to set the current value for.
310 @param SizeOfBuffer A pointer to the size, in bytes, of Buffer.
311 @param Buffer Pointer to the value to set.
312
313 @return Return the pointer to the Buffer that was set.
314
315 **/
316 #define PatchPcdSetPtr(TokenName, Size, Buffer) \
317 LibPatchPcdSetPtrAndSize ( \
318 (VOID *)_gPcd_BinaryPatch_##TokenName, \
319 &_gPcd_BinaryPatch_Size_##TokenName, \
320 (UINTN)_PCD_PATCHABLE_##TokenName##_SIZE, \
321 (Size), \
322 (Buffer) \
323 )
324
325 /**
326 Retrieves an 8-bit PCD token value based on a token name.
327
328 Returns the 8-bit value for the token specified by TokenName.
329 If TokenName is not a valid token in the token space, then the module will not build.
330
331 @param TokenName The name of the PCD token to retrieve a current value for.
332
333 @return 8-bit value for the token specified by TokenName.
334
335 **/
336 #define PcdGet8(TokenName) _PCD_GET_MODE_8_##TokenName
337
338 /**
339 Retrieves a 16-bit PCD token value based on a token name.
340
341 Returns the 16-bit value for the token specified by TokenName.
342 If TokenName is not a valid token in the token space, then the module will not build.
343
344 @param TokenName The name of the PCD token to retrieve a current value for.
345
346 @return 16-bit value for the token specified by TokenName.
347
348 **/
349 #define PcdGet16(TokenName) _PCD_GET_MODE_16_##TokenName
350
351 /**
352 Retrieves a 32-bit PCD token value based on a token name.
353
354 Returns the 32-bit value for the token specified by TokenName.
355 If TokenName is not a valid token in the token space, then the module will not build.
356
357 @param TokenName The name of the PCD token to retrieve a current value for.
358
359 @return 32-bit value for the token specified by TokenName.
360
361 **/
362 #define PcdGet32(TokenName) _PCD_GET_MODE_32_##TokenName
363
364 /**
365 Retrieves a 64-bit PCD token value based on a token name.
366
367 Returns the 64-bit value for the token specified by TokenName.
368 If TokenName is not a valid token in the token space, then the module will not build.
369
370 @param TokenName The name of the PCD token to retrieve a current value for.
371
372 @return 64-bit value for the token specified by TokenName.
373
374 **/
375 #define PcdGet64(TokenName) _PCD_GET_MODE_64_##TokenName
376
377 /**
378 Retrieves a pointer to a PCD token buffer based on a token name.
379
380 Returns a pointer to the buffer for the token specified by TokenName.
381 If TokenName is not a valid token in the token space, then the module will not build.
382
383 @param TokenName The name of the PCD token to retrieve a current value for.
384
385 @return A pointer to the buffer.
386
387 **/
388 #define PcdGetPtr(TokenName) _PCD_GET_MODE_PTR_##TokenName
389
390 /**
391 Retrieves a Boolean PCD token value based on a token name.
392
393 Returns the Boolean value for the token specified by TokenName.
394 If TokenName is not a valid token in the token space, then the module will not build.
395
396 @param TokenName The name of the PCD token to retrieve a current value for.
397
398 @return A Boolean PCD token value.
399
400 **/
401 #define PcdGetBool(TokenName) _PCD_GET_MODE_BOOL_##TokenName
402
403 /**
404 Retrieves the size of a fixed PCD token based on a token name.
405
406 Returns the size of the token specified by TokenName.
407 If TokenName is not a valid token in the token space, then the module will not build.
408
409 @param[in] TokenName The name of the PCD token to retrieve a current value size for.
410
411 @return Return the size
412
413 **/
414 #define FixedPcdGetSize(TokenName) _PCD_SIZE_##TokenName
415
416 /**
417 Retrieves the size of a binary patchable PCD token based on a token name.
418
419 Returns the size of the token specified by TokenName.
420 If TokenName is not a valid token in the token space, then the module will not build.
421
422 @param[in] TokenName The name of the PCD token to retrieve a current value size for.
423
424 @return Return the size
425
426 **/
427 #define PatchPcdGetSize(TokenName) _gPcd_BinaryPatch_Size_##TokenName
428
429 /**
430 Retrieves the size of the PCD token based on a token name.
431
432 Returns the size of the token specified by TokenName.
433 If TokenName is not a valid token in the token space, then the module will not build.
434
435 @param[in] TokenName The name of the PCD token to retrieve a current value size for.
436
437 @return Return the size
438
439 **/
440 #define PcdGetSize(TokenName) _PCD_GET_MODE_SIZE_##TokenName
441
442 /**
443 Retrieve the size of a given PCD token.
444
445 Returns the size of the token specified by TokenNumber and Guid.
446 If Guid is NULL, then ASSERT().
447
448 @param[in] Guid Pointer to a 128-bit unique value that designates
449 which namespace to retrieve a value from.
450 @param[in] TokenNumber The PCD token number to retrieve a current value size for.
451
452 @return Return the size.
453
454 **/
455 #define PcdGetExSize(Guid, TokenName) LibPcdGetExSize ((Guid), PcdTokenEx(Guid,TokenName))
456
457 /**
458 Sets a 8-bit PCD token value based on a token name.
459
460 Sets the 8-bit value for the token specified by TokenName.
461 If TokenName is not a valid token in the token space, then the module will not build.
462
463 @param TokenName The name of the PCD token to retrieve a current value for.
464 @param Value The 8-bit value to set.
465
466 @return The status of the set operation.
467
468 **/
469 #define PcdSet8S(TokenName, Value) _PCD_SET_MODE_8_S_##TokenName ((Value))
470
471 /**
472 Sets a 16-bit PCD token value based on a token name.
473
474 Sets the 16-bit value for the token specified by TokenName.
475 If TokenName is not a valid token in the token space, then the module will not build.
476
477 @param TokenName The name of the PCD token to retrieve a current value for.
478 @param Value The 16-bit value to set.
479
480 @return The status of the set operation.
481
482 **/
483 #define PcdSet16S(TokenName, Value) _PCD_SET_MODE_16_S_##TokenName ((Value))
484
485 /**
486 Sets a 32-bit PCD token value based on a token name.
487
488 Sets the 32-bit value for the token specified by TokenName.
489 If TokenName is not a valid token in the token space, then the module will not build.
490
491 @param TokenName The name of the PCD token to retrieve a current value for.
492 @param Value The 32-bit value to set.
493
494 @return The status of the set operation.
495
496 **/
497 #define PcdSet32S(TokenName, Value) _PCD_SET_MODE_32_S_##TokenName ((Value))
498
499 /**
500 Sets a 64-bit PCD token value based on a token name.
501
502 Sets the 64-bit value for the token specified by TokenName.
503 If TokenName is not a valid token in the token space, then the module will not build.
504
505 @param TokenName The name of the PCD token to retrieve a current value for.
506 @param Value The 64-bit value to set.
507
508 @return The status of the set operation.
509
510 **/
511 #define PcdSet64S(TokenName, Value) _PCD_SET_MODE_64_S_##TokenName ((Value))
512
513 /**
514 Sets a pointer to a PCD token buffer based on a token name.
515
516 Sets the buffer for the token specified by TokenName.
517 If SizeOfBuffer is greater than the maximum size supported by TokenName,
518 then set SizeOfBuffer to the maximum size supported by TokenName and return
519 RETURN_INVALID_PARAMETER to indicate that the set operation was not actually performed.
520 If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to the maximum size
521 supported by TokenName and RETURN_INVALID_PARAMETER must be returned.
522 If TokenName is not a valid token in the token space, then the module will not build.
523
524 If SizeOfBuffer is NULL, then ASSERT().
525 If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
526
527 @param TokenName The name of the PCD token to set the current value for.
528 @param SizeOfBuffer A pointer to the size, in bytes, of Buffer.
529 @param Buffer A pointer to the buffer to set.
530
531 @return The status of the set operation.
532
533 **/
534 #define PcdSetPtrS(TokenName, SizeOfBuffer, Buffer) \
535 _PCD_SET_MODE_PTR_S_##TokenName ((SizeOfBuffer), (Buffer))
536
537 /**
538 Sets a boolean PCD token value based on a token name.
539
540 Sets the boolean value for the token specified by TokenName.
541 If TokenName is not a valid token in the token space, then the module will not build.
542
543 @param TokenName The name of the PCD token to retrieve a current value for.
544 @param Value The boolean value to set.
545
546 @return The status of the set operation.
547
548 **/
549 #define PcdSetBoolS(TokenName, Value) _PCD_SET_MODE_BOOL_S_##TokenName ((Value))
550
551 /**
552 Retrieves a token number based on a GUID and a token name.
553
554 Returns the token number for the token specified by Guid and TokenName.
555 If TokenName is not a valid token in the token space, then the module will not build.
556
557 @param Guid Pointer to a 128-bit unique value that designates
558 which namespace to retrieve a value from.
559 @param TokenName The name of the PCD token to retrieve a current value for.
560
561 @return Return the token number.
562
563 **/
564 #define PcdTokenEx(Guid, TokenName) _PCD_TOKEN_EX_##TokenName(Guid)
565
566 /**
567 Retrieves an 8-bit PCD token value based on a GUID and a token name.
568
569 Returns the 8-bit value for the token specified by Guid and TokenName.
570 If TokenName is not a valid token in the token space specified by Guid,
571 then the module will not build.
572
573 If Guid is NULL, then ASSERT().
574
575 @param Guid Pointer to a 128-bit unique value that designates
576 which namespace to retrieve a value from.
577 @param TokenName The name of the PCD token to retrieve a current value for.
578
579 @return An 8-bit PCD token value.
580
581 **/
582 #define PcdGetEx8(Guid, TokenName) LibPcdGetEx8 ((Guid), PcdTokenEx(Guid,TokenName))
583
584 /**
585 Retrieves a 16-bit PCD token value based on a GUID and a token name.
586
587 Returns the 16-bit value for the token specified by Guid and TokenName.
588 If TokenName is not a valid token in the token space specified by Guid,
589 then the module will not build.
590
591 If Guid is NULL, then ASSERT().
592
593 @param Guid Pointer to a 128-bit unique value that designates
594 which namespace to retrieve a value from.
595 @param TokenName The name of the PCD token to retrieve a current value for.
596
597 @return A 16-bit PCD token value.
598
599 **/
600 #define PcdGetEx16(Guid, TokenName) LibPcdGetEx16 ((Guid), PcdTokenEx(Guid,TokenName))
601
602 /**
603 Retrieves a 32-bit PCD token value based on a GUID and a token name.
604
605 Returns the 32-bit value for the token specified by Guid and TokenName.
606 If TokenName is not a valid token in the token space specified by Guid,
607 then the module will not build.
608
609 If Guid is NULL, then ASSERT().
610
611 @param Guid Pointer to a 128-bit unique value that designates
612 which namespace to retrieve a value from.
613 @param TokenName The name of the PCD token to retrieve a current value for.
614
615 @return A 32-bit PCD token value.
616
617 **/
618 #define PcdGetEx32(Guid, TokenName) LibPcdGetEx32 ((Guid), PcdTokenEx(Guid,TokenName))
619
620 /**
621 Retrieves a 64-bit PCD token value based on a GUID and a token name.
622
623 Returns the 64-bit value for the token specified by Guid and TokenName.
624 If TokenName is not a valid token in the token space specified by Guid,
625 then the module will not build.
626
627 If Guid is NULL, then ASSERT().
628
629 @param Guid Pointer to a 128-bit unique value that designates
630 which namespace to retrieve a value from.
631 @param TokenName The name of the PCD token to retrieve a current value for.
632
633 @return A 64-bit PCD token value.
634
635 **/
636 #define PcdGetEx64(Guid, TokenName) LibPcdGetEx64 ((Guid), PcdTokenEx(Guid,TokenName))
637
638 /**
639 Retrieves a pointer to a PCD token buffer based on a GUID and a token name.
640
641 Returns a pointer to the buffer for the token specified by Guid and TokenName.
642 If TokenName is not a valid token in the token space specified by Guid,
643 then the module will not build.
644
645 If Guid is NULL, then ASSERT().
646
647 @param Guid Pointer to a 128-bit unique value that designates
648 which namespace to retrieve a value from.
649 @param TokenName The name of the PCD token to retrieve a current value for.
650
651 @return A pointer to a PCD token buffer.
652
653 **/
654 #define PcdGetExPtr(Guid, TokenName) LibPcdGetExPtr ((Guid), PcdTokenEx(Guid,TokenName))
655
656 /**
657 Retrieves a Boolean PCD token value based on a GUID and a token name.
658
659 Returns the Boolean value for the token specified by Guid and TokenName.
660 If TokenName is not a valid token in the token space specified by Guid,
661 then the module will not build.
662
663 If Guid is NULL, then ASSERT().
664
665 @param Guid Pointer to a 128-bit unique value that designates
666 which namespace to retrieve a value from.
667 @param TokenName The name of the PCD token to retrieve a current value for.
668
669 @return A Boolean PCD token value.
670
671 **/
672 #define PcdGetExBool(Guid, TokenName) LibPcdGetExBool ((Guid), PcdTokenEx(Guid,TokenName))
673
674 /**
675 Sets an 8-bit PCD token value based on a GUID and a token name.
676
677 Sets the 8-bit value for the token specified by Guid and TokenName.
678 If TokenName is not a valid token in the token space specified by Guid,
679 then the module will not build.
680
681 If Guid is NULL, then ASSERT().
682
683 @param Guid Pointer to a 128-bit unique value that designates
684 which namespace to retrieve a value from.
685 @param TokenName The name of the PCD token to set the current value for.
686 @param Value The 8-bit value to set.
687
688 @return The status of the set operation.
689
690 **/
691 #define PcdSetEx8S(Guid, TokenName, Value) LibPcdSetEx8S ((Guid), PcdTokenEx(Guid,TokenName), (Value))
692
693 /**
694 Sets an 16-bit PCD token value based on a GUID and a token name.
695
696 Sets the 16-bit value for the token specified by Guid and TokenName.
697 If TokenName is not a valid token in the token space specified by Guid,
698 then the module will not build.
699
700 If Guid is NULL, then ASSERT().
701
702 @param Guid Pointer to a 128-bit unique value that designates
703 which namespace to retrieve a value from.
704 @param TokenName The name of the PCD token to set the current value for.
705 @param Value The 16-bit value to set.
706
707 @return The status of the set operation.
708
709 **/
710 #define PcdSetEx16S(Guid, TokenName, Value) LibPcdSetEx16S ((Guid), PcdTokenEx(Guid,TokenName), (Value))
711
712 /**
713 Sets an 32-bit PCD token value based on a GUID and a token name.
714
715 Sets the 32-bit value for the token specified by Guid and TokenName.
716 If TokenName is not a valid token in the token space specified by Guid,
717 then the module will not build.
718
719 If Guid is NULL, then ASSERT().
720
721 @param Guid Pointer to a 128-bit unique value that designates
722 which namespace to retrieve a value from.
723 @param TokenName The name of the PCD token to set the current value for.
724 @param Value The 32-bit value to set.
725
726 @return The status of the set operation.
727
728 **/
729 #define PcdSetEx32S(Guid, TokenName, Value) LibPcdSetEx32S ((Guid), PcdTokenEx(Guid,TokenName), (Value))
730
731 /**
732 Sets an 64-bit PCD token value based on a GUID and a token name.
733
734 Sets the 64-bit value for the token specified by Guid and TokenName.
735 If TokenName is not a valid token in the token space specified by Guid,
736 then the module will not build.
737
738 If Guid is NULL, then ASSERT().
739
740 @param Guid Pointer to a 128-bit unique value that designates
741 which namespace to retrieve a value from.
742 @param TokenName The name of the PCD token to set the current value for.
743 @param Value The 64-bit value to set.
744
745 @return The status of the set operation.
746
747 **/
748 #define PcdSetEx64S(Guid, TokenName, Value) LibPcdSetEx64S ((Guid), PcdTokenEx(Guid,TokenName), (Value))
749
750 /**
751 Sets a pointer to a PCD token buffer based on a GUID and a token name.
752
753 Sets the buffer for the token specified by Guid and TokenName.
754 If SizeOfBuffer is greater than the maximum size supported by Guid and TokenName,
755 then set SizeOfBuffer to the maximum size supported by Guid and TokenName and return
756 RETURN_INVALID_PARAMETER to indicate that the set operation was not actually performed.
757 If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to the maximum size
758 supported by Guid and TokenName and RETURN_INVALID_PARAMETER must be returned.
759 If TokenName is not a valid token in the token space specified by Guid,
760 then the module will not build.
761
762 If Guid is NULL, then ASSERT().
763 If SizeOfBuffer is NULL, then ASSERT().
764 If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
765
766 @param Guid Pointer to a 128-bit unique value that designates
767 which namespace to retrieve a value from.
768 @param TokenName The name of the PCD token to set the current value for.
769 @param SizeOfBuffer A pointer to the size, in bytes, of Buffer.
770 @param Buffer Pointer to the buffer to set.
771
772 @return The status of the set operation.
773
774 **/
775 #define PcdSetExPtrS(Guid, TokenName, SizeOfBuffer, Buffer) \
776 LibPcdSetExPtrS ((Guid), PcdTokenEx(Guid,TokenName), (SizeOfBuffer), (Buffer))
777
778 /**
779 Sets an boolean PCD token value based on a GUID and a token name.
780
781 Sets the boolean value for the token specified by Guid and TokenName.
782 If TokenName is not a valid token in the token space specified by Guid,
783 then the module will not build.
784
785 If Guid is NULL, then ASSERT().
786
787 @param Guid Pointer to a 128-bit unique value that designates
788 which namespace to retrieve a value from.
789 @param TokenName The name of the PCD token to set the current value for.
790 @param Value The boolean value to set.
791
792 @return The status of the set operation.
793
794 **/
795 #define PcdSetExBoolS(Guid, TokenName, Value) \
796 LibPcdSetExBoolS ((Guid), PcdTokenEx(Guid,TokenName), (Value))
797
798 /**
799 This function provides a means by which SKU support can be established in the PCD infrastructure.
800
801 Sets the current SKU in the PCD database to the value specified by SkuId. SkuId is returned.
802
803 @param SkuId The SKU value that will be used when the PCD service retrieves and sets values
804 associated with a PCD token.
805
806 @return Return the SKU ID that was set.
807
808 **/
809 UINTN
810 EFIAPI
811 LibPcdSetSku (
812 IN UINTN SkuId
813 );
814
815 /**
816 This function provides a means by which to retrieve a value for a given PCD token.
817
818 Returns the 8-bit value for the token specified by TokenNumber.
819
820 @param[in] TokenNumber The PCD token number to retrieve a current value for.
821
822 @return Returns the 8-bit value for the token specified by TokenNumber.
823
824 **/
825 UINT8
826 EFIAPI
827 LibPcdGet8 (
828 IN UINTN TokenNumber
829 );
830
831 /**
832 This function provides a means by which to retrieve a value for a given PCD token.
833
834 Returns the 16-bit value for the token specified by TokenNumber.
835
836 @param[in] TokenNumber The PCD token number to retrieve a current value for.
837
838 @return Returns the 16-bit value for the token specified by TokenNumber.
839
840 **/
841 UINT16
842 EFIAPI
843 LibPcdGet16 (
844 IN UINTN TokenNumber
845 );
846
847 /**
848 This function provides a means by which to retrieve a value for a given PCD token.
849
850 Returns the 32-bit value for the token specified by TokenNumber.
851
852 @param[in] TokenNumber The PCD token number to retrieve a current value for.
853
854 @return Returns the 32-bit value for the token specified by TokenNumber.
855
856 **/
857 UINT32
858 EFIAPI
859 LibPcdGet32 (
860 IN UINTN TokenNumber
861 );
862
863 /**
864 This function provides a means by which to retrieve a value for a given PCD token.
865
866 Returns the 64-bit value for the token specified by TokenNumber.
867
868 @param[in] TokenNumber The PCD token number to retrieve a current value for.
869
870 @return Returns the 64-bit value for the token specified by TokenNumber.
871
872 **/
873 UINT64
874 EFIAPI
875 LibPcdGet64 (
876 IN UINTN TokenNumber
877 );
878
879 /**
880 This function provides a means by which to retrieve a value for a given PCD token.
881
882 Returns the pointer to the buffer of the token specified by TokenNumber.
883
884 @param[in] TokenNumber The PCD token number to retrieve a current value for.
885
886 @return Returns the pointer to the token specified by TokenNumber.
887
888 **/
889 VOID *
890 EFIAPI
891 LibPcdGetPtr (
892 IN UINTN TokenNumber
893 );
894
895 /**
896 This function provides a means by which to retrieve a value for a given PCD token.
897
898 Returns the Boolean value of the token specified by TokenNumber.
899
900 @param[in] TokenNumber The PCD token number to retrieve a current value for.
901
902 @return Returns the Boolean value of the token specified by TokenNumber.
903
904 **/
905 BOOLEAN
906 EFIAPI
907 LibPcdGetBool (
908 IN UINTN TokenNumber
909 );
910
911 /**
912 This function provides a means by which to retrieve the size of a given PCD token.
913
914 @param[in] TokenNumber The PCD token number to retrieve a current value for.
915
916 @return Returns the size of the token specified by TokenNumber.
917
918 **/
919 UINTN
920 EFIAPI
921 LibPcdGetSize (
922 IN UINTN TokenNumber
923 );
924
925 /**
926 This function provides a means by which to retrieve a value for a given PCD token.
927
928 Returns the 8-bit value for the token specified by TokenNumber and Guid.
929
930 If Guid is NULL, then ASSERT().
931
932 @param[in] Guid Pointer to a 128-bit unique value that designates
933 which namespace to retrieve a value from.
934 @param[in] TokenNumber The PCD token number to retrieve a current value for.
935
936 @return Return the UINT8.
937
938 **/
939 UINT8
940 EFIAPI
941 LibPcdGetEx8 (
942 IN CONST GUID *Guid,
943 IN UINTN TokenNumber
944 );
945
946 /**
947 This function provides a means by which to retrieve a value for a given PCD token.
948
949 Returns the 16-bit value for the token specified by TokenNumber and Guid.
950
951 If Guid is NULL, then ASSERT().
952
953 @param[in] Guid Pointer to a 128-bit unique value that designates
954 which namespace to retrieve a value from.
955 @param[in] TokenNumber The PCD token number to retrieve a current value for.
956
957 @return Return the UINT16.
958
959 **/
960 UINT16
961 EFIAPI
962 LibPcdGetEx16 (
963 IN CONST GUID *Guid,
964 IN UINTN TokenNumber
965 );
966
967 /**
968 Returns the 32-bit value for the token specified by TokenNumber and Guid.
969 If Guid is NULL, then ASSERT().
970
971 @param[in] Guid Pointer to a 128-bit unique value that designates
972 which namespace to retrieve a value from.
973 @param[in] TokenNumber The PCD token number to retrieve a current value for.
974
975 @return Return the UINT32.
976
977 **/
978 UINT32
979 EFIAPI
980 LibPcdGetEx32 (
981 IN CONST GUID *Guid,
982 IN UINTN TokenNumber
983 );
984
985 /**
986 This function provides a means by which to retrieve a value for a given PCD token.
987
988 Returns the 64-bit value for the token specified by TokenNumber and Guid.
989
990 If Guid is NULL, then ASSERT().
991
992 @param[in] Guid Pointer to a 128-bit unique value that designates
993 which namespace to retrieve a value from.
994 @param[in] TokenNumber The PCD token number to retrieve a current value for.
995
996 @return Return the UINT64.
997
998 **/
999 UINT64
1000 EFIAPI
1001 LibPcdGetEx64 (
1002 IN CONST GUID *Guid,
1003 IN UINTN TokenNumber
1004 );
1005
1006 /**
1007 This function provides a means by which to retrieve a value for a given PCD token.
1008
1009 Returns the pointer to the buffer of token specified by TokenNumber and Guid.
1010
1011 If Guid is NULL, then ASSERT().
1012
1013 @param[in] Guid Pointer to a 128-bit unique value that designates
1014 which namespace to retrieve a value from.
1015 @param[in] TokenNumber The PCD token number to retrieve a current value for.
1016
1017 @return Return the VOID* pointer.
1018
1019 **/
1020 VOID *
1021 EFIAPI
1022 LibPcdGetExPtr (
1023 IN CONST GUID *Guid,
1024 IN UINTN TokenNumber
1025 );
1026
1027 /**
1028 This function provides a means by which to retrieve a value for a given PCD token.
1029
1030 Returns the Boolean value of the token specified by TokenNumber and Guid.
1031
1032 If Guid is NULL, then ASSERT().
1033
1034 @param[in] Guid Pointer to a 128-bit unique value that designates
1035 which namespace to retrieve a value from.
1036 @param[in] TokenNumber The PCD token number to retrieve a current value for.
1037
1038 @return Return the BOOLEAN.
1039
1040 **/
1041 BOOLEAN
1042 EFIAPI
1043 LibPcdGetExBool (
1044 IN CONST GUID *Guid,
1045 IN UINTN TokenNumber
1046 );
1047
1048 /**
1049 This function provides a means by which to retrieve the size of a given PCD token.
1050
1051 Returns the size of the token specified by TokenNumber and Guid.
1052
1053 If Guid is NULL, then ASSERT().
1054
1055 @param[in] Guid Pointer to a 128-bit unique value that designates
1056 which namespace to retrieve a value from.
1057 @param[in] TokenNumber The PCD token number to retrieve a current value for.
1058
1059 @return Return the size.
1060
1061 **/
1062 UINTN
1063 EFIAPI
1064 LibPcdGetExSize (
1065 IN CONST GUID *Guid,
1066 IN UINTN TokenNumber
1067 );
1068
1069 /**
1070 This function provides a means by which to set a value for a given PCD token.
1071
1072 Sets the 8-bit value for the token specified by TokenNumber
1073 to the value specified by Value.
1074
1075 @param[in] TokenNumber The PCD token number to set a current value for.
1076 @param[in] Value The 8-bit value to set.
1077
1078 @return The status of the set operation.
1079
1080 **/
1081 RETURN_STATUS
1082 EFIAPI
1083 LibPcdSet8S (
1084 IN UINTN TokenNumber,
1085 IN UINT8 Value
1086 );
1087
1088 /**
1089 This function provides a means by which to set a value for a given PCD token.
1090
1091 Sets the 16-bit value for the token specified by TokenNumber
1092 to the value specified by Value.
1093
1094 @param[in] TokenNumber The PCD token number to set a current value for.
1095 @param[in] Value The 16-bit value to set.
1096
1097 @return The status of the set operation.
1098
1099 **/
1100 RETURN_STATUS
1101 EFIAPI
1102 LibPcdSet16S (
1103 IN UINTN TokenNumber,
1104 IN UINT16 Value
1105 );
1106
1107 /**
1108 This function provides a means by which to set a value for a given PCD token.
1109
1110 Sets the 32-bit value for the token specified by TokenNumber
1111 to the value specified by Value.
1112
1113 @param[in] TokenNumber The PCD token number to set a current value for.
1114 @param[in] Value The 32-bit value to set.
1115
1116 @return The status of the set operation.
1117
1118 **/
1119 RETURN_STATUS
1120 EFIAPI
1121 LibPcdSet32S (
1122 IN UINTN TokenNumber,
1123 IN UINT32 Value
1124 );
1125
1126 /**
1127 This function provides a means by which to set a value for a given PCD token.
1128
1129 Sets the 64-bit value for the token specified by TokenNumber
1130 to the value specified by Value.
1131
1132 @param[in] TokenNumber The PCD token number to set a current value for.
1133 @param[in] Value The 64-bit value to set.
1134
1135 @return The status of the set operation.
1136
1137 **/
1138 RETURN_STATUS
1139 EFIAPI
1140 LibPcdSet64S (
1141 IN UINTN TokenNumber,
1142 IN UINT64 Value
1143 );
1144
1145 /**
1146 This function provides a means by which to set a value for a given PCD token.
1147
1148 Sets a buffer for the token specified by TokenNumber to the value specified
1149 by Buffer and SizeOfBuffer. If SizeOfBuffer is greater than the maximum size
1150 support by TokenNumber, then set SizeOfBuffer to the maximum size supported by
1151 TokenNumber and return RETURN_INVALID_PARAMETER to indicate that the set operation
1152 was not actually performed.
1153
1154 If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to the
1155 maximum size supported by TokenName and RETURN_INVALID_PARAMETER must be returned.
1156
1157 If SizeOfBuffer is NULL, then ASSERT().
1158 If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
1159
1160 @param[in] TokenNumber The PCD token number to set a current value for.
1161 @param[in, out] SizeOfBuffer The size, in bytes, of Buffer.
1162 @param[in] Buffer A pointer to the buffer to set.
1163
1164 @return The status of the set operation.
1165
1166 **/
1167 RETURN_STATUS
1168 EFIAPI
1169 LibPcdSetPtrS (
1170 IN UINTN TokenNumber,
1171 IN OUT UINTN *SizeOfBuffer,
1172 IN CONST VOID *Buffer
1173 );
1174
1175 /**
1176 This function provides a means by which to set a value for a given PCD token.
1177
1178 Sets the boolean value for the token specified by TokenNumber
1179 to the value specified by Value.
1180
1181 @param[in] TokenNumber The PCD token number to set a current value for.
1182 @param[in] Value The boolean value to set.
1183
1184 @return The status of the set operation.
1185
1186 **/
1187 RETURN_STATUS
1188 EFIAPI
1189 LibPcdSetBoolS (
1190 IN UINTN TokenNumber,
1191 IN BOOLEAN Value
1192 );
1193
1194 /**
1195 This function provides a means by which to set a value for a given PCD token.
1196
1197 Sets the 8-bit value for the token specified by TokenNumber
1198 to the value specified by Value.
1199
1200 If Guid is NULL, then ASSERT().
1201
1202 @param[in] Guid The pointer to a 128-bit unique value that
1203 designates which namespace to set a value from.
1204 @param[in] TokenNumber The PCD token number to set a current value for.
1205 @param[in] Value The 8-bit value to set.
1206
1207 @return The status of the set operation.
1208
1209 **/
1210 RETURN_STATUS
1211 EFIAPI
1212 LibPcdSetEx8S (
1213 IN CONST GUID *Guid,
1214 IN UINTN TokenNumber,
1215 IN UINT8 Value
1216 );
1217
1218 /**
1219 This function provides a means by which to set a value for a given PCD token.
1220
1221 Sets the 16-bit value for the token specified by TokenNumber
1222 to the value specified by Value.
1223
1224 If Guid is NULL, then ASSERT().
1225
1226 @param[in] Guid The pointer to a 128-bit unique value that
1227 designates which namespace to set a value from.
1228 @param[in] TokenNumber The PCD token number to set a current value for.
1229 @param[in] Value The 16-bit value to set.
1230
1231 @return The status of the set operation.
1232
1233 **/
1234 RETURN_STATUS
1235 EFIAPI
1236 LibPcdSetEx16S (
1237 IN CONST GUID *Guid,
1238 IN UINTN TokenNumber,
1239 IN UINT16 Value
1240 );
1241
1242 /**
1243 This function provides a means by which to set a value for a given PCD token.
1244
1245 Sets the 32-bit value for the token specified by TokenNumber
1246 to the value specified by Value.
1247
1248 If Guid is NULL, then ASSERT().
1249
1250 @param[in] Guid The pointer to a 128-bit unique value that
1251 designates which namespace to set a value from.
1252 @param[in] TokenNumber The PCD token number to set a current value for.
1253 @param[in] Value The 32-bit value to set.
1254
1255 @return The status of the set operation.
1256
1257 **/
1258 RETURN_STATUS
1259 EFIAPI
1260 LibPcdSetEx32S (
1261 IN CONST GUID *Guid,
1262 IN UINTN TokenNumber,
1263 IN UINT32 Value
1264 );
1265
1266 /**
1267 This function provides a means by which to set a value for a given PCD token.
1268
1269 Sets the 64-bit value for the token specified by TokenNumber
1270 to the value specified by Value.
1271
1272 If Guid is NULL, then ASSERT().
1273
1274 @param[in] Guid The pointer to a 128-bit unique value that
1275 designates which namespace to set a value from.
1276 @param[in] TokenNumber The PCD token number to set a current value for.
1277 @param[in] Value The 64-bit value to set.
1278
1279 @return The status of the set operation.
1280
1281 **/
1282 RETURN_STATUS
1283 EFIAPI
1284 LibPcdSetEx64S (
1285 IN CONST GUID *Guid,
1286 IN UINTN TokenNumber,
1287 IN UINT64 Value
1288 );
1289
1290 /**
1291 This function provides a means by which to set a value for a given PCD token.
1292
1293 Sets a buffer for the token specified by TokenNumber to the value specified by
1294 Buffer and SizeOfBuffer. If SizeOfBuffer is greater than the maximum size
1295 support by TokenNumber, then set SizeOfBuffer to the maximum size supported by
1296 TokenNumber and return RETURN_INVALID_PARAMETER to indicate that the set operation
1297 was not actually performed.
1298
1299 If Guid is NULL, then ASSERT().
1300 If SizeOfBuffer is NULL, then ASSERT().
1301 If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
1302
1303 @param[in] Guid Pointer to a 128-bit unique value that
1304 designates which namespace to set a value from.
1305 @param[in] TokenNumber The PCD token number to set a current value for.
1306 @param[in, out] SizeOfBuffer The size, in bytes, of Buffer.
1307 @param[in] Buffer A pointer to the buffer to set.
1308
1309 @return The status of the set operation.
1310
1311 **/
1312 RETURN_STATUS
1313 EFIAPI
1314 LibPcdSetExPtrS (
1315 IN CONST GUID *Guid,
1316 IN UINTN TokenNumber,
1317 IN OUT UINTN *SizeOfBuffer,
1318 IN VOID *Buffer
1319 );
1320
1321 /**
1322 This function provides a means by which to set a value for a given PCD token.
1323
1324 Sets the boolean value for the token specified by TokenNumber
1325 to the value specified by Value.
1326
1327 If Guid is NULL, then ASSERT().
1328
1329 @param[in] Guid The pointer to a 128-bit unique value that
1330 designates which namespace to set a value from.
1331 @param[in] TokenNumber The PCD token number to set a current value for.
1332 @param[in] Value The boolean value to set.
1333
1334 @return The status of the set operation.
1335
1336 **/
1337 RETURN_STATUS
1338 EFIAPI
1339 LibPcdSetExBoolS (
1340 IN CONST GUID *Guid,
1341 IN UINTN TokenNumber,
1342 IN BOOLEAN Value
1343 );
1344
1345 /**
1346 This notification function serves two purposes.
1347
1348 Firstly, it notifies the module that did the registration that the value of this
1349 PCD token has been set.
1350 Secondly, it provides a mechanism for the module that did the registration to intercept
1351 the set operation and override the value been set if necessary. After the invocation of
1352 the callback function, TokenData will be used by PCD service PEIM or driver to modify th
1353 internal data in PCD database.
1354
1355 @param[in] CallBackGuid The PCD token GUID being set.
1356 @param[in] CallBackToken The PCD token number being set.
1357 @param[in, out] TokenData A pointer to the token data being set.
1358 @param[in] TokenDataSize The size, in bytes, of the data being set.
1359
1360 **/
1361 typedef
1362 VOID
1363 (EFIAPI *PCD_CALLBACK)(
1364 IN CONST GUID *CallBackGuid OPTIONAL,
1365 IN UINTN CallBackToken,
1366 IN OUT VOID *TokenData,
1367 IN UINTN TokenDataSize
1368 );
1369
1370 /**
1371 Set up a notification function that is called when a specified token is set.
1372
1373 When the token specified by TokenNumber and Guid is set,
1374 then notification function specified by NotificationFunction is called.
1375 If Guid is NULL, then the default token space is used.
1376 If NotificationFunction is NULL, then ASSERT().
1377
1378 @param[in] Guid Pointer to a 128-bit unique value that designates which
1379 namespace to set a value from. If NULL, then the default
1380 token space is used.
1381 @param[in] TokenNumber The PCD token number to monitor.
1382 @param[in] NotificationFunction The function to call when the token
1383 specified by Guid and TokenNumber is set.
1384
1385 **/
1386 VOID
1387 EFIAPI
1388 LibPcdCallbackOnSet (
1389 IN CONST GUID *Guid OPTIONAL,
1390 IN UINTN TokenNumber,
1391 IN PCD_CALLBACK NotificationFunction
1392 );
1393
1394 /**
1395 Disable a notification function that was established with LibPcdCallbackonSet().
1396
1397 Disable a notification function that was previously established with LibPcdCallbackOnSet().
1398 If NotificationFunction is NULL, then ASSERT().
1399 If LibPcdCallbackOnSet() was not previously called with Guid, TokenNumber,
1400 and NotificationFunction, then ASSERT().
1401
1402 @param[in] Guid Specify the GUID token space.
1403 @param[in] TokenNumber Specify the token number.
1404 @param[in] NotificationFunction The callback function to be unregistered.
1405
1406 **/
1407 VOID
1408 EFIAPI
1409 LibPcdCancelCallback (
1410 IN CONST GUID *Guid OPTIONAL,
1411 IN UINTN TokenNumber,
1412 IN PCD_CALLBACK NotificationFunction
1413 );
1414
1415 /**
1416 Retrieves the next token in a token space.
1417
1418 Retrieves the next PCD token number from the token space specified by Guid.
1419 If Guid is NULL, then the default token space is used. If TokenNumber is 0,
1420 then the first token number is returned. Otherwise, the token number that
1421 follows TokenNumber in the token space is returned. If TokenNumber is the last
1422 token number in the token space, then 0 is returned.
1423
1424 If TokenNumber is not 0 and is not in the token space specified by Guid, then ASSERT().
1425
1426 @param[in] Guid Pointer to a 128-bit unique value that designates which namespace
1427 to set a value from. If NULL, then the default token space is used.
1428 @param[in] TokenNumber The previous PCD token number. If 0, then retrieves the first PCD
1429 token number.
1430
1431 @return The next valid token number.
1432
1433 **/
1434 UINTN
1435 EFIAPI
1436 LibPcdGetNextToken (
1437 IN CONST GUID *Guid OPTIONAL,
1438 IN UINTN TokenNumber
1439 );
1440
1441 /**
1442 Used to retrieve the list of available PCD token space GUIDs.
1443
1444 Returns the PCD token space GUID that follows TokenSpaceGuid in the list of token spaces
1445 in the platform.
1446 If TokenSpaceGuid is NULL, then a pointer to the first PCD token spaces returned.
1447 If TokenSpaceGuid is the last PCD token space GUID in the list, then NULL is returned.
1448
1449 @param TokenSpaceGuid Pointer to the a PCD token space GUID
1450
1451 @return The next valid token namespace.
1452
1453 **/
1454 GUID *
1455 EFIAPI
1456 LibPcdGetNextTokenSpace (
1457 IN CONST GUID *TokenSpaceGuid
1458 );
1459
1460 /**
1461 Sets a value of a patchable PCD entry that is type pointer.
1462
1463 Sets the PCD entry specified by PatchVariable to the value specified by Buffer
1464 and SizeOfBuffer. Buffer is returned. If SizeOfBuffer is greater than
1465 MaximumDatumSize, then set SizeOfBuffer to MaximumDatumSize and return
1466 NULL to indicate that the set operation was not actually performed.
1467 If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to
1468 MaximumDatumSize and NULL must be returned.
1469
1470 If PatchVariable is NULL, then ASSERT().
1471 If SizeOfBuffer is NULL, then ASSERT().
1472 If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
1473
1474 @param[out] PatchVariable A pointer to the global variable in a module that is
1475 the target of the set operation.
1476 @param[in] MaximumDatumSize The maximum size allowed for the PCD entry specified by PatchVariable.
1477 @param[in, out] SizeOfBuffer A pointer to the size, in bytes, of Buffer.
1478 @param[in] Buffer A pointer to the buffer to used to set the target variable.
1479
1480 @return Return the pointer to the Buffer that was set.
1481
1482 **/
1483 VOID *
1484 EFIAPI
1485 LibPatchPcdSetPtr (
1486 OUT VOID *PatchVariable,
1487 IN UINTN MaximumDatumSize,
1488 IN OUT UINTN *SizeOfBuffer,
1489 IN CONST VOID *Buffer
1490 );
1491
1492 /**
1493 Sets a value of a patchable PCD entry that is type pointer.
1494
1495 Sets the PCD entry specified by PatchVariable to the value specified
1496 by Buffer and SizeOfBuffer. If SizeOfBuffer is greater than MaximumDatumSize,
1497 then set SizeOfBuffer to MaximumDatumSize and return RETURN_INVALID_PARAMETER
1498 to indicate that the set operation was not actually performed.
1499 If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to
1500 MaximumDatumSize and RETURN_INVALID_PARAMETER must be returned.
1501
1502 If PatchVariable is NULL, then ASSERT().
1503 If SizeOfBuffer is NULL, then ASSERT().
1504 If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
1505
1506 @param[out] PatchVariable A pointer to the global variable in a module that is
1507 the target of the set operation.
1508 @param[in] MaximumDatumSize The maximum size allowed for the PCD entry specified by PatchVariable.
1509 @param[in, out] SizeOfBuffer A pointer to the size, in bytes, of Buffer.
1510 @param[in] Buffer A pointer to the buffer to used to set the target variable.
1511
1512 @return The status of the set operation.
1513
1514 **/
1515 RETURN_STATUS
1516 EFIAPI
1517 LibPatchPcdSetPtrS (
1518 OUT VOID *PatchVariable,
1519 IN UINTN MaximumDatumSize,
1520 IN OUT UINTN *SizeOfBuffer,
1521 IN CONST VOID *Buffer
1522 );
1523
1524 /**
1525 Sets a value and size of a patchable PCD entry that is type pointer.
1526
1527 Sets the PCD entry specified by PatchVariable to the value specified by Buffer
1528 and SizeOfBuffer. Buffer is returned. If SizeOfBuffer is greater than
1529 MaximumDatumSize, then set SizeOfBuffer to MaximumDatumSize and return
1530 NULL to indicate that the set operation was not actually performed.
1531 If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to
1532 MaximumDatumSize and NULL must be returned.
1533
1534 If PatchVariable is NULL, then ASSERT().
1535 If SizeOfPatchVariable is NULL, then ASSERT().
1536 If SizeOfBuffer is NULL, then ASSERT().
1537 If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
1538
1539 @param[out] PatchVariable A pointer to the global variable in a module that is
1540 the target of the set operation.
1541 @param[out] SizeOfPatchVariable A pointer to the size, in bytes, of PatchVariable.
1542 @param[in] MaximumDatumSize The maximum size allowed for the PCD entry specified by PatchVariable.
1543 @param[in, out] SizeOfBuffer A pointer to the size, in bytes, of Buffer.
1544 @param[in] Buffer A pointer to the buffer to used to set the target variable.
1545
1546 @return Return the pointer to the Buffer that was set.
1547
1548 **/
1549 VOID *
1550 EFIAPI
1551 LibPatchPcdSetPtrAndSize (
1552 OUT VOID *PatchVariable,
1553 OUT UINTN *SizeOfPatchVariable,
1554 IN UINTN MaximumDatumSize,
1555 IN OUT UINTN *SizeOfBuffer,
1556 IN CONST VOID *Buffer
1557 );
1558
1559 /**
1560 Sets a value and size of a patchable PCD entry that is type pointer.
1561
1562 Sets the PCD entry specified by PatchVariable to the value specified
1563 by Buffer and SizeOfBuffer. If SizeOfBuffer is greater than MaximumDatumSize,
1564 then set SizeOfBuffer to MaximumDatumSize and return RETURN_INVALID_PARAMETER
1565 to indicate that the set operation was not actually performed.
1566 If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to
1567 MaximumDatumSize and RETURN_INVALID_PARAMETER must be returned.
1568
1569 If PatchVariable is NULL, then ASSERT().
1570 If SizeOfPatchVariable is NULL, then ASSERT().
1571 If SizeOfBuffer is NULL, then ASSERT().
1572 If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
1573
1574 @param[out] PatchVariable A pointer to the global variable in a module that is
1575 the target of the set operation.
1576 @param[out] SizeOfPatchVariable A pointer to the size, in bytes, of PatchVariable.
1577 @param[in] MaximumDatumSize The maximum size allowed for the PCD entry specified by PatchVariable.
1578 @param[in, out] SizeOfBuffer A pointer to the size, in bytes, of Buffer.
1579 @param[in] Buffer A pointer to the buffer to used to set the target variable.
1580
1581 @return The status of the set operation.
1582
1583 **/
1584 RETURN_STATUS
1585 EFIAPI
1586 LibPatchPcdSetPtrAndSizeS (
1587 OUT VOID *PatchVariable,
1588 OUT UINTN *SizeOfPatchVariable,
1589 IN UINTN MaximumDatumSize,
1590 IN OUT UINTN *SizeOfBuffer,
1591 IN CONST VOID *Buffer
1592 );
1593
1594 typedef enum {
1595 PCD_TYPE_8,
1596 PCD_TYPE_16,
1597 PCD_TYPE_32,
1598 PCD_TYPE_64,
1599 PCD_TYPE_BOOL,
1600 PCD_TYPE_PTR
1601 } PCD_TYPE;
1602
1603 typedef struct {
1604 ///
1605 /// The returned information associated with the requested TokenNumber. If
1606 /// TokenNumber is 0, then PcdType is set to PCD_TYPE_8.
1607 ///
1608 PCD_TYPE PcdType;
1609 ///
1610 /// The size of the data in bytes associated with the TokenNumber specified. If
1611 /// TokenNumber is 0, then PcdSize is set 0.
1612 ///
1613 UINTN PcdSize;
1614 ///
1615 /// The null-terminated ASCII string associated with a given token. If the
1616 /// TokenNumber specified was 0, then this field corresponds to the null-terminated
1617 /// ASCII string associated with the token's namespace Guid. If NULL, there is no
1618 /// name associated with this request.
1619 ///
1620 CHAR8 *PcdName;
1621 } PCD_INFO;
1622
1623 /**
1624 Retrieve additional information associated with a PCD token.
1625
1626 This includes information such as the type of value the TokenNumber is associated with as well as possible
1627 human readable name that is associated with the token.
1628
1629 If TokenNumber is not in the default token space specified, then ASSERT().
1630
1631 @param[in] TokenNumber The PCD token number.
1632 @param[out] PcdInfo The returned information associated with the requested TokenNumber.
1633 The caller is responsible for freeing the buffer that is allocated by callee for PcdInfo->PcdName.
1634 **/
1635 VOID
1636 EFIAPI
1637 LibPcdGetInfo (
1638 IN UINTN TokenNumber,
1639 OUT PCD_INFO *PcdInfo
1640 );
1641
1642 /**
1643 Retrieve additional information associated with a PCD token.
1644
1645 This includes information such as the type of value the TokenNumber is associated with as well as possible
1646 human readable name that is associated with the token.
1647
1648 If TokenNumber is not in the token space specified by Guid, then ASSERT().
1649
1650 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
1651 @param[in] TokenNumber The PCD token number.
1652 @param[out] PcdInfo The returned information associated with the requested TokenNumber.
1653 The caller is responsible for freeing the buffer that is allocated by callee for PcdInfo->PcdName.
1654 **/
1655 VOID
1656 EFIAPI
1657 LibPcdGetInfoEx (
1658 IN CONST GUID *Guid,
1659 IN UINTN TokenNumber,
1660 OUT PCD_INFO *PcdInfo
1661 );
1662
1663 /**
1664 Retrieve the currently set SKU Id.
1665
1666 @return The currently set SKU Id. If the platform has not set at a SKU Id, then the
1667 default SKU Id value of 0 is returned. If the platform has set a SKU Id, then the currently set SKU
1668 Id is returned.
1669 **/
1670 UINTN
1671 EFIAPI
1672 LibPcdGetSku (
1673 VOID
1674 );
1675
1676 #endif