mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-31 01:24:12 +02:00
MdeModulePkg Pcd: Check the input SkuId in SetSku()
then GetSku() could return the currently active SkuId. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17173 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
a4d42c22d2
commit
85d0b97d8d
@ -152,21 +152,16 @@ PcdDxeInit (
|
|||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Only install PcdInfo PROTOCOL when PCD info content is present.
|
// Install GET_PCD_INFO_PROTOCOL to handle dynamic type PCD
|
||||||
|
// Install EFI_GET_PCD_INFO_PROTOCOL to handle dynamicEx type PCD
|
||||||
//
|
//
|
||||||
if (mPcdDatabase.DxeDb->PcdNameTableOffset != 0) {
|
Status = gBS->InstallMultipleProtocolInterfaces (
|
||||||
//
|
&mPcdHandle,
|
||||||
// Install GET_PCD_INFO_PROTOCOL to handle dynamic type PCD
|
&gGetPcdInfoProtocolGuid, &mGetPcdInfoInstance,
|
||||||
// Install EFI_GET_PCD_INFO_PROTOCOL to handle dynamicEx type PCD
|
&gEfiGetPcdInfoProtocolGuid, &mEfiGetPcdInfoInstance,
|
||||||
//
|
NULL
|
||||||
Status = gBS->InstallMultipleProtocolInterfaces (
|
);
|
||||||
&mPcdHandle,
|
ASSERT_EFI_ERROR (Status);
|
||||||
&gGetPcdInfoProtocolGuid, &mGetPcdInfoInstance,
|
|
||||||
&gEfiGetPcdInfoProtocolGuid, &mEfiGetPcdInfoInstance,
|
|
||||||
NULL
|
|
||||||
);
|
|
||||||
ASSERT_EFI_ERROR (Status);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Register callback function upon VariableLockProtocol
|
// Register callback function upon VariableLockProtocol
|
||||||
@ -274,8 +269,22 @@ DxePcdSetSku (
|
|||||||
IN UINTN SkuId
|
IN UINTN SkuId
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
mPcdDatabase.DxeDb->SystemSkuId = (SKU_ID) SkuId;
|
SKU_ID *SkuIdTable;
|
||||||
|
UINTN Index;
|
||||||
|
|
||||||
|
SkuIdTable = (SKU_ID *) ((UINT8 *) mPcdDatabase.DxeDb + mPcdDatabase.DxeDb->SkuIdTableOffset);
|
||||||
|
for (Index = 0; Index < SkuIdTable[0]; Index++) {
|
||||||
|
if (SkuId == SkuIdTable[Index + 1]) {
|
||||||
|
mPcdDatabase.DxeDb->SystemSkuId = (SKU_ID) SkuId;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Invalid input SkuId, the default SKU Id will be used for the system.
|
||||||
|
//
|
||||||
|
DEBUG ((EFI_D_INFO, "PcdDxe - Invalid input SkuId, the default SKU Id will be used.\n"));
|
||||||
|
mPcdDatabase.DxeDb->SystemSkuId = (SKU_ID) 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
Help functions used by PCD DXE driver.
|
Help functions used by PCD DXE driver.
|
||||||
|
|
||||||
Copyright (c) 2014, Hewlett-Packard Development Company, L.P.<BR>
|
Copyright (c) 2014, Hewlett-Packard Development Company, L.P.<BR>
|
||||||
Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -147,6 +147,19 @@ GetPcdName (
|
|||||||
CHAR8 *PcdName;
|
CHAR8 *PcdName;
|
||||||
CHAR8 *Name;
|
CHAR8 *Name;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Return NULL when PCD name table is absent.
|
||||||
|
//
|
||||||
|
if (IsPeiDb) {
|
||||||
|
if (mPcdDatabase.PeiDb->PcdNameTableOffset == 0) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (mPcdDatabase.DxeDb->PcdNameTableOffset == 0) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// TokenNumber Zero is reserved as PCD_INVALID_TOKEN_NUMBER.
|
// TokenNumber Zero is reserved as PCD_INVALID_TOKEN_NUMBER.
|
||||||
// We have to decrement TokenNumber by 1 to make it usable
|
// We have to decrement TokenNumber by 1 to make it usable
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/** @file
|
/** @file
|
||||||
All Pcd Ppi services are implemented here.
|
All Pcd Ppi services are implemented here.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -158,15 +158,10 @@ PcdPeimInit (
|
|||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Only install PcdInfo PPI when PCD info content is present.
|
// Install GET_PCD_INFO_PPI and EFI_GET_PCD_INFO_PPI.
|
||||||
//
|
//
|
||||||
if (DataBase->PcdNameTableOffset != 0) {
|
Status = PeiServicesInstallPpi (&mPpiList2[0]);
|
||||||
//
|
ASSERT_EFI_ERROR (Status);
|
||||||
// Install GET_PCD_INFO_PPI and EFI_GET_PCD_INFO_PPI.
|
|
||||||
//
|
|
||||||
Status = PeiServicesInstallPpi (&mPpiList2[0]);
|
|
||||||
ASSERT_EFI_ERROR (Status);
|
|
||||||
}
|
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
@ -262,9 +257,24 @@ PeiPcdSetSku (
|
|||||||
IN UINTN SkuId
|
IN UINTN SkuId
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
PEI_PCD_DATABASE *PeiPcdDb;
|
||||||
|
SKU_ID *SkuIdTable;
|
||||||
|
UINTN Index;
|
||||||
|
|
||||||
GetPcdDatabase()->SystemSkuId = (SKU_ID) SkuId;
|
PeiPcdDb = GetPcdDatabase();
|
||||||
|
SkuIdTable = (SKU_ID *) ((UINT8 *) PeiPcdDb + PeiPcdDb->SkuIdTableOffset);
|
||||||
|
for (Index = 0; Index < SkuIdTable[0]; Index++) {
|
||||||
|
if (SkuId == SkuIdTable[Index + 1]) {
|
||||||
|
PeiPcdDb->SystemSkuId = (SKU_ID) SkuId;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Invalid input SkuId, the default SKU Id will be used for the system.
|
||||||
|
//
|
||||||
|
DEBUG ((EFI_D_INFO, "PcdPei - Invalid input SkuId, the default SKU Id will be used.\n"));
|
||||||
|
PeiPcdDb->SystemSkuId = (SKU_ID) 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
The driver internal functions are implmented here.
|
The driver internal functions are implmented here.
|
||||||
They build Pei PCD database, and provide access service to PCD database.
|
They build Pei PCD database, and provide access service to PCD database.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -112,6 +112,13 @@ GetPcdName (
|
|||||||
CHAR8 *PcdName;
|
CHAR8 *PcdName;
|
||||||
CHAR8 *Name;
|
CHAR8 *Name;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Return NULL when PCD name table is absent.
|
||||||
|
//
|
||||||
|
if (Database->PcdNameTableOffset == 0) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// TokenNumber Zero is reserved as PCD_INVALID_TOKEN_NUMBER.
|
// TokenNumber Zero is reserved as PCD_INVALID_TOKEN_NUMBER.
|
||||||
// We have to decrement TokenNumber by 1 to make it usable
|
// We have to decrement TokenNumber by 1 to make it usable
|
||||||
|
Loading…
x
Reference in New Issue
Block a user