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