Merge branch 'vendor/BMAKE'
[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 /**
485   Sets a 8-bit PCD token value based on a token name.
486
487   Sets the 8-bit value for the token specified by TokenName.
488   If TokenName is not a valid token in the token space, then the module will not build.
489
490   @param TokenName  The name of the PCD token to retrieve a current value for.
491   @param Value      The 8-bit value to set.
492
493   @return The status of the set operation.
494
495 **/
496 #define PcdSet8S(TokenName, Value)          _PCD_SET_MODE_8_S_##TokenName    ((Value))
497
498 /**
499   Sets a 16-bit PCD token value based on a token name.
500
501   Sets the 16-bit value for the token specified by TokenName.
502   If TokenName is not a valid token in the token space, then the module will not build.
503
504   @param TokenName  The name of the PCD token to retrieve a current value for.
505   @param Value      The 16-bit value to set.
506
507   @return The status of the set operation.
508
509 **/
510 #define PcdSet16S(TokenName, Value)         _PCD_SET_MODE_16_S_##TokenName    ((Value))
511
512 /**
513   Sets a 32-bit PCD token value based on a token name.
514
515   Sets the 32-bit value for the token specified by TokenName.
516   If TokenName is not a valid token in the token space, then the module will not build.
517
518   @param TokenName  The name of the PCD token to retrieve a current value for.
519   @param Value      The 32-bit value to set.
520
521   @return The status of the set operation.
522
523 **/
524 #define PcdSet32S(TokenName, Value)         _PCD_SET_MODE_32_S_##TokenName    ((Value))
525
526 /**
527   Sets a 64-bit PCD token value based on a token name.
528
529   Sets the 64-bit value for the token specified by TokenName.
530   If TokenName is not a valid token in the token space, then the module will not build.
531
532   @param TokenName  The name of the PCD token to retrieve a current value for.
533   @param Value      The 64-bit value to set.
534
535   @return The status of the set operation.
536
537 **/
538 #define PcdSet64S(TokenName, Value)         _PCD_SET_MODE_64_S_##TokenName    ((Value))
539
540 /**
541   Sets a pointer to a PCD token buffer based on a token name.
542
543   Sets the buffer for the token specified by TokenName.
544   If SizeOfBuffer is greater than the maximum size supported by TokenName,
545   then set SizeOfBuffer to the maximum size supported by TokenName and return
546   RETURN_INVALID_PARAMETER to indicate that the set operation was not actually performed.
547   If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to the maximum size
548   supported by TokenName and RETURN_INVALID_PARAMETER must be returned.
549   If TokenName is not a valid token in the token space, then the module will not build.
550
551   If SizeOfBuffer is NULL, then ASSERT().
552   If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
553
554   @param TokenName      The name of the PCD token to set the current value for.
555   @param SizeOfBuffer   A pointer to the size, in bytes, of Buffer.
556   @param Buffer         A pointer to the buffer to set.
557
558   @return The status of the set operation.
559
560 **/
561 #define PcdSetPtrS(TokenName, SizeOfBuffer, Buffer) \
562                                             _PCD_SET_MODE_PTR_S_##TokenName   ((SizeOfBuffer), (Buffer))
563
564
565
566 /**
567   Sets a boolean PCD token value based on a token name.
568
569   Sets the boolean value for the token specified by TokenName.
570   If TokenName is not a valid token in the token space, then the module will not build.
571
572   @param TokenName  The name of the PCD token to retrieve a current value for.
573   @param Value      The boolean value to set.
574
575   @return The status of the set operation.
576
577 **/
578 #define PcdSetBoolS(TokenName, Value)       _PCD_SET_MODE_BOOL_S_##TokenName    ((Value))
579
580 /**
581   Retrieves a token number based on a GUID and a token name.
582
583   Returns the token number for the token specified by Guid and TokenName.
584   If TokenName is not a valid token in the token space, then the module will not build.
585
586   @param   Guid        Pointer to a 128-bit unique value that designates
587                        which namespace to retrieve a value from.
588   @param   TokenName   The name of the PCD token to retrieve a current value for.
589
590   @return  Return the token number.
591
592 **/
593 #define PcdTokenEx(Guid,TokenName)  _PCD_TOKEN_EX_##TokenName(Guid)
594
595 /**
596   Retrieves an 8-bit PCD token value based on a GUID and a token name.
597
598   Returns the 8-bit value for the token specified by Guid and TokenName.
599   If TokenName is not a valid token in the token space specified by Guid,
600   then the module will not build.
601
602   If Guid is NULL, then ASSERT().
603
604   @param   Guid        Pointer to a 128-bit unique value that designates
605                        which namespace to retrieve a value from.
606   @param   TokenName   The name of the PCD token to retrieve a current value for.
607
608   @return  An 8-bit PCD token value.
609
610 **/
611 #define PcdGetEx8(Guid, TokenName)          LibPcdGetEx8 ((Guid), PcdTokenEx(Guid,TokenName))
612
613 /**
614   Retrieves a 16-bit PCD token value based on a GUID and a token name.
615
616   Returns the 16-bit value for the token specified by Guid and TokenName.
617   If TokenName is not a valid token in the token space specified by Guid,
618   then the module will not build.
619
620   If Guid is NULL, then ASSERT().
621
622   @param   Guid        Pointer to a 128-bit unique value that designates
623                        which namespace to retrieve a value from.
624   @param   TokenName   The name of the PCD token to retrieve a current value for.
625
626   @return  A 16-bit PCD token value.
627
628 **/
629 #define PcdGetEx16(Guid, TokenName)         LibPcdGetEx16 ((Guid), PcdTokenEx(Guid,TokenName))
630
631
632 /**
633   Retrieves a 32-bit PCD token value based on a GUID and a token name.
634
635   Returns the 32-bit value for the token specified by Guid and TokenName.
636   If TokenName is not a valid token in the token space specified by Guid,
637   then the module will not build.
638
639   If Guid is NULL, then ASSERT().
640
641   @param   Guid        Pointer to a 128-bit unique value that designates
642                        which namespace to retrieve a value from.
643   @param   TokenName   The name of the PCD token to retrieve a current value for.
644
645   @return  A 32-bit PCD token value.
646
647 **/
648 #define PcdGetEx32(Guid, TokenName)         LibPcdGetEx32 ((Guid), PcdTokenEx(Guid,TokenName))
649
650
651 /**
652   Retrieves a 64-bit PCD token value based on a GUID and a token name.
653
654   Returns the 64-bit value for the token specified by Guid and TokenName.
655   If TokenName is not a valid token in the token space specified by Guid,
656   then the module will not build.
657
658   If Guid is NULL, then ASSERT().
659
660   @param   Guid        Pointer to a 128-bit unique value that designates
661                        which namespace to retrieve a value from.
662   @param   TokenName   The name of the PCD token to retrieve a current value for.
663
664   @return  A 64-bit PCD token value.
665
666 **/
667 #define PcdGetEx64(Guid, TokenName)         LibPcdGetEx64 ((Guid), PcdTokenEx(Guid,TokenName))
668
669
670 /**
671   Retrieves a pointer to a PCD token buffer based on a GUID and a token name.
672
673   Returns a pointer to the buffer for the token specified by Guid and TokenName.
674   If TokenName is not a valid token in the token space specified by Guid,
675   then the module will not build.
676
677   If Guid is NULL, then ASSERT().
678
679   @param   Guid        Pointer to a 128-bit unique value that designates
680                        which namespace to retrieve a value from.
681   @param   TokenName   The name of the PCD token to retrieve a current value for.
682
683   @return  A pointer to a PCD token buffer.
684
685 **/
686 #define PcdGetExPtr(Guid, TokenName)        LibPcdGetExPtr ((Guid), PcdTokenEx(Guid,TokenName))
687
688
689 /**
690   Retrieves a Boolean PCD token value based on a GUID and a token name.
691
692   Returns the Boolean value for the token specified by Guid and TokenName.
693   If TokenName is not a valid token in the token space specified by Guid,
694   then the module will not build.
695
696   If Guid is NULL, then ASSERT().
697
698   @param   Guid        Pointer to a 128-bit unique value that designates
699                        which namespace to retrieve a value from.
700   @param   TokenName   The name of the PCD token to retrieve a current value for.
701
702   @return  A Boolean PCD token value.
703
704 **/
705 #define PcdGetExBool(Guid, TokenName)       LibPcdGetExBool  ((Guid), PcdTokenEx(Guid,TokenName))
706
707
708
709 /**
710   Sets an 8-bit PCD token value based on a GUID and a token name.
711
712   Sets the 8-bit value for the token specified by Guid and TokenName.
713   If TokenName is not a valid token in the token space specified by Guid,
714   then the module will not build.
715
716   If Guid is NULL, then ASSERT().
717
718   @param Guid       Pointer to a 128-bit unique value that designates
719                     which namespace to retrieve a value from.
720   @param TokenName  The name of the PCD token to set the current value for.
721   @param Value      The 8-bit value to set.
722
723   @return The status of the set operation.
724
725 **/
726 #define PcdSetEx8S(Guid, TokenName, Value)     LibPcdSetEx8S ((Guid), PcdTokenEx(Guid,TokenName), (Value))
727
728 /**
729   Sets an 16-bit PCD token value based on a GUID and a token name.
730
731   Sets the 16-bit value for the token specified by Guid and TokenName.
732   If TokenName is not a valid token in the token space specified by Guid,
733   then the module will not build.
734
735   If Guid is NULL, then ASSERT().
736
737   @param Guid       Pointer to a 128-bit unique value that designates
738                     which namespace to retrieve a value from.
739   @param TokenName  The name of the PCD token to set the current value for.
740   @param Value      The 16-bit value to set.
741
742   @return The status of the set operation.
743
744 **/
745 #define PcdSetEx16S(Guid, TokenName, Value)    LibPcdSetEx16S ((Guid), PcdTokenEx(Guid,TokenName), (Value))
746
747 /**
748   Sets an 32-bit PCD token value based on a GUID and a token name.
749
750   Sets the 32-bit value for the token specified by Guid and TokenName.
751   If TokenName is not a valid token in the token space specified by Guid,
752   then the module will not build.
753
754   If Guid is NULL, then ASSERT().
755
756   @param Guid       Pointer to a 128-bit unique value that designates
757                     which namespace to retrieve a value from.
758   @param TokenName  The name of the PCD token to set the current value for.
759   @param Value      The 32-bit value to set.
760
761   @return The status of the set operation.
762
763 **/
764 #define PcdSetEx32S(Guid, TokenName, Value)    LibPcdSetEx32S ((Guid), PcdTokenEx(Guid,TokenName), (Value))
765
766 /**
767   Sets an 64-bit PCD token value based on a GUID and a token name.
768
769   Sets the 64-bit value for the token specified by Guid and TokenName.
770   If TokenName is not a valid token in the token space specified by Guid,
771   then the module will not build.
772
773   If Guid is NULL, then ASSERT().
774
775   @param Guid       Pointer to a 128-bit unique value that designates
776                     which namespace to retrieve a value from.
777   @param TokenName  The name of the PCD token to set the current value for.
778   @param Value      The 64-bit value to set.
779
780   @return The status of the set operation.
781
782 **/
783 #define PcdSetEx64S(Guid, TokenName, Value)    LibPcdSetEx64S ((Guid), PcdTokenEx(Guid,TokenName), (Value))
784
785 /**
786   Sets a pointer to a PCD token buffer based on a GUID and a token name.
787
788   Sets the buffer for the token specified by Guid and TokenName.
789   If SizeOfBuffer is greater than the maximum size supported by Guid and TokenName,
790   then set SizeOfBuffer to the maximum size supported by Guid and TokenName and return
791   RETURN_INVALID_PARAMETER to indicate that the set operation was not actually performed.
792   If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to the maximum size
793   supported by Guid and TokenName and RETURN_INVALID_PARAMETER must be returned.
794   If TokenName is not a valid token in the token space specified by Guid,
795   then the module will not build.
796
797   If Guid is NULL, then ASSERT().
798   If SizeOfBuffer is NULL, then ASSERT().
799   If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
800
801   @param Guid           Pointer to a 128-bit unique value that designates
802                         which namespace to retrieve a value from.
803   @param TokenName      The name of the PCD token to set the current value for.
804   @param SizeOfBuffer   A pointer to the size, in bytes, of Buffer.
805   @param Buffer         Pointer to the buffer to set.
806
807   @return The status of the set operation.
808
809 **/
810 #define PcdSetExPtrS(Guid, TokenName, SizeOfBuffer, Buffer) \
811                                             LibPcdSetExPtrS ((Guid), PcdTokenEx(Guid,TokenName), (SizeOfBuffer), (Buffer))
812
813
814 /**
815   Sets an boolean PCD token value based on a GUID and a token name.
816
817   Sets the boolean value for the token specified by Guid and TokenName.
818   If TokenName is not a valid token in the token space specified by Guid,
819   then the module will not build.
820
821   If Guid is NULL, then ASSERT().
822
823   @param Guid       Pointer to a 128-bit unique value that designates
824                     which namespace to retrieve a value from.
825   @param TokenName  The name of the PCD token to set the current value for.
826   @param Value      The boolean value to set.
827
828   @return The status of the set operation.
829
830 **/
831 #define PcdSetExBoolS(Guid, TokenName, Value) \
832                                             LibPcdSetExBoolS ((Guid), PcdTokenEx(Guid,TokenName), (Value))
833
834 /**
835   This function provides a means by which SKU support can be established in the PCD infrastructure.
836
837   Sets the current SKU in the PCD database to the value specified by SkuId.  SkuId is returned.
838
839   @param  SkuId   The SKU value that will be used when the PCD service retrieves and sets values
840                   associated with a PCD token.
841
842   @return  Return the SKU ID that was set.
843
844 **/
845 UINTN
846 EFIAPI
847 LibPcdSetSku (
848   IN UINTN   SkuId
849   );
850
851
852 /**
853   This function provides a means by which to retrieve a value for a given PCD token.
854
855   Returns the 8-bit value for the token specified by TokenNumber.
856
857   @param[in]  TokenNumber The PCD token number to retrieve a current value for.
858
859   @return Returns the 8-bit value for the token specified by TokenNumber.
860
861 **/
862 UINT8
863 EFIAPI
864 LibPcdGet8 (
865   IN UINTN             TokenNumber
866   );
867
868
869 /**
870   This function provides a means by which to retrieve a value for a given PCD token.
871
872   Returns the 16-bit value for the token specified by TokenNumber.
873
874   @param[in]  TokenNumber The PCD token number to retrieve a current value for.
875
876   @return Returns the 16-bit value for the token specified by TokenNumber.
877
878 **/
879 UINT16
880 EFIAPI
881 LibPcdGet16 (
882   IN UINTN             TokenNumber
883   );
884
885
886 /**
887   This function provides a means by which to retrieve a value for a given PCD token.
888
889   Returns the 32-bit value for the token specified by TokenNumber.
890
891   @param[in]  TokenNumber The PCD token number to retrieve a current value for.
892
893   @return Returns the 32-bit value for the token specified by TokenNumber.
894
895 **/
896 UINT32
897 EFIAPI
898 LibPcdGet32 (
899   IN UINTN             TokenNumber
900   );
901
902
903 /**
904   This function provides a means by which to retrieve a value for a given PCD token.
905
906   Returns the 64-bit value for the token specified by TokenNumber.
907
908   @param[in]  TokenNumber The PCD token number to retrieve a current value for.
909
910   @return Returns the 64-bit value for the token specified by TokenNumber.
911
912 **/
913 UINT64
914 EFIAPI
915 LibPcdGet64 (
916   IN UINTN             TokenNumber
917   );
918
919
920 /**
921   This function provides a means by which to retrieve a value for a given PCD token.
922
923   Returns the pointer to the buffer of the token specified by TokenNumber.
924
925   @param[in]  TokenNumber The PCD token number to retrieve a current value for.
926
927   @return Returns the pointer to the token specified by TokenNumber.
928
929 **/
930 VOID *
931 EFIAPI
932 LibPcdGetPtr (
933   IN UINTN             TokenNumber
934   );
935
936
937 /**
938   This function provides a means by which to retrieve a value for a given PCD token.
939
940   Returns the Boolean value of the token specified by TokenNumber.
941
942   @param[in]  TokenNumber The PCD token number to retrieve a current value for.
943
944   @return Returns the Boolean value of the token specified by TokenNumber.
945
946 **/
947 BOOLEAN
948 EFIAPI
949 LibPcdGetBool (
950   IN UINTN             TokenNumber
951   );
952
953
954 /**
955   This function provides a means by which to retrieve the size of a given PCD token.
956
957   @param[in]  TokenNumber The PCD token number to retrieve a current value for.
958
959   @return Returns the size of the token specified by TokenNumber.
960
961 **/
962 UINTN
963 EFIAPI
964 LibPcdGetSize (
965   IN UINTN             TokenNumber
966   );
967
968
969 /**
970   This function provides a means by which to retrieve a value for a given PCD token.
971
972   Returns the 8-bit value for the token specified by TokenNumber and Guid.
973
974   If Guid is NULL, then ASSERT().
975
976   @param[in]  Guid         Pointer to a 128-bit unique value that designates
977                            which namespace to retrieve a value from.
978   @param[in]  TokenNumber  The PCD token number to retrieve a current value for.
979
980   @return Return the UINT8.
981
982 **/
983 UINT8
984 EFIAPI
985 LibPcdGetEx8 (
986   IN CONST GUID        *Guid,
987   IN UINTN             TokenNumber
988   );
989
990
991 /**
992   This function provides a means by which to retrieve a value for a given PCD token.
993
994   Returns the 16-bit value for the token specified by TokenNumber and Guid.
995
996   If Guid is NULL, then ASSERT().
997
998   @param[in]  Guid         Pointer to a 128-bit unique value that designates
999                            which namespace to retrieve a value from.
1000   @param[in]  TokenNumber  The PCD token number to retrieve a current value for.
1001
1002   @return Return the UINT16.
1003
1004 **/
1005 UINT16
1006 EFIAPI
1007 LibPcdGetEx16 (
1008   IN CONST GUID        *Guid,
1009   IN UINTN             TokenNumber
1010   );
1011
1012
1013 /**
1014   Returns the 32-bit value for the token specified by TokenNumber and Guid.
1015   If Guid is NULL, then ASSERT().
1016
1017   @param[in]  Guid         Pointer to a 128-bit unique value that designates
1018                            which namespace to retrieve a value from.
1019   @param[in]  TokenNumber  The PCD token number to retrieve a current value for.
1020
1021   @return Return the UINT32.
1022
1023 **/
1024 UINT32
1025 EFIAPI
1026 LibPcdGetEx32 (
1027   IN CONST GUID        *Guid,
1028   IN UINTN             TokenNumber
1029   );
1030
1031
1032 /**
1033   This function provides a means by which to retrieve a value for a given PCD token.
1034
1035   Returns the 64-bit value for the token specified by TokenNumber and Guid.
1036
1037   If Guid is NULL, then ASSERT().
1038
1039   @param[in]  Guid          Pointer to a 128-bit unique value that designates
1040                             which namespace to retrieve a value from.
1041   @param[in]  TokenNumber   The PCD token number to retrieve a current value for.
1042
1043   @return Return the UINT64.
1044
1045 **/
1046 UINT64
1047 EFIAPI
1048 LibPcdGetEx64 (
1049   IN CONST GUID        *Guid,
1050   IN UINTN             TokenNumber
1051   );
1052
1053
1054 /**
1055   This function provides a means by which to retrieve a value for a given PCD token.
1056
1057   Returns the pointer to the buffer of token specified by TokenNumber and Guid.
1058
1059   If Guid is NULL, then ASSERT().
1060
1061   @param[in]  Guid          Pointer to a 128-bit unique value that designates
1062                             which namespace to retrieve a value from.
1063   @param[in]  TokenNumber   The PCD token number to retrieve a current value for.
1064
1065   @return Return the VOID* pointer.
1066
1067 **/
1068 VOID *
1069 EFIAPI
1070 LibPcdGetExPtr (
1071   IN CONST GUID        *Guid,
1072   IN UINTN             TokenNumber
1073   );
1074
1075
1076 /**
1077   This function provides a means by which to retrieve a value for a given PCD token.
1078
1079   Returns the Boolean value of the token specified by TokenNumber and Guid.
1080
1081   If Guid is NULL, then ASSERT().
1082
1083   @param[in]  Guid          Pointer to a 128-bit unique value that designates
1084                             which namespace to retrieve a value from.
1085   @param[in]  TokenNumber   The PCD token number to retrieve a current value for.
1086
1087   @return Return the BOOLEAN.
1088
1089 **/
1090 BOOLEAN
1091 EFIAPI
1092 LibPcdGetExBool (
1093   IN CONST GUID        *Guid,
1094   IN UINTN             TokenNumber
1095   );
1096
1097
1098 /**
1099   This function provides a means by which to retrieve the size of a given PCD token.
1100
1101   Returns the size of the token specified by TokenNumber and Guid.
1102
1103   If Guid is NULL, then ASSERT().
1104
1105   @param[in]  Guid          Pointer to a 128-bit unique value that designates
1106                             which namespace to retrieve a value from.
1107   @param[in]  TokenNumber   The PCD token number to retrieve a current value for.
1108
1109   @return Return the size.
1110
1111 **/
1112 UINTN
1113 EFIAPI
1114 LibPcdGetExSize (
1115   IN CONST GUID        *Guid,
1116   IN UINTN             TokenNumber
1117   );
1118
1119
1120 /**
1121   This function provides a means by which to set a value for a given PCD token.
1122
1123   Sets the 8-bit value for the token specified by TokenNumber
1124   to the value specified by Value.
1125
1126   @param[in] TokenNumber    The PCD token number to set a current value for.
1127   @param[in] Value          The 8-bit value to set.
1128
1129   @return The status of the set operation.
1130
1131 **/
1132 RETURN_STATUS
1133 EFIAPI
1134 LibPcdSet8S (
1135   IN UINTN          TokenNumber,
1136   IN UINT8          Value
1137   );
1138
1139 /**
1140   This function provides a means by which to set a value for a given PCD token.
1141
1142   Sets the 16-bit value for the token specified by TokenNumber
1143   to the value specified by Value.
1144
1145   @param[in] TokenNumber    The PCD token number to set a current value for.
1146   @param[in] Value          The 16-bit value to set.
1147
1148   @return The status of the set operation.
1149
1150 **/
1151 RETURN_STATUS
1152 EFIAPI
1153 LibPcdSet16S (
1154   IN UINTN          TokenNumber,
1155   IN UINT16         Value
1156   );
1157
1158 /**
1159   This function provides a means by which to set a value for a given PCD token.
1160
1161   Sets the 32-bit value for the token specified by TokenNumber
1162   to the value specified by Value.
1163
1164   @param[in] TokenNumber    The PCD token number to set a current value for.
1165   @param[in] Value          The 32-bit value to set.
1166
1167   @return The status of the set operation.
1168
1169 **/
1170 RETURN_STATUS
1171 EFIAPI
1172 LibPcdSet32S (
1173   IN UINTN          TokenNumber,
1174   IN UINT32         Value
1175   );
1176
1177 /**
1178   This function provides a means by which to set a value for a given PCD token.
1179
1180   Sets the 64-bit value for the token specified by TokenNumber
1181   to the value specified by Value.
1182
1183   @param[in] TokenNumber    The PCD token number to set a current value for.
1184   @param[in] Value          The 64-bit value to set.
1185
1186   @return The status of the set operation.
1187
1188 **/
1189 RETURN_STATUS
1190 EFIAPI
1191 LibPcdSet64S (
1192   IN UINTN          TokenNumber,
1193   IN UINT64         Value
1194   );
1195
1196 /**
1197   This function provides a means by which to set a value for a given PCD token.
1198
1199   Sets a buffer for the token specified by TokenNumber to the value specified
1200   by Buffer and SizeOfBuffer. If SizeOfBuffer is greater than the maximum size
1201   support by TokenNumber, then set SizeOfBuffer to the maximum size supported by
1202   TokenNumber and return RETURN_INVALID_PARAMETER to indicate that the set operation
1203   was not actually performed.
1204
1205   If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to the
1206   maximum size supported by TokenName and RETURN_INVALID_PARAMETER must be returned.
1207
1208   If SizeOfBuffer is NULL, then ASSERT().
1209   If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
1210
1211   @param[in]      TokenNumber   The PCD token number to set a current value for.
1212   @param[in, out] SizeOfBuffer  The size, in bytes, of Buffer.
1213   @param[in]      Buffer        A pointer to the buffer to set.
1214
1215   @return The status of the set operation.
1216
1217 **/
1218 RETURN_STATUS
1219 EFIAPI
1220 LibPcdSetPtrS (
1221   IN       UINTN    TokenNumber,
1222   IN OUT   UINTN    *SizeOfBuffer,
1223   IN CONST VOID     *Buffer
1224   );
1225
1226 /**
1227   This function provides a means by which to set a value for a given PCD token.
1228
1229   Sets the boolean value for the token specified by TokenNumber
1230   to the value specified by Value.
1231
1232   @param[in] TokenNumber    The PCD token number to set a current value for.
1233   @param[in] Value          The boolean value to set.
1234
1235   @return The status of the set operation.
1236
1237 **/
1238 RETURN_STATUS
1239 EFIAPI
1240 LibPcdSetBoolS (
1241   IN UINTN          TokenNumber,
1242   IN BOOLEAN        Value
1243   );
1244
1245 /**
1246   This function provides a means by which to set a value for a given PCD token.
1247
1248   Sets the 8-bit value for the token specified by TokenNumber
1249   to the value specified by Value.
1250
1251   If Guid is NULL, then ASSERT().
1252
1253   @param[in] Guid           The pointer to a 128-bit unique value that
1254                             designates which namespace to set a value from.
1255   @param[in] TokenNumber    The PCD token number to set a current value for.
1256   @param[in] Value          The 8-bit value to set.
1257
1258   @return The status of the set operation.
1259
1260 **/
1261 RETURN_STATUS
1262 EFIAPI
1263 LibPcdSetEx8S (
1264   IN CONST GUID     *Guid,
1265   IN UINTN          TokenNumber,
1266   IN UINT8          Value
1267   );
1268
1269 /**
1270   This function provides a means by which to set a value for a given PCD token.
1271
1272   Sets the 16-bit value for the token specified by TokenNumber
1273   to the value specified by Value.
1274
1275   If Guid is NULL, then ASSERT().
1276
1277   @param[in] Guid           The pointer to a 128-bit unique value that
1278                             designates which namespace to set a value from.
1279   @param[in] TokenNumber    The PCD token number to set a current value for.
1280   @param[in] Value          The 16-bit value to set.
1281
1282   @return The status of the set operation.
1283
1284 **/
1285 RETURN_STATUS
1286 EFIAPI
1287 LibPcdSetEx16S (
1288   IN CONST GUID     *Guid,
1289   IN UINTN          TokenNumber,
1290   IN UINT16         Value
1291   );
1292
1293 /**
1294   This function provides a means by which to set a value for a given PCD token.
1295
1296   Sets the 32-bit value for the token specified by TokenNumber
1297   to the value specified by Value.
1298
1299   If Guid is NULL, then ASSERT().
1300
1301   @param[in] Guid           The pointer to a 128-bit unique value that
1302                             designates which namespace to set a value from.
1303   @param[in] TokenNumber    The PCD token number to set a current value for.
1304   @param[in] Value          The 32-bit value to set.
1305
1306   @return The status of the set operation.
1307
1308 **/
1309 RETURN_STATUS
1310 EFIAPI
1311 LibPcdSetEx32S (
1312   IN CONST GUID     *Guid,
1313   IN UINTN          TokenNumber,
1314   IN UINT32         Value
1315   );
1316
1317 /**
1318   This function provides a means by which to set a value for a given PCD token.
1319
1320   Sets the 64-bit value for the token specified by TokenNumber
1321   to the value specified by Value.
1322
1323   If Guid is NULL, then ASSERT().
1324
1325   @param[in] Guid           The pointer to a 128-bit unique value that
1326                             designates which namespace to set a value from.
1327   @param[in] TokenNumber    The PCD token number to set a current value for.
1328   @param[in] Value          The 64-bit value to set.
1329
1330   @return The status of the set operation.
1331
1332 **/
1333 RETURN_STATUS
1334 EFIAPI
1335 LibPcdSetEx64S (
1336   IN CONST GUID     *Guid,
1337   IN UINTN          TokenNumber,
1338   IN UINT64         Value
1339   );
1340
1341 /**
1342   This function provides a means by which to set a value for a given PCD token.
1343
1344   Sets a buffer for the token specified by TokenNumber to the value specified by
1345   Buffer and SizeOfBuffer. If SizeOfBuffer is greater than the maximum size
1346   support by TokenNumber, then set SizeOfBuffer to the maximum size supported by
1347   TokenNumber and return RETURN_INVALID_PARAMETER to indicate that the set operation
1348   was not actually performed.
1349
1350   If Guid is NULL, then ASSERT().
1351   If SizeOfBuffer is NULL, then ASSERT().
1352   If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
1353
1354   @param[in]      Guid          Pointer to a 128-bit unique value that
1355                                 designates which namespace to set a value from.
1356   @param[in]      TokenNumber   The PCD token number to set a current value for.
1357   @param[in, out] SizeOfBuffer  The size, in bytes, of Buffer.
1358   @param[in]      Buffer        A pointer to the buffer to set.
1359
1360   @return The status of the set operation.
1361
1362 **/
1363 RETURN_STATUS
1364 EFIAPI
1365 LibPcdSetExPtrS (
1366   IN CONST GUID     *Guid,
1367   IN       UINTN    TokenNumber,
1368   IN OUT   UINTN    *SizeOfBuffer,
1369   IN       VOID     *Buffer
1370   );
1371
1372 /**
1373   This function provides a means by which to set a value for a given PCD token.
1374
1375   Sets the boolean value for the token specified by TokenNumber
1376   to the value specified by Value.
1377
1378   If Guid is NULL, then ASSERT().
1379
1380   @param[in] Guid           The pointer to a 128-bit unique value that
1381                             designates which namespace to set a value from.
1382   @param[in] TokenNumber    The PCD token number to set a current value for.
1383   @param[in] Value          The boolean value to set.
1384
1385   @return The status of the set operation.
1386
1387 **/
1388 RETURN_STATUS
1389 EFIAPI
1390 LibPcdSetExBoolS (
1391   IN CONST GUID     *Guid,
1392   IN UINTN          TokenNumber,
1393   IN BOOLEAN        Value
1394   );
1395
1396 /**
1397   This notification function serves two purposes.
1398
1399   Firstly, it notifies the module that did the registration that the value of this
1400   PCD token has been set.
1401   Secondly, it provides a mechanism for the module that did the registration to intercept
1402   the set operation and override the value been set if necessary. After the invocation of
1403   the callback function, TokenData will be used by PCD service PEIM or driver to modify th
1404   internal data in PCD database.
1405
1406   @param[in]      CallBackGuid    The PCD token GUID being set.
1407   @param[in]      CallBackToken   The PCD token number being set.
1408   @param[in, out] TokenData       A pointer to the token data being set.
1409   @param[in]      TokenDataSize   The size, in bytes, of the data being set.
1410
1411 **/
1412 typedef
1413 VOID
1414 (EFIAPI *PCD_CALLBACK)(
1415   IN        CONST GUID        *CallBackGuid, OPTIONAL
1416   IN        UINTN             CallBackToken,
1417   IN  OUT   VOID              *TokenData,
1418   IN        UINTN             TokenDataSize
1419   );
1420
1421
1422 /**
1423   Set up a notification function that is called when a specified token is set.
1424
1425   When the token specified by TokenNumber and Guid is set,
1426   then notification function specified by NotificationFunction is called.
1427   If Guid is NULL, then the default token space is used.
1428   If NotificationFunction is NULL, then ASSERT().
1429
1430   @param[in]  Guid                  Pointer to a 128-bit unique value that designates which
1431                                     namespace to set a value from.  If NULL, then the default
1432                                     token space is used.
1433   @param[in]  TokenNumber           The PCD token number to monitor.
1434   @param[in]  NotificationFunction  The function to call when the token
1435                                     specified by Guid and TokenNumber is set.
1436
1437 **/
1438 VOID
1439 EFIAPI
1440 LibPcdCallbackOnSet (
1441   IN CONST GUID               *Guid,       OPTIONAL
1442   IN UINTN                    TokenNumber,
1443   IN PCD_CALLBACK             NotificationFunction
1444   );
1445
1446
1447 /**
1448   Disable a notification function that was established with LibPcdCallbackonSet().
1449
1450   Disable a notification function that was previously established with LibPcdCallbackOnSet().
1451   If NotificationFunction is NULL, then ASSERT().
1452   If LibPcdCallbackOnSet() was not previously called with Guid, TokenNumber,
1453   and NotificationFunction, then ASSERT().
1454
1455   @param[in]  Guid                 Specify the GUID token space.
1456   @param[in]  TokenNumber          Specify the token number.
1457   @param[in]  NotificationFunction The callback function to be unregistered.
1458
1459 **/
1460 VOID
1461 EFIAPI
1462 LibPcdCancelCallback (
1463   IN CONST GUID               *Guid,       OPTIONAL
1464   IN UINTN                    TokenNumber,
1465   IN PCD_CALLBACK             NotificationFunction
1466   );
1467
1468
1469 /**
1470   Retrieves the next token in a token space.
1471
1472   Retrieves the next PCD token number from the token space specified by Guid.
1473   If Guid is NULL, then the default token space is used.  If TokenNumber is 0,
1474   then the first token number is returned.  Otherwise, the token number that
1475   follows TokenNumber in the token space is returned.  If TokenNumber is the last
1476   token number in the token space, then 0 is returned.
1477
1478   If TokenNumber is not 0 and is not in the token space specified by Guid, then ASSERT().
1479
1480   @param[in]  Guid        Pointer to a 128-bit unique value that designates which namespace
1481                           to set a value from.  If NULL, then the default token space is used.
1482   @param[in]  TokenNumber The previous PCD token number.  If 0, then retrieves the first PCD
1483                           token number.
1484
1485   @return The next valid token number.
1486
1487 **/
1488 UINTN
1489 EFIAPI
1490 LibPcdGetNextToken (
1491   IN CONST GUID               *Guid,       OPTIONAL
1492   IN UINTN                    TokenNumber
1493   );
1494
1495
1496
1497 /**
1498   Used to retrieve the list of available PCD token space GUIDs.
1499
1500   Returns the PCD token space GUID that follows TokenSpaceGuid in the list of token spaces
1501   in the platform.
1502   If TokenSpaceGuid is NULL, then a pointer to the first PCD token spaces returned.
1503   If TokenSpaceGuid is the last PCD token space GUID in the list, then NULL is returned.
1504
1505   @param  TokenSpaceGuid  Pointer to the a PCD token space GUID
1506
1507   @return The next valid token namespace.
1508
1509 **/
1510 GUID *
1511 EFIAPI
1512 LibPcdGetNextTokenSpace (
1513   IN CONST GUID  *TokenSpaceGuid
1514   );
1515
1516
1517 /**
1518   Sets a value of a patchable PCD entry that is type pointer.
1519
1520   Sets the PCD entry specified by PatchVariable to the value specified by Buffer
1521   and SizeOfBuffer.  Buffer is returned.  If SizeOfBuffer is greater than
1522   MaximumDatumSize, then set SizeOfBuffer to MaximumDatumSize and return
1523   NULL to indicate that the set operation was not actually performed.
1524   If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to
1525   MaximumDatumSize and NULL must be returned.
1526
1527   If PatchVariable is NULL, then ASSERT().
1528   If SizeOfBuffer is NULL, then ASSERT().
1529   If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
1530
1531   @param[out] PatchVariable     A pointer to the global variable in a module that is
1532                                 the target of the set operation.
1533   @param[in] MaximumDatumSize   The maximum size allowed for the PCD entry specified by PatchVariable.
1534   @param[in, out] SizeOfBuffer  A pointer to the size, in bytes, of Buffer.
1535   @param[in] Buffer             A pointer to the buffer to used to set the target variable.
1536
1537   @return Return the pointer to the Buffer that was set.
1538
1539 **/
1540 VOID *
1541 EFIAPI
1542 LibPatchPcdSetPtr (
1543   OUT        VOID       *PatchVariable,
1544   IN        UINTN       MaximumDatumSize,
1545   IN OUT    UINTN       *SizeOfBuffer,
1546   IN CONST  VOID        *Buffer
1547   );
1548
1549 /**
1550   Sets a value of a patchable PCD entry that is type pointer.
1551
1552   Sets the PCD entry specified by PatchVariable to the value specified
1553   by Buffer and SizeOfBuffer. If SizeOfBuffer is greater than MaximumDatumSize,
1554   then set SizeOfBuffer to MaximumDatumSize and return RETURN_INVALID_PARAMETER
1555   to indicate that the set operation was not actually performed.
1556   If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to
1557   MaximumDatumSize and RETURN_INVALID_PARAMETER must be returned.
1558
1559   If PatchVariable is NULL, then ASSERT().
1560   If SizeOfBuffer is NULL, then ASSERT().
1561   If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
1562
1563   @param[out] PatchVariable     A pointer to the global variable in a module that is
1564                                 the target of the set operation.
1565   @param[in] MaximumDatumSize   The maximum size allowed for the PCD entry specified by PatchVariable.
1566   @param[in, out] SizeOfBuffer  A pointer to the size, in bytes, of Buffer.
1567   @param[in] Buffer             A pointer to the buffer to used to set the target variable.
1568
1569   @return The status of the set operation.
1570
1571 **/
1572 RETURN_STATUS
1573 EFIAPI
1574 LibPatchPcdSetPtrS (
1575   OUT      VOID     *PatchVariable,
1576   IN       UINTN    MaximumDatumSize,
1577   IN OUT   UINTN    *SizeOfBuffer,
1578   IN CONST VOID     *Buffer
1579   );
1580
1581 /**
1582   Sets a value and size of a patchable PCD entry that is type pointer.
1583
1584   Sets the PCD entry specified by PatchVariable to the value specified by Buffer
1585   and SizeOfBuffer. Buffer is returned.  If SizeOfBuffer is greater than
1586   MaximumDatumSize, then set SizeOfBuffer to MaximumDatumSize and return
1587   NULL to indicate that the set operation was not actually performed.
1588   If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to
1589   MaximumDatumSize and NULL must be returned.
1590
1591   If PatchVariable is NULL, then ASSERT().
1592   If SizeOfPatchVariable is NULL, then ASSERT().
1593   If SizeOfBuffer is NULL, then ASSERT().
1594   If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
1595
1596   @param[out] PatchVariable     A pointer to the global variable in a module that is
1597                                 the target of the set operation.
1598   @param[out] SizeOfPatchVariable A pointer to the size, in bytes, of PatchVariable.
1599   @param[in] MaximumDatumSize   The maximum size allowed for the PCD entry specified by PatchVariable.
1600   @param[in, out] SizeOfBuffer  A pointer to the size, in bytes, of Buffer.
1601   @param[in] Buffer             A pointer to the buffer to used to set the target variable.
1602
1603   @return Return the pointer to the Buffer that was set.
1604
1605 **/
1606 VOID *
1607 EFIAPI
1608 LibPatchPcdSetPtrAndSize (
1609   OUT       VOID        *PatchVariable,
1610   OUT       UINTN       *SizeOfPatchVariable,
1611   IN        UINTN       MaximumDatumSize,
1612   IN OUT    UINTN       *SizeOfBuffer,
1613   IN CONST  VOID        *Buffer
1614   );
1615
1616 /**
1617   Sets a value and size of a patchable PCD entry that is type pointer.
1618
1619   Sets the PCD entry specified by PatchVariable to the value specified
1620   by Buffer and SizeOfBuffer. If SizeOfBuffer is greater than MaximumDatumSize,
1621   then set SizeOfBuffer to MaximumDatumSize and return RETURN_INVALID_PARAMETER
1622   to indicate that the set operation was not actually performed.
1623   If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to
1624   MaximumDatumSize and RETURN_INVALID_PARAMETER must be returned.
1625
1626   If PatchVariable is NULL, then ASSERT().
1627   If SizeOfPatchVariable is NULL, then ASSERT().
1628   If SizeOfBuffer is NULL, then ASSERT().
1629   If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
1630
1631   @param[out] PatchVariable     A pointer to the global variable in a module that is
1632                                 the target of the set operation.
1633   @param[out] SizeOfPatchVariable A pointer to the size, in bytes, of PatchVariable.
1634   @param[in] MaximumDatumSize   The maximum size allowed for the PCD entry specified by PatchVariable.
1635   @param[in, out] SizeOfBuffer  A pointer to the size, in bytes, of Buffer.
1636   @param[in] Buffer             A pointer to the buffer to used to set the target variable.
1637
1638   @return The status of the set operation.
1639
1640 **/
1641 RETURN_STATUS
1642 EFIAPI
1643 LibPatchPcdSetPtrAndSizeS (
1644   OUT      VOID     *PatchVariable,
1645   OUT      UINTN    *SizeOfPatchVariable,
1646   IN       UINTN    MaximumDatumSize,
1647   IN OUT   UINTN    *SizeOfBuffer,
1648   IN CONST VOID     *Buffer
1649   );
1650
1651 typedef enum {
1652   PCD_TYPE_8,
1653   PCD_TYPE_16,
1654   PCD_TYPE_32,
1655   PCD_TYPE_64,
1656   PCD_TYPE_BOOL,
1657   PCD_TYPE_PTR
1658 } PCD_TYPE;
1659
1660 typedef struct {
1661   ///
1662   /// The returned information associated with the requested TokenNumber. If
1663   /// TokenNumber is 0, then PcdType is set to PCD_TYPE_8.
1664   ///
1665   PCD_TYPE          PcdType;
1666   ///
1667   /// The size of the data in bytes associated with the TokenNumber specified. If
1668   /// TokenNumber is 0, then PcdSize is set 0.
1669   ///
1670   UINTN             PcdSize;
1671   ///
1672   /// The null-terminated ASCII string associated with a given token. If the
1673   /// TokenNumber specified was 0, then this field corresponds to the null-terminated
1674   /// ASCII string associated with the token's namespace Guid. If NULL, there is no
1675   /// name associated with this request.
1676   ///
1677   CHAR8             *PcdName;
1678 } PCD_INFO;
1679
1680
1681 /**
1682   Retrieve additional information associated with a PCD token.
1683
1684   This includes information such as the type of value the TokenNumber is associated with as well as possible
1685   human readable name that is associated with the token.
1686
1687   If TokenNumber is not in the default token space specified, then ASSERT().
1688
1689   @param[in]    TokenNumber The PCD token number.
1690   @param[out]   PcdInfo     The returned information associated with the requested TokenNumber.
1691                             The caller is responsible for freeing the buffer that is allocated by callee for PcdInfo->PcdName.
1692 **/
1693 VOID
1694 EFIAPI
1695 LibPcdGetInfo (
1696   IN        UINTN           TokenNumber,
1697   OUT       PCD_INFO        *PcdInfo
1698   );
1699
1700 /**
1701   Retrieve additional information associated with a PCD token.
1702
1703   This includes information such as the type of value the TokenNumber is associated with as well as possible
1704   human readable name that is associated with the token.
1705
1706   If TokenNumber is not in the token space specified by Guid, then ASSERT().
1707
1708   @param[in]    Guid        The 128-bit unique value that designates the namespace from which to extract the value.
1709   @param[in]    TokenNumber The PCD token number.
1710   @param[out]   PcdInfo     The returned information associated with the requested TokenNumber.
1711                             The caller is responsible for freeing the buffer that is allocated by callee for PcdInfo->PcdName.
1712 **/
1713 VOID
1714 EFIAPI
1715 LibPcdGetInfoEx (
1716   IN CONST  GUID            *Guid,
1717   IN        UINTN           TokenNumber,
1718   OUT       PCD_INFO        *PcdInfo
1719   );
1720
1721 /**
1722   Retrieve the currently set SKU Id.
1723
1724   @return   The currently set SKU Id. If the platform has not set at a SKU Id, then the
1725             default SKU Id value of 0 is returned. If the platform has set a SKU Id, then the currently set SKU
1726             Id is returned.
1727 **/
1728 UINTN
1729 EFIAPI
1730 LibPcdGetSku (
1731   VOID
1732   );
1733
1734 #endif