From: qwang12 Date: Wed, 30 Aug 2006 09:11:34 +0000 (+0000) Subject: Add in feature flag PcdPeiPcdDatabaseSetEnabled, PcdPeiPcdDatabaseGetSizeEnabled... X-Git-Tag: edk2-stable201903~24466 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=f89f5802f82b1b83f85a074fc0f76ec782e003b5 Add in feature flag PcdPeiPcdDatabaseSetEnabled, PcdPeiPcdDatabaseGetSizeEnabled, PcdPeiPcdDatabaseCallbackOnSetEnabled, PcdPeiPcdDatabaseExEnabled to allow user to customize Pcd service PEIM. It is very curical to save size in PEI phase. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1408 6f19259b-4bc3-4df7-8a09-765794883524 --- diff --git a/EdkModulePkg/EdkModulePkg.fpd b/EdkModulePkg/EdkModulePkg.fpd index 719b135443..c3c44a5eed 100644 --- a/EdkModulePkg/EdkModulePkg.fpd +++ b/EdkModulePkg/EdkModulePkg.fpd @@ -1,4 +1,4 @@ - + EdkModuleAll @@ -231,6 +231,38 @@ 1 0xAF + + PcdPeiPcdDatabaseCallbackOnSetEnabled + 0x00010032 + gEfiEdkModulePkgTokenSpaceGuid + BOOLEAN + 1 + true + + + PcdPeiPcdDatabaseExEnabled + 0x00010033 + gEfiEdkModulePkgTokenSpaceGuid + BOOLEAN + 1 + true + + + PcdPeiPcdDatabaseGetSizeEnabled + 0x00010031 + gEfiEdkModulePkgTokenSpaceGuid + BOOLEAN + 1 + true + + + PcdPeiPcdDatabaseSetEnabled + 0x00010030 + gEfiEdkModulePkgTokenSpaceGuid + BOOLEAN + 1 + true + NULL @@ -4847,6 +4879,38 @@ 1 0xAF + + PcdPeiPcdDatabaseCallbackOnSetEnabled + 0x00010032 + gEfiEdkModulePkgTokenSpaceGuid + BOOLEAN + 1 + true + + + PcdPeiPcdDatabaseExEnabled + 0x00010033 + gEfiEdkModulePkgTokenSpaceGuid + BOOLEAN + 1 + true + + + PcdPeiPcdDatabaseGetSizeEnabled + 0x00010031 + gEfiEdkModulePkgTokenSpaceGuid + BOOLEAN + 1 + true + + + PcdPeiPcdDatabaseSetEnabled + 0x00010030 + gEfiEdkModulePkgTokenSpaceGuid + BOOLEAN + 1 + true + NULL @@ -8835,6 +8899,38 @@ 1 0xAF + + PcdPeiPcdDatabaseCallbackOnSetEnabled + 0x00010032 + gEfiEdkModulePkgTokenSpaceGuid + BOOLEAN + 1 + true + + + PcdPeiPcdDatabaseExEnabled + 0x00010033 + gEfiEdkModulePkgTokenSpaceGuid + BOOLEAN + 1 + true + + + PcdPeiPcdDatabaseGetSizeEnabled + 0x00010031 + gEfiEdkModulePkgTokenSpaceGuid + BOOLEAN + 1 + true + + + PcdPeiPcdDatabaseSetEnabled + 0x00010030 + gEfiEdkModulePkgTokenSpaceGuid + BOOLEAN + 1 + true + NULL @@ -12827,6 +12923,38 @@ 1 0xAF + + PcdPeiPcdDatabaseCallbackOnSetEnabled + 0x00010032 + gEfiEdkModulePkgTokenSpaceGuid + BOOLEAN + 1 + true + + + PcdPeiPcdDatabaseExEnabled + 0x00010033 + gEfiEdkModulePkgTokenSpaceGuid + BOOLEAN + 1 + true + + + PcdPeiPcdDatabaseGetSizeEnabled + 0x00010031 + gEfiEdkModulePkgTokenSpaceGuid + BOOLEAN + 1 + true + + + PcdPeiPcdDatabaseSetEnabled + 0x00010030 + gEfiEdkModulePkgTokenSpaceGuid + BOOLEAN + 1 + true + NULL @@ -16702,74 +16830,74 @@ - - - PcdFlashNvStorageVariableBase - 0x30000001 - gEfiGenericPlatformTokenSpaceGuid - UINT32 - 4 - - 0 - 0x0 - - - - PcdFlashNvStorageVariableSize - 0x30000002 - gEfiGenericPlatformTokenSpaceGuid - UINT32 - 4 - - 0 - 0x0 - - - - PcdFlashNvStorageFtwWorkingBase - 0x30000010 - gEfiGenericPlatformTokenSpaceGuid - UINT32 - 4 - - 0 - 0x0 - - - - PcdFlashNvStorageFtwWorkingSize - 0x30000011 - gEfiGenericPlatformTokenSpaceGuid - UINT32 - 4 - - 0 - 0x0 - - - - PcdFlashNvStorageFtwSpareBase - 0x30000013 - gEfiGenericPlatformTokenSpaceGuid - UINT32 - 4 - - 0 - 0x0 - - - - PcdFlashNvStorageFtwSpareSize - 0x30000014 - gEfiGenericPlatformTokenSpaceGuid - UINT32 - 4 - - 0 - 0x0 - + + + PcdFlashNvStorageVariableBase + 0x30000001 + gEfiGenericPlatformTokenSpaceGuid + UINT32 + 4 + + 0 + 0x0 + + + + PcdFlashNvStorageVariableSize + 0x30000002 + gEfiGenericPlatformTokenSpaceGuid + UINT32 + 4 + + 0 + 0x0 + + + + PcdFlashNvStorageFtwWorkingBase + 0x30000010 + gEfiGenericPlatformTokenSpaceGuid + UINT32 + 4 + + 0 + 0x0 + + + + PcdFlashNvStorageFtwWorkingSize + 0x30000011 + gEfiGenericPlatformTokenSpaceGuid + UINT32 + 4 + + 0 + 0x0 + + + + PcdFlashNvStorageFtwSpareBase + 0x30000013 + gEfiGenericPlatformTokenSpaceGuid + UINT32 + 4 + + 0 + 0x0 + + + + PcdFlashNvStorageFtwSpareSize + 0x30000014 + gEfiGenericPlatformTokenSpaceGuid + UINT32 + 4 + + 0 + 0x0 + - + @@ -16785,7 +16913,7 @@ - + @@ -16793,7 +16921,7 @@ - + @@ -16804,7 +16932,7 @@ - + diff --git a/EdkModulePkg/EdkModulePkg.spd b/EdkModulePkg/EdkModulePkg.spd index 86d33e69cd..48f49279ac 100644 --- a/EdkModulePkg/EdkModulePkg.spd +++ b/EdkModulePkg/EdkModulePkg.spd @@ -7,11 +7,11 @@ Edk Module Package Reference Implementations This Module provides standard reference information for EFI/Tiano implementations. Copyright (c) 2006, Intel Corporation. - All rights reserved. - 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 http://opensource.org/licenses/bsd-license.php - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES + All rights reserved. + 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 http://opensource.org/licenses/bsd-license.php + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052 @@ -457,11 +457,9 @@ gEfiGenericPlatformTokenSpaceGuid 18D15EA6-9E14-40a1-B39C-59C44DA9D891 - - This is the token space GUID for platform generic PCD definitions. - Now FlashLayout and Platform CPU belong to this space. - - + This is the token space GUID for platform generic PCD definitions. + Now FlashLayout and Platform CPU belong to this space. + gEfiEdkModulePkgTokenSpaceGuid 8CC4092F-F60E-46d1-B41C-1E761DF50582 @@ -814,7 +812,7 @@ gEfiEdkModulePkgTokenSpaceGuid UINT32 FIXED_AT_BUILD - The maximum number of callback function, which will be triggered when + The maximum number of callback function, which will be triggered when a PCD entry is been set, can be registered for a single PCD entry in PEI phase. @@ -823,7 +821,7 @@ gEfiEdkModulePkgTokenSpaceGuid UINT32 FIXED_AT_BUILD - The base address of the VPD (Vital Product Data) region. It is + The base address of the VPD (Vital Product Data) region. It is normally a region reserved on flash. @@ -857,7 +855,7 @@ BOOLEAN FEATURE_FLAG TRUE - This feature flag can be used to enable or disable the Pcd PEIM database + This feature flag can be used to enable or disable the Pcd PEIM database traverse capability. Disable it can reduce the size of final image generated. @@ -867,7 +865,7 @@ BOOLEAN FEATURE_FLAG TRUE - This feature flag can be used to enable or disable the Pcd DXE database + This feature flag can be used to enable or disable the Pcd DXE database traverse capability. Disable it can reduce the size of final image generated. @@ -1003,11 +1001,9 @@ VOID* DYNAMIC {} - - This PCD is a array of EFI_PHYSICAL_ADDERSS of each Firmware Volume on the - platform. FVB driver will make use of this PCD entry to install EFI_FIRMWARE_BLOCK_PROTOCOL - on every FV specified. - + This PCD is a array of EFI_PHYSICAL_ADDERSS of each Firmware Volume on the + platform. FVB driver will make use of this PCD entry to install EFI_FIRMWARE_BLOCK_PROTOCOL + on every FV specified. PcdFlashFvBaseArrayElementNumber @@ -1016,11 +1012,45 @@ UINT8 DYNAMIC 3 - - This PCD is a number element in the array defined by PcdFlashFvBaseArray in - gEfiGenericPlatformTokenSpaceGuid. Normally, we have 3 firmware volumes: - FV_MAIN, FV_RECOVERY, NV_STORAGE. - + This PCD is a number element in the array defined by PcdFlashFvBaseArray in + gEfiGenericPlatformTokenSpaceGuid. Normally, we have 3 firmware volumes: + FV_MAIN, FV_RECOVERY, NV_STORAGE. + + + PcdPeiPcdDatabaseSetEnabled + 0x00010030 + gEfiEdkModulePkgTokenSpaceGuid + BOOLEAN + FEATURE_FLAG + FALSE + This feature flag can be used to enable or disable the SET capability of PCD service PEIM. If a platform does not do PCD SET operation in PEI phase. This flag can be set to DISABLE to save size. + + + PcdPeiPcdDatabaseGetSizeEnabled + 0x00010031 + gEfiEdkModulePkgTokenSpaceGuid + BOOLEAN + FEATURE_FLAG + FALSE + This feature flag can be used to enable or disable the GET size capability of PCD service PEIM. If a platform does not do PCD get size operation in PEI phase. This flag can be set to DISABLE to save size. + + + PcdPeiPcdDatabaseCallbackOnSetEnabled + 0x00010032 + gEfiEdkModulePkgTokenSpaceGuid + BOOLEAN + FEATURE_FLAG + FALSE + This feature flag can be used to enable or disable the Callback On SET capability of PCD service PEIM. If a platform does not register any callback on set in PEI phase. This flag can be set to DISABLE to save size. + + + PcdPeiPcdDatabaseExEnabled + 0x00010033 + gEfiEdkModulePkgTokenSpaceGuid + BOOLEAN + FEATURE_FLAG + FALSE + This feature flag can be used to enable or disable the PCD service PEIM to handle DynamicEX PCD. If a platform has no module to use DynamicEX in PEI phase. This flag can be set to DISABLE to save size. - + \ No newline at end of file diff --git a/EdkModulePkg/Universal/PCD/Pei/Pcd.c b/EdkModulePkg/Universal/PCD/Pei/Pcd.c index 40013cf8b5..33972d3c7f 100644 --- a/EdkModulePkg/Universal/PCD/Pei/Pcd.c +++ b/EdkModulePkg/Universal/PCD/Pei/Pcd.c @@ -174,6 +174,10 @@ PeiPcdGetSize ( UINTN Size; UINTN MaxSize; + if (!FeaturePcdGet(PcdPeiPcdDatabaseGetSizeEnabled)) { + return EFI_UNSUPPORTED; + } + PeiPcdDb = GetPcdDatabase (); // // TokenNumber Zero is reserved as PCD_INVALID_TOKEN_NUMBER. @@ -281,6 +285,10 @@ PeiPcdGetSizeEx ( IN UINTN ExTokenNumber ) { + if ((!FeaturePcdGet (PcdPeiPcdDatabaseGetSizeEnabled)) || !FeaturePcdGet (PcdPeiPcdDatabaseExEnabled)) { + return EFI_UNSUPPORTED; + } + return PeiPcdGetSize (GetExPcdTokenNumber (Guid, ExTokenNumber)); } @@ -446,6 +454,10 @@ PeiRegisterCallBackOnSet ( IN PCD_PPI_CALLBACK CallBackFunction ) { + if (!FeaturePcdGet(PcdPeiPcdDatabaseCallbackOnSetEnabled)) { + return EFI_UNSUPPORTED; + } + ASSERT (CallBackFunction != NULL); return PeiRegisterCallBackWorker (ExTokenNumber, Guid, CallBackFunction, TRUE); @@ -461,6 +473,10 @@ PcdUnRegisterCallBackOnSet ( IN PCD_PPI_CALLBACK CallBackFunction ) { + if (!FeaturePcdGet(PcdPeiPcdDatabaseCallbackOnSetEnabled)) { + return EFI_UNSUPPORTED; + } + ASSERT (CallBackFunction != NULL); return PeiRegisterCallBackWorker (ExTokenNumber, Guid, CallBackFunction, FALSE); diff --git a/EdkModulePkg/Universal/PCD/Pei/Pcd.msa b/EdkModulePkg/Universal/PCD/Pei/Pcd.msa index 9510738246..0ae491a85a 100644 --- a/EdkModulePkg/Universal/PCD/Pei/Pcd.msa +++ b/EdkModulePkg/Universal/PCD/Pei/Pcd.msa @@ -1,13 +1,5 @@ - - - + + PcdPeim PEIM @@ -16,11 +8,11 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.--> Component description file for Pcd Database PEIM module This DXE driver implement and produce the PCD PPI. Copyright (c) 2006, Intel Corporation - All rights reserved. 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 - http://opensource.org/licenses/bsd-license.php - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + All rights reserved. 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 + http://opensource.org/licenses/bsd-license.php + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052 @@ -93,23 +85,47 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.--> - + PcdMaxPeiPcdCallBackNumberPerPcdEntry gEfiEdkModulePkgTokenSpaceGuid - The maximum number of callback function, which will be triggered when + The maximum number of callback function, which will be triggered when a PCD entry is been set, can be registered for a single PCD entry in PEI phase. - + PcdVpdBaseAddress gEfiEdkModulePkgTokenSpaceGuid - The base address of the VPD (Vital Product Data) region. It is + The base address of the VPD (Vital Product Data) region. It is normally a region reserved on flash. - + PcdPeiPcdDatabaseTraverseEnabled gEfiEdkModulePkgTokenSpaceGuid - This feature flag can be used to enable or disable the Pcd PEIM database + This feature flag can be used to enable or disable the Pcd PEIM database traverse capability. Disable it can reduce the size of final image generated. + + PcdPeiPcdDatabaseCallbackOnSetEnabled + gEfiEdkModulePkgTokenSpaceGuid + FALSE + This feature flag can be used to enable or disable the Callback On SET capability of PCD service PEIM. If a platform does not register any callback on set in PEI phase. This flag can be set to DISABLE to save size. + + + PcdPeiPcdDatabaseExEnabled + gEfiEdkModulePkgTokenSpaceGuid + FALSE + This feature flag can be used to enable or disable the PCD service PEIM to handle DynamicEX PCD. If a platform has no module to use DynamicEX in PEI phase. This flag can be set to DISABLE to save size. + + + PcdPeiPcdDatabaseGetSizeEnabled + gEfiEdkModulePkgTokenSpaceGuid + FALSE + This feature flag can be used to enable or disable the GET size capability of PCD service PEIM. If a platform does not do PCD get size operation in PEI phase. This flag can be set to DISABLE to save size. + + + PcdPeiPcdDatabaseSetEnabled + gEfiEdkModulePkgTokenSpaceGuid + FALSE + This feature flag can be used to enable or disable the SET capability of PCD service PEIM. If a platform does not do PCD SET operation in PEI phase. This flag can be set to DISABLE to save size. + - + \ No newline at end of file diff --git a/EdkModulePkg/Universal/PCD/Pei/Service.c b/EdkModulePkg/Universal/PCD/Pei/Service.c index 255267c9ab..521c88b7fc 100644 --- a/EdkModulePkg/Universal/PCD/Pei/Service.c +++ b/EdkModulePkg/Universal/PCD/Pei/Service.c @@ -337,6 +337,10 @@ SetWorker ( VOID *InternalData; UINTN MaxSize; + if (!FeaturePcdGet(PcdPeiPcdDatabaseSetEnabled)) { + return EFI_UNSUPPORTED; + } + // // TokenNumber Zero is reserved as PCD_INVALID_TOKEN_NUMBER. // We have to decrement TokenNumber by 1 to make it usable @@ -462,6 +466,10 @@ ExSetWorker ( { UINTN TokenNumber; + if (!FeaturePcdGet(PcdPeiPcdDatabaseSetEnabled)) { + return EFI_UNSUPPORTED; + } + TokenNumber = GetExPcdTokenNumber (Guid, ExTokenNumber); InvokeCallbackOnSet (ExTokenNumber, Guid, TokenNumber, Data, *Size); @@ -480,6 +488,11 @@ ExGetWorker ( IN UINTN GetSize ) { + if (!FeaturePcdGet (PcdPeiPcdDatabaseExEnabled)) { + ASSERT (FALSE); + return 0; + } + return GetWorker (GetExPcdTokenNumber (Guid, ExTokenNumber), GetSize); }