Add below four PcdGetSize() API in PcdLib header file. They can be used
to get the size of PCD value.
FixedPcdGetSize()
PatchPcdGetSize()
PcdGetSize()
PcdGetExSize()

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming....@intel.com>
---
 MdePkg/Include/Library/PcdLib.h | 58 ++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 57 insertions(+), 1 deletion(-)

diff --git a/MdePkg/Include/Library/PcdLib.h b/MdePkg/Include/Library/PcdLib.h
index a7e1e62..962d442 100644
--- a/MdePkg/Include/Library/PcdLib.h
+++ b/MdePkg/Include/Library/PcdLib.h
@@ -346,11 +346,10 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
EXPRESS OR IMPLIED.
                                               _gPcd_BinaryPatch_##TokenName,   
        \
                                               
(UINTN)_PCD_PATCHABLE_##TokenName##_SIZE, \
                                               (Size),                          
        \
                                               (Buffer)                         
        \
                                               )
-
 /**
   Retrieves an 8-bit PCD token value based on a token name.
   
   Returns the 8-bit value for the token specified by TokenName.
   If TokenName is not a valid token in the token space, then the module will 
not build.
@@ -431,10 +430,67 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
EXPRESS OR IMPLIED.
 
 **/
 #define PcdGetBool(TokenName)               _PCD_GET_MODE_BOOL_##TokenName
 
 
+/**
+  Retrieves the size of a fixed PCD token based on a token name.
+
+  Returns the size of the token specified by TokenName.
+  If TokenName is not a valid token in the token space, then the module will 
not build.
+
+  @param[in]  TokenName  The name of the PCD token to retrieve a current value 
size for.
+
+  @return     Return the size
+
+**/
+#define FixedPcdGetSize(TokenName)    _PCD_SIZE_##TokenName
+
+
+/**
+  Retrieves the size of a binary patchable PCD token based on a token name.
+
+  Returns the size of the token specified by TokenName.
+  If TokenName is not a valid token in the token space, then the module will 
not build.
+
+  @param[in]  TokenName  The name of the PCD token to retrieve a current value 
size for.
+
+  @return     Return the size
+
+**/
+#define PatchPcdGetSize(TokenName)    _gPcd_BinaryPatch_Size_##TokenName
+
+
+/**
+  Retrieves the size of the PCD token based on a token name.
+  
+  Returns the size of the token specified by TokenName.
+  If TokenName is not a valid token in the token space, then the module will 
not build.
+  
+  @param[in]   TokenName  The name of the PCD token to retrieve a current 
value size for.
+
+  @return      Return the size
+
+**/
+#define PcdGetSize(TokenName)         _PCD_GET_MODE_SIZE_##TokenName
+
+
+/**
+  Retrieve the size of a given PCD token.
+  
+  Returns the size of the token specified by TokenNumber and Guid. 
+  If Guid is NULL, then ASSERT(). 
+
+  @param[in]  Guid          Pointer to a 128-bit unique value that designates 
+                            which namespace to retrieve a value from.
+  @param[in]  TokenNumber   The PCD token number to retrieve a current value 
for.
+
+  @return     Return the size.
+
+**/
+#define PcdGetExSize(Guid, TokenName) LibPcdGetExSize ((Guid), 
PcdTokenEx(Guid,TokenName))
+
 #ifndef DISABLE_NEW_DEPRECATED_INTERFACES
 /**
   Sets an 8-bit PCD token value based on a token name.
 
   Sets the 8-bit value for the token specified by TokenName. Value is returned.
-- 
1.9.5.msysgit.0

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to