summaryrefslogtreecommitdiffstats
path: root/MdePkg
diff options
context:
space:
mode:
authorqwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524>2006-06-23 14:41:16 +0000
committerqwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524>2006-06-23 14:41:16 +0000
commit4276d5dacfd4812abc1d7a1bd1da995d7002ee9e (patch)
treee761b29520a4c86b05082fe2c13ca356f0bedd7a /MdePkg
parente88ea4239b6530720cf2d99ba1798ba9950b5f51 (diff)
downloadedk2-4276d5dacfd4812abc1d7a1bd1da995d7002ee9e.tar.gz
edk2-4276d5dacfd4812abc1d7a1bd1da995d7002ee9e.tar.bz2
edk2-4276d5dacfd4812abc1d7a1bd1da995d7002ee9e.zip
1) Add in support to traverse taken space
2) Remove unused import in DynamicTokenValue.java. 3) Support Byte Stream input for Pointer type Dynamic PCD entry in FPD file. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@616 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdePkg')
-rw-r--r--MdePkg/Include/Library/PcdLib.h70
-rw-r--r--MdePkg/Include/Ppi/Pcd.h7
-rw-r--r--MdePkg/Include/Protocol/Pcd.h9
-rw-r--r--MdePkg/Library/BasePcdLibNull/PcdLib.c72
-rw-r--r--MdePkg/Library/DxePcdLib/DxePcdLib.c102
-rw-r--r--MdePkg/Library/PeiPcdLib/PeiPcdLib.c108
6 files changed, 299 insertions, 69 deletions
diff --git a/MdePkg/Include/Library/PcdLib.h b/MdePkg/Include/Library/PcdLib.h
index 2f797640a0..5858cfc475 100644
--- a/MdePkg/Include/Library/PcdLib.h
+++ b/MdePkg/Include/Library/PcdLib.h
@@ -436,10 +436,20 @@ LibPcdSet64 (
/**
Sets a buffer for the token specified by TokenNumber to
- the value specified by Value. Value is returned.
- If Value is NULL, then ASSERT().
+ the value specified by Buffer and SizeOfValue. Buffer to
+ be set is returned. The content of the buffer could be
+ overwritten if a Callback on SET is registered with this
+ TokenNumber.
+
+ If SizeOfValue is greater than the maximum
+ size support by TokenNumber, then set SizeOfValue to the
+ maximum size supported by TokenNumber and return NULL to
+ indicate that the set operation was not actually performed.
+
+ If SizeOfValue > 0 and Buffer is NULL, then ASSERT().
@param[in] TokenNumber The PCD token number to set a current value for.
+ @param[in,out] SizeOfBuffer The size, in bytes, of Buffer.
@param[in] Value A pointer to the buffer to set.
@retval VOID* Return the pointer for the buffer been set.
@@ -448,9 +458,9 @@ LibPcdSet64 (
VOID*
EFIAPI
LibPcdSetPtr (
- IN UINTN TokenNumber,
- IN UINTN SizeOfBuffer,
- IN VOID *Value
+ IN UINTN TokenNumber,
+ IN OUT UINTN *SizeOfBuffer,
+ IN VOID *Value
);
@@ -561,26 +571,30 @@ LibPcdSetEx64 (
/**
- Sets a buffer for the token specified by TokenNumber and
- Guid to the value specified by Value. Value is returned.
- If Guid is NULL, then ASSERT().
- If Value is NULL, then ASSERT().
+ Sets a buffer for the token specified by TokenNumber to the value specified by
+ Buffer and SizeOfValue. Buffer is returned. If SizeOfValue is greater than
+ the maximum size support by TokenNumber, then set SizeOfValue to the maximum size
+ supported by TokenNumber and return NULL to indicate that the set operation
+ was not actually performed.
+
+ If SizeOfValue > 0 and Buffer is NULL, then ASSERT().
@param[in] Guid Pointer to a 128-bit unique value that
designates which namespace to set a value from.
@param[in] TokenNumber The PCD token number to set a current value for.
- @param[in] Value The 8-bit value to set.
+ @param[in, out] SizeOfBuffer The size, in bytes, of Buffer.
+ @param[in] Buffer A pointer to the buffer to set.
- @retval VOID * Return the value been set.
+ @retval VOID * Return the pinter to the buffer been set.
**/
VOID *
EFIAPI
LibPcdSetExPtr (
- IN CONST GUID *Guid,
- IN UINTN TokenNumber,
- IN UINTN SizeOfBuffer,
- IN VOID *Value
+ IN CONST GUID *Guid,
+ IN UINTN TokenNumber,
+ IN OUT UINTN *SizeOfBuffer,
+ IN VOID *Buffer
);
@@ -697,4 +711,30 @@ LibPcdGetNextToken (
IN UINTN TokenNumber
);
+
+
+/**
+ Retrieves the next PCD token space from a token space specified by Guid.
+ Guid of NULL is reserved to mark the default local token namespace on the current
+ platform. If Guid is NULL, then the GUID of the first non-local token space of the
+ current platform is returned. If Guid is the last non-local token space,
+ then NULL is returned.
+
+ If Guid is not NULL and is not a valid token space in the current platform, then ASSERT().
+
+
+
+ @param[in] Pointer to a 128-bit unique value that designates from which namespace
+ to start the search.
+
+ @retval CONST GUID * The next valid token namespace.
+
+**/
+
+CONST GUID*
+EFIAPI
+LibPcdGetNextTokenSpace (
+ IN CONST GUID *Guid
+ );
+
#endif
diff --git a/MdePkg/Include/Ppi/Pcd.h b/MdePkg/Include/Ppi/Pcd.h
index 360eea3beb..a67e79c01c 100644
--- a/MdePkg/Include/Ppi/Pcd.h
+++ b/MdePkg/Include/Ppi/Pcd.h
@@ -256,6 +256,12 @@ EFI_STATUS
IN OUT UINTN *TokenNumber
);
+typedef
+EFI_STATUS
+(EFIAPI *PCD_PPI_GET_NEXT_TOKENSPACE) (
+ IN OUT CONST EFI_GUID **Guid
+ );
+
typedef struct {
PCD_PPI_SET_SKU SetSku;
@@ -292,6 +298,7 @@ typedef struct {
PCD_PPI_CALLBACK_ONSET CallbackOnSet;
PCD_PPI_CANCEL_CALLBACK CancelCallback;
PCD_PPI_GET_NEXT_TOKEN GetNextToken;
+ PCD_PPI_GET_NEXT_TOKENSPACE GetNextTokenSpace;
} PCD_PPI;
diff --git a/MdePkg/Include/Protocol/Pcd.h b/MdePkg/Include/Protocol/Pcd.h
index 07517ffbb1..8869ad2be1 100644
--- a/MdePkg/Include/Protocol/Pcd.h
+++ b/MdePkg/Include/Protocol/Pcd.h
@@ -256,6 +256,14 @@ EFI_STATUS
IN OUT UINTN *TokenNumber
);
+
+typedef
+EFI_STATUS
+(EFIAPI *PCD_PROTOCOL_GET_NEXT_TOKENSPACE) (
+ IN CONST EFI_GUID **Guid
+ );
+
+
typedef struct {
PCD_PROTOCOL_SET_SKU SetSku;
@@ -292,6 +300,7 @@ typedef struct {
PCD_PROTOCOL_CALLBACK_ONSET CallbackOnSet;
PCD_PROTOCOL_CANCEL_CALLBACK CancelCallback;
PCD_PROTOCOL_GET_NEXT_TOKEN GetNextToken;
+ PCD_PROTOCOL_GET_NEXT_TOKENSPACE GetNextTokenSpace;
} PCD_PROTOCOL;
#endif
diff --git a/MdePkg/Library/BasePcdLibNull/PcdLib.c b/MdePkg/Library/BasePcdLibNull/PcdLib.c
index 1dcb6fe0ba..832100758f 100644
--- a/MdePkg/Library/BasePcdLibNull/PcdLib.c
+++ b/MdePkg/Library/BasePcdLibNull/PcdLib.c
@@ -434,10 +434,20 @@ LibPcdSet64 (
/**
Sets a buffer for the token specified by TokenNumber to
- the value specified by Value. Value is returned.
- If Value is NULL, then ASSERT().
+ the value specified by Buffer and SizeOfValue. Buffer to
+ be set is returned. The content of the buffer could be
+ overwritten if a Callback on SET is registered with this
+ TokenNumber.
+
+ If SizeOfValue is greater than the maximum
+ size support by TokenNumber, then set SizeOfValue to the
+ maximum size supported by TokenNumber and return NULL to
+ indicate that the set operation was not actually performed.
+
+ If SizeOfValue > 0 and Buffer is NULL, then ASSERT().
@param[in] TokenNumber The PCD token number to set a current value for.
+ @param[in,out] SizeOfBuffer The size, in bytes, of Buffer.
@param[in] Value A pointer to the buffer to set.
@retval VOID* Return the pointer for the buffer been set.
@@ -446,9 +456,9 @@ LibPcdSet64 (
VOID *
EFIAPI
LibPcdSetPtr (
- IN UINTN TokenNumber,
- IN UINTN SizeOfBuffer,
- IN VOID *Buffer
+ IN UINTN TokenNumber,
+ IN OUT UINTN *SizeOfBuffer,
+ IN VOID *Buffer
)
{
ASSERT (Buffer != NULL);
@@ -593,26 +603,30 @@ LibPcdSetEx64 (
/**
- Sets a buffer for the token specified by TokenNumber and
- Guid to the value specified by Value. Value is returned.
- If Guid is NULL, then ASSERT().
- If Value is NULL, then ASSERT().
+ Sets a buffer for the token specified by TokenNumber to the value specified by
+ Buffer and SizeOfValue. Buffer is returned. If SizeOfValue is greater than
+ the maximum size support by TokenNumber, then set SizeOfValue to the maximum size
+ supported by TokenNumber and return NULL to indicate that the set operation
+ was not actually performed.
+
+ If SizeOfValue > 0 and Buffer is NULL, then ASSERT().
@param[in] Guid Pointer to a 128-bit unique value that
designates which namespace to set a value from.
@param[in] TokenNumber The PCD token number to set a current value for.
- @param[in] Value The 8-bit value to set.
+ @param[in, out] SizeOfBuffer The size, in bytes, of Buffer.
+ @param[in] Buffer A pointer to the buffer to set.
- @retval VOID * Return the value been set.
+ @retval VOID * Return the pinter to the buffer been set.
**/
VOID *
EFIAPI
LibPcdSetExPtr (
- IN CONST GUID *Guid,
- IN UINTN TokenNumber,
- IN UINTN SizeOfBuffer,
- IN VOID *Buffer
+ IN CONST GUID *Guid,
+ IN UINTN TokenNumber,
+ IN OUT UINTN *SizeOfBuffer,
+ IN VOID *Buffer
)
{
ASSERT (Guid != NULL);
@@ -729,3 +743,31 @@ LibPcdGetNextToken (
{
return 0;
}
+
+
+
+/**
+ Retrieves the next PCD token space from a token space specified by Guid.
+ Guid of NULL is reserved to mark the default local token namespace on the current
+ platform. If Guid is NULL, then the GUID of the first non-local token space of the
+ current platform is returned. If Guid is the last non-local token space,
+ then NULL is returned.
+
+ If Guid is not NULL and is not a valid token space in the current platform, then ASSERT().
+
+
+
+ @param[in] Pointer to a 128-bit unique value that designates from which namespace
+ to start the search.
+
+ @retval CONST GUID * The next valid token namespace.
+
+**/
+CONST GUID*
+EFIAPI
+LibPcdGetNextTokenSpace (
+ IN CONST GUID *Guid
+ )
+{
+ return NULL;
+}
diff --git a/MdePkg/Library/DxePcdLib/DxePcdLib.c b/MdePkg/Library/DxePcdLib/DxePcdLib.c
index c20fad2302..ee517715f5 100644
--- a/MdePkg/Library/DxePcdLib/DxePcdLib.c
+++ b/MdePkg/Library/DxePcdLib/DxePcdLib.c
@@ -483,28 +483,47 @@ LibPcdSet64 (
/**
Sets a buffer for the token specified by TokenNumber to
- the value specified by Value. Value is returned.
- If Value is NULL, then ASSERT().
+ the value specified by Buffer and SizeOfValue. Buffer to
+ be set is returned. The content of the buffer could be
+ overwritten if a Callback on SET is registered with this
+ TokenNumber.
+
+ If SizeOfValue is greater than the maximum
+ size support by TokenNumber, then set SizeOfValue to the
+ maximum size supported by TokenNumber and return NULL to
+ indicate that the set operation was not actually performed.
+
+ If SizeOfValue > 0 and Buffer is NULL, then ASSERT().
@param[in] TokenNumber The PCD token number to set a current value for.
+ @param[in,out] SizeOfBuffer The size, in bytes, of Buffer.
@param[in] Value A pointer to the buffer to set.
@retval VOID* Return the pointer for the buffer been set.
**/
+
VOID *
EFIAPI
LibPcdSetPtr (
- IN UINTN TokenNumber,
- IN UINTN SizeOfBuffer,
- IN VOID *Buffer
+ IN UINTN TokenNumber,
+ IN OUT UINTN *SizeOfBuffer,
+ IN VOID *Buffer
)
{
EFI_STATUS Status;
+ UINTN Size;
- ASSERT (Buffer != NULL);
+ ASSERT ((*SizeOfBuffer > 0) && Buffer == NULL);
- Status = mPcd->SetPtr (TokenNumber, SizeOfBuffer, Buffer);
+ Size = LibPcdGetSize (TokenNumber);
+
+ if (*SizeOfBuffer > Size) {
+ *SizeOfBuffer = Size;
+ return NULL;
+ }
+
+ Status = mPcd->SetPtr (TokenNumber, *SizeOfBuffer, Buffer);
ASSERT_EFI_ERROR (Status);
@@ -678,34 +697,45 @@ LibPcdSetEx64 (
/**
- Sets a buffer for the token specified by TokenNumber and
- Guid to the value specified by Value. Value is returned.
- If Guid is NULL, then ASSERT().
- If Value is NULL, then ASSERT().
+ Sets a buffer for the token specified by TokenNumber to the value specified by
+ Buffer and SizeOfValue. Buffer is returned. If SizeOfValue is greater than
+ the maximum size support by TokenNumber, then set SizeOfValue to the maximum size
+ supported by TokenNumber and return NULL to indicate that the set operation
+ was not actually performed.
+
+ If SizeOfValue > 0 and Buffer is NULL, then ASSERT().
@param[in] Guid Pointer to a 128-bit unique value that
designates which namespace to set a value from.
@param[in] TokenNumber The PCD token number to set a current value for.
- @param[in] Value The 8-bit value to set.
+ @param[in, out] SizeOfBuffer The size, in bytes, of Buffer.
+ @param[in] Buffer A pointer to the buffer to set.
- @retval VOID * Return the value been set.
+ @retval VOID * Return the pinter to the buffer been set.
**/
VOID *
EFIAPI
LibPcdSetExPtr (
- IN CONST GUID *Guid,
- IN UINTN TokenNumber,
- IN UINTN SizeOfBuffer,
- IN VOID *Buffer
+ IN CONST GUID *Guid,
+ IN UINTN TokenNumber,
+ IN OUT UINTN *SizeOfBuffer,
+ IN VOID *Buffer
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
+ UINTN Size;
ASSERT (Guid != NULL);
ASSERT (Buffer != NULL);
- Status = mPcd->SetPtrEx (Guid, TokenNumber, SizeOfBuffer, Buffer);
+ Size = LibPcdGetExSize (Guid, TokenNumber);
+ if (*SizeOfBuffer > Size) {
+ *SizeOfBuffer = Size;
+ return NULL;
+ }
+
+ Status = mPcd->SetPtrEx (Guid, TokenNumber, *SizeOfBuffer, Buffer);
ASSERT_EFI_ERROR (Status);
@@ -849,3 +879,37 @@ LibPcdGetNextToken (
return TokenNumber;
}
+
+
+/**
+ Retrieves the next PCD token space from a token space specified by Guid.
+ Guid of NULL is reserved to mark the default local token namespace on the current
+ platform. If Guid is NULL, then the GUID of the first non-local token space of the
+ current platform is returned. If Guid is the last non-local token space,
+ then NULL is returned.
+
+ If Guid is not NULL and is not a valid token space in the current platform, then ASSERT().
+
+
+
+ @param[in] Pointer to a 128-bit unique value that designates from which namespace
+ to start the search.
+
+ @retval CONST GUID * The next valid token namespace.
+
+**/
+CONST GUID*
+EFIAPI
+LibPcdGetNextTokenSpace (
+ IN CONST GUID *Guid
+ )
+{
+ EFI_STATUS Status;
+
+ Status = mPcd->GetNextTokenSpace (&Guid);
+
+ ASSERT_EFI_ERROR (Status);
+
+ return Guid;
+}
+
diff --git a/MdePkg/Library/PeiPcdLib/PeiPcdLib.c b/MdePkg/Library/PeiPcdLib/PeiPcdLib.c
index fca14af868..a73d804797 100644
--- a/MdePkg/Library/PeiPcdLib/PeiPcdLib.c
+++ b/MdePkg/Library/PeiPcdLib/PeiPcdLib.c
@@ -555,10 +555,20 @@ LibPcdSet64 (
/**
Sets a buffer for the token specified by TokenNumber to
- the value specified by Value. Value is returned.
- If Value is NULL, then ASSERT().
+ the value specified by Buffer and SizeOfValue. Buffer to
+ be set is returned. The content of the buffer could be
+ overwritten if a Callback on SET is registered with this
+ TokenNumber.
+
+ If SizeOfValue is greater than the maximum
+ size support by TokenNumber, then set SizeOfValue to the
+ maximum size supported by TokenNumber and return NULL to
+ indicate that the set operation was not actually performed.
+
+ If SizeOfValue > 0 and Buffer is NULL, then ASSERT().
@param[in] TokenNumber The PCD token number to set a current value for.
+ @param[in,out] SizeOfBuffer The size, in bytes, of Buffer.
@param[in] Value A pointer to the buffer to set.
@retval VOID* Return the pointer for the buffer been set.
@@ -567,18 +577,27 @@ LibPcdSet64 (
VOID *
EFIAPI
LibPcdSetPtr (
- IN UINTN TokenNumber,
- IN UINTN SizeOfBuffer,
- IN VOID *Buffer
+ IN UINTN TokenNumber,
+ IN OUT UINTN *SizeOfBuffer,
+ IN VOID *Buffer
)
{
EFI_STATUS Status;
- PCD_PPI * PcdPpi;
+ PCD_PPI *PcdPpi;
+ UINTN Size;
PcdPpi = GetPcdPpiPtr ();
+
+ ASSERT ((*SizeOfBuffer > 0) && Buffer == NULL);
+ Size = LibPcdGetSize (TokenNumber);
+
+ if (*SizeOfBuffer > Size) {
+ *SizeOfBuffer = Size;
+ return NULL;
+ }
- Status = PcdPpi->SetPtr (TokenNumber, SizeOfBuffer, Buffer);
+ Status = PcdPpi->SetPtr (TokenNumber, *SizeOfBuffer, Buffer);
ASSERT_EFI_ERROR (Status);
@@ -764,34 +783,45 @@ LibPcdSetEx64 (
/**
- Sets a buffer for the token specified by TokenNumber and
- Guid to the value specified by Value. Value is returned.
- If Guid is NULL, then ASSERT().
- If Value is NULL, then ASSERT().
+ Sets a buffer for the token specified by TokenNumber to the value specified by
+ Buffer and SizeOfValue. Buffer is returned. If SizeOfValue is greater than
+ the maximum size support by TokenNumber, then set SizeOfValue to the maximum size
+ supported by TokenNumber and return NULL to indicate that the set operation
+ was not actually performed.
+
+ If SizeOfValue > 0 and Buffer is NULL, then ASSERT().
@param[in] Guid Pointer to a 128-bit unique value that
designates which namespace to set a value from.
@param[in] TokenNumber The PCD token number to set a current value for.
- @param[in] Value The 8-bit value to set.
+ @param[in, out] SizeOfBuffer The size, in bytes, of Buffer.
+ @param[in] Buffer A pointer to the buffer to set.
- @retval VOID * Return the value been set.
+ @retval VOID * Return the pinter to the buffer been set.
**/
VOID *
EFIAPI
LibPcdSetExPtr (
- IN CONST GUID *Guid,
- IN UINTN TokenNumber,
- IN UINTN SizeOfBuffer,
- IN VOID *Buffer
+ IN CONST GUID *Guid,
+ IN UINTN TokenNumber,
+ IN OUT UINTN *SizeOfBuffer,
+ IN VOID *Buffer
)
{
- EFI_STATUS Status;
- PCD_PPI * PcdPpi;
+ EFI_STATUS Status;
+ PCD_PPI *PcdPpi;
+ UINTN Size;
PcdPpi = GetPcdPpiPtr ();
- Status = PcdPpi->SetPtrEx (Guid, TokenNumber, SizeOfBuffer, Buffer);
+ Size = LibPcdGetExSize (Guid, TokenNumber);
+ if (*SizeOfBuffer > Size) {
+ *SizeOfBuffer = Size;
+ return NULL;
+ }
+
+ Status = PcdPpi->SetPtrEx (Guid, TokenNumber, *SizeOfBuffer, Buffer);
ASSERT_EFI_ERROR (Status);
@@ -944,3 +974,41 @@ LibPcdGetNextToken (
return TokenNumber;
}
+
+
+/**
+ Retrieves the next PCD token space from a token space specified by Guid.
+ Guid of NULL is reserved to mark the default local token namespace on the current
+ platform. If Guid is NULL, then the GUID of the first non-local token space of the
+ current platform is returned. If Guid is the last non-local token space,
+ then NULL is returned.
+
+ If Guid is not NULL and is not a valid token space in the current platform, then ASSERT().
+
+
+
+ @param[in] Pointer to a 128-bit unique value that designates from which namespace
+ to start the search.
+
+ @retval CONST GUID * The next valid token namespace.
+
+**/
+CONST GUID*
+EFIAPI
+LibPcdGetNextTokenSpace (
+ IN CONST GUID *Guid
+ )
+{
+ EFI_STATUS Status;
+ PCD_PPI * PcdPpi;
+
+ PcdPpi = GetPcdPpiPtr ();
+
+
+ Status = PcdPpi->GetNextTokenSpace (&Guid);
+
+ ASSERT_EFI_ERROR (Status);
+
+ return Guid;
+}
+