198944Sobrien/** @file
2130809Smarcel  Provides library services to get and set Platform Configuration Database entries.
398944Sobrien
498944Sobrien  PCD Library Class provides a PCD usage macro interface for all PCD types.
598944Sobrien  It should be included in any module that uses PCD. If a module uses dynamic/dynamicex
698944Sobrien  PCD, module should be linked to a PEIM/DXE library instance to access that PCD.
798944Sobrien  If a module uses PatchableInModule type PCD, it also needs the library instance to produce
898944Sobrien  LibPatchPcdSetPtr() interface. For FeatureFlag/Fixed PCD, the macro interface is
998944Sobrien  translated to a variable or macro that is auto-generated by build tool in
1098944Sobrien  module's autogen.h/autogen.c.
1198944Sobrien  The PcdGetXX(), PcdSetXX(), PcdToken(), and PcdGetNextTokenSpace() operations are
1298944Sobrien  only available prior to ExitBootServices().  If access to PCD values are required
1398944Sobrien  at runtime, then their values must be collected prior to ExitBootServices().
1498944Sobrien  There are no restrictions on the use of FeaturePcd(), FixedPcdGetXX(),
1598944Sobrien  PatchPcdGetXX(), and PatchPcdSetXX().
1698944Sobrien
1798944SobrienCopyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
1898944SobrienThis program and the accompanying materials
1998944Sobrienare licensed and made available under the terms and conditions of the BSD License
2098944Sobrienwhich accompanies this distribution.  The full text of the license may be found at
2198944Sobrienhttp://opensource.org/licenses/bsd-license.php
2298944Sobrien
2398944SobrienTHE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
2498944SobrienWITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
2598944Sobrien
2698944Sobrien**/
2798944Sobrien
2898944Sobrien#ifndef __PCD_LIB_H__
2998944Sobrien#define __PCD_LIB_H__
3098944Sobrien
3198944Sobrien
3298944Sobrien/**
3398944Sobrien  Retrieves a token number based on a token name.
3498944Sobrien
3598944Sobrien  Returns the token number associated with the PCD token specified by TokenName.
3698944Sobrien  If TokenName is not a valid token in the token space, then the module will not build.
3798944Sobrien
3898944Sobrien  @param   TokenName  The name of the PCD token to retrieve the token number for.
3998944Sobrien
4098944Sobrien  @return  The token number associated with the PCD.
4198944Sobrien
4298944Sobrien**/
4398944Sobrien#define PcdToken(TokenName)                 _PCD_TOKEN_##TokenName
4498944Sobrien
4598944Sobrien
46130809Smarcel/**
4798944Sobrien  Retrieves a Boolean PCD feature flag based on a token name.
4898944Sobrien
4998944Sobrien  Returns the Boolean value for the PCD feature flag specified by TokenName.
5098944Sobrien  If TokenName is not a valid token in the token space, then the module will not build.
5198944Sobrien  If TokenName is not a feature flag PCD, then the module will not build.
5298944Sobrien
5398944Sobrien  @param   TokenName  The name of the PCD token to retrieve a current value for.
5498944Sobrien
5598944Sobrien  @return  Boolean value for the PCD feature flag.
5698944Sobrien
5798944Sobrien**/
5898944Sobrien#define FeaturePcdGet(TokenName)            _PCD_GET_MODE_BOOL_##TokenName
5998944Sobrien
6098944Sobrien
6198944Sobrien/**
6298944Sobrien  Retrieves an 8-bit fixed PCD token value based on a token name.
6398944Sobrien
6498944Sobrien  Returns the 8-bit value for the token specified by TokenName.
6598944Sobrien  If TokenName is not a valid token in the token space, then the module will not build.
6698944Sobrien  If TokenName is not a fixed at build PCD, then the module will not build.
6798944Sobrien
6898944Sobrien  @param   TokenName  The name of the PCD token to retrieve a current value for.
6998944Sobrien
7098944Sobrien  @return  8-bit value for the token specified by TokenName.
7198944Sobrien
7298944Sobrien**/
7398944Sobrien#define FixedPcdGet8(TokenName)             _PCD_VALUE_##TokenName
7498944Sobrien
7598944Sobrien
7698944Sobrien/**
7798944Sobrien  Retrieves a 16-bit fixed PCD token value based on a token name.
7898944Sobrien
7998944Sobrien  Returns the 16-bit value for the token specified by TokenName.
8098944Sobrien  If TokenName is not a valid token in the token space, then the module will not build.
8198944Sobrien  If TokenName is not a fixed at build PCD, then the module will not build.
8298944Sobrien
8398944Sobrien  @param   TokenName  The name of the PCD token to retrieve a current value for.
8498944Sobrien
8598944Sobrien  @return  16-bit value for the token specified by TokenName.
8698944Sobrien
8798944Sobrien**/
8898944Sobrien#define FixedPcdGet16(TokenName)            _PCD_VALUE_##TokenName
8998944Sobrien
9098944Sobrien
9198944Sobrien/**
9298944Sobrien  Retrieves a 32-bit fixed PCD token value based on a token name.
9398944Sobrien
9498944Sobrien  Returns the 32-bit value for the token specified by TokenName.
9598944Sobrien  If TokenName is not a valid token in the token space, then the module will not build.
9698944Sobrien  If TokenName is not a fixed at build PCD, then the module will not build.
9798944Sobrien
9898944Sobrien  @param   TokenName  The name of the PCD token to retrieve a current value for.
9998944Sobrien
10098944Sobrien  @return  32-bit value for the token specified by TokenName.
10198944Sobrien
10298944Sobrien**/
10398944Sobrien#define FixedPcdGet32(TokenName)            _PCD_VALUE_##TokenName
10498944Sobrien
10598944Sobrien
10698944Sobrien/**
10798944Sobrien  Retrieves a 64-bit fixed PCD token value based on a token name.
10898944Sobrien
10998944Sobrien  Returns the 64-bit value for the token specified by TokenName.
11098944Sobrien  If TokenName is not a valid token in the token space, then the module will not build.
11198944Sobrien  If TokenName is not a fixed at build PCD, then the module will not build.
11298944Sobrien
11398944Sobrien  @param   TokenName  The name of the PCD token to retrieve a current value for.
11498944Sobrien
11598944Sobrien  @return  64-bit value for the token specified by TokenName.
11698944Sobrien
11798944Sobrien**/
11898944Sobrien#define FixedPcdGet64(TokenName)            _PCD_VALUE_##TokenName
11998944Sobrien
12098944Sobrien
12198944Sobrien/**
12298944Sobrien  Retrieves a Boolean fixed PCD token value based on a token name.
12398944Sobrien
12498944Sobrien  Returns the Boolean value for the token specified by TokenName.
12598944Sobrien  If TokenName is not a valid token in the token space, then the module will not build.
12698944Sobrien  If TokenName is not a fixed at build PCD, then the module will not build.
12798944Sobrien
12898944Sobrien  @param   TokenName  The name of the PCD token to retrieve a current value for.
129130809Smarcel
13098944Sobrien  @return  The Boolean value for the token.
13198944Sobrien
13298944Sobrien**/
13398944Sobrien#define FixedPcdGetBool(TokenName)          _PCD_VALUE_##TokenName
13498944Sobrien
13598944Sobrien
13698944Sobrien/**
13798944Sobrien  Retrieves a pointer to a fixed PCD token buffer based on a token name.
13898944Sobrien
13998944Sobrien  Returns a pointer to the buffer for the token specified by TokenName.
14098944Sobrien  If TokenName is not a valid token in the token space, then the module will not build.
14198944Sobrien  If TokenName is not a fixed at build PCD, then the module will not build.
14298944Sobrien
14398944Sobrien  @param   TokenName  The name of the PCD token to retrieve a current value for.
14498944Sobrien
14598944Sobrien  @return  A pointer to the buffer.
14698944Sobrien
147130809Smarcel**/
14898944Sobrien#define FixedPcdGetPtr(TokenName)           ((VOID *)_PCD_VALUE_##TokenName)
14998944Sobrien
15098944Sobrien
15198944Sobrien/**
152130809Smarcel  Retrieves an 8-bit binary patchable PCD token value based on a token name.
15398944Sobrien
15498944Sobrien  Returns the 8-bit value for the token specified by TokenName.
15598944Sobrien  If TokenName is not a valid token in the token space, then the module will not build.
15698944Sobrien  If TokenName is not a patchable in module PCD, then the module will not build.
15798944Sobrien
15898944Sobrien  @param   TokenName  The name of the PCD token to retrieve a current value for.
15998944Sobrien
160130809Smarcel  @return  An 8-bit binary patchable PCD token value.
16198944Sobrien
16298944Sobrien**/
16398944Sobrien#define PatchPcdGet8(TokenName)             _gPcd_BinaryPatch_##TokenName
16498944Sobrien
16598944Sobrien/**
16698944Sobrien  Retrieves a 16-bit binary patchable PCD token value based on a token name.
16798944Sobrien
16898944Sobrien  Returns the 16-bit value for the token specified by TokenName.
16998944Sobrien  If TokenName is not a valid token in the token space, then the module will not build.
17098944Sobrien  If TokenName is not a patchable in module PCD, then the module will not build.
17198944Sobrien
17298944Sobrien  @param   TokenName  The name of the PCD token to retrieve a current value for.
17398944Sobrien
17498944Sobrien  @return  A 16-bit binary patchable PCD token value.
17598944Sobrien
17698944Sobrien**/
17798944Sobrien#define PatchPcdGet16(TokenName)            _gPcd_BinaryPatch_##TokenName
17898944Sobrien
17998944Sobrien
18098944Sobrien/**
18198944Sobrien  Retrieves a 32-bit binary patchable PCD token value based on a token name.
18298944Sobrien
18398944Sobrien  Returns the 32-bit value for the token specified by TokenName.
18498944Sobrien  If TokenName is not a valid token in the token space, then the module will not build.
18598944Sobrien  If TokenName is not a patchable in module PCD, then the module will not build.
18698944Sobrien
18798944Sobrien  @param   TokenName  The name of the PCD token to retrieve a current value for.
18898944Sobrien
18998944Sobrien  @return  A 32-bit binary patchable PCD token value.
19098944Sobrien
19198944Sobrien**/
19298944Sobrien#define PatchPcdGet32(TokenName)            _gPcd_BinaryPatch_##TokenName
19398944Sobrien
19498944Sobrien
19598944Sobrien/**
19698944Sobrien  Retrieves a 64-bit binary patchable PCD token value based on a token name.
19798944Sobrien
198130809Smarcel  Returns the 64-bit value for the token specified by TokenName.
199130809Smarcel  If TokenName is not a valid token in the token space, then the module will not build.
200130809Smarcel  If TokenName is not a patchable in module PCD, then the module will not build.
20198944Sobrien
20298944Sobrien  @param   TokenName  The name of the PCD token to retrieve a current value for.
203130809Smarcel
20498944Sobrien  @return  A 64-bit binary patchable PCD token value.
20598944Sobrien
20698944Sobrien**/
20798944Sobrien#define PatchPcdGet64(TokenName)            _gPcd_BinaryPatch_##TokenName
20898944Sobrien
20998944Sobrien
21098944Sobrien/**
211130809Smarcel  Retrieves a Boolean binary patchable PCD token value based on a token name.
21298944Sobrien
21398944Sobrien  Returns the Boolean value for the token specified by TokenName.
21498944Sobrien  If TokenName is not a valid token in the token space, then the module will not build.
21598944Sobrien  If TokenName is not a patchable in module PCD, then the module will not build.
21698944Sobrien
21798944Sobrien  @param   TokenName  The name of the PCD token to retrieve a current value for.
218130809Smarcel
21998944Sobrien  @return  The Boolean value for the token.
22098944Sobrien
22198944Sobrien**/
22298944Sobrien#define PatchPcdGetBool(TokenName)          _gPcd_BinaryPatch_##TokenName
22398944Sobrien
22498944Sobrien
22598944Sobrien/**
22698944Sobrien  Retrieves a pointer to a binary patchable PCD token buffer based on a token name.
22798944Sobrien
22898944Sobrien  Returns a pointer to the buffer for the token specified by TokenName.
22998944Sobrien  If TokenName is not a valid token in the token space, then the module will not build.
23098944Sobrien  If TokenName is not a patchable in module PCD, then the module will not build.
23198944Sobrien
23298944Sobrien  @param   TokenName  The name of the PCD token to retrieve a current value for.
23398944Sobrien
23498944Sobrien  @return  A pointer to the buffer for the token.
23598944Sobrien
23698944Sobrien**/
23798944Sobrien#define PatchPcdGetPtr(TokenName)           ((VOID *)_gPcd_BinaryPatch_##TokenName)
23898944Sobrien
23998944Sobrien
24098944Sobrien/**
24198944Sobrien  Sets an 8-bit binary patchable PCD token value based on a token name.
24298944Sobrien
24398944Sobrien  Sets the 8-bit value for the token specified by TokenName. Value is returned.
24498944Sobrien  If TokenName is not a valid token in the token space, then the module will not build.
24598944Sobrien  If TokenName is not a patchable in module PCD, then the module will not build.
24698944Sobrien
24798944Sobrien  @param   TokenName  The name of the binary patchable PCD token to set the current value for.
24898944Sobrien  @param   Value      The 8-bit value to set.
24998944Sobrien
25098944Sobrien  @return Return the Value that was set.
25198944Sobrien
25298944Sobrien**/
253130809Smarcel#define PatchPcdSet8(TokenName, Value)      (_gPcd_BinaryPatch_##TokenName = (Value))
254130809Smarcel
255130809Smarcel
25698944Sobrien/**
25798944Sobrien  Sets a 16-bit binary patchable PCD token value based on a token name.
25898944Sobrien
25998944Sobrien  Sets the 16-bit value for the token specified by TokenName. Value is returned.
26098944Sobrien  If TokenName is not a valid token in the token space, then the module will not build.
26198944Sobrien  If TokenName is not a patchable in module PCD, then the module will not build.
26298944Sobrien
26398944Sobrien  @param   TokenName  The name of the binary patchable PCD token to set the current value for.
26498944Sobrien  @param   Value      The 16-bit value to set.
26598944Sobrien
26698944Sobrien  @return Return the Value that was set.
26798944Sobrien
26898944Sobrien**/
26998944Sobrien#define PatchPcdSet16(TokenName, Value)     (_gPcd_BinaryPatch_##TokenName = (Value))
27098944Sobrien
27198944Sobrien
27298944Sobrien/**
273130809Smarcel  Sets a 32-bit binary patchable PCD token value based on a token name.
27498944Sobrien
27598944Sobrien  Sets the 32-bit value for the token specified by TokenName. Value is returned.
27698944Sobrien  If TokenName is not a valid token in the token space, then the module will not build.
27798944Sobrien  If TokenName is not a patchable in module PCD, then the module will not build.
27898944Sobrien
27998944Sobrien  @param   TokenName  The name of the binary patchable PCD token to set the current value for.
28098944Sobrien  @param   Value      The 32-bit value to set.
28198944Sobrien
28298944Sobrien  @return Return the Value that was set.
28398944Sobrien
28498944Sobrien**/
28598944Sobrien#define PatchPcdSet32(TokenName, Value)     (_gPcd_BinaryPatch_##TokenName = (Value))
28698944Sobrien
28798944Sobrien
28898944Sobrien/**
28998944Sobrien  Sets a 64-bit binary patchable PCD token value based on a token name.
29098944Sobrien
29198944Sobrien  Sets the 64-bit value for the token specified by TokenName. Value is returned.
29298944Sobrien  If TokenName is not a valid token in the token space, then the module will not build.
29398944Sobrien  If TokenName is not a patchable in module PCD, then the module will not build.
29498944Sobrien
29598944Sobrien  @param   TokenName  The name of the binary patchable PCD token to set the current value for.
29698944Sobrien  @param   Value      The 64-bit value to set.
29798944Sobrien
29898944Sobrien  @return Return the Value that was set.
29998944Sobrien
30098944Sobrien**/
30198944Sobrien#define PatchPcdSet64(TokenName, Value)     (_gPcd_BinaryPatch_##TokenName = (Value))
30298944Sobrien
30398944Sobrien
30498944Sobrien/**
30598944Sobrien  Sets a Boolean binary patchable PCD token value based on a token name.
30698944Sobrien
307130809Smarcel  Sets the Boolean value for the token specified by TokenName. Value is returned.
30898944Sobrien  If TokenName is not a valid token in the token space, then the module will not build.
30998944Sobrien  If TokenName is not a patchable in module PCD, then the module will not build.
31098944Sobrien
31198944Sobrien  @param   TokenName  The name of the binary patchable PCD token to set the current value for.
31298944Sobrien  @param   Value      The boolean value to set.
31398944Sobrien
31498944Sobrien  @return Return the Value that was set.
31598944Sobrien
31698944Sobrien**/
31798944Sobrien#define PatchPcdSetBool(TokenName, Value)   (_gPcd_BinaryPatch_##TokenName = (Value))
31898944Sobrien
31998944Sobrien
32098944Sobrien/**
32198944Sobrien  Sets a pointer to a binary patchable PCD token buffer based on a token name.
32298944Sobrien
32398944Sobrien  Sets the buffer for the token specified by TokenName.  Buffer is returned.
32498944Sobrien  If SizeOfBuffer is greater than the maximum size supported by TokenName, then set SizeOfBuffer
32598944Sobrien  to the maximum size supported by TokenName and return NULL to indicate that the set operation
32698944Sobrien  was not actually performed.  If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be
32798944Sobrien  set to the maximum size supported by TokenName and NULL must be returned.
32898944Sobrien  If TokenName is not a valid token in the token space, then the module will not build.
32998944Sobrien  If TokenName is not a patchable in module PCD, then the module will not build.
33098944Sobrien
33198944Sobrien  If SizeOfBuffer is NULL, then ASSERT().
33298944Sobrien  If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
33398944Sobrien
33498944Sobrien  @param   TokenName      The name of the binary patchable PCD token to set the current value for.
33598944Sobrien  @param   SizeOfBuffer   A pointer to the size, in bytes, of Buffer.
33698944Sobrien  @param   Buffer         Pointer to the value to set.
33798944Sobrien
33898944Sobrien  @return Return the pointer to the Buffer that was set.
33998944Sobrien
34098944Sobrien**/
34198944Sobrien#define PatchPcdSetPtr(TokenName, Size, Buffer) \
34298944Sobrien                                            LibPatchPcdSetPtrAndSize (                 \
34398944Sobrien                                              (VOID *)_gPcd_BinaryPatch_##TokenName,   \
34498944Sobrien                                              &_gPcd_BinaryPatch_Size_##TokenName,     \
34598944Sobrien                                              (UINTN)_PCD_PATCHABLE_##TokenName##_SIZE, \
34698944Sobrien                                              (Size),                                  \
34798944Sobrien                                              (Buffer)                                 \
34898944Sobrien                                              )
34998944Sobrien/**
35098944Sobrien  Retrieves an 8-bit PCD token value based on a token name.
35198944Sobrien
35298944Sobrien  Returns the 8-bit value for the token specified by TokenName.
35398944Sobrien  If TokenName is not a valid token in the token space, then the module will not build.
35498944Sobrien
35598944Sobrien  @param   TokenName  The name of the PCD token to retrieve a current value for.
356130809Smarcel
35798944Sobrien  @return  8-bit value for the token specified by TokenName.
35898944Sobrien
35998944Sobrien**/
36098944Sobrien#define PcdGet8(TokenName)                  _PCD_GET_MODE_8_##TokenName
36198944Sobrien
36298944Sobrien
36398944Sobrien/**
36498944Sobrien  Retrieves a 16-bit PCD token value based on a token name.
36598944Sobrien
36698944Sobrien  Returns the 16-bit value for the token specified by TokenName.
36798944Sobrien  If TokenName is not a valid token in the token space, then the module will not build.
36898944Sobrien
36998944Sobrien  @param   TokenName  The name of the PCD token to retrieve a current value for.
37098944Sobrien
37198944Sobrien  @return  16-bit value for the token specified by TokenName.
37298944Sobrien
37398944Sobrien**/
37498944Sobrien#define PcdGet16(TokenName)                 _PCD_GET_MODE_16_##TokenName
37598944Sobrien
37698944Sobrien
37798944Sobrien/**
37898944Sobrien  Retrieves a 32-bit PCD token value based on a token name.
37998944Sobrien
38098944Sobrien  Returns the 32-bit value for the token specified by TokenName.
38198944Sobrien  If TokenName is not a valid token in the token space, then the module will not build.
38298944Sobrien
38398944Sobrien  @param   TokenName  The name of the PCD token to retrieve a current value for.
38498944Sobrien
38598944Sobrien  @return  32-bit value for the token specified by TokenName.
38698944Sobrien
387130809Smarcel**/
388130809Smarcel#define PcdGet32(TokenName)                 _PCD_GET_MODE_32_##TokenName
38998944Sobrien
39098944Sobrien
39198944Sobrien/**
39298944Sobrien  Retrieves a 64-bit PCD token value based on a token name.
39398944Sobrien
39498944Sobrien  Returns the 64-bit value for the token specified by TokenName.
395130809Smarcel  If TokenName is not a valid token in the token space, then the module will not build.
396130809Smarcel
397130809Smarcel  @param   TokenName  The name of the PCD token to retrieve a current value for.
398130809Smarcel
399130809Smarcel  @return  64-bit value for the token specified by TokenName.
400130809Smarcel
401130809Smarcel**/
402130809Smarcel#define PcdGet64(TokenName)                 _PCD_GET_MODE_64_##TokenName
403130809Smarcel
404130809Smarcel
405130809Smarcel/**
406130809Smarcel  Retrieves a pointer to a PCD token buffer based on a token name.
407130809Smarcel
408130809Smarcel  Returns a pointer to the buffer for the token specified by TokenName.
409130809Smarcel  If TokenName is not a valid token in the token space, then the module will not build.
410130809Smarcel
411130809Smarcel  @param   TokenName  The name of the PCD token to retrieve a current value for.
412130809Smarcel
413130809Smarcel  @return  A pointer to the buffer.
414130809Smarcel
415130809Smarcel**/
416130809Smarcel#define PcdGetPtr(TokenName)                _PCD_GET_MODE_PTR_##TokenName
41798944Sobrien
41898944Sobrien
419130809Smarcel/**
420130809Smarcel  Retrieves a Boolean PCD token value based on a token name.
421130809Smarcel
422130809Smarcel  Returns the Boolean value for the token specified by TokenName.
423130809Smarcel  If TokenName is not a valid token in the token space, then the module will not build.
424130809Smarcel
425130809Smarcel  @param   TokenName  The name of the PCD token to retrieve a current value for.
426130809Smarcel
427130809Smarcel  @return  A Boolean PCD token value.
428130809Smarcel
429130809Smarcel**/
430130809Smarcel#define PcdGetBool(TokenName)               _PCD_GET_MODE_BOOL_##TokenName
431130809Smarcel
432130809Smarcel
433130809Smarcel/**
434130809Smarcel  Retrieves the size of a fixed PCD token based on a token name.
435130809Smarcel
436130809Smarcel  Returns the size of the token specified by TokenName.
437130809Smarcel  If TokenName is not a valid token in the token space, then the module will not build.
438130809Smarcel
439130809Smarcel  @param[in]  TokenName  The name of the PCD token to retrieve a current value size for.
440130809Smarcel
441130809Smarcel  @return     Return the size
442130809Smarcel
443130809Smarcel**/
444130809Smarcel#define FixedPcdGetSize(TokenName)    _PCD_SIZE_##TokenName
445130809Smarcel
446130809Smarcel
447130809Smarcel/**
448130809Smarcel  Retrieves the size of a binary patchable PCD token based on a token name.
449130809Smarcel
450130809Smarcel  Returns the size of the token specified by TokenName.
451130809Smarcel  If TokenName is not a valid token in the token space, then the module will not build.
452130809Smarcel
453130809Smarcel  @param[in]  TokenName  The name of the PCD token to retrieve a current value size for.
454130809Smarcel
455130809Smarcel  @return     Return the size
45698944Sobrien
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**/
1082UINTN
1083EFIAPI
1084LibPcdSetSku (
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**/
1099UINT8
1100EFIAPI
1101LibPcdGet8 (
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**/
1116UINT16
1117EFIAPI
1118LibPcdGet16 (
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**/
1133UINT32
1134EFIAPI
1135LibPcdGet32 (
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**/
1150UINT64
1151EFIAPI
1152LibPcdGet64 (
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**/
1167VOID *
1168EFIAPI
1169LibPcdGetPtr (
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**/
1184BOOLEAN
1185EFIAPI
1186LibPcdGetBool (
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**/
1199UINTN
1200EFIAPI
1201LibPcdGetSize (
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**/
1220UINT8
1221EFIAPI
1222LibPcdGetEx8 (
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**/
1242UINT16
1243EFIAPI
1244LibPcdGetEx16 (
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**/
1261UINT32
1262EFIAPI
1263LibPcdGetEx32 (
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**/
1283UINT64
1284EFIAPI
1285LibPcdGetEx64 (
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**/
1305VOID *
1306EFIAPI
1307LibPcdGetExPtr (
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**/
1327BOOLEAN
1328EFIAPI
1329LibPcdGetExBool (
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**/
1349UINTN
1350EFIAPI
1351LibPcdGetExSize (
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**/
1370UINT8
1371EFIAPI
1372LibPcdSet8 (
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**/
1390UINT16
1391EFIAPI
1392LibPcdSet16 (
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**/
1410UINT32
1411EFIAPI
1412LibPcdSet32 (
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**/
1430UINT64
1431EFIAPI
1432LibPcdSet64 (
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**/
1460VOID *
1461EFIAPI
1462LibPcdSetPtr (
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**/
1481BOOLEAN
1482EFIAPI
1483LibPcdSetBool (
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**/
1505UINT8
1506EFIAPI
1507LibPcdSetEx8 (
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**/
1530UINT16
1531EFIAPI
1532LibPcdSetEx16 (
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**/
1555UINT32
1556EFIAPI
1557LibPcdSetEx32 (
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**/
1580UINT64
1581EFIAPI
1582LibPcdSetEx64 (
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**/
1611VOID *
1612EFIAPI
1613LibPcdSetExPtr (
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**/
1637BOOLEAN
1638EFIAPI
1639LibPcdSetExBool (
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**/
1658RETURN_STATUS
1659EFIAPI
1660LibPcdSet8S (
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**/
1677RETURN_STATUS
1678EFIAPI
1679LibPcdSet16S (
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**/
1696RETURN_STATUS
1697EFIAPI
1698LibPcdSet32S (
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**/
1715RETURN_STATUS
1716EFIAPI
1717LibPcdSet64S (
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**/
1744RETURN_STATUS
1745EFIAPI
1746LibPcdSetPtrS (
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**/
1764RETURN_STATUS
1765EFIAPI
1766LibPcdSetBoolS (
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**/
1787RETURN_STATUS
1788EFIAPI
1789LibPcdSetEx8S (
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**/
1811RETURN_STATUS
1812EFIAPI
1813LibPcdSetEx16S (
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**/
1835RETURN_STATUS
1836EFIAPI
1837LibPcdSetEx32S (
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**/
1859RETURN_STATUS
1860EFIAPI
1861LibPcdSetEx64S (
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**/
1889RETURN_STATUS
1890EFIAPI
1891LibPcdSetExPtrS (
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**/
1914RETURN_STATUS
1915EFIAPI
1916LibPcdSetExBoolS (
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**/
1938typedef
1939VOID
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**/
1964VOID
1965EFIAPI
1966LibPcdCallbackOnSet (
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**/
1986VOID
1987EFIAPI
1988LibPcdCancelCallback (
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**/
2014UINTN
2015EFIAPI
2016LibPcdGetNextToken (
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**/
2036GUID *
2037EFIAPI
2038LibPcdGetNextTokenSpace (
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**/
2066VOID *
2067EFIAPI
2068LibPatchPcdSetPtr (
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**/
2098RETURN_STATUS
2099EFIAPI
2100LibPatchPcdSetPtrS (
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**/
2132VOID *
2133EFIAPI
2134LibPatchPcdSetPtrAndSize (
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**/
2167RETURN_STATUS
2168EFIAPI
2169LibPatchPcdSetPtrAndSizeS (
2170  OUT      VOID     *PatchVariable,
2171  OUT      UINTN    *SizeOfPatchVariable,
2172  IN       UINTN    MaximumDatumSize,
2173  IN OUT   UINTN    *SizeOfBuffer,
2174  IN CONST VOID     *Buffer
2175  );
2176
2177typedef 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
2186typedef 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**/
2219VOID
2220EFIAPI
2221LibPcdGetInfo (
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**/
2239VOID
2240EFIAPI
2241LibPcdGetInfoEx (
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**/
2254UINTN
2255EFIAPI
2256LibPcdGetSku (
2257  VOID
2258  );
2259
2260#endif
2261