/** @file \r
All Pcd Ppi services are implemented here.\r
\r
-Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>\r
-This program and the accompanying materials \r
-are licensed and made available under the terms and conditions of the BSD License \r
-which accompanies this distribution. The full text of the license may be found at \r
-http://opensource.org/licenses/bsd-license.php \r
- \r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
+Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>\r
+(C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>\r
+This program and the accompanying materials\r
+are licensed and made available under the terms and conditions of the BSD License\r
+which accompanies this distribution. The full text of the license may be found at\r
+http://opensource.org/licenses/bsd-license.php\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
\r
**/\r
\r
VOID\r
)\r
{\r
- return GetPcdDatabase()->SystemSkuId;\r
+ return (UINTN) GetPcdDatabase()->SystemSkuId;\r
}\r
\r
/**\r
UINTN Index;\r
\r
PeiPcdDb = GetPcdDatabase();\r
+\r
+ if (SkuId == PeiPcdDb->SystemSkuId) {\r
+ //\r
+ // The input SKU Id is equal to current SKU Id, return directly.\r
+ //\r
+ return;\r
+ }\r
+\r
+ if (PeiPcdDb->SystemSkuId != (SKU_ID) 0) {\r
+ DEBUG ((DEBUG_ERROR, "PcdPei - The SKU Id could be changed only once."));\r
+ DEBUG ((\r
+ DEBUG_ERROR,\r
+ "PcdPei - The SKU Id was set to 0x%lx already, it could not be set to 0x%lx any more.",\r
+ PeiPcdDb->SystemSkuId,\r
+ (SKU_ID) SkuId\r
+ ));\r
+ ASSERT (FALSE);\r
+ return;\r
+ }\r
+\r
SkuIdTable = (SKU_ID *) ((UINT8 *) PeiPcdDb + PeiPcdDb->SkuIdTableOffset);\r
for (Index = 0; Index < SkuIdTable[0]; Index++) {\r
if (SkuId == SkuIdTable[Index + 1]) {\r
+ DEBUG ((EFI_D_INFO, "PcdPei - Set current SKU Id to 0x%lx.\n", (SKU_ID) SkuId));\r
PeiPcdDb->SystemSkuId = (SKU_ID) SkuId;\r
return;\r
}\r
}\r
\r
//\r
- // Invalid input SkuId, the default SKU Id will be used for the system.\r
+ // Invalid input SkuId, the default SKU Id will be still used for the system.\r
//\r
- DEBUG ((EFI_D_INFO, "PcdPei - Invalid input SkuId, the default SKU Id will be used.\n"));\r
- PeiPcdDb->SystemSkuId = (SKU_ID) 0;\r
+ DEBUG ((EFI_D_INFO, "PcdPei - Invalid input SkuId, the default SKU Id will be still used.\n"));\r
return;\r
}\r
\r
}\r
\r
if (Found) {\r
+ //\r
+ // If given token number is PCD_INVALID_TOKEN_NUMBER, then return the first\r
+ // token number in found token space.\r
+ //\r
if (*TokenNumber == PCD_INVALID_TOKEN_NUMBER) {\r
*TokenNumber = ExMapTable[Index].ExTokenNumber;\r
return EFI_SUCCESS;\r
}\r
\r
for ( ; Index < PeiPcdDb->ExTokenCount; Index++) {\r
- if (ExMapTable[Index].ExTokenNumber == *TokenNumber) {\r
+ if ((ExMapTable[Index].ExTokenNumber == *TokenNumber) && (ExMapTable[Index].ExGuidIndex == GuidTableIdx)) {\r
break;\r
}\r
}\r