xref: /freebsd/sys/contrib/edk2/Include/Library/PcdLib.h (revision 4928135658a9d0eaee37003df6137ab363fcb0b4)
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 - 2017, 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 
38   @param   TokenName  The name of the PCD token to retrieve the token number for.
39 
40   @return  The token number associated with the PCD.
41 
42 **/
43 #define PcdToken(TokenName)                 _PCD_TOKEN_##TokenName
44 
45 
46 /**
47   Retrieves a Boolean PCD feature flag based on a token name.
48 
49   Returns the Boolean value for the PCD feature flag specified by TokenName.
50   If TokenName is not a valid token in the token space, then the module will not build.
51   If TokenName is not a feature flag PCD, then the module will not build.
52 
53   @param   TokenName  The name of the PCD token to retrieve a current value for.
54 
55   @return  Boolean value for the PCD feature flag.
56 
57 **/
58 #define FeaturePcdGet(TokenName)            _PCD_GET_MODE_BOOL_##TokenName
59 
60 
61 /**
62   Retrieves an 8-bit fixed PCD token value based on a token name.
63 
64   Returns the 8-bit value for the token specified by TokenName.
65   If TokenName is not a valid token in the token space, then the module will not build.
66   If TokenName is not a fixed at build PCD, then the module will not build.
67 
68   @param   TokenName  The name of the PCD token to retrieve a current value for.
69 
70   @return  8-bit value for the token specified by TokenName.
71 
72 **/
73 #define FixedPcdGet8(TokenName)             _PCD_VALUE_##TokenName
74 
75 
76 /**
77   Retrieves a 16-bit fixed PCD token value based on a token name.
78 
79   Returns the 16-bit value for the token specified by TokenName.
80   If TokenName is not a valid token in the token space, then the module will not build.
81   If TokenName is not a fixed at build PCD, then the module will not build.
82 
83   @param   TokenName  The name of the PCD token to retrieve a current value for.
84 
85   @return  16-bit value for the token specified by TokenName.
86 
87 **/
88 #define FixedPcdGet16(TokenName)            _PCD_VALUE_##TokenName
89 
90 
91 /**
92   Retrieves a 32-bit fixed PCD token value based on a token name.
93 
94   Returns the 32-bit value for the token specified by TokenName.
95   If TokenName is not a valid token in the token space, then the module will not build.
96   If TokenName is not a fixed at build PCD, then the module will not build.
97 
98   @param   TokenName  The name of the PCD token to retrieve a current value for.
99 
100   @return  32-bit value for the token specified by TokenName.
101 
102 **/
103 #define FixedPcdGet32(TokenName)            _PCD_VALUE_##TokenName
104 
105 
106 /**
107   Retrieves a 64-bit fixed PCD token value based on a token name.
108 
109   Returns the 64-bit value for the token specified by TokenName.
110   If TokenName is not a valid token in the token space, then the module will not build.
111   If TokenName is not a fixed at build PCD, then the module will not build.
112 
113   @param   TokenName  The name of the PCD token to retrieve a current value for.
114 
115   @return  64-bit value for the token specified by TokenName.
116 
117 **/
118 #define FixedPcdGet64(TokenName)            _PCD_VALUE_##TokenName
119 
120 
121 /**
122   Retrieves a Boolean fixed PCD token value based on a token name.
123 
124   Returns the Boolean value for the token specified by TokenName.
125   If TokenName is not a valid token in the token space, then the module will not build.
126   If TokenName is not a fixed at build PCD, then the module will not build.
127 
128   @param   TokenName  The name of the PCD token to retrieve a current value for.
129 
130   @return  The Boolean value for the token.
131 
132 **/
133 #define FixedPcdGetBool(TokenName)          _PCD_VALUE_##TokenName
134 
135 
136 /**
137   Retrieves a pointer to a fixed PCD token buffer based on a token name.
138 
139   Returns a pointer to the buffer for the token specified by TokenName.
140   If TokenName is not a valid token in the token space, then the module will not build.
141   If TokenName is not a fixed at build PCD, then the module will not build.
142 
143   @param   TokenName  The name of the PCD token to retrieve a current value for.
144 
145   @return  A pointer to the buffer.
146 
147 **/
148 #define FixedPcdGetPtr(TokenName)           ((VOID *)_PCD_VALUE_##TokenName)
149 
150 
151 /**
152   Retrieves an 8-bit binary patchable PCD token value based on a token name.
153 
154   Returns the 8-bit value for the token specified by TokenName.
155   If TokenName is not a valid token in the token space, then the module will not build.
156   If TokenName is not a patchable in module PCD, then the module will not build.
157 
158   @param   TokenName  The name of the PCD token to retrieve a current value for.
159 
160   @return  An 8-bit binary patchable PCD token value.
161 
162 **/
163 #define PatchPcdGet8(TokenName)             _gPcd_BinaryPatch_##TokenName
164 
165 /**
166   Retrieves a 16-bit binary patchable PCD token value based on a token name.
167 
168   Returns the 16-bit value for the token specified by TokenName.
169   If TokenName is not a valid token in the token space, then the module will not build.
170   If TokenName is not a patchable in module PCD, then the module will not build.
171 
172   @param   TokenName  The name of the PCD token to retrieve a current value for.
173 
174   @return  A 16-bit binary patchable PCD token value.
175 
176 **/
177 #define PatchPcdGet16(TokenName)            _gPcd_BinaryPatch_##TokenName
178 
179 
180 /**
181   Retrieves a 32-bit binary patchable PCD token value based on a token name.
182 
183   Returns the 32-bit value for the token specified by TokenName.
184   If TokenName is not a valid token in the token space, then the module will not build.
185   If TokenName is not a patchable in module PCD, then the module will not build.
186 
187   @param   TokenName  The name of the PCD token to retrieve a current value for.
188 
189   @return  A 32-bit binary patchable PCD token value.
190 
191 **/
192 #define PatchPcdGet32(TokenName)            _gPcd_BinaryPatch_##TokenName
193 
194 
195 /**
196   Retrieves a 64-bit binary patchable PCD token value based on a token name.
197 
198   Returns the 64-bit value for the token specified by TokenName.
199   If TokenName is not a valid token in the token space, then the module will not build.
200   If TokenName is not a patchable in module PCD, then the module will not build.
201 
202   @param   TokenName  The name of the PCD token to retrieve a current value for.
203 
204   @return  A 64-bit binary patchable PCD token value.
205 
206 **/
207 #define PatchPcdGet64(TokenName)            _gPcd_BinaryPatch_##TokenName
208 
209 
210 /**
211   Retrieves a Boolean binary patchable PCD token value based on a token name.
212 
213   Returns the Boolean value for the token specified by TokenName.
214   If TokenName is not a valid token in the token space, then the module will not build.
215   If TokenName is not a patchable in module PCD, then the module will not build.
216 
217   @param   TokenName  The name of the PCD token to retrieve a current value for.
218 
219   @return  The Boolean value for the token.
220 
221 **/
222 #define PatchPcdGetBool(TokenName)          _gPcd_BinaryPatch_##TokenName
223 
224 
225 /**
226   Retrieves a pointer to a binary patchable PCD token buffer based on a token name.
227 
228   Returns a pointer to the buffer for the token specified by TokenName.
229   If TokenName is not a valid token in the token space, then the module will not build.
230   If TokenName is not a patchable in module PCD, then the module will not build.
231 
232   @param   TokenName  The name of the PCD token to retrieve a current value for.
233 
234   @return  A pointer to the buffer for the token.
235 
236 **/
237 #define PatchPcdGetPtr(TokenName)           ((VOID *)_gPcd_BinaryPatch_##TokenName)
238 
239 
240 /**
241   Sets an 8-bit binary patchable PCD token value based on a token name.
242 
243   Sets the 8-bit value for the token specified by TokenName. Value is returned.
244   If TokenName is not a valid token in the token space, then the module will not build.
245   If TokenName is not a patchable in module PCD, then the module will not build.
246 
247   @param   TokenName  The name of the binary patchable PCD token to set the current value for.
248   @param   Value      The 8-bit value to set.
249 
250   @return Return the Value that was set.
251 
252 **/
253 #define PatchPcdSet8(TokenName, Value)      (_gPcd_BinaryPatch_##TokenName = (Value))
254 
255 
256 /**
257   Sets a 16-bit binary patchable PCD token value based on a token name.
258 
259   Sets the 16-bit value for the token specified by TokenName. Value is returned.
260   If TokenName is not a valid token in the token space, then the module will not build.
261   If TokenName is not a patchable in module PCD, then the module will not build.
262 
263   @param   TokenName  The name of the binary patchable PCD token to set the current value for.
264   @param   Value      The 16-bit value to set.
265 
266   @return Return the Value that was set.
267 
268 **/
269 #define PatchPcdSet16(TokenName, Value)     (_gPcd_BinaryPatch_##TokenName = (Value))
270 
271 
272 /**
273   Sets a 32-bit binary patchable PCD token value based on a token name.
274 
275   Sets the 32-bit value for the token specified by TokenName. Value is returned.
276   If TokenName is not a valid token in the token space, then the module will not build.
277   If TokenName is not a patchable in module PCD, then the module will not build.
278 
279   @param   TokenName  The name of the binary patchable PCD token to set the current value for.
280   @param   Value      The 32-bit value to set.
281 
282   @return Return the Value that was set.
283 
284 **/
285 #define PatchPcdSet32(TokenName, Value)     (_gPcd_BinaryPatch_##TokenName = (Value))
286 
287 
288 /**
289   Sets a 64-bit binary patchable PCD token value based on a token name.
290 
291   Sets the 64-bit value for the token specified by TokenName. Value is returned.
292   If TokenName is not a valid token in the token space, then the module will not build.
293   If TokenName is not a patchable in module PCD, then the module will not build.
294 
295   @param   TokenName  The name of the binary patchable PCD token to set the current value for.
296   @param   Value      The 64-bit value to set.
297 
298   @return Return the Value that was set.
299 
300 **/
301 #define PatchPcdSet64(TokenName, Value)     (_gPcd_BinaryPatch_##TokenName = (Value))
302 
303 
304 /**
305   Sets a Boolean binary patchable PCD token value based on a token name.
306 
307   Sets the Boolean value for the token specified by TokenName. Value is returned.
308   If TokenName is not a valid token in the token space, then the module will not build.
309   If TokenName is not a patchable in module PCD, then the module will not build.
310 
311   @param   TokenName  The name of the binary patchable PCD token to set the current value for.
312   @param   Value      The boolean value to set.
313 
314   @return Return the Value that was set.
315 
316 **/
317 #define PatchPcdSetBool(TokenName, Value)   (_gPcd_BinaryPatch_##TokenName = (Value))
318 
319 
320 /**
321   Sets a pointer to a binary patchable PCD token buffer based on a token name.
322 
323   Sets the buffer for the token specified by TokenName.  Buffer is returned.
324   If SizeOfBuffer is greater than the maximum size supported by TokenName, then set SizeOfBuffer
325   to the maximum size supported by TokenName and return NULL to indicate that the set operation
326   was not actually performed.  If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be
327   set to the maximum size supported by TokenName and NULL must be returned.
328   If TokenName is not a valid token in the token space, then the module will not build.
329   If TokenName is not a patchable in module PCD, then the module will not build.
330 
331   If SizeOfBuffer is NULL, then ASSERT().
332   If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
333 
334   @param   TokenName      The name of the binary patchable PCD token to set the current value for.
335   @param   SizeOfBuffer   A pointer to the size, in bytes, of Buffer.
336   @param   Buffer         Pointer to the value to set.
337 
338   @return Return the pointer to the Buffer that was set.
339 
340 **/
341 #define PatchPcdSetPtr(TokenName, Size, Buffer) \
342                                             LibPatchPcdSetPtrAndSize (                 \
343                                               (VOID *)_gPcd_BinaryPatch_##TokenName,   \
344                                               &_gPcd_BinaryPatch_Size_##TokenName,     \
345                                               (UINTN)_PCD_PATCHABLE_##TokenName##_SIZE, \
346                                               (Size),                                  \
347                                               (Buffer)                                 \
348                                               )
349 /**
350   Retrieves an 8-bit PCD token value based on a token name.
351 
352   Returns the 8-bit value for the token specified by TokenName.
353   If TokenName is not a valid token in the token space, then the module will not build.
354 
355   @param   TokenName  The name of the PCD token to retrieve a current value for.
356 
357   @return  8-bit value for the token specified by TokenName.
358 
359 **/
360 #define PcdGet8(TokenName)                  _PCD_GET_MODE_8_##TokenName
361 
362 
363 /**
364   Retrieves a 16-bit PCD token value based on a token name.
365 
366   Returns the 16-bit value for the token specified by TokenName.
367   If TokenName is not a valid token in the token space, then the module will not build.
368 
369   @param   TokenName  The name of the PCD token to retrieve a current value for.
370 
371   @return  16-bit value for the token specified by TokenName.
372 
373 **/
374 #define PcdGet16(TokenName)                 _PCD_GET_MODE_16_##TokenName
375 
376 
377 /**
378   Retrieves a 32-bit PCD token value based on a token name.
379 
380   Returns the 32-bit value for the token specified by TokenName.
381   If TokenName is not a valid token in the token space, then the module will not build.
382 
383   @param   TokenName  The name of the PCD token to retrieve a current value for.
384 
385   @return  32-bit value for the token specified by TokenName.
386 
387 **/
388 #define PcdGet32(TokenName)                 _PCD_GET_MODE_32_##TokenName
389 
390 
391 /**
392   Retrieves a 64-bit PCD token value based on a token name.
393 
394   Returns the 64-bit value for the token specified by TokenName.
395   If TokenName is not a valid token in the token space, then the module will not build.
396 
397   @param   TokenName  The name of the PCD token to retrieve a current value for.
398 
399   @return  64-bit value for the token specified by TokenName.
400 
401 **/
402 #define PcdGet64(TokenName)                 _PCD_GET_MODE_64_##TokenName
403 
404 
405 /**
406   Retrieves a pointer to a PCD token buffer based on a token name.
407 
408   Returns a pointer to the buffer for the token specified by TokenName.
409   If TokenName is not a valid token in the token space, then the module will not build.
410 
411   @param   TokenName  The name of the PCD token to retrieve a current value for.
412 
413   @return  A pointer to the buffer.
414 
415 **/
416 #define PcdGetPtr(TokenName)                _PCD_GET_MODE_PTR_##TokenName
417 
418 
419 /**
420   Retrieves a Boolean PCD token value based on a token name.
421 
422   Returns the Boolean value for the token specified by TokenName.
423   If TokenName is not a valid token in the token space, then the module will not build.
424 
425   @param   TokenName  The name of the PCD token to retrieve a current value for.
426 
427   @return  A Boolean PCD token value.
428 
429 **/
430 #define PcdGetBool(TokenName)               _PCD_GET_MODE_BOOL_##TokenName
431 
432 
433 /**
434   Retrieves the size of a fixed PCD token based on a token name.
435 
436   Returns the size of the token specified by TokenName.
437   If TokenName is not a valid token in the token space, then the module will not build.
438 
439   @param[in]  TokenName  The name of the PCD token to retrieve a current value size for.
440 
441   @return     Return the size
442 
443 **/
444 #define FixedPcdGetSize(TokenName)    _PCD_SIZE_##TokenName
445 
446 
447 /**
448   Retrieves the size of a binary patchable PCD token based on a token name.
449 
450   Returns the size of the token specified by TokenName.
451   If TokenName is not a valid token in the token space, then the module will not build.
452 
453   @param[in]  TokenName  The name of the PCD token to retrieve a current value size for.
454 
455   @return     Return the size
456 
457 **/
458 #define PatchPcdGetSize(TokenName)    _gPcd_BinaryPatch_Size_##TokenName
459 
460 
461 /**
462   Retrieves the size of the PCD token based on a token name.
463 
464   Returns the size of the token specified by TokenName.
465   If TokenName is not a valid token in the token space, then the module will not build.
466 
467   @param[in]   TokenName  The name of the PCD token to retrieve a current value size for.
468 
469   @return      Return the size
470 
471 **/
472 #define PcdGetSize(TokenName)         _PCD_GET_MODE_SIZE_##TokenName
473 
474 
475 /**
476   Retrieve the size of a given PCD token.
477 
478   Returns the size of the token specified by TokenNumber and Guid.
479   If Guid is NULL, then ASSERT().
480 
481   @param[in]  Guid          Pointer to a 128-bit unique value that designates
482                             which namespace to retrieve a value from.
483   @param[in]  TokenNumber   The PCD token number to retrieve a current value size for.
484 
485   @return     Return the size.
486 
487 **/
488 #define PcdGetExSize(Guid, TokenName) LibPcdGetExSize ((Guid), PcdTokenEx(Guid,TokenName))
489 
490 #ifndef DISABLE_NEW_DEPRECATED_INTERFACES
491 /**
492   Sets an 8-bit PCD token value based on a token name.
493 
494   Sets the 8-bit value for the token specified by TokenName. Value is returned.
495   If TokenName is not a valid token in the token space, then the module will not build.
496 
497   @param   TokenName  The name of the PCD token to retrieve a current value for.
498   @param   Value      The 8-bit value to set.
499 
500   @return Return the Value that was set.
501 
502 **/
503 #define PcdSet8(TokenName, Value)           _PCD_SET_MODE_8_##TokenName     ((Value))
504 
505 
506 /**
507   Sets a 16-bit PCD token value based on a token name.
508 
509   Sets the 16-bit value for the token specified by TokenName. Value is returned.
510   If TokenName is not a valid token in the token space, then the module will not build.
511 
512   @param   TokenName  The name of the PCD token to retrieve a current value for.
513   @param   Value      The 16-bit value to set.
514 
515   @return Return the Value that was set.
516 
517 **/
518 #define PcdSet16(TokenName, Value)          _PCD_SET_MODE_16_##TokenName    ((Value))
519 
520 
521 /**
522   Sets a 32-bit PCD token value based on a token name.
523 
524   Sets the 32-bit value for the token specified by TokenName. Value is returned.
525   If TokenName is not a valid token in the token space, then the module will not build.
526 
527   @param   TokenName  The name of the PCD token to retrieve a current value for.
528   @param   Value      The 32-bit value to set.
529 
530   @return Return the Value that was set.
531 
532 **/
533 #define PcdSet32(TokenName, Value)          _PCD_SET_MODE_32_##TokenName    ((Value))
534 
535 
536 /**
537   Sets a 64-bit PCD token value based on a token name.
538 
539   Sets the 64-bit value for the token specified by TokenName. Value is returned.
540   If TokenName is not a valid token in the token space, then the module will not build.
541 
542   @param   TokenName  The name of the PCD token to retrieve a current value for.
543   @param   Value      The 64-bit value to set.
544 
545   @return Return the Value that was set.
546 
547 **/
548 #define PcdSet64(TokenName, Value)          _PCD_SET_MODE_64_##TokenName    ((Value))
549 
550 
551 /**
552   Sets a pointer to a PCD token buffer based on a token name.
553 
554   Sets the buffer for the token specified by TokenName. Buffer is returned.
555   If SizeOfBuffer is greater than the maximum size supported by TokenName,
556   then set SizeOfBuffer to the maximum size supported by TokenName and return NULL
557   to indicate that the set operation was not actually performed.  If SizeOfBuffer
558   is set to MAX_ADDRESS, then SizeOfBuffer must be set to the maximum size supported
559   by TokenName and NULL must be returned.
560   If TokenName is not a valid token in the token space, then the module will not build.
561 
562   If SizeOfBuffer is NULL, then ASSERT().
563   If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
564 
565   @param   TokenName      The name of the PCD token to set the current value for.
566   @param   SizeOfBuffer   A pointer to the size, in bytes, of Buffer.
567   @param   Buffer         A pointer to the buffer to set.
568 
569   @return Return the pointer to the Buffer that was set.
570 
571 **/
572 #define PcdSetPtr(TokenName, SizeOfBuffer, Buffer) \
573                                             _PCD_SET_MODE_PTR_##TokenName   ((SizeOfBuffer), (Buffer))
574 
575 /**
576   Sets a Boolean PCD token value based on a token name.
577 
578   Sets the Boolean value for the token specified by TokenName. Value is returned.
579   If TokenName is not a valid token in the token space, then the module will not build.
580 
581   @param   TokenName      The name of the PCD token to set the current value for.
582   @param   Buffer         The Boolean value to set.
583 
584   @return Return the Value that was set.
585 
586 **/
587 #define PcdSetBool(TokenName, Value)        _PCD_SET_MODE_BOOL_##TokenName  ((Value))
588 #endif
589 
590 /**
591   Sets a 8-bit PCD token value based on a token name.
592 
593   Sets the 8-bit value for the token specified by TokenName.
594   If TokenName is not a valid token in the token space, then the module will not build.
595 
596   @param TokenName  The name of the PCD token to retrieve a current value for.
597   @param Value      The 8-bit value to set.
598 
599   @return The status of the set operation.
600 
601 **/
602 #define PcdSet8S(TokenName, Value)          _PCD_SET_MODE_8_S_##TokenName    ((Value))
603 
604 /**
605   Sets a 16-bit PCD token value based on a token name.
606 
607   Sets the 16-bit value for the token specified by TokenName.
608   If TokenName is not a valid token in the token space, then the module will not build.
609 
610   @param TokenName  The name of the PCD token to retrieve a current value for.
611   @param Value      The 16-bit value to set.
612 
613   @return The status of the set operation.
614 
615 **/
616 #define PcdSet16S(TokenName, Value)         _PCD_SET_MODE_16_S_##TokenName    ((Value))
617 
618 /**
619   Sets a 32-bit PCD token value based on a token name.
620 
621   Sets the 32-bit value for the token specified by TokenName.
622   If TokenName is not a valid token in the token space, then the module will not build.
623 
624   @param TokenName  The name of the PCD token to retrieve a current value for.
625   @param Value      The 32-bit value to set.
626 
627   @return The status of the set operation.
628 
629 **/
630 #define PcdSet32S(TokenName, Value)         _PCD_SET_MODE_32_S_##TokenName    ((Value))
631 
632 /**
633   Sets a 64-bit PCD token value based on a token name.
634 
635   Sets the 64-bit value for the token specified by TokenName.
636   If TokenName is not a valid token in the token space, then the module will not build.
637 
638   @param TokenName  The name of the PCD token to retrieve a current value for.
639   @param Value      The 64-bit value to set.
640 
641   @return The status of the set operation.
642 
643 **/
644 #define PcdSet64S(TokenName, Value)         _PCD_SET_MODE_64_S_##TokenName    ((Value))
645 
646 /**
647   Sets a pointer to a PCD token buffer based on a token name.
648 
649   Sets the buffer for the token specified by TokenName.
650   If SizeOfBuffer is greater than the maximum size supported by TokenName,
651   then set SizeOfBuffer to the maximum size supported by TokenName and return
652   RETURN_INVALID_PARAMETER to indicate that the set operation was not actually performed.
653   If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to the maximum size
654   supported by TokenName and RETURN_INVALID_PARAMETER must be returned.
655   If TokenName is not a valid token in the token space, then the module will not build.
656 
657   If SizeOfBuffer is NULL, then ASSERT().
658   If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
659 
660   @param TokenName      The name of the PCD token to set the current value for.
661   @param SizeOfBuffer   A pointer to the size, in bytes, of Buffer.
662   @param Buffer         A pointer to the buffer to set.
663 
664   @return The status of the set operation.
665 
666 **/
667 #define PcdSetPtrS(TokenName, SizeOfBuffer, Buffer) \
668                                             _PCD_SET_MODE_PTR_S_##TokenName   ((SizeOfBuffer), (Buffer))
669 
670 
671 
672 /**
673   Sets a boolean PCD token value based on a token name.
674 
675   Sets the boolean value for the token specified by TokenName.
676   If TokenName is not a valid token in the token space, then the module will not build.
677 
678   @param TokenName  The name of the PCD token to retrieve a current value for.
679   @param Value      The boolean value to set.
680 
681   @return The status of the set operation.
682 
683 **/
684 #define PcdSetBoolS(TokenName, Value)       _PCD_SET_MODE_BOOL_S_##TokenName    ((Value))
685 
686 /**
687   Retrieves a token number based on a GUID and a token name.
688 
689   Returns the token number for the token specified by Guid and TokenName.
690   If TokenName is not a valid token in the token space, then the module will not build.
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