Upgrade less(1). 1/2
[dragonfly.git] / sys / contrib / edk2 / 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 /**
27   Retrieves a token number based on a token name.
28
29   Returns the token number associated with the PCD token specified by TokenName.
30   If TokenName is not a valid token in the token space, then the module will not build.
31
32   @param   TokenName  The name of the PCD token to retrieve the token number for.
33
34   @return  The token number associated with the PCD.
35
36 **/
37 #define PcdToken(TokenName)                 _PCD_TOKEN_##TokenName
38
39
40 /**
41   Retrieves a Boolean PCD feature flag based on a token name.
42
43   Returns the Boolean value for the PCD feature flag specified by TokenName.
44   If TokenName is not a valid token in the token space, then the module will not build.
45   If TokenName is not a feature flag PCD, then the module will not build.
46
47   @param   TokenName  The name of the PCD token to retrieve a current value for.
48
49   @return  Boolean value for the PCD feature flag.
50
51 **/
52 #define FeaturePcdGet(TokenName)            _PCD_GET_MODE_BOOL_##TokenName
53
54
55 /**
56   Retrieves an 8-bit fixed PCD token value based on a token name.
57
58   Returns the 8-bit value for the token specified by TokenName.
59   If TokenName is not a valid token in the token space, then the module will not build.
60   If TokenName is not a fixed at build PCD, then the module will not build.
61
62   @param   TokenName  The name of the PCD token to retrieve a current value for.
63
64   @return  8-bit value for the token specified by TokenName.
65
66 **/
67 #define FixedPcdGet8(TokenName)             _PCD_VALUE_##TokenName
68
69
70 /**
71   Retrieves a 16-bit fixed PCD token value based on a token name.
72
73   Returns the 16-bit value for the token specified by TokenName.
74   If TokenName is not a valid token in the token space, then the module will not build.
75   If TokenName is not a fixed at build PCD, then the module will not build.
76
77   @param   TokenName  The name of the PCD token to retrieve a current value for.
78
79   @return  16-bit value for the token specified by TokenName.
80
81 **/
82 #define FixedPcdGet16(TokenName)            _PCD_VALUE_##TokenName
83
84
85 /**
86   Retrieves a 32-bit fixed PCD token value based on a token name.
87
88   Returns the 32-bit value for the token specified by TokenName.
89   If TokenName is not a valid token in the token space, then the module will not build.
90   If TokenName is not a fixed at build PCD, then the module will not build.
91
92   @param   TokenName  The name of the PCD token to retrieve a current value for.
93
94   @return  32-bit value for the token specified by TokenName.
95
96 **/
97 #define FixedPcdGet32(TokenName)            _PCD_VALUE_##TokenName
98
99
100 /**
101   Retrieves a 64-bit fixed PCD token value based on a token name.
102
103   Returns the 64-bit value for the token specified by TokenName.
104   If TokenName is not a valid token in the token space, then the module will not build.
105   If TokenName is not a fixed at build PCD, then the module will not build.
106
107   @param   TokenName  The name of the PCD token to retrieve a current value for.
108
109   @return  64-bit value for the token specified by TokenName.
110
111 **/
112 #define FixedPcdGet64(TokenName)            _PCD_VALUE_##TokenName
113
114
115 /**
116   Retrieves a Boolean fixed PCD token value based on a token name.
117
118   Returns the Boolean value for the token specified by TokenName.
119   If TokenName is not a valid token in the token space, then the module will not build.
120   If TokenName is not a fixed at build PCD, then the module will not build.
121
122   @param   TokenName  The name of the PCD token to retrieve a current value for.
123
124   @return  The Boolean value for the token.
125
126 **/
127 #define FixedPcdGetBool(TokenName)          _PCD_VALUE_##TokenName
128
129
130 /**
131   Retrieves a pointer to a fixed PCD token buffer based on a token name.
132
133   Returns a pointer to the buffer for the token specified by TokenName.
134   If TokenName is not a valid token in the token space, then the module will not build.
135   If TokenName is not a fixed at build PCD, then the module will not build.
136
137   @param   TokenName  The name of the PCD token to retrieve a current value for.
138
139   @return  A pointer to the buffer.
140
141 **/
142 #define FixedPcdGetPtr(TokenName)           ((VOID *)_PCD_VALUE_##TokenName)
143
144
145 /**
146   Retrieves an 8-bit binary patchable PCD token value based on a token name.
147
148   Returns the 8-bit value for the token specified by TokenName.
149   If TokenName is not a valid token in the token space, then the module will not build.
150   If TokenName is not a patchable in module PCD, then the module will not build.
151
152   @param   TokenName  The name of the PCD token to retrieve a current value for.
153
154   @return  An 8-bit binary patchable PCD token value.
155
156 **/
157 #define PatchPcdGet8(TokenName)             _gPcd_BinaryPatch_##TokenName
158
159 /**
160   Retrieves a 16-bit binary patchable PCD token value based on a token name.
161
162   Returns the 16-bit value for the token specified by TokenName.
163   If TokenName is not a valid token in the token space, then the module will not build.
164   If TokenName is not a patchable in module PCD, then the module will not build.
165
166   @param   TokenName  The name of the PCD token to retrieve a current value for.
167
168   @return  A 16-bit binary patchable PCD token value.
169
170 **/
171 #define PatchPcdGet16(TokenName)            _gPcd_BinaryPatch_##TokenName
172
173
174 /**
175   Retrieves a 32-bit binary patchable PCD token value based on a token name.
176
177   Returns the 32-bit value for the token specified by TokenName.
178   If TokenName is not a valid token in the token space, then the module will not build.
179   If TokenName is not a patchable in module PCD, then the module will not build.
180
181   @param   TokenName  The name of the PCD token to retrieve a current value for.
182
183   @return  A 32-bit binary patchable PCD token value.
184
185 **/
186 #define PatchPcdGet32(TokenName)            _gPcd_BinaryPatch_##TokenName
187
188
189 /**
190   Retrieves a 64-bit binary patchable PCD token value based on a token name.
191
192   Returns the 64-bit value for the token specified by TokenName.
193   If TokenName is not a valid token in the token space, then the module will not build.
194   If TokenName is not a patchable in module PCD, then the module will not build.
195
196   @param   TokenName  The name of the PCD token to retrieve a current value for.
197
198   @return  A 64-bit binary patchable PCD token value.
199
200 **/
201 #define PatchPcdGet64(TokenName)            _gPcd_BinaryPatch_##TokenName
202
203
204 /**
205   Retrieves a Boolean binary patchable PCD token value based on a token name.
206
207   Returns the Boolean value for the token specified by TokenName.
208   If TokenName is not a valid token in the token space, then the module will not build.
209   If TokenName is not a patchable in module PCD, then the module will not build.
210
211   @param   TokenName  The name of the PCD token to retrieve a current value for.
212
213   @return  The Boolean value for the token.
214
215 **/
216 #define PatchPcdGetBool(TokenName)          _gPcd_BinaryPatch_##TokenName
217
218
219 /**
220   Retrieves a pointer to a binary patchable PCD token buffer based on a token name.
221
222   Returns a pointer to the buffer for the token specified by TokenName.
223   If TokenName is not a valid token in the token space, then the module will not build.
224   If TokenName is not a patchable in module PCD, then the module will not build.
225
226   @param   TokenName  The name of the PCD token to retrieve a current value for.
227
228   @return  A pointer to the buffer for the token.
229
230 **/
231 #define PatchPcdGetPtr(TokenName)           ((VOID *)_gPcd_BinaryPatch_##TokenName)
232
233
234 /**
235   Sets an 8-bit binary patchable PCD token value based on a token name.
236
237   Sets the 8-bit value for the token specified by TokenName. Value is returned.
238   If TokenName is not a valid token in the token space, then the module will not build.
239   If TokenName is not a patchable in module PCD, then the module will not build.
240
241   @param   TokenName  The name of the binary patchable PCD token to set the current value for.
242   @param   Value      The 8-bit value to set.
243
244   @return Return the Value that was set.
245
246 **/
247 #define PatchPcdSet8(TokenName, Value)      (_gPcd_BinaryPatch_##TokenName = (Value))
248
249
250 /**
251   Sets a 16-bit binary patchable PCD token value based on a token name.
252
253   Sets the 16-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 16-bit value to set.
259
260   @return Return the Value that was set.
261
262 **/
263 #define PatchPcdSet16(TokenName, Value)     (_gPcd_BinaryPatch_##TokenName = (Value))
264
265
266 /**
267   Sets a 32-bit binary patchable PCD token value based on a token name.
268
269   Sets the 32-bit value for the token specified by TokenName. Value is returned.
270   If TokenName is not a valid token in the token space, then the module will not build.
271   If TokenName is not a patchable in module PCD, then the module will not build.
272
273   @param   TokenName  The name of the binary patchable PCD token to set the current value for.
274   @param   Value      The 32-bit value to set.
275
276   @return Return the Value that was set.
277
278 **/
279 #define PatchPcdSet32(TokenName, Value)     (_gPcd_BinaryPatch_##TokenName = (Value))
280
281
282 /**
283   Sets a 64-bit binary patchable PCD token value based on a token name.
284
285   Sets the 64-bit value for the token specified by TokenName. Value is returned.
286   If TokenName is not a valid token in the token space, then the module will not build.
287   If TokenName is not a patchable in module PCD, then the module will not build.
288
289   @param   TokenName  The name of the binary patchable PCD token to set the current value for.
290   @param   Value      The 64-bit value to set.
291
292   @return Return the Value that was set.
293
294 **/
295 #define PatchPcdSet64(TokenName, Value)     (_gPcd_BinaryPatch_##TokenName = (Value))
296
297
298 /**
299   Sets a Boolean binary patchable PCD token value based on a token name.
300
301   Sets the Boolean value for the token specified by TokenName. Value is returned.
302   If TokenName is not a valid token in the token space, then the module will not build.
303   If TokenName is not a patchable in module PCD, then the module will not build.
304
305   @param   TokenName  The name of the binary patchable PCD token to set the current value for.
306   @param   Value      The boolean value to set.
307
308   @return Return the Value that was set.
309
310 **/
311 #define PatchPcdSetBool(TokenName, Value)   (_gPcd_BinaryPatch_##TokenName = (Value))
312
313
314 /**
315   Sets a pointer to a binary patchable PCD token buffer based on a token name.
316
317   Sets the buffer for the token specified by TokenName.  Buffer is returned.
318   If SizeOfBuffer is greater than the maximum size supported by TokenName, then set SizeOfBuffer
319   to the maximum size supported by TokenName and return NULL to indicate that the set operation
320   was not actually performed.  If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be
321   set to the maximum size supported by TokenName and NULL must be returned.
322   If TokenName is not a valid token in the token space, then the module will not build.
323   If TokenName is not a patchable in module PCD, then the module will not build.
324
325   If SizeOfBuffer is NULL, then ASSERT().
326   If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
327
328   @param   TokenName      The name of the binary patchable PCD token to set the current value for.
329   @param   SizeOfBuffer   A pointer to the size, in bytes, of Buffer.
330   @param   Buffer         Pointer to the value to set.
331
332   @return Return the pointer to the Buffer that was set.
333
334 **/
335 #define PatchPcdSetPtr(TokenName, Size, Buffer) \
336                                             LibPatchPcdSetPtrAndSize (                 \
337                                               (VOID *)_gPcd_BinaryPatch_##TokenName,   \
338                                               &_gPcd_BinaryPatch_Size_##TokenName,     \
339                                               (UINTN)_PCD_PATCHABLE_##TokenName##_SIZE, \
340                                               (Size),                                  \
341                                               (Buffer)                                 \
342                                               )
343 /**
344   Retrieves an 8-bit PCD token value based on a token name.
345
346   Returns the 8-bit value for the token specified by TokenName.
347   If TokenName is not a valid token in the token space, then the module will not build.
348
349   @param   TokenName  The name of the PCD token to retrieve a current value for.
350
351   @return  8-bit value for the token specified by TokenName.
352
353 **/
354 #define PcdGet8(TokenName)                  _PCD_GET_MODE_8_##TokenName
355
356
357 /**
358   Retrieves a 16-bit PCD token value based on a token name.
359
360   Returns the 16-bit value for the token specified by TokenName.
361   If TokenName is not a valid token in the token space, then the module will not build.
362
363   @param   TokenName  The name of the PCD token to retrieve a current value for.
364
365   @return  16-bit value for the token specified by TokenName.
366
367 **/
368 #define PcdGet16(TokenName)                 _PCD_GET_MODE_16_##TokenName
369
370
371 /**
372   Retrieves a 32-bit PCD token value based on a token name.
373
374   Returns the 32-bit value for the token specified by TokenName.
375   If TokenName is not a valid token in the token space, then the module will not build.
376
377   @param   TokenName  The name of the PCD token to retrieve a current value for.
378
379   @return  32-bit value for the token specified by TokenName.
380
381 **/
382 #define PcdGet32(TokenName)                 _PCD_GET_MODE_32_##TokenName
383
384
385 /**
386   Retrieves a 64-bit PCD token value based on a token name.
387
388   Returns the 64-bit value for the token specified by TokenName.
389   If TokenName is not a valid token in the token space, then the module will not build.
390
391   @param   TokenName  The name of the PCD token to retrieve a current value for.
392
393   @return  64-bit value for the token specified by TokenName.
394
395 **/
396 #define PcdGet64(TokenName)                 _PCD_GET_MODE_64_##TokenName
397
398
399 /**
400   Retrieves a pointer to a PCD token buffer based on a token name.
401
402   Returns a pointer to the buffer for the token specified by TokenName.
403   If TokenName is not a valid token in the token space, then the module will not build.
404
405   @param   TokenName  The name of the PCD token to retrieve a current value for.
406
407   @return  A pointer to the buffer.
408
409 **/
410 #define PcdGetPtr(TokenName)                _PCD_GET_MODE_PTR_##TokenName
411
412
413 /**
414   Retrieves a Boolean PCD token value based on a token name.
415
416   Returns the Boolean value for the token specified by TokenName.
417   If TokenName is not a valid token in the token space, then the module will not build.
418
419   @param   TokenName  The name of the PCD token to retrieve a current value for.
420
421   @return  A Boolean PCD token value.
422
423 **/
424 #define PcdGetBool(TokenName)               _PCD_GET_MODE_BOOL_##TokenName
425
426
427 /**
428   Retrieves the size of a fixed PCD token based on a token name.
429
430   Returns the size of the token specified by TokenName.
431   If TokenName is not a valid token in the token space, then the module will not build.
432
433   @param[in]  TokenName  The name of the PCD token to retrieve a current value size for.
434
435   @return     Return the size
436
437 **/
438 #define FixedPcdGetSize(TokenName)    _PCD_SIZE_##TokenName
439
440
441 /**
442   Retrieves the size of a binary patchable PCD token based on a token name.
443
444   Returns the size of the token specified by TokenName.
445   If TokenName is not a valid token in the token space, then the module will not build.
446
447   @param[in]  TokenName  The name of the PCD token to retrieve a current value size for.
448
449   @return     Return the size
450
451 **/
452 #define PatchPcdGetSize(TokenName)    _gPcd_BinaryPatch_Size_##TokenName
453
454
455 /**
456   Retrieves the size of the PCD token based on a token name.
457
458   Returns the size of the token specified by TokenName.
459   If TokenName is not a valid token in the token space, then the module will not build.
460
461   @param[in]   TokenName  The name of the PCD token to retrieve a current value size for.
462
463   @return      Return the size
464
465 **/
466 #define PcdGetSize(TokenName)         _PCD_GET_MODE_SIZE_##TokenName
467
468
469 /**
470   Retrieve the size of a given PCD token.
471
472   Returns the size of the token specified by TokenNumber and Guid.
473   If Guid is NULL, then ASSERT().
474
475   @param[in]  Guid          Pointer to a 128-bit unique value that designates
476                             which namespace to retrieve a value from.
477   @param[in]  TokenNumber   The PCD token number to retrieve a current value size for.
478
479   @return     Return the size.
480
481 **/
482 #define PcdGetExSize(Guid, TokenName) LibPcdGetExSize ((Guid), PcdTokenEx(Guid,TokenName))
483
484 #ifndef DISABLE_NEW_DEPRECATED_INTERFACES
485 /**
486   Sets an 8-bit PCD token value based on a token name.
487
488   Sets the 8-bit value for the token specified by TokenName. Value is returned.
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 8-bit value to set.
493
494   @return Return the Value that was set.
495
496 **/
497 #define PcdSet8(TokenName, Value)           _PCD_SET_MODE_8_##TokenName     ((Value))
498
499
500 /**
501   Sets a 16-bit PCD token value based on a token name.
502
503   Sets the 16-bit value for the token specified by TokenName. Value is returned.
504   If TokenName is not a valid token in the token space, then the module will not build.
505
506   @param   TokenName  The name of the PCD token to retrieve a current value for.
507   @param   Value      The 16-bit value to set.
508
509   @return Return the Value that was set.
510
511 **/
512 #define PcdSet16(TokenName, Value)          _PCD_SET_MODE_16_##TokenName    ((Value))
513
514
515 /**
516   Sets a 32-bit PCD token value based on a token name.
517
518   Sets the 32-bit value for the token specified by TokenName. Value is returned.
519   If TokenName is not a valid token in the token space, then the module will not build.
520
521   @param   TokenName  The name of the PCD token to retrieve a current value for.
522   @param   Value      The 32-bit value to set.
523
524   @return Return the Value that was set.
525
526 **/
527 #define PcdSet32(TokenName, Value)          _PCD_SET_MODE_32_##TokenName    ((Value))
528
529
530 /**
531   Sets a 64-bit PCD token value based on a token name.
532
533   Sets the 64-bit value for the token specified by TokenName. Value is returned.
534   If TokenName is not a valid token in the token space, then the module will not build.
535
536   @param   TokenName  The name of the PCD token to retrieve a current value for.
537   @param   Value      The 64-bit value to set.
538
539   @return Return the Value that was set.
540
541 **/
542 #define PcdSet64(TokenName, Value)          _PCD_SET_MODE_64_##TokenName    ((Value))
543
544
545 /**
546   Sets a pointer to a PCD token buffer based on a token name.
547
548   Sets the buffer for the token specified by TokenName. Buffer is returned.
549   If SizeOfBuffer is greater than the maximum size supported by TokenName,
550   then set SizeOfBuffer to the maximum size supported by TokenName and return NULL
551   to indicate that the set operation was not actually performed.  If SizeOfBuffer
552   is set to MAX_ADDRESS, then SizeOfBuffer must be set to the maximum size supported
553   by TokenName and NULL must be returned.
554   If TokenName is not a valid token in the token space, then the module will not build.
555
556   If SizeOfBuffer is NULL, then ASSERT().
557   If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
558
559   @param   TokenName      The name of the PCD token to set the current value for.
560   @param   SizeOfBuffer   A pointer to the size, in bytes, of Buffer.
561   @param   Buffer         A pointer to the buffer to set.
562
563   @return Return the pointer to the Buffer that was set.
564
565 **/
566 #define PcdSetPtr(TokenName, SizeOfBuffer, Buffer) \
567                                             _PCD_SET_MODE_PTR_##TokenName   ((SizeOfBuffer), (Buffer))
568
569 /**
570   Sets a Boolean PCD token value based on a token name.
571
572   Sets the Boolean value for the token specified by TokenName. Value is returned.
573   If TokenName is not a valid token in the token space, then the module will not build.
574
575   @param   TokenName      The name of the PCD token to set the current value for.
576   @param   Buffer         The Boolean value to set.
577
578   @return Return the Value that was set.
579
580 **/
581 #define PcdSetBool(TokenName, Value)        _PCD_SET_MODE_BOOL_##TokenName  ((Value))
582 #endif
583
584 /**
585   Sets a 8-bit PCD token value based on a token name.
586
587   Sets the 8-bit value for the token specified by TokenName.
588   If TokenName is not a valid token in the token space, then the module will not build.
589
590   @param TokenName  The name of the PCD token to retrieve a current value for.
591   @param Value      The 8-bit value to set.
592
593   @return The status of the set operation.
594
595 **/
596 #define PcdSet8S(TokenName, Value)          _PCD_SET_MODE_8_S_##TokenName    ((Value))
597
598 /**
599   Sets a 16-bit PCD token value based on a token name.
600
601   Sets the 16-bit value for the token specified by TokenName.
602   If TokenName is not a valid token in the token space, then the module will not build.
603
604   @param TokenName  The name of the PCD token to retrieve a current value for.
605   @param Value      The 16-bit value to set.
606
607   @return The status of the set operation.
608
609 **/
610 #define PcdSet16S(TokenName, Value)         _PCD_SET_MODE_16_S_##TokenName    ((Value))
611
612 /**
613   Sets a 32-bit PCD token value based on a token name.
614
615   Sets the 32-bit value for the token specified by TokenName.
616   If TokenName is not a valid token in the token space, then the module will not build.
617
618   @param TokenName  The name of the PCD token to retrieve a current value for.
619   @param Value      The 32-bit value to set.
620
621   @return The status of the set operation.
622
623 **/
624 #define PcdSet32S(TokenName, Value)         _PCD_SET_MODE_32_S_##TokenName    ((Value))
625
626 /**
627   Sets a 64-bit PCD token value based on a token name.
628
629   Sets the 64-bit value for the token specified by TokenName.
630   If TokenName is not a valid token in the token space, then the module will not build.
631
632   @param TokenName  The name of the PCD token to retrieve a current value for.
633   @param Value      The 64-bit value to set.
634
635   @return The status of the set operation.
636
637 **/
638 #define PcdSet64S(TokenName, Value)         _PCD_SET_MODE_64_S_##TokenName    ((Value))
639
640 /**
641   Sets a pointer to a PCD token buffer based on a token name.
642
643   Sets the buffer for the token specified by TokenName.
644   If SizeOfBuffer is greater than the maximum size supported by TokenName,
645   then set SizeOfBuffer to the maximum size supported by TokenName and return
646   RETURN_INVALID_PARAMETER to indicate that the set operation was not actually performed.
647   If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to the maximum size
648   supported by TokenName and RETURN_INVALID_PARAMETER must be returned.
649   If TokenName is not a valid token in the token space, then the module will not build.
650
651   If SizeOfBuffer is NULL, then ASSERT().
652   If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
653
654   @param TokenName      The name of the PCD token to set the current value for.
655   @param SizeOfBuffer   A pointer to the size, in bytes, of Buffer.
656   @param Buffer         A pointer to the buffer to set.
657
658   @return The status of the set operation.
659
660 **/
661 #define PcdSetPtrS(TokenName, SizeOfBuffer, Buffer) \
662                                             _PCD_SET_MODE_PTR_S_##TokenName   ((SizeOfBuffer), (Buffer))
663
664
665
666 /**
667   Sets a boolean PCD token value based on a token name.
668
669   Sets the boolean value for the token specified by TokenName.
670   If TokenName is not a valid token in the token space, then the module will not build.
671
672   @param TokenName  The name of the PCD token to retrieve a current value for.
673   @param Value      The boolean value to set.
674
675   @return The status of the set operation.
676
677 **/
678 #define PcdSetBoolS(TokenName, Value)       _PCD_SET_MODE_BOOL_S_##TokenName    ((Value))
679
680 /**
681   Retrieves a token number based on a GUID and a token name.
682
683   Returns the token number for the token specified by Guid and TokenName.
684   If TokenName is not a valid token in the token space, then the module will not build.
685
686   @param   Guid        Pointer to a 128-bit unique value that designates
687                        which namespace to retrieve a value from.
688   @param   TokenName   The name of the PCD token to retrieve a current value for.
689
690   @return  Return the token number.
691
692 **/
693 #define PcdTokenEx(Guid,TokenName)  _PCD_TOKEN_EX_##TokenName(Guid)
694
695 /**
696   Retrieves an 8-bit PCD token value based on a GUID and a token name.
697
698   Returns the 8-bit value for the token specified by Guid and TokenName.
699   If TokenName is not a valid token in the token space specified by Guid,
700   then the module will not build.
701
702   If Guid is NULL, then ASSERT().
703
704   @param   Guid        Pointer to a 128-bit unique value that designates
705                        which namespace to retrieve a value from.
706   @param   TokenName   The name of the PCD token to retrieve a current value for.
707
708   @return  An 8-bit PCD token value.
709
710 **/
711 #define PcdGetEx8(Guid, TokenName)          LibPcdGetEx8 ((Guid), PcdTokenEx(Guid,TokenName))
712
713 /**
714   Retrieves a 16-bit PCD token value based on a GUID and a token name.
715
716   Returns the 16-bit value for the token specified by Guid and TokenName.
717   If TokenName is not a valid token in the token space specified by Guid,
718   then the module will not build.
719
720   If Guid is NULL, then ASSERT().
721
722   @param   Guid        Pointer to a 128-bit unique value that designates
723                        which namespace to retrieve a value from.
724   @param   TokenName   The name of the PCD token to retrieve a current value for.
725
726   @return  A 16-bit PCD token value.
727
728 **/
729 #define PcdGetEx16(Guid, TokenName)         LibPcdGetEx16 ((Guid), PcdTokenEx(Guid,TokenName))
730
731
732 /**
733   Retrieves a 32-bit PCD token value based on a GUID and a token name.
734
735   Returns the 32-bit value for the token specified by Guid and TokenName.
736   If TokenName is not a valid token in the token space specified by Guid,
737   then the module will not build.
738
739   If Guid is NULL, then ASSERT().
740
741   @param   Guid        Pointer to a 128-bit unique value that designates
742                        which namespace to retrieve a value from.
743   @param   TokenName   The name of the PCD token to retrieve a current value for.
744
745   @return  A 32-bit PCD token value.
746
747 **/
748 #define PcdGetEx32(Guid, TokenName)         LibPcdGetEx32 ((Guid), PcdTokenEx(Guid,TokenName))
749
750
751 /**
752   Retrieves a 64-bit PCD token value based on a GUID and a token name.
753
754   Returns the 64-bit value for the token specified by Guid and TokenName.
755   If TokenName is not a valid token in the token space specified by Guid,
756   then the module will not build.
757
758   If Guid is NULL, then ASSERT().
759
760   @param   Guid        Pointer to a 128-bit unique value that designates
761                        which namespace to retrieve a value from.
762   @param   TokenName   The name of the PCD token to retrieve a current value for.
763
764   @return  A 64-bit PCD token value.
765
766 **/
767 #define PcdGetEx64(Guid, TokenName)         LibPcdGetEx64 ((Guid), PcdTokenEx(Guid,TokenName))
768
769
770 /**
771   Retrieves a pointer to a PCD token buffer based on a GUID and a token name.
772
773   Returns a pointer to the buffer for the token specified by Guid and TokenName.
774   If TokenName is not a valid token in the token space specified by Guid,
775   then the module will not build.
776
777   If Guid is NULL, then ASSERT().
778
779   @param   Guid        Pointer to a 128-bit unique value that designates
780                        which namespace to retrieve a value from.
781   @param   TokenName   The name of the PCD token to retrieve a current value for.
782
783   @return  A pointer to a PCD token buffer.
784
785 **/
786 #define PcdGetExPtr(Guid, TokenName)        LibPcdGetExPtr ((Guid), PcdTokenEx(Guid,TokenName))
787
788
789 /**
790   Retrieves a Boolean PCD token value based on a GUID and a token name.
791
792   Returns the Boolean value for the token specified by Guid and TokenName.
793   If TokenName is not a valid token in the token space specified by Guid,
794   then the module will not build.
795
796   If Guid is NULL, then ASSERT().
797
798   @param   Guid        Pointer to a 128-bit unique value that designates
799                        which namespace to retrieve a value from.
800   @param   TokenName   The name of the PCD token to retrieve a current value for.
801
802   @return  A Boolean PCD token value.
803
804 **/
805 #define PcdGetExBool(Guid, TokenName)       LibPcdGetExBool  ((Guid), PcdTokenEx(Guid,TokenName))
806
807
808
809 #ifndef DISABLE_NEW_DEPRECATED_INTERFACES
810 /**
811   Sets an 8-bit PCD token value based on a GUID and a token name.
812
813   Sets the 8-bit value for the token specified by Guid and TokenName. Value is returned.
814   If TokenName is not a valid token in the token space specified by Guid,
815   then the module will not build.
816
817   If Guid is NULL, then ASSERT().
818
819   @param   Guid        Pointer to a 128-bit unique value that designates
820                        which namespace to retrieve a value from.
821   @param   TokenName   The name of the PCD token to set the current value for.
822   @param   Value       The 8-bit value to set.
823
824   @return Return the Value that was set.
825
826 **/
827 #define PcdSetEx8(Guid, TokenName, Value)   LibPcdSetEx8   ((Guid), PcdTokenEx(Guid,TokenName), (Value))
828
829
830 /**
831   Sets a 16-bit PCD token value based on a GUID and a token name.
832
833   Sets the 16-bit value for the token specified by Guid and TokenName. Value is returned.
834   If TokenName is not a valid token in the token space specified by Guid,
835   then the module will not build.
836
837   If Guid is NULL, then ASSERT().
838
839   @param   Guid        Pointer to a 128-bit unique value that designates
840                        which namespace to retrieve a value from.
841   @param   TokenName   The name of the PCD token to set the current value for.
842   @param   Value       The 16-bit value to set.
843
844   @return Return the Value that was set.
845
846 **/
847 #define PcdSetEx16(Guid, TokenName, Value)  LibPcdSetEx16  ((Guid), PcdTokenEx(Guid,TokenName), (Value))
848
849
850 /**
851   Sets a 32-bit PCD token value based on a GUID and a token name.
852
853   Sets the 32-bit value for the token specified by Guid and TokenName. Value is returned.
854   If TokenName is not a valid token in the token space specified by Guid,
855   then the module will not build.
856
857   If Guid is NULL, then ASSERT().
858
859   @param   Guid        Pointer to a 128-bit unique value that designates
860                        which namespace to retrieve a value from.
861   @param   TokenName   The name of the PCD token to set the current value for.
862   @param   Value       The 32-bit value to set.
863
864   @return Return the Value that was set.
865
866 **/
867 #define PcdSetEx32(Guid, TokenName, Value)  LibPcdSetEx32  ((Guid), PcdTokenEx(Guid,TokenName), (Value))
868
869
870 /**
871   Sets a 64-bit PCD token value based on a GUID and a token name.
872
873   Sets the 64-bit value for the token specified by Guid and TokenName. Value is returned.
874   If TokenName is not a valid token in the token space specified by Guid,
875   then the module will not build.
876
877   If Guid is NULL, then ASSERT().
878
879   @param   Guid        Pointer to a 128-bit unique value that designates
880   which namespace to retrieve a value from.
881   @param   TokenName   The name of the PCD token to set the current value for.
882   @param   Value       The 64-bit value to set.
883
884   @return Return the Value that was set.
885
886 **/
887 #define PcdSetEx64(Guid, TokenName, Value)  LibPcdSetEx64  ((Guid), PcdTokenEx(Guid,TokenName), (Value))
888
889
890 /**
891   Sets a pointer to a PCD token buffer based on a GUID and a token name.
892
893   Sets the buffer for the token specified by Guid and TokenName. Buffer is returned.
894   If SizeOfBuffer is greater than the maximum size supported by Guid and TokenName,
895   then set SizeOfBuffer to the maximum size supported by Guid and TokenName and return
896   NULL to indicate that the set operation was not actually performed. If SizeOfBuffer
897   is set to MAX_ADDRESS, then SizeOfBuffer must be set to the maximum size supported by
898   Guid and TokenName and NULL must be returned.
899   If TokenName is not a valid token in the token space specified by Guid,
900   then the module will not build.
901
902   If Guid is NULL, then ASSERT().
903   If SizeOfBuffer is NULL, then ASSERT().
904   If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
905
906   @param   Guid           Pointer to a 128-bit unique value that designates
907                           which namespace to retrieve a value from.
908   @param   TokenName      The name of the PCD token to set the current value for.
909   @param   SizeOfBuffer   A pointer to the size, in bytes, of Buffer.
910   @param   Buffer         Pointer to the buffer to set.
911
912   @return Return the pointer to the Buffer that was set.
913
914 **/
915 #define PcdSetExPtr(Guid, TokenName, SizeOfBuffer, Buffer) \
916                                             LibPcdSetExPtr ((Guid), PcdTokenEx(Guid,TokenName), (SizeOfBuffer), (Buffer))
917
918
919 /**
920   Sets a Boolean PCD token value based on a GUID and a token name.
921
922   Sets the Boolean value for the token specified by Guid and TokenName. Value is returned.
923   If TokenName is not a valid token in the token space specified by Guid,
924   then the module will not build.
925
926   If Guid is NULL, then ASSERT().
927
928   @param   Guid           Pointer to a 128-bit unique value that designates
929                           which namespace to retrieve a value from.
930   @param   TokenName      The name of the PCD token to set the current value for.
931   @param   Value          The Boolean value to set.
932
933   @return Return the Value that was set.
934
935 **/
936 #define PcdSetExBool(Guid, TokenName, Value) \
937                                             LibPcdSetExBool((Guid), PcdTokenEx(Guid,TokenName), (Value))
938 #endif
939
940 /**
941   Sets an 8-bit PCD token value based on a GUID and a token name.
942
943   Sets the 8-bit value for the token specified by Guid and TokenName.
944   If TokenName is not a valid token in the token space specified by Guid,
945   then the module will not build.
946
947   If Guid is NULL, then ASSERT().
948
949   @param Guid       Pointer to a 128-bit unique value that designates
950                     which namespace to retrieve a value from.
951   @param TokenName  The name of the PCD token to set the current value for.
952   @param Value      The 8-bit value to set.
953
954   @return The status of the set operation.
955
956 **/
957 #define PcdSetEx8S(Guid, TokenName, Value)     LibPcdSetEx8S ((Guid), PcdTokenEx(Guid,TokenName), (Value))
958
959 /**
960   Sets an 16-bit PCD token value based on a GUID and a token name.
961
962   Sets the 16-bit value for the token specified by Guid and TokenName.
963   If TokenName is not a valid token in the token space specified by Guid,
964   then the module will not build.
965
966   If Guid is NULL, then ASSERT().
967
968   @param Guid       Pointer to a 128-bit unique value that designates
969                     which namespace to retrieve a value from.
970   @param TokenName  The name of the PCD token to set the current value for.
971   @param Value      The 16-bit value to set.
972
973   @return The status of the set operation.
974
975 **/
976 #define PcdSetEx16S(Guid, TokenName, Value)    LibPcdSetEx16S ((Guid), PcdTokenEx(Guid,TokenName), (Value))
977
978 /**
979   Sets an 32-bit PCD token value based on a GUID and a token name.
980
981   Sets the 32-bit value for the token specified by Guid and TokenName.
982   If TokenName is not a valid token in the token space specified by Guid,
983   then the module will not build.
984
985   If Guid is NULL, then ASSERT().
986
987   @param Guid       Pointer to a 128-bit unique value that designates
988                     which namespace to retrieve a value from.
989   @param TokenName  The name of the PCD token to set the current value for.
990   @param Value      The 32-bit value to set.
991
992   @return The status of the set operation.
993
994 **/
995 #define PcdSetEx32S(Guid, TokenName, Value)    LibPcdSetEx32S ((Guid), PcdTokenEx(Guid,TokenName), (Value))
996
997 /**
998   Sets an 64-bit PCD token value based on a GUID and a token name.
999
1000   Sets the 64-bit value for the token specified by Guid and TokenName.
1001   If TokenName is not a valid token in the token space specified by Guid,
1002   then the module will not build.
1003
1004   If Guid is NULL, then ASSERT().
1005
1006   @param Guid       Pointer to a 128-bit unique value that designates
1007                     which namespace to retrieve a value from.
1008   @param TokenName  The name of the PCD token to set the current value for.
1009   @param Value      The 64-bit value to set.
1010
1011   @return The status of the set operation.
1012
1013 **/
1014 #define PcdSetEx64S(Guid, TokenName, Value)    LibPcdSetEx64S ((Guid), PcdTokenEx(Guid,TokenName), (Value))
1015
1016 /**
1017   Sets a pointer to a PCD token buffer based on a GUID and a token name.
1018
1019   Sets the buffer for the token specified by Guid and TokenName.
1020   If SizeOfBuffer is greater than the maximum size supported by Guid and TokenName,
1021   then set SizeOfBuffer to the maximum size supported by Guid and TokenName and return
1022   RETURN_INVALID_PARAMETER to indicate that the set operation was not actually performed.
1023   If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to the maximum size
1024   supported by Guid and TokenName and RETURN_INVALID_PARAMETER must be returned.
1025   If TokenName is not a valid token in the token space specified by Guid,
1026   then the module will not build.
1027
1028   If Guid is NULL, then ASSERT().
1029   If SizeOfBuffer is NULL, then ASSERT().
1030   If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
1031
1032   @param Guid           Pointer to a 128-bit unique value that designates
1033                         which namespace to retrieve a value from.
1034   @param TokenName      The name of the PCD token to set the current value for.
1035   @param SizeOfBuffer   A pointer to the size, in bytes, of Buffer.
1036   @param Buffer         Pointer to the buffer to set.
1037
1038   @return The status of the set operation.
1039
1040 **/
1041 #define PcdSetExPtrS(Guid, TokenName, SizeOfBuffer, Buffer) \
1042                                             LibPcdSetExPtrS ((Guid), PcdTokenEx(Guid,TokenName), (SizeOfBuffer), (Buffer))
1043
1044
1045 /**
1046   Sets an boolean PCD token value based on a GUID and a token name.
1047
1048   Sets the boolean value for the token specified by Guid and TokenName.
1049   If TokenName is not a valid token in the token space specified by Guid,
1050   then the module will not build.
1051
1052   If Guid is NULL, then ASSERT().
1053
1054   @param Guid       Pointer to a 128-bit unique value that designates
1055                     which namespace to retrieve a value from.
1056   @param TokenName  The name of the PCD token to set the current value for.
1057   @param Value      The boolean value to set.
1058
1059   @return The status of the set operation.
1060
1061 **/
1062 #define PcdSetExBoolS(Guid, TokenName, Value) \
1063                                             LibPcdSetExBoolS ((Guid), PcdTokenEx(Guid,TokenName), (Value))
1064
1065 /**
1066   This function provides a means by which SKU support can be established in the PCD infrastructure.
1067
1068   Sets the current SKU in the PCD database to the value specified by SkuId.  SkuId is returned.
1069
1070   @param  SkuId   The SKU value that will be used when the PCD service retrieves and sets values
1071                   associated with a PCD token.
1072
1073   @return  Return the SKU ID that was set.
1074
1075 **/
1076 UINTN
1077 EFIAPI
1078 LibPcdSetSku (
1079   IN UINTN   SkuId
1080   );
1081
1082
1083 /**
1084   This function provides a means by which to retrieve a value for a given PCD token.
1085
1086   Returns the 8-bit value for the token specified by TokenNumber.
1087
1088   @param[in]  TokenNumber The PCD token number to retrieve a current value for.
1089
1090   @return Returns the 8-bit value for the token specified by TokenNumber.
1091
1092 **/
1093 UINT8
1094 EFIAPI
1095 LibPcdGet8 (
1096   IN UINTN             TokenNumber
1097   );
1098
1099
1100 /**
1101   This function provides a means by which to retrieve a value for a given PCD token.
1102
1103   Returns the 16-bit value for the token specified by TokenNumber.
1104
1105   @param[in]  TokenNumber The PCD token number to retrieve a current value for.
1106
1107   @return Returns the 16-bit value for the token specified by TokenNumber.
1108
1109 **/
1110 UINT16
1111 EFIAPI
1112 LibPcdGet16 (
1113   IN UINTN             TokenNumber
1114   );
1115
1116
1117 /**
1118   This function provides a means by which to retrieve a value for a given PCD token.
1119
1120   Returns the 32-bit value for the token specified by TokenNumber.
1121
1122   @param[in]  TokenNumber The PCD token number to retrieve a current value for.
1123
1124   @return Returns the 32-bit value for the token specified by TokenNumber.
1125
1126 **/
1127 UINT32
1128 EFIAPI
1129 LibPcdGet32 (
1130   IN UINTN             TokenNumber
1131   );
1132
1133
1134 /**
1135   This function provides a means by which to retrieve a value for a given PCD token.
1136
1137   Returns the 64-bit value for the token specified by TokenNumber.
1138
1139   @param[in]  TokenNumber The PCD token number to retrieve a current value for.
1140
1141   @return Returns the 64-bit value for the token specified by TokenNumber.
1142
1143 **/
1144 UINT64
1145 EFIAPI
1146 LibPcdGet64 (
1147   IN UINTN             TokenNumber
1148   );
1149
1150
1151 /**
1152   This function provides a means by which to retrieve a value for a given PCD token.
1153
1154   Returns the pointer to the buffer of the token specified by TokenNumber.
1155
1156   @param[in]  TokenNumber The PCD token number to retrieve a current value for.
1157
1158   @return Returns the pointer to the token specified by TokenNumber.
1159
1160 **/
1161 VOID *
1162 EFIAPI
1163 LibPcdGetPtr (
1164   IN UINTN             TokenNumber
1165   );
1166
1167
1168 /**
1169   This function provides a means by which to retrieve a value for a given PCD token.
1170
1171   Returns the Boolean value of the token specified by TokenNumber.
1172
1173   @param[in]  TokenNumber The PCD token number to retrieve a current value for.
1174
1175   @return Returns the Boolean value of the token specified by TokenNumber.
1176
1177 **/
1178 BOOLEAN
1179 EFIAPI
1180 LibPcdGetBool (
1181   IN UINTN             TokenNumber
1182   );
1183
1184
1185 /**
1186   This function provides a means by which to retrieve the size of a given PCD token.
1187
1188   @param[in]  TokenNumber The PCD token number to retrieve a current value for.
1189
1190   @return Returns the size of the token specified by TokenNumber.
1191
1192 **/
1193 UINTN
1194 EFIAPI
1195 LibPcdGetSize (
1196   IN UINTN             TokenNumber
1197   );
1198
1199
1200 /**
1201   This function provides a means by which to retrieve a value for a given PCD token.
1202
1203   Returns the 8-bit value for the token specified by TokenNumber and Guid.
1204
1205   If Guid is NULL, then ASSERT().
1206
1207   @param[in]  Guid         Pointer to a 128-bit unique value that designates
1208                            which namespace to retrieve a value from.
1209   @param[in]  TokenNumber  The PCD token number to retrieve a current value for.
1210
1211   @return Return the UINT8.
1212
1213 **/
1214 UINT8
1215 EFIAPI
1216 LibPcdGetEx8 (
1217   IN CONST GUID        *Guid,
1218   IN UINTN             TokenNumber
1219   );
1220
1221
1222 /**
1223   This function provides a means by which to retrieve a value for a given PCD token.
1224
1225   Returns the 16-bit value for the token specified by TokenNumber and Guid.
1226
1227   If Guid is NULL, then ASSERT().
1228
1229   @param[in]  Guid         Pointer to a 128-bit unique value that designates
1230                            which namespace to retrieve a value from.
1231   @param[in]  TokenNumber  The PCD token number to retrieve a current value for.
1232
1233   @return Return the UINT16.
1234
1235 **/
1236 UINT16
1237 EFIAPI
1238 LibPcdGetEx16 (
1239   IN CONST GUID        *Guid,
1240   IN UINTN             TokenNumber
1241   );
1242
1243
1244 /**
1245   Returns the 32-bit value for the token specified by TokenNumber and Guid.
1246   If Guid is NULL, then ASSERT().
1247
1248   @param[in]  Guid         Pointer to a 128-bit unique value that designates
1249                            which namespace to retrieve a value from.
1250   @param[in]  TokenNumber  The PCD token number to retrieve a current value for.
1251
1252   @return Return the UINT32.
1253
1254 **/
1255 UINT32
1256 EFIAPI
1257 LibPcdGetEx32 (
1258   IN CONST GUID        *Guid,
1259   IN UINTN             TokenNumber
1260   );
1261
1262
1263 /**
1264   This function provides a means by which to retrieve a value for a given PCD token.
1265
1266   Returns the 64-bit value for the token specified by TokenNumber and Guid.
1267
1268   If Guid is NULL, then ASSERT().
1269
1270   @param[in]  Guid          Pointer to a 128-bit unique value that designates
1271                             which namespace to retrieve a value from.
1272   @param[in]  TokenNumber   The PCD token number to retrieve a current value for.
1273
1274   @return Return the UINT64.
1275
1276 **/
1277 UINT64
1278 EFIAPI
1279 LibPcdGetEx64 (
1280   IN CONST GUID        *Guid,
1281   IN UINTN             TokenNumber
1282   );
1283
1284
1285 /**
1286   This function provides a means by which to retrieve a value for a given PCD token.
1287
1288   Returns the pointer to the buffer of token specified by TokenNumber and Guid.
1289
1290   If Guid is NULL, then ASSERT().
1291
1292   @param[in]  Guid          Pointer to a 128-bit unique value that designates
1293                             which namespace to retrieve a value from.
1294   @param[in]  TokenNumber   The PCD token number to retrieve a current value for.
1295
1296   @return Return the VOID* pointer.
1297
1298 **/
1299 VOID *
1300 EFIAPI
1301 LibPcdGetExPtr (
1302   IN CONST GUID        *Guid,
1303   IN UINTN             TokenNumber
1304   );
1305
1306
1307 /**
1308   This function provides a means by which to retrieve a value for a given PCD token.
1309
1310   Returns the Boolean value of the token specified by TokenNumber and Guid.
1311
1312   If Guid is NULL, then ASSERT().
1313
1314   @param[in]  Guid          Pointer to a 128-bit unique value that designates
1315                             which namespace to retrieve a value from.
1316   @param[in]  TokenNumber   The PCD token number to retrieve a current value for.
1317
1318   @return Return the BOOLEAN.
1319
1320 **/
1321 BOOLEAN
1322 EFIAPI
1323 LibPcdGetExBool (
1324   IN CONST GUID        *Guid,
1325   IN UINTN             TokenNumber
1326   );
1327
1328
1329 /**
1330   This function provides a means by which to retrieve the size of a given PCD token.
1331
1332   Returns the size of the token specified by TokenNumber and Guid.
1333
1334   If Guid is NULL, then ASSERT().
1335
1336   @param[in]  Guid          Pointer to a 128-bit unique value that designates
1337                             which namespace to retrieve a value from.
1338   @param[in]  TokenNumber   The PCD token number to retrieve a current value for.
1339
1340   @return Return the size.
1341
1342 **/
1343 UINTN
1344 EFIAPI
1345 LibPcdGetExSize (
1346   IN CONST GUID        *Guid,
1347   IN UINTN             TokenNumber
1348   );
1349
1350
1351 #ifndef DISABLE_NEW_DEPRECATED_INTERFACES
1352 /**
1353   This function provides a means by which to set a value for a given PCD token.
1354
1355   Sets the 8-bit value for the token specified by TokenNumber
1356   to the value specified by Value.  Value is returned.
1357
1358   @param[in]  TokenNumber   The PCD token number to set a current value for.
1359   @param[in]  Value         The 8-bit value to set.
1360
1361   @return Return the Value that was set.
1362
1363 **/
1364 UINT8
1365 EFIAPI
1366 LibPcdSet8 (
1367   IN UINTN             TokenNumber,
1368   IN UINT8             Value
1369   );
1370
1371
1372 /**
1373   This function provides a means by which to set a value for a given PCD token.
1374
1375   Sets the 16-bit value for the token specified by TokenNumber
1376   to the value specified by Value.  Value is returned.
1377
1378   @param[in]  TokenNumber   The PCD token number to set a current value for.
1379   @param[in]  Value         The 16-bit value to set.
1380
1381   @return Return the Value that was set.
1382
1383 **/
1384 UINT16
1385 EFIAPI
1386 LibPcdSet16 (
1387   IN UINTN             TokenNumber,
1388   IN UINT16            Value
1389   );
1390
1391
1392 /**
1393   This function provides a means by which to set a value for a given PCD token.
1394
1395   Sets the 32-bit value for the token specified by TokenNumber
1396   to the value specified by Value.  Value is returned.
1397
1398   @param[in]  TokenNumber   The PCD token number to set a current value for.
1399   @param[in]  Value         The 32-bit value to set.
1400
1401   @return Return the Value that was set.
1402
1403 **/
1404 UINT32
1405 EFIAPI
1406 LibPcdSet32 (
1407   IN UINTN             TokenNumber,
1408   IN UINT32            Value
1409   );
1410
1411
1412 /**
1413   This function provides a means by which to set a value for a given PCD token.
1414
1415   Sets the 64-bit value for the token specified by TokenNumber
1416   to the value specified by Value.  Value is returned.
1417
1418   @param[in]  TokenNumber   The PCD token number to set a current value for.
1419   @param[in]  Value         The 64-bit value to set.
1420
1421   @return Return the Value that was set.
1422
1423 **/
1424 UINT64
1425 EFIAPI
1426 LibPcdSet64 (
1427   IN UINTN             TokenNumber,
1428   IN UINT64            Value
1429   );
1430
1431
1432 /**
1433   This function provides a means by which to set a value for a given PCD token.
1434
1435   Sets a buffer for the token specified by TokenNumber to the value
1436   specified by Buffer and SizeOfBuffer.  Buffer is returned.
1437   If SizeOfBuffer is greater than the maximum size support by TokenNumber,
1438   then set SizeOfBuffer to the maximum size supported by TokenNumber and
1439   return NULL to indicate that the set operation was not actually performed.
1440
1441   If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to the
1442   maximum size supported by TokenName and NULL must be returned.
1443
1444   If SizeOfBuffer is NULL, then ASSERT().
1445   If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
1446
1447   @param[in]      TokenNumber   The PCD token number to set a current value for.
1448   @param[in, out] SizeOfBuffer  The size, in bytes, of Buffer.
1449   @param[in]      Buffer        A pointer to the buffer to set.
1450
1451   @return Return the pointer for the Buffer that was set.
1452
1453 **/
1454 VOID *
1455 EFIAPI
1456 LibPcdSetPtr (
1457   IN        UINTN             TokenNumber,
1458   IN OUT    UINTN             *SizeOfBuffer,
1459   IN CONST  VOID              *Buffer
1460   );
1461
1462
1463 /**
1464   This function provides a means by which to set a value for a given PCD token.
1465
1466   Sets the Boolean value for the token specified by TokenNumber
1467   to the value specified by Value.  Value is returned.
1468
1469   @param[in]  TokenNumber   The PCD token number to set a current value for.
1470   @param[in]  Value         The boolean value to set.
1471
1472   @return Return the Value that was set.
1473
1474 **/
1475 BOOLEAN
1476 EFIAPI
1477 LibPcdSetBool (
1478   IN UINTN             TokenNumber,
1479   IN BOOLEAN           Value
1480   );
1481
1482
1483 /**
1484   This function provides a means by which to set a value for a given PCD token.
1485
1486   Sets the 8-bit value for the token specified by TokenNumber and
1487   Guid to the value specified by Value. Value is returned.
1488
1489   If Guid is NULL, then ASSERT().
1490
1491   @param[in]  Guid          Pointer to a 128-bit unique value that
1492                             designates which namespace to set a value from.
1493   @param[in]  TokenNumber   The PCD token number to set a current value for.
1494   @param[in]  Value         The 8-bit value to set.
1495
1496   @return Return the Value that was set.
1497
1498 **/
1499 UINT8
1500 EFIAPI
1501 LibPcdSetEx8 (
1502   IN CONST GUID        *Guid,
1503   IN UINTN             TokenNumber,
1504   IN UINT8             Value
1505   );
1506
1507
1508 /**
1509   This function provides a means by which to set a value for a given PCD token.
1510
1511   Sets the 16-bit value for the token specified by TokenNumber and
1512   Guid to the value specified by Value. Value is returned.
1513
1514   If Guid is NULL, then ASSERT().
1515
1516   @param[in]  Guid          Pointer to a 128-bit unique value that
1517                             designates which namespace to set a value from.
1518   @param[in]  TokenNumber   The PCD token number to set a current value for.
1519   @param[in]  Value         The 16-bit value to set.
1520
1521   @return Return the Value that was set.
1522
1523 **/
1524 UINT16
1525 EFIAPI
1526 LibPcdSetEx16 (
1527   IN CONST GUID        *Guid,
1528   IN UINTN             TokenNumber,
1529   IN UINT16            Value
1530   );
1531
1532
1533 /**
1534   This function provides a means by which to set a value for a given PCD token.
1535
1536   Sets the 32-bit value for the token specified by TokenNumber and
1537   Guid to the value specified by Value. Value is returned.
1538
1539   If Guid is NULL, then ASSERT().
1540
1541   @param[in]  Guid          Pointer to a 128-bit unique value that
1542                             designates which namespace to set a value from.
1543   @param[in]  TokenNumber   The PCD token number to set a current value for.
1544   @param[in]  Value         The 32-bit value to set.
1545
1546   @return Return the Value that was set.
1547
1548 **/
1549 UINT32
1550 EFIAPI
1551 LibPcdSetEx32 (
1552   IN CONST GUID        *Guid,
1553   IN UINTN             TokenNumber,
1554   IN UINT32            Value
1555   );
1556
1557
1558 /**
1559   This function provides a means by which to set a value for a given PCD token.
1560
1561   Sets the 64-bit value for the token specified by TokenNumber and
1562   Guid to the value specified by Value. Value is returned.
1563
1564   If Guid is NULL, then ASSERT().
1565
1566   @param[in]  Guid          Pointer to a 128-bit unique value that
1567                             designates which namespace to set a value from.
1568   @param[in]  TokenNumber   The PCD token number to set a current value for.
1569   @param[in]  Value         The 64-bit value to set.
1570
1571   @return Return the Value that was set.
1572
1573 **/
1574 UINT64
1575 EFIAPI
1576 LibPcdSetEx64 (
1577   IN CONST GUID        *Guid,
1578   IN UINTN             TokenNumber,
1579   IN UINT64            Value
1580   );
1581
1582
1583 /**
1584   This function provides a means by which to set a value for a given PCD token.
1585
1586   Sets a buffer for the token specified by TokenNumber to the value specified by
1587   Buffer and SizeOfBuffer.  Buffer is returned.  If SizeOfBuffer is greater than
1588   the maximum size support by TokenNumber, then set SizeOfBuffer to the maximum size
1589   supported by TokenNumber and return NULL to indicate that the set operation
1590   was not actually performed.
1591
1592   If Guid is NULL, then ASSERT().
1593   If SizeOfBuffer is NULL, then ASSERT().
1594   If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
1595
1596   @param[in]  Guid              Pointer to a 128-bit unique value that
1597                                 designates which namespace to set a value from.
1598   @param[in]  TokenNumber       The PCD token number to set a current value for.
1599   @param[in, out] SizeOfBuffer  The size, in bytes, of Buffer.
1600   @param[in]  Buffer            A pointer to the buffer to set.
1601
1602   @return Return the pointer to the Buffer that was set.
1603
1604 **/
1605 VOID *
1606 EFIAPI
1607 LibPcdSetExPtr (
1608   IN      CONST GUID        *Guid,
1609   IN      UINTN             TokenNumber,
1610   IN OUT  UINTN             *SizeOfBuffer,
1611   IN      VOID              *Buffer
1612   );
1613
1614
1615 /**
1616   This function provides a means by which to set a value for a given PCD token.
1617
1618   Sets the Boolean value for the token specified by TokenNumber and
1619   Guid to the value specified by Value. Value is returned.
1620
1621   If Guid is NULL, then ASSERT().
1622
1623   @param[in]  Guid          Pointer to a 128-bit unique value that
1624                             designates which namespace to set a value from.
1625   @param[in]  TokenNumber   The PCD token number to set a current value for.
1626   @param[in]  Value         The Boolean value to set.
1627
1628   @return Return the Value that was set.
1629
1630 **/
1631 BOOLEAN
1632 EFIAPI
1633 LibPcdSetExBool (
1634   IN CONST GUID        *Guid,
1635   IN UINTN             TokenNumber,
1636   IN BOOLEAN           Value
1637   );
1638 #endif
1639
1640 /**
1641   This function provides a means by which to set a value for a given PCD token.
1642
1643   Sets the 8-bit value for the token specified by TokenNumber
1644   to the value specified by Value.
1645
1646   @param[in] TokenNumber    The PCD token number to set a current value for.
1647   @param[in] Value          The 8-bit value to set.
1648
1649   @return The status of the set operation.
1650
1651 **/
1652 RETURN_STATUS
1653 EFIAPI
1654 LibPcdSet8S (
1655   IN UINTN          TokenNumber,
1656   IN UINT8          Value
1657   );
1658
1659 /**
1660   This function provides a means by which to set a value for a given PCD token.
1661
1662   Sets the 16-bit value for the token specified by TokenNumber
1663   to the value specified by Value.
1664
1665   @param[in] TokenNumber    The PCD token number to set a current value for.
1666   @param[in] Value          The 16-bit value to set.
1667
1668   @return The status of the set operation.
1669
1670 **/
1671 RETURN_STATUS
1672 EFIAPI
1673 LibPcdSet16S (
1674   IN UINTN          TokenNumber,
1675   IN UINT16         Value
1676   );
1677
1678 /**
1679   This function provides a means by which to set a value for a given PCD token.
1680
1681   Sets the 32-bit value for the token specified by TokenNumber
1682   to the value specified by Value.
1683
1684   @param[in] TokenNumber    The PCD token number to set a current value for.
1685   @param[in] Value          The 32-bit value to set.
1686
1687   @return The status of the set operation.
1688
1689 **/
1690 RETURN_STATUS
1691 EFIAPI
1692 LibPcdSet32S (
1693   IN UINTN          TokenNumber,
1694   IN UINT32         Value
1695   );
1696
1697 /**
1698   This function provides a means by which to set a value for a given PCD token.
1699
1700   Sets the 64-bit value for the token specified by TokenNumber
1701   to the value specified by Value.
1702
1703   @param[in] TokenNumber    The PCD token number to set a current value for.
1704   @param[in] Value          The 64-bit value to set.
1705
1706   @return The status of the set operation.
1707
1708 **/
1709 RETURN_STATUS
1710 EFIAPI
1711 LibPcdSet64S (
1712   IN UINTN          TokenNumber,
1713   IN UINT64         Value
1714   );
1715
1716 /**
1717   This function provides a means by which to set a value for a given PCD token.
1718
1719   Sets a buffer for the token specified by TokenNumber to the value specified
1720   by Buffer and SizeOfBuffer. If SizeOfBuffer is greater than the maximum size
1721   support by TokenNumber, then set SizeOfBuffer to the maximum size supported by
1722   TokenNumber and return RETURN_INVALID_PARAMETER to indicate that the set operation
1723   was not actually performed.
1724
1725   If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to the
1726   maximum size supported by TokenName and RETURN_INVALID_PARAMETER must be returned.
1727
1728   If SizeOfBuffer is NULL, then ASSERT().
1729   If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
1730
1731   @param[in]      TokenNumber   The PCD token number to set a current value for.
1732   @param[in, out] SizeOfBuffer  The size, in bytes, of Buffer.
1733   @param[in]      Buffer        A pointer to the buffer to set.
1734
1735   @return The status of the set operation.
1736
1737 **/
1738 RETURN_STATUS
1739 EFIAPI
1740 LibPcdSetPtrS (
1741   IN       UINTN    TokenNumber,
1742   IN OUT   UINTN    *SizeOfBuffer,
1743   IN CONST VOID     *Buffer
1744   );
1745
1746 /**
1747   This function provides a means by which to set a value for a given PCD token.
1748
1749   Sets the boolean value for the token specified by TokenNumber
1750   to the value specified by Value.
1751
1752   @param[in] TokenNumber    The PCD token number to set a current value for.
1753   @param[in] Value          The boolean value to set.
1754
1755   @return The status of the set operation.
1756
1757 **/
1758 RETURN_STATUS
1759 EFIAPI
1760 LibPcdSetBoolS (
1761   IN UINTN          TokenNumber,
1762   IN BOOLEAN        Value
1763   );
1764
1765 /**
1766   This function provides a means by which to set a value for a given PCD token.
1767
1768   Sets the 8-bit value for the token specified by TokenNumber
1769   to the value specified by Value.
1770
1771   If Guid is NULL, then ASSERT().
1772
1773   @param[in] Guid           The pointer to a 128-bit unique value that
1774                             designates which namespace to set a value from.
1775   @param[in] TokenNumber    The PCD token number to set a current value for.
1776   @param[in] Value          The 8-bit value to set.
1777
1778   @return The status of the set operation.
1779
1780 **/
1781 RETURN_STATUS
1782 EFIAPI
1783 LibPcdSetEx8S (
1784   IN CONST GUID     *Guid,
1785   IN UINTN          TokenNumber,
1786   IN UINT8          Value
1787   );
1788
1789 /**
1790   This function provides a means by which to set a value for a given PCD token.
1791
1792   Sets the 16-bit value for the token specified by TokenNumber
1793   to the value specified by Value.
1794
1795   If Guid is NULL, then ASSERT().
1796
1797   @param[in] Guid           The pointer to a 128-bit unique value that
1798                             designates which namespace to set a value from.
1799   @param[in] TokenNumber    The PCD token number to set a current value for.
1800   @param[in] Value          The 16-bit value to set.
1801
1802   @return The status of the set operation.
1803
1804 **/
1805 RETURN_STATUS
1806 EFIAPI
1807 LibPcdSetEx16S (
1808   IN CONST GUID     *Guid,
1809   IN UINTN          TokenNumber,
1810   IN UINT16         Value
1811   );
1812
1813 /**
1814   This function provides a means by which to set a value for a given PCD token.
1815
1816   Sets the 32-bit value for the token specified by TokenNumber
1817   to the value specified by Value.
1818
1819   If Guid is NULL, then ASSERT().
1820
1821   @param[in] Guid           The pointer to a 128-bit unique value that
1822                             designates which namespace to set a value from.
1823   @param[in] TokenNumber    The PCD token number to set a current value for.
1824   @param[in] Value          The 32-bit value to set.
1825
1826   @return The status of the set operation.
1827
1828 **/
1829 RETURN_STATUS
1830 EFIAPI
1831 LibPcdSetEx32S (
1832   IN CONST GUID     *Guid,
1833   IN UINTN          TokenNumber,
1834   IN UINT32         Value
1835   );
1836
1837 /**
1838   This function provides a means by which to set a value for a given PCD token.
1839
1840   Sets the 64-bit value for the token specified by TokenNumber
1841   to the value specified by Value.
1842
1843   If Guid is NULL, then ASSERT().
1844
1845   @param[in] Guid           The pointer to a 128-bit unique value that
1846                             designates which namespace to set a value from.
1847   @param[in] TokenNumber    The PCD token number to set a current value for.
1848   @param[in] Value          The 64-bit value to set.
1849
1850   @return The status of the set operation.
1851
1852 **/
1853 RETURN_STATUS
1854 EFIAPI
1855 LibPcdSetEx64S (
1856   IN CONST GUID     *Guid,
1857   IN UINTN          TokenNumber,
1858   IN UINT64         Value
1859   );
1860
1861 /**
1862   This function provides a means by which to set a value for a given PCD token.
1863
1864   Sets a buffer for the token specified by TokenNumber to the value specified by
1865   Buffer and SizeOfBuffer. If SizeOfBuffer is greater than the maximum size
1866   support by TokenNumber, then set SizeOfBuffer to the maximum size supported by
1867   TokenNumber and return RETURN_INVALID_PARAMETER to indicate that the set operation
1868   was not actually performed.
1869
1870   If Guid is NULL, then ASSERT().
1871   If SizeOfBuffer is NULL, then ASSERT().
1872   If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
1873
1874   @param[in]      Guid          Pointer to a 128-bit unique value that
1875                                 designates which namespace to set a value from.
1876   @param[in]      TokenNumber   The PCD token number to set a current value for.
1877   @param[in, out] SizeOfBuffer  The size, in bytes, of Buffer.
1878   @param[in]      Buffer        A pointer to the buffer to set.
1879
1880   @return The status of the set operation.
1881
1882 **/
1883 RETURN_STATUS
1884 EFIAPI
1885 LibPcdSetExPtrS (
1886   IN CONST GUID     *Guid,
1887   IN       UINTN    TokenNumber,
1888   IN OUT   UINTN    *SizeOfBuffer,
1889   IN       VOID     *Buffer
1890   );
1891
1892 /**
1893   This function provides a means by which to set a value for a given PCD token.
1894
1895   Sets the boolean value for the token specified by TokenNumber
1896   to the value specified by Value.
1897
1898   If Guid is NULL, then ASSERT().
1899
1900   @param[in] Guid           The pointer to a 128-bit unique value that
1901                             designates which namespace to set a value from.
1902   @param[in] TokenNumber    The PCD token number to set a current value for.
1903   @param[in] Value          The boolean value to set.
1904
1905   @return The status of the set operation.
1906
1907 **/
1908 RETURN_STATUS
1909 EFIAPI
1910 LibPcdSetExBoolS (
1911   IN CONST GUID     *Guid,
1912   IN UINTN          TokenNumber,
1913   IN BOOLEAN        Value
1914   );
1915
1916 /**
1917   This notification function serves two purposes.
1918
1919   Firstly, it notifies the module that did the registration that the value of this
1920   PCD token has been set.
1921   Secondly, it provides a mechanism for the module that did the registration to intercept
1922   the set operation and override the value been set if necessary. After the invocation of
1923   the callback function, TokenData will be used by PCD service PEIM or driver to modify th
1924   internal data in PCD database.
1925
1926   @param[in]      CallBackGuid    The PCD token GUID being set.
1927   @param[in]      CallBackToken   The PCD token number being set.
1928   @param[in, out] TokenData       A pointer to the token data being set.
1929   @param[in]      TokenDataSize   The size, in bytes, of the data being set.
1930
1931 **/
1932 typedef
1933 VOID
1934 (EFIAPI *PCD_CALLBACK)(
1935   IN        CONST GUID        *CallBackGuid, OPTIONAL
1936   IN        UINTN             CallBackToken,
1937   IN  OUT   VOID              *TokenData,
1938   IN        UINTN             TokenDataSize
1939   );
1940
1941
1942 /**
1943   Set up a notification function that is called when a specified token is set.
1944
1945   When the token specified by TokenNumber and Guid is set,
1946   then notification function specified by NotificationFunction is called.
1947   If Guid is NULL, then the default token space is used.
1948   If NotificationFunction is NULL, then ASSERT().
1949
1950   @param[in]  Guid                  Pointer to a 128-bit unique value that designates which
1951                                     namespace to set a value from.  If NULL, then the default
1952                                     token space is used.
1953   @param[in]  TokenNumber           The PCD token number to monitor.
1954   @param[in]  NotificationFunction  The function to call when the token
1955                                     specified by Guid and TokenNumber is set.
1956
1957 **/
1958 VOID
1959 EFIAPI
1960 LibPcdCallbackOnSet (
1961   IN CONST GUID               *Guid,       OPTIONAL
1962   IN UINTN                    TokenNumber,
1963   IN PCD_CALLBACK             NotificationFunction
1964   );
1965
1966
1967 /**
1968   Disable a notification function that was established with LibPcdCallbackonSet().
1969
1970   Disable a notification function that was previously established with LibPcdCallbackOnSet().
1971   If NotificationFunction is NULL, then ASSERT().
1972   If LibPcdCallbackOnSet() was not previously called with Guid, TokenNumber,
1973   and NotificationFunction, then ASSERT().
1974
1975   @param[in]  Guid                 Specify the GUID token space.
1976   @param[in]  TokenNumber          Specify the token number.
1977   @param[in]  NotificationFunction The callback function to be unregistered.
1978
1979 **/
1980 VOID
1981 EFIAPI
1982 LibPcdCancelCallback (
1983   IN CONST GUID               *Guid,       OPTIONAL
1984   IN UINTN                    TokenNumber,
1985   IN PCD_CALLBACK             NotificationFunction
1986   );
1987
1988
1989 /**
1990   Retrieves the next token in a token space.
1991
1992   Retrieves the next PCD token number from the token space specified by Guid.
1993   If Guid is NULL, then the default token space is used.  If TokenNumber is 0,
1994   then the first token number is returned.  Otherwise, the token number that
1995   follows TokenNumber in the token space is returned.  If TokenNumber is the last
1996   token number in the token space, then 0 is returned.
1997
1998   If TokenNumber is not 0 and is not in the token space specified by Guid, then ASSERT().
1999
2000   @param[in]  Guid        Pointer to a 128-bit unique value that designates which namespace
2001                           to set a value from.  If NULL, then the default token space is used.
2002   @param[in]  TokenNumber The previous PCD token number.  If 0, then retrieves the first PCD
2003                           token number.
2004
2005   @return The next valid token number.
2006
2007 **/
2008 UINTN
2009 EFIAPI
2010 LibPcdGetNextToken (
2011   IN CONST GUID               *Guid,       OPTIONAL
2012   IN UINTN                    TokenNumber
2013   );
2014
2015
2016
2017 /**
2018   Used to retrieve the list of available PCD token space GUIDs.
2019
2020   Returns the PCD token space GUID that follows TokenSpaceGuid in the list of token spaces
2021   in the platform.
2022   If TokenSpaceGuid is NULL, then a pointer to the first PCD token spaces returned.
2023   If TokenSpaceGuid is the last PCD token space GUID in the list, then NULL is returned.
2024
2025   @param  TokenSpaceGuid  Pointer to the a PCD token space GUID
2026
2027   @return The next valid token namespace.
2028
2029 **/
2030 GUID *
2031 EFIAPI
2032 LibPcdGetNextTokenSpace (
2033   IN CONST GUID  *TokenSpaceGuid
2034   );
2035
2036
2037 /**
2038   Sets a value of a patchable PCD entry that is type pointer.
2039
2040   Sets the PCD entry specified by PatchVariable to the value specified by Buffer
2041   and SizeOfBuffer.  Buffer is returned.  If SizeOfBuffer is greater than
2042   MaximumDatumSize, then set SizeOfBuffer to MaximumDatumSize and return
2043   NULL to indicate that the set operation was not actually performed.
2044   If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to
2045   MaximumDatumSize and NULL must be returned.
2046
2047   If PatchVariable is NULL, then ASSERT().
2048   If SizeOfBuffer is NULL, then ASSERT().
2049   If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
2050
2051   @param[out] PatchVariable     A pointer to the global variable in a module that is
2052                                 the target of the set operation.
2053   @param[in] MaximumDatumSize   The maximum size allowed for the PCD entry specified by PatchVariable.
2054   @param[in, out] SizeOfBuffer  A pointer to the size, in bytes, of Buffer.
2055   @param[in] Buffer             A pointer to the buffer to used to set the target variable.
2056
2057   @return Return the pointer to the Buffer that was set.
2058
2059 **/
2060 VOID *
2061 EFIAPI
2062 LibPatchPcdSetPtr (
2063   OUT        VOID       *PatchVariable,
2064   IN        UINTN       MaximumDatumSize,
2065   IN OUT    UINTN       *SizeOfBuffer,
2066   IN CONST  VOID        *Buffer
2067   );
2068
2069 /**
2070   Sets a value of a patchable PCD entry that is type pointer.
2071
2072   Sets the PCD entry specified by PatchVariable to the value specified
2073   by Buffer and SizeOfBuffer. If SizeOfBuffer is greater than MaximumDatumSize,
2074   then set SizeOfBuffer to MaximumDatumSize and return RETURN_INVALID_PARAMETER
2075   to indicate that the set operation was not actually performed.
2076   If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to
2077   MaximumDatumSize and RETURN_INVALID_PARAMETER must be returned.
2078
2079   If PatchVariable is NULL, then ASSERT().
2080   If SizeOfBuffer is NULL, then ASSERT().
2081   If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
2082
2083   @param[out] PatchVariable     A pointer to the global variable in a module that is
2084                                 the target of the set operation.
2085   @param[in] MaximumDatumSize   The maximum size allowed for the PCD entry specified by PatchVariable.
2086   @param[in, out] SizeOfBuffer  A pointer to the size, in bytes, of Buffer.
2087   @param[in] Buffer             A pointer to the buffer to used to set the target variable.
2088
2089   @return The status of the set operation.
2090
2091 **/
2092 RETURN_STATUS
2093 EFIAPI
2094 LibPatchPcdSetPtrS (
2095   OUT      VOID     *PatchVariable,
2096   IN       UINTN    MaximumDatumSize,
2097   IN OUT   UINTN    *SizeOfBuffer,
2098   IN CONST VOID     *Buffer
2099   );
2100
2101 /**
2102   Sets a value and size of a patchable PCD entry that is type pointer.
2103
2104   Sets the PCD entry specified by PatchVariable to the value specified by Buffer
2105   and SizeOfBuffer. Buffer is returned.  If SizeOfBuffer is greater than
2106   MaximumDatumSize, then set SizeOfBuffer to MaximumDatumSize and return
2107   NULL to indicate that the set operation was not actually performed.
2108   If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to
2109   MaximumDatumSize and NULL must be returned.
2110
2111   If PatchVariable is NULL, then ASSERT().
2112   If SizeOfPatchVariable is NULL, then ASSERT().
2113   If SizeOfBuffer is NULL, then ASSERT().
2114   If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
2115
2116   @param[out] PatchVariable     A pointer to the global variable in a module that is
2117                                 the target of the set operation.
2118   @param[out] SizeOfPatchVariable A pointer to the size, in bytes, of PatchVariable.
2119   @param[in] MaximumDatumSize   The maximum size allowed for the PCD entry specified by PatchVariable.
2120   @param[in, out] SizeOfBuffer  A pointer to the size, in bytes, of Buffer.
2121   @param[in] Buffer             A pointer to the buffer to used to set the target variable.
2122
2123   @return Return the pointer to the Buffer that was set.
2124
2125 **/
2126 VOID *
2127 EFIAPI
2128 LibPatchPcdSetPtrAndSize (
2129   OUT       VOID        *PatchVariable,
2130   OUT       UINTN       *SizeOfPatchVariable,
2131   IN        UINTN       MaximumDatumSize,
2132   IN OUT    UINTN       *SizeOfBuffer,
2133   IN CONST  VOID        *Buffer
2134   );
2135
2136 /**
2137   Sets a value and size of a patchable PCD entry that is type pointer.
2138
2139   Sets the PCD entry specified by PatchVariable to the value specified
2140   by Buffer and SizeOfBuffer. If SizeOfBuffer is greater than MaximumDatumSize,
2141   then set SizeOfBuffer to MaximumDatumSize and return RETURN_INVALID_PARAMETER
2142   to indicate that the set operation was not actually performed.
2143   If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to
2144   MaximumDatumSize and RETURN_INVALID_PARAMETER must be returned.
2145
2146   If PatchVariable is NULL, then ASSERT().
2147   If SizeOfPatchVariable is NULL, then ASSERT().
2148   If SizeOfBuffer is NULL, then ASSERT().
2149   If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
2150
2151   @param[out] PatchVariable     A pointer to the global variable in a module that is
2152                                 the target of the set operation.
2153   @param[out] SizeOfPatchVariable A pointer to the size, in bytes, of PatchVariable.
2154   @param[in] MaximumDatumSize   The maximum size allowed for the PCD entry specified by PatchVariable.
2155   @param[in, out] SizeOfBuffer  A pointer to the size, in bytes, of Buffer.
2156   @param[in] Buffer             A pointer to the buffer to used to set the target variable.
2157
2158   @return The status of the set operation.
2159
2160 **/
2161 RETURN_STATUS
2162 EFIAPI
2163 LibPatchPcdSetPtrAndSizeS (
2164   OUT      VOID     *PatchVariable,
2165   OUT      UINTN    *SizeOfPatchVariable,
2166   IN       UINTN    MaximumDatumSize,
2167   IN OUT   UINTN    *SizeOfBuffer,
2168   IN CONST VOID     *Buffer
2169   );
2170
2171 typedef enum {
2172   PCD_TYPE_8,
2173   PCD_TYPE_16,
2174   PCD_TYPE_32,
2175   PCD_TYPE_64,
2176   PCD_TYPE_BOOL,
2177   PCD_TYPE_PTR
2178 } PCD_TYPE;
2179
2180 typedef struct {
2181   ///
2182   /// The returned information associated with the requested TokenNumber. If
2183   /// TokenNumber is 0, then PcdType is set to PCD_TYPE_8.
2184   ///
2185   PCD_TYPE          PcdType;
2186   ///
2187   /// The size of the data in bytes associated with the TokenNumber specified. If
2188   /// TokenNumber is 0, then PcdSize is set 0.
2189   ///
2190   UINTN             PcdSize;
2191   ///
2192   /// The null-terminated ASCII string associated with a given token. If the
2193   /// TokenNumber specified was 0, then this field corresponds to the null-terminated
2194   /// ASCII string associated with the token's namespace Guid. If NULL, there is no
2195   /// name associated with this request.
2196   ///
2197   CHAR8             *PcdName;
2198 } PCD_INFO;
2199
2200
2201 /**
2202   Retrieve additional information associated with a PCD token.
2203
2204   This includes information such as the type of value the TokenNumber is associated with as well as possible
2205   human readable name that is associated with the token.
2206
2207   If TokenNumber is not in the default token space specified, then ASSERT().
2208
2209   @param[in]    TokenNumber The PCD token number.
2210   @param[out]   PcdInfo     The returned information associated with the requested TokenNumber.
2211                             The caller is responsible for freeing the buffer that is allocated by callee for PcdInfo->PcdName.
2212 **/
2213 VOID
2214 EFIAPI
2215 LibPcdGetInfo (
2216   IN        UINTN           TokenNumber,
2217   OUT       PCD_INFO        *PcdInfo
2218   );
2219
2220 /**
2221   Retrieve additional information associated with a PCD token.
2222
2223   This includes information such as the type of value the TokenNumber is associated with as well as possible
2224   human readable name that is associated with the token.
2225
2226   If TokenNumber is not in the token space specified by Guid, then ASSERT().
2227
2228   @param[in]    Guid        The 128-bit unique value that designates the namespace from which to extract the value.
2229   @param[in]    TokenNumber The PCD token number.
2230   @param[out]   PcdInfo     The returned information associated with the requested TokenNumber.
2231                             The caller is responsible for freeing the buffer that is allocated by callee for PcdInfo->PcdName.
2232 **/
2233 VOID
2234 EFIAPI
2235 LibPcdGetInfoEx (
2236   IN CONST  GUID            *Guid,
2237   IN        UINTN           TokenNumber,
2238   OUT       PCD_INFO        *PcdInfo
2239   );
2240
2241 /**
2242   Retrieve the currently set SKU Id.
2243
2244   @return   The currently set SKU Id. If the platform has not set at a SKU Id, then the
2245             default SKU Id value of 0 is returned. If the platform has set a SKU Id, then the currently set SKU
2246             Id is returned.
2247 **/
2248 UINTN
2249 EFIAPI
2250 LibPcdGetSku (
2251   VOID
2252   );
2253
2254 #endif