diff options
author | Bob C Feng <bob.c.feng@intel.com> | 2013-11-18 07:45:49 +0000 |
---|---|---|
committer | lzeng14 <lzeng14@6f19259b-4bc3-4df7-8a09-765794883524> | 2013-11-18 07:45:49 +0000 |
commit | 419db80bef66edff583a0a5f406e801d70f11344 (patch) | |
tree | 2d3e4e5b918200570bd6ec4b0eccc874b7447410 /MdePkg | |
parent | e8a47801a1dfdb148b1bfcd5bdc8ebc3bf51f92d (diff) | |
download | edk2-platforms-419db80bef66edff583a0a5f406e801d70f11344.tar.xz |
MdePkg and MdeModulePkg Pcd: Implement PCD Driver for External PCD Database and SKU enable Feature.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Bob C Feng <bob.c.feng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14857 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdePkg')
-rw-r--r-- | MdePkg/Include/Library/PcdLib.h | 41 | ||||
-rw-r--r-- | MdePkg/Include/Ppi/Pcd.h | 38 | ||||
-rw-r--r-- | MdePkg/Include/Ppi/PiPcd.h | 12 | ||||
-rw-r--r-- | MdePkg/Include/Protocol/Pcd.h | 37 | ||||
-rw-r--r-- | MdePkg/Library/DxePcdLib/DxePcdLib.c | 12 | ||||
-rw-r--r-- | MdePkg/Library/PeiPcdLib/PeiPcdLib.c | 14 |
6 files changed, 68 insertions, 86 deletions
diff --git a/MdePkg/Include/Library/PcdLib.h b/MdePkg/Include/Library/PcdLib.h index 8deb6f758e..1fc584060f 100644 --- a/MdePkg/Include/Library/PcdLib.h +++ b/MdePkg/Include/Library/PcdLib.h @@ -14,7 +14,7 @@ There are no restrictions on the use of FeaturePcd(), FixedPcdGetXX(),
PatchPcdGetXX(), and PatchPcdSetXX().
-Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2013, 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
@@ -533,6 +533,20 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. /**
+ Retrieves a token number based on a GUID and a token name.
+
+ Returns the token number for the token specified by Guid and TokenName.
+
+ @param Guid Pointer to a 128-bit unique value that designates
+ which namespace to retrieve a value from.
+ @param TokenName The name of the PCD token to retrieve a current value for.
+
+ @return Return the token number.
+
+**/
+#define PcdTokenEx(Guid,TokenName) _PCD_TOKEN_EX_##TokenName(Guid)
+
+/**
Retrieves an 8-bit PCD token value based on a GUID and a token name.
Returns the 8-bit value for the token specified by Guid and TokenName.
@@ -548,8 +562,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. @return An 8-bit PCD token value.
**/
-#define PcdGetEx8(Guid, TokenName) LibPcdGetEx8 ((Guid), _PCD_TOKEN_##TokenName)
-
+#define PcdGetEx8(Guid, TokenName) LibPcdGetEx8 ((Guid), PcdTokenEx(Guid,TokenName))
/**
Retrieves a 16-bit PCD token value based on a GUID and a token name.
@@ -567,7 +580,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. @return A 16-bit PCD token value.
**/
-#define PcdGetEx16(Guid, TokenName) LibPcdGetEx16 ((Guid), _PCD_TOKEN_##TokenName)
+#define PcdGetEx16(Guid, TokenName) LibPcdGetEx16 ((Guid), PcdTokenEx(Guid,TokenName))
/**
@@ -586,7 +599,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. @return A 32-bit PCD token value.
**/
-#define PcdGetEx32(Guid, TokenName) LibPcdGetEx32 ((Guid), _PCD_TOKEN_##TokenName)
+#define PcdGetEx32(Guid, TokenName) LibPcdGetEx32 ((Guid), PcdTokenEx(Guid,TokenName))
/**
@@ -605,7 +618,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. @return A 64-bit PCD token value.
**/
-#define PcdGetEx64(Guid, TokenName) LibPcdGetEx64 ((Guid), _PCD_TOKEN_##TokenName)
+#define PcdGetEx64(Guid, TokenName) LibPcdGetEx64 ((Guid), PcdTokenEx(Guid,TokenName))
/**
@@ -624,7 +637,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. @return A pointer to a PCD token buffer.
**/
-#define PcdGetExPtr(Guid, TokenName) LibPcdGetExPtr ((Guid), _PCD_TOKEN_##TokenName)
+#define PcdGetExPtr(Guid, TokenName) LibPcdGetExPtr ((Guid), PcdTokenEx(Guid,TokenName))
/**
@@ -643,7 +656,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. @return A Boolean PCD token value.
**/
-#define PcdGetExBool(Guid, TokenName) LibPcdGetExBool ((Guid), _PCD_TOKEN_##TokenName)
+#define PcdGetExBool(Guid, TokenName) LibPcdGetExBool ((Guid), PcdTokenEx(Guid,TokenName))
/**
@@ -663,7 +676,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. @return Return the Value that was set.
**/
-#define PcdSetEx8(Guid, TokenName, Value) LibPcdSetEx8 ((Guid), _PCD_TOKEN_##TokenName, (Value))
+#define PcdSetEx8(Guid, TokenName, Value) LibPcdSetEx8 ((Guid), PcdTokenEx(Guid,TokenName), (Value))
/**
@@ -683,7 +696,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. @return Return the Value that was set.
**/
-#define PcdSetEx16(Guid, TokenName, Value) LibPcdSetEx16 ((Guid), _PCD_TOKEN_##TokenName, (Value))
+#define PcdSetEx16(Guid, TokenName, Value) LibPcdSetEx16 ((Guid), PcdTokenEx(Guid,TokenName), (Value))
/**
@@ -703,7 +716,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. @return Return the Value that was set.
**/
-#define PcdSetEx32(Guid, TokenName, Value) LibPcdSetEx32 ((Guid), _PCD_TOKEN_##TokenName, (Value))
+#define PcdSetEx32(Guid, TokenName, Value) LibPcdSetEx32 ((Guid), PcdTokenEx(Guid,TokenName), (Value))
/**
@@ -723,7 +736,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. @return Return the Value that was set.
**/
-#define PcdSetEx64(Guid, TokenName, Value) LibPcdSetEx64 ((Guid), _PCD_TOKEN_##TokenName, (Value))
+#define PcdSetEx64(Guid, TokenName, Value) LibPcdSetEx64 ((Guid), PcdTokenEx(Guid,TokenName), (Value))
/**
@@ -752,7 +765,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/
#define PcdSetExPtr(Guid, TokenName, SizeOfBuffer, Buffer) \
- LibPcdSetExPtr ((Guid), _PCD_TOKEN_##TokenName, (SizeOfBuffer), (Buffer))
+ LibPcdSetExPtr ((Guid), PcdTokenEx(Guid,TokenName), (SizeOfBuffer), (Buffer))
/**
@@ -773,7 +786,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/
#define PcdSetExBool(Guid, TokenName, Value) \
- LibPcdSetExBool((Guid), _PCD_TOKEN_##TokenName, (Value))
+ LibPcdSetExBool((Guid), PcdTokenEx(Guid,TokenName), (Value))
/**
diff --git a/MdePkg/Include/Ppi/Pcd.h b/MdePkg/Include/Ppi/Pcd.h index da250a59ed..79e9c3e971 100644 --- a/MdePkg/Include/Ppi/Pcd.h +++ b/MdePkg/Include/Ppi/Pcd.h @@ -6,7 +6,7 @@ The interfaces for dynamic type PCD do not require the token space guid as parameter,
but interfaces for dynamic-ex type PCD require token space guid as parameter.
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2013, 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 that accompanies this distribution.
The full text of the license may be found at
@@ -775,10 +775,8 @@ EFI_STATUS is being made to retrieve tokens from the default token space.
@param[in, out] TokenNumber A pointer to the PCD token number to use to find the subsequent token number.
- @retval EFI_SUCCESS The PCD service has retrieved the next valid token number.
- Or the input token number is already the last valid token number in the PCD database.
- In the later case, *TokenNumber is updated with the value of 0.
- @retval EFI_NOT_FOUND If this input token number and token namespace does not exist on the platform.
+ @retval EFI_SUCCESS The PCD service has retrieved the next valid token number.
+ @retval EFI_NOT_FOUND The PCD service could not find data from the requested token number.
**/
typedef
@@ -793,25 +791,17 @@ EFI_STATUS /**
Retrieves the next valid PCD token namespace for a given namespace.
- If *Guid is NULL, then the GUID of the first token space of the
- current platform is assigned to *Guid the function return EFI_SUCCESS.
- If *Guid is NULL and there is no namespace exist in the platform other than the default
- (NULL) tokennamespace, *Guid is unchanged and the function return EFI_SUCCESS.
- If this input token namespace is the last namespace on the platform,
- *Guid will be assigned to NULL and the function return EFI_SUCCESS.
-
- @param[in, out] Guid An indirect pointer to EFI_GUID. On input it designates a known
- token namespace from which the search will start. On output, it designates
- the next valid token namespace on the platform. If the input token namespace
- does not exist on the platform, an error is returned, and the value of *Guid is
- undefined.
-
- @retval EFI_SUCCESS The PCD service has retrieved the next valid token namespace.
- Or the input token namespace is already the last valid token
- number in the PCD database. In the later case, *Guid is updated
- with the value of NULL. Or the input token name space is NULL and there
- is no valid token namespace other than the default namespace (NULL).
- @retval EFI_NOT_FOUND If the input token namespace does not exist on the platform.
+ Gets the next valid token namespace for a given namespace. This is useful to traverse the valid
+ token namespaces on a platform.
+
+ @param[in, out] Guid An indirect pointer to EFI_GUID. On input it designates a known token
+ namespace from which the search will start. On output, it designates the next valid
+ token namespace on the platform. If *Guid is NULL, then the GUID of the first token
+ space of the current platform is returned. If the search cannot locate the next valid
+ token namespace, an error is returned and the value of *Guid is undefined.
+
+ @retval EFI_SUCCESS The PCD service retrieved the value requested.
+ @retval EFI_NOT_FOUND The PCD service could not find the next valid token namespace.
**/
typedef
diff --git a/MdePkg/Include/Ppi/PiPcd.h b/MdePkg/Include/Ppi/PiPcd.h index d116dc230f..4698ecc3ad 100644 --- a/MdePkg/Include/Ppi/PiPcd.h +++ b/MdePkg/Include/Ppi/PiPcd.h @@ -1,18 +1,17 @@ /** @file
- Platform Configuration Database (PCD) Protocol defined in PI 1.2 Vol3
+ Platform Configuration Database (PCD) PPI defined in PI 1.2 Vol3
A platform database that contains a variety of current platform settings or
directives that can be accessed by a driver or application.
- PI PCD protocol only provide the accessing interfaces for Dynamic-Ex type PCD.
+ PI PCD ppi only provide the accessing interfaces for Dynamic-Ex type PCD.
- Callers to this protocol must be at a TPL_APPLICATION task priority level.
This is the base PCD service API that provides an abstraction for accessing configuration content in
the platform. It a seamless mechanism for extracting information regardless of where the
information is stored (such as in Read-only data, or an EFI Variable).
This protocol allows access to data through size-granular APIs and provides a mechanism for a
firmware component to monitor specific settings and be alerted when a setting is changed.
- Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2009 - 2013, 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
@@ -73,7 +72,7 @@ UINT8 );
/**
- Retrieves the current byte-sized value for a PCD token number. If the TokenNumber is invalid,
+ Retrieves the current word-sized value for a PCD token number. If the TokenNumber is invalid,
the results are unpredictable.
@param[in] Guid The 128-bit unique value that designates which namespace to extract the value from.
@@ -375,7 +374,8 @@ EFI_STATUS know what token numbers are valid in the database.
@param[in] Guid The 128-bit unique value that designates which namespace to extract the value from.
- @param[in] TokenNumber The PCD token number.
+ @param[in] TokenNumber A pointer to the PCD token number to use to find the subsequent token number. To
+ retrieve the "first" token, have the pointer reference a TokenNumber value of 0.
@retval EFI_SUCCESS The PCD service has retrieved the value requested.
@retval EFI_NOT_FOUND The PCD service could not find data from the requested token number.
diff --git a/MdePkg/Include/Protocol/Pcd.h b/MdePkg/Include/Protocol/Pcd.h index 03ce981d46..03b02fd936 100644 --- a/MdePkg/Include/Protocol/Pcd.h +++ b/MdePkg/Include/Protocol/Pcd.h @@ -6,7 +6,7 @@ The interfaces in dynamic type PCD do not require the token space guid as parameter,
but interfaces in dynamic-ex type PCD require token space guid as parameter.
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2013, 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 that accompanies this distribution.
The full text of the license may be found at
@@ -766,7 +766,7 @@ EFI_STATUS Retrieves the next valid token number in a given namespace.
This is useful since the PCD infrastructure contains a sparse list of token numbers,
- and one cannot know without examination or by deduction what token numbers are valid in the database.
+ and one cannot a priori know what token numbers are valid in the database.
If TokenNumber is 0 and Guid is not NULL, then the first token from the token space specified by Guid is returned.
If TokenNumber is not 0 and Guid is not NULL, then the next token in the token space specified by Guid is returned.
@@ -784,10 +784,8 @@ EFI_STATUS @param[in,out] TokenNumber
A pointer to the PCD token number to use to find the subsequent token number.
- @retval EFI_SUCCESS The PCD service retrieved the next valid token number. Or the input token number
- is already the last valid token number in the PCD database.
- In the later case, *TokenNumber is updated with the value of 0.
- @retval EFI_NOT_FOUND If this input token number and token namespace does not exist on the platform.
+ @retval EFI_SUCCESS The PCD service has retrieved the next valid token number.
+ @retval EFI_NOT_FOUND The PCD service could not find data from the requested token number.
**/
typedef
@@ -802,22 +800,17 @@ EFI_STATUS /**
Retrieves the next valid PCD token namespace for a given namespace.
- @param[in, out] Guid An indirect pointer to EFI_GUID. On input it designates
- a known token namespace from which the search will start. On output,
- it designates the next valid token namespace on the platform. If the input
- token namespace does not exist on the platform, an error is returned and
- the value of *Guid is undefined. If *Guid is NULL, then the GUID of the
- first token space of the current platform is assigned to *Guid the function
- return EFI_SUCCESS. If *Guid is NULL and there is no namespace exist in
- the platform other than the default (NULL) token namespace, *Guid is unchanged
- and the function return EFI_SUCCESS. If this input token namespace is the last
- namespace on the platform, *Guid will be assigned to NULL and the function return
- EFI_SUCCESS.
-
- @retval EFI_SUCCESS The PCD service retrieved the next valid token space Guid.
- Or, the input token space Guid is already the last valid token space Guid
- in the PCD database. In the later case, *Guid is updated with the value of NULL.
- @retval EFI_NOT_FOUND If the input token namespace does not exist on the platform.
+ Gets the next valid token namespace for a given namespace. This is useful to traverse the valid
+ token namespaces on a platform.
+
+ @param[in, out] Guid An indirect pointer to EFI_GUID. On input it designates a known token namespace
+ from which the search will start. On output, it designates the next valid token
+ namespace on the platform. If *Guid is NULL, then the GUID of the first token
+ space of the current platform is returned. If the search cannot locate the next valid
+ token namespace, an error is returned and the value of *Guid is undefined.
+
+ @retval EFI_SUCCESS The PCD service retrieved the value requested.
+ @retval EFI_NOT_FOUND The PCD service could not find the next valid token namespace.
**/
typedef
diff --git a/MdePkg/Library/DxePcdLib/DxePcdLib.c b/MdePkg/Library/DxePcdLib/DxePcdLib.c index a7303e800c..cd8212824f 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 - 2010, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2013, 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
@@ -955,10 +955,7 @@ LibPcdGetNextToken ( IN UINTN TokenNumber
)
{
- EFI_STATUS Status;
-
- Status = GetPiPcdProtocol()->GetNextToken (Guid, &TokenNumber);
- ASSERT_EFI_ERROR (Status);
+ GetPiPcdProtocol()->GetNextToken (Guid, &TokenNumber);
return TokenNumber;
}
@@ -984,10 +981,7 @@ LibPcdGetNextTokenSpace ( IN CONST GUID *TokenSpaceGuid
)
{
- EFI_STATUS Status;
-
- Status = GetPiPcdProtocol()->GetNextTokenSpace (&TokenSpaceGuid);
- ASSERT_EFI_ERROR (Status);
+ GetPiPcdProtocol()->GetNextTokenSpace (&TokenSpaceGuid);
return (GUID *)TokenSpaceGuid;
}
diff --git a/MdePkg/Library/PeiPcdLib/PeiPcdLib.c b/MdePkg/Library/PeiPcdLib/PeiPcdLib.c index 4d91799025..0a7efdb44e 100644 --- a/MdePkg/Library/PeiPcdLib/PeiPcdLib.c +++ b/MdePkg/Library/PeiPcdLib/PeiPcdLib.c @@ -1,7 +1,7 @@ /** @file
Implementation of PcdLib class library for PEI phase.
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2013, 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
@@ -962,11 +962,7 @@ LibPcdGetNextToken ( IN UINTN TokenNumber
)
{
- EFI_STATUS Status;
-
- Status = (GetPiPcdPpiPointer ())->GetNextToken (Guid, &TokenNumber);
-
- ASSERT_EFI_ERROR (Status);
+ (GetPiPcdPpiPointer ())->GetNextToken (Guid, &TokenNumber);
return TokenNumber;
}
@@ -991,11 +987,7 @@ LibPcdGetNextTokenSpace ( IN CONST GUID *TokenSpaceGuid
)
{
- EFI_STATUS Status;
-
- Status = (GetPiPcdPpiPointer ())->GetNextTokenSpace (&TokenSpaceGuid);
-
- ASSERT_EFI_ERROR (Status);
+ (GetPiPcdPpiPointer ())->GetNextTokenSpace (&TokenSpaceGuid);
return (GUID *) TokenSpaceGuid;
}
|