summaryrefslogtreecommitdiff
path: root/MdePkg/Library/DxePcdLib/DxePcdLib.c
diff options
context:
space:
mode:
Diffstat (limited to 'MdePkg/Library/DxePcdLib/DxePcdLib.c')
-rw-r--r--MdePkg/Library/DxePcdLib/DxePcdLib.c64
1 files changed, 45 insertions, 19 deletions
diff --git a/MdePkg/Library/DxePcdLib/DxePcdLib.c b/MdePkg/Library/DxePcdLib/DxePcdLib.c
index bc87c4e6a..6f3a1b286 100644
--- a/MdePkg/Library/DxePcdLib/DxePcdLib.c
+++ b/MdePkg/Library/DxePcdLib/DxePcdLib.c
@@ -1,7 +1,7 @@
/** @file
Implementation of PcdLib class library for DXE phase.
-Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -489,7 +489,9 @@ LibPcdGetExSize (
Sets the 8-bit value for the token specified by TokenNumber
to the value specified by Value. Value is returned.
-
+
+ If the set operation was not correctly performed, then ASSERT().
+
@param[in] TokenNumber The PCD token number to set a current value for.
@param[in] Value The 8-bit value to set.
@@ -518,7 +520,9 @@ LibPcdSet8 (
Sets the 16-bit value for the token specified by TokenNumber
to the value specified by Value. Value is returned.
-
+
+ If the set operation was not correctly performed, then ASSERT().
+
@param[in] TokenNumber The PCD token number to set a current value for.
@param[in] Value The 16-bit value to set.
@@ -547,7 +551,9 @@ LibPcdSet16 (
Sets the 32-bit value for the token specified by TokenNumber
to the value specified by Value. Value is returned.
-
+
+ If the set operation was not correctly performed, then ASSERT().
+
@param[in] TokenNumber The PCD token number to set a current value for.
@param[in] Value The 32-bit value to set.
@@ -576,6 +582,8 @@ LibPcdSet32 (
Sets the 64-bit value for the token specified by TokenNumber
to the value specified by Value. Value is returned.
+
+ If the set operation was not correctly performed, then ASSERT().
@param[in] TokenNumber The PCD token number to set a current value for.
@param[in] Value The 64-bit value to set.
@@ -607,7 +615,8 @@ LibPcdSet64 (
specified by Buffer and SizeOfBuffer. Buffer is returned.
If SizeOfBuffer is greater than the maximum size support by TokenNumber,
then set SizeOfBuffer to the maximum size supported by TokenNumber and
- return NULL to indicate that the set operation was not actually performed.
+ return NULL to indicate that the set operation was not actually performed,
+ or ASSERT() if the set operation was not correctly performed.
If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to the
maximum size supported by TokenName and NULL must be returned.
@@ -631,6 +640,7 @@ LibPcdSetPtr (
)
{
EFI_STATUS Status;
+ UINTN InputSizeOfBuffer;
ASSERT (SizeOfBuffer != NULL);
@@ -638,10 +648,12 @@ LibPcdSetPtr (
ASSERT (Buffer != NULL);
}
+ InputSizeOfBuffer = *SizeOfBuffer;
Status = GetPcdProtocol()->SetPtr (TokenNumber, SizeOfBuffer, (VOID *) Buffer);
- if (EFI_ERROR (Status)) {
+ if (EFI_ERROR (Status) && (*SizeOfBuffer < InputSizeOfBuffer)) {
return NULL;
}
+ ASSERT_EFI_ERROR (Status);
return (VOID *)Buffer;
}
@@ -653,7 +665,9 @@ LibPcdSetPtr (
Sets the Boolean value for the token specified by TokenNumber
to the value specified by Value. Value is returned.
-
+
+ If the set operation was not correctly performed, then ASSERT().
+
@param[in] TokenNumber The PCD token number to set a current value for.
@param[in] Value The boolean value to set.
@@ -682,9 +696,10 @@ LibPcdSetBool (
Sets the 8-bit value for the token specified by TokenNumber and
Guid to the value specified by Value. Value is returned.
-
+
If Guid is NULL, then ASSERT().
-
+ If the set operation was not correctly performed, then ASSERT().
+
@param[in] Guid The 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.
@@ -718,9 +733,10 @@ LibPcdSetEx8 (
Sets the 16-bit value for the token specified by TokenNumber and
Guid to the value specified by Value. Value is returned.
-
+
If Guid is NULL, then ASSERT().
-
+ If the set operation was not correctly performed, then ASSERT().
+
@param[in] Guid The 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.
@@ -754,9 +770,10 @@ LibPcdSetEx16 (
Sets the 32-bit value for the token specified by TokenNumber and
Guid to the value specified by Value. Value is returned.
-
+
If Guid is NULL, then ASSERT().
-
+ If the set operation was not correctly performed, then ASSERT().
+
@param[in] Guid The 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.
@@ -790,8 +807,10 @@ LibPcdSetEx32 (
Sets the 64-bit value for the token specified by TokenNumber and
Guid to the value specified by Value. Value is returned.
+
If Guid is NULL, then ASSERT().
-
+ If the set operation was not correctly performed, then ASSERT().
+
@param[in] Guid The 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.
@@ -827,7 +846,7 @@ LibPcdSetEx64 (
Buffer and SizeOfBuffer. Buffer is returned. If SizeOfBuffer is greater than
the maximum size support by TokenNumber, then set SizeOfBuffer to the maximum size
supported by TokenNumber and return NULL to indicate that the set operation
- was not actually performed.
+ was not actually performed, or ASSERT() if the set operation was not corretly performed.
If Guid is NULL, then ASSERT().
If SizeOfBuffer is NULL, then ASSERT().
@@ -852,6 +871,7 @@ LibPcdSetExPtr (
)
{
EFI_STATUS Status;
+ UINTN InputSizeOfBuffer;
ASSERT (Guid != NULL);
@@ -861,10 +881,12 @@ LibPcdSetExPtr (
ASSERT (Buffer != NULL);
}
+ InputSizeOfBuffer = *SizeOfBuffer;
Status = GetPiPcdProtocol()->SetPtr (Guid, TokenNumber, SizeOfBuffer, Buffer);
- if (EFI_ERROR (Status)) {
+ if (EFI_ERROR (Status) && (*SizeOfBuffer < InputSizeOfBuffer)) {
return NULL;
}
+ ASSERT_EFI_ERROR (Status);
return Buffer;
}
@@ -876,9 +898,10 @@ LibPcdSetExPtr (
Sets the Boolean value for the token specified by TokenNumber and
Guid to the value specified by Value. Value is returned.
-
+
If Guid is NULL, then ASSERT().
-
+ If the set operation was not correctly performed, then ASSERT().
+
@param[in] Guid The 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.
@@ -1002,7 +1025,10 @@ LibPcdGetNextToken (
IN UINTN TokenNumber
)
{
- GetPiPcdProtocol()->GetNextToken (Guid, &TokenNumber);
+ EFI_STATUS Status;
+
+ Status = GetPiPcdProtocol()->GetNextToken (Guid, &TokenNumber);
+ ASSERT (!EFI_ERROR (Status) || TokenNumber == 0);
return TokenNumber;
}