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