Reviewed-by: Chasel Chiu <chasel.c...@intel.com>
> -----Original Message----- > From: Kubacki, Michael A > Sent: Saturday, August 17, 2019 8:16 AM > To: devel@edk2.groups.io > Cc: Chaganty, Rangasai V <rangasai.v.chaga...@intel.com>; Chiu, Chasel > <chasel.c...@intel.com>; Desimone, Nathaniel L > <nathaniel.l.desim...@intel.com>; Gao, Liming <liming....@intel.com>; > Kinney, Michael D <michael.d.kin...@intel.com>; Sinha, Ankit > <ankit.si...@intel.com> > Subject: [edk2-platforms][PATCH V1 16/37] CoffeelakeSiliconPkg/Me: Add > library instances > > REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2082 > > Adds ME library class instances. > > * PeiMePolicyLib - PEI ME policy configuration services. > > Cc: Sai Chaganty <rangasai.v.chaga...@intel.com> > Cc: Chasel Chiu <chasel.c...@intel.com> > Cc: Nate DeSimone <nathaniel.l.desim...@intel.com> > Cc: Liming Gao <liming....@intel.com> > Cc: Michael D Kinney <michael.d.kin...@intel.com> > Cc: Ankit Sinha <ankit.si...@intel.com> > Signed-off-by: Michael Kubacki <michael.a.kuba...@intel.com> > --- > > Silicon/Intel/CoffeelakeSiliconPkg/Me/Library/PeiMePolicyLib/PeiMePolicyLi > b.inf | 44 ++++ > > Silicon/Intel/CoffeelakeSiliconPkg/Me/Library/PeiMePolicyLib/PeiMePolicyLi > brary.h | 25 ++ > > Silicon/Intel/CoffeelakeSiliconPkg/Me/Library/PeiMePolicyLib/PeiMePolicyLi > b.c | 251 ++++++++++++++++++++ > 3 files changed, 320 insertions(+) > > diff --git > a/Silicon/Intel/CoffeelakeSiliconPkg/Me/Library/PeiMePolicyLib/PeiMePolicy > Lib.inf > b/Silicon/Intel/CoffeelakeSiliconPkg/Me/Library/PeiMePolicyLib/PeiMePolicy > Lib.inf > new file mode 100644 > index 0000000000..85a227f950 > --- /dev/null > +++ b/Silicon/Intel/CoffeelakeSiliconPkg/Me/Library/PeiMePolicyLib/PeiMe > +++ PolicyLib.inf > @@ -0,0 +1,44 @@ > +## @file > +# Component description file for the PeiMePolicyLib libbrary. > +# > +# Copyright (c) 2019 Intel Corporation. All rights reserved. <BR> # # > +SPDX-License-Identifier: BSD-2-Clause-Patent # ## > + > +[Defines] > +INF_VERSION = 0x00010017 > +BASE_NAME = PeiMePolicyLib > +FILE_GUID = 2655FA94-4559-F393-B0B1-85A8E79C1532 > +VERSION_STRING = 1.0 > +MODULE_TYPE = PEIM > +LIBRARY_CLASS = PeiMePolicyLib > + > + > +[LibraryClasses] > +DebugLib > +IoLib > +PeiServicesLib > +BaseMemoryLib > +MemoryAllocationLib > +ConfigBlockLib > + > + > +[Packages] > +MdePkg/MdePkg.dec > +CoffeelakeSiliconPkg/SiPkg.dec > + > +[Sources] > +PeiMePolicyLib.c > +PeiMePolicyLibrary.h > + > + > +[Ppis] > +gSiPolicyPpiGuid ## PRODUCES > +gSiPreMemPolicyPpiGuid ## PRODUCES > + > + > +[Guids] > +gMePeiPreMemConfigGuid > +gMePeiConfigGuid > diff --git > a/Silicon/Intel/CoffeelakeSiliconPkg/Me/Library/PeiMePolicyLib/PeiMePolicy > Library.h > b/Silicon/Intel/CoffeelakeSiliconPkg/Me/Library/PeiMePolicyLib/PeiMePolicy > Library.h > new file mode 100644 > index 0000000000..3ac6a639e9 > --- /dev/null > +++ b/Silicon/Intel/CoffeelakeSiliconPkg/Me/Library/PeiMePolicyLib/PeiMe > +++ PolicyLibrary.h > @@ -0,0 +1,25 @@ > +/** @file > + Header file for the PeiMePolicy library. > + > + Copyright (c) 2019 Intel Corporation. All rights reserved. <BR> > + > + SPDX-License-Identifier: BSD-2-Clause-Patent **/ > + > +#ifndef _PEI_ME_POLICY_LIBRARY_H_ > +#define _PEI_ME_POLICY_LIBRARY_H_ > + > +#include <Library/DebugLib.h> > +#include <Library/IoLib.h> > +#include <Library/BaseMemoryLib.h> > +#include <Library/PeiServicesLib.h> > +#include <Library/MemoryAllocationLib.h> #include <Ppi/SiPolicy.h> > +#include <Library/PeiMePolicyLib.h> #include <ConfigBlock.h> #include > +<ConfigBlock/MePeiConfig.h> #include <Library/ConfigBlockLib.h> > +#include <Library/SiConfigBlockLib.h> #include <MkhiMsgs.h> > + > +#endif // _PEI_ME_POLICY_LIBRARY_H_ > diff --git > a/Silicon/Intel/CoffeelakeSiliconPkg/Me/Library/PeiMePolicyLib/PeiMePolicy > Lib.c > b/Silicon/Intel/CoffeelakeSiliconPkg/Me/Library/PeiMePolicyLib/PeiMePolicy > Lib.c > new file mode 100644 > index 0000000000..6f3d70b841 > --- /dev/null > +++ b/Silicon/Intel/CoffeelakeSiliconPkg/Me/Library/PeiMePolicyLib/PeiMe > +++ PolicyLib.c > @@ -0,0 +1,251 @@ > +/** @file > + This file is PeiMePolicy library. > + > + Copyright (c) 2019 Intel Corporation. All rights reserved. <BR> > + > + SPDX-License-Identifier: BSD-2-Clause-Patent **/ > + > +#include "PeiMePolicyLibrary.h" > + > +/** > + Load default settings for ME config block in pre-mem phase. > + > + @param[in] ConfigBlockPointer The pointer to the config > block > +**/ > +VOID > +LoadMePeiPreMemDefault ( > + IN VOID *ConfigBlockPointer > + ); > + > +/** > + Load default settings for ME config block in PEI phase. > + > + @param[in] ConfigBlockPointer The pointer to the config > block > +**/ > +VOID > +LoadMePeiDefault ( > + IN VOID *ConfigBlockPointer > + ); > + > +STATIC COMPONENT_BLOCK_ENTRY mMeCompontBlockPreMemBlocks [] = { > + {&gMePeiPreMemConfigGuid, sizeof (ME_PEI_PREMEM_CONFIG), > +ME_PEI_PREMEM_CONFIG_REVISION, LoadMePeiPreMemDefault} }; > + > +STATIC COMPONENT_BLOCK_ENTRY mMeCompontBlockBlocks [] = { > + {&gMePeiConfigGuid, sizeof (ME_PEI_CONFIG), > ME_PEI_CONFIG_REVISION, LoadMePeiDefault} > +}; > + > +/** > + Load default settings for ME config block in pre-mem phase. > + > + @param[in] ConfigBlockPointer The pointer to the config > block > +**/ > +VOID > +LoadMePeiPreMemDefault ( > + IN VOID *ConfigBlockPointer > + ) > +{ > + ME_PEI_PREMEM_CONFIG *MePeiPreMemConfig; > + MePeiPreMemConfig = ConfigBlockPointer; > + > + MePeiPreMemConfig->HeciTimeouts = 1; > + > + MePeiPreMemConfig->Heci1BarAddress = 0xFED1A000; > + MePeiPreMemConfig->Heci2BarAddress = 0xFED1B000; > + MePeiPreMemConfig->Heci3BarAddress = 0xFED1C000; > + > + // > + // Test policies > + // > + MePeiPreMemConfig->SendDidMsg = 1; > + > + MePeiPreMemConfig->KtDeviceEnable = 1; > +} > + > +/** > + Load default settings for ME config block in PEI phase. > + > + @param[in] ConfigBlockPointer The pointer to the config > block > +**/ > +VOID > +LoadMePeiDefault ( > + IN VOID *ConfigBlockPointer > + ) > +{ > + ME_PEI_CONFIG *MePeiConfig; > + MePeiConfig = ConfigBlockPointer; > + > + MePeiConfig->EndOfPostMessage = EOP_SEND_IN_DXE; > + MePeiConfig->MeUnconfigOnRtcClear = 1; } > + > +/** > + Dump values of ME config block in pre-mem phase. > + > + @param[in] MePeiPreMemConfig The pointer to the config > block > +**/ > +VOID > +EFIAPI > +PrintMePeiPreMemConfig ( > + IN ME_PEI_PREMEM_CONFIG *MePeiPreMemConfig > + ) > +{ > + DEBUG_CODE_BEGIN (); > + DEBUG ((DEBUG_INFO, "------------------------ ME_PEI_PREMEM_CONFIG > -----------------\n")); > + DEBUG ((DEBUG_INFO, " Revision : 0x%x\n", > MePeiPreMemConfig->Header.Revision)); > + ASSERT (MePeiPreMemConfig->Header.Revision == > +ME_PEI_PREMEM_CONFIG_REVISION); > + > + DEBUG ((DEBUG_INFO, " HeciTimeouts : 0x%x\n", > MePeiPreMemConfig->HeciTimeouts)); > + DEBUG ((DEBUG_INFO, " DidInitStat : 0x%x\n", > MePeiPreMemConfig->DidInitStat)); > + DEBUG ((DEBUG_INFO, " DisableCpuReplacedPolling : 0x%x\n", > MePeiPreMemConfig->DisableCpuReplacedPolling)); > + DEBUG ((DEBUG_INFO, " SendDidMsg : 0x%x\n", > MePeiPreMemConfig->SendDidMsg)); > + DEBUG ((DEBUG_INFO, " DisableHeciRetry : 0x%x\n", > MePeiPreMemConfig->DisableHeciRetry)); > + DEBUG ((DEBUG_INFO, " DisableMessageCheck : 0x%x\n", > MePeiPreMemConfig->DisableMessageCheck)); > + DEBUG ((DEBUG_INFO, " SkipMbpHob : 0x%x\n", > MePeiPreMemConfig->SkipMbpHob)); > + DEBUG ((DEBUG_INFO, " HeciCommunication2 : 0x%x\n", > MePeiPreMemConfig->HeciCommunication2)); > + DEBUG ((DEBUG_INFO, " KtDeviceEnable : 0x%x\n", > MePeiPreMemConfig->KtDeviceEnable)); > + DEBUG ((DEBUG_INFO, " Heci1BarAddress : 0x%x\n", > MePeiPreMemConfig->Heci1BarAddress)); > + DEBUG ((DEBUG_INFO, " Heci2BarAddress : 0x%x\n", > MePeiPreMemConfig->Heci2BarAddress)); > + DEBUG ((DEBUG_INFO, " Heci3BarAddress : 0x%x\n", > MePeiPreMemConfig->Heci3BarAddress)); > + DEBUG_CODE_END (); > +} > + > +/** > + Dump values of ME config block in PEI phase. > + > + @param[in] MePeiConfig The pointer to the config block > +**/ > +VOID > +EFIAPI > +PrintMePeiConfig ( > + IN ME_PEI_CONFIG *MePeiConfig > + ) > +{ > + DEBUG_CODE_BEGIN (); > + DEBUG ((DEBUG_INFO, "------------------------ ME_PEI_CONFIG > -----------------\n")); > + DEBUG ((DEBUG_INFO, " Revision : 0x%x\n", > MePeiConfig->Header.Revision)); > + ASSERT (MePeiConfig->Header.Revision == ME_PEI_CONFIG_REVISION); > + > + DEBUG ((DEBUG_INFO, " MctpBroadcastCycle : 0x%x\n", > MePeiConfig->MctpBroadcastCycle)); > + DEBUG ((DEBUG_INFO, " EndOfPostMessage : 0x%x\n", > MePeiConfig->EndOfPostMessage)); > + DEBUG ((DEBUG_INFO, " Heci3Enabled : 0x%x\n", > MePeiConfig->Heci3Enabled)); > + DEBUG ((DEBUG_INFO, " DisableD0I3SettingForHeci : 0x%x\n", > MePeiConfig->DisableD0I3SettingForHeci)); > + DEBUG ((DEBUG_INFO, " MeUnconfigOnRtcClear : 0x%x\n", > MePeiConfig->MeUnconfigOnRtcClear)); > + > + DEBUG_CODE_END (); > +} > + > +/** > + Print PEI ME config block > + > + @param[in] SiPolicyPpiPreMem The RC Policy PPI instance **/ VOID > +EFIAPI MePrintPolicyPpiPreMem ( > + IN SI_PREMEM_POLICY_PPI *SiPolicyPpiPreMem > + ) > +{ > + DEBUG_CODE_BEGIN (); > + EFI_STATUS Status; > + ME_PEI_PREMEM_CONFIG *MePeiPreMemConfig; > + > + Status = GetConfigBlock ((VOID *) SiPolicyPpiPreMem, > + &gMePeiPreMemConfigGuid, (VOID *) &MePeiPreMemConfig); > + ASSERT_EFI_ERROR (Status); > + > + DEBUG ((DEBUG_INFO, "\n---------------------- Me Config Block Pre-Mem > +Print Begin -----------------\n")); > + PrintMePeiPreMemConfig (MePeiPreMemConfig); > + DEBUG ((DEBUG_INFO, "\n---------------------- Me Config Block Pre-Mem > +Print End -------------------\n")); > + DEBUG_CODE_END (); > +} > + > +/** > + Print PEI ME config block > + > + @param[in] SiPolicyPpi The RC Policy PPI instance **/ VOID EFIAPI > +MePrintPolicyPpi ( > + IN SI_POLICY_PPI *SiPolicyPpi > + ) > +{ > + DEBUG_CODE_BEGIN (); > + EFI_STATUS Status; > + ME_PEI_CONFIG *MePeiConfig; > + > + Status = GetConfigBlock ((VOID *) SiPolicyPpi, &gMePeiConfigGuid, > + (VOID *) &MePeiConfig); ASSERT_EFI_ERROR (Status); > + > + DEBUG ((DEBUG_INFO, "\n---------------------- Me Config Block Print > +Begin -----------------\n")); > + PrintMePeiConfig (MePeiConfig); > + DEBUG ((DEBUG_INFO, "\n---------------------- Me Config Block Print > +End -------------------\n")); > + DEBUG_CODE_END (); > +} > + > +/** > + Get ME config block table total size. > + > + @retval Size of ME config block table > +**/ > +UINT16 > +EFIAPI > +MeGetConfigBlockTotalSizePreMem ( > + VOID > + ) > +{ > + return GetComponentConfigBlockTotalSize > +(&mMeCompontBlockPreMemBlocks[0], sizeof > (mMeCompontBlockPreMemBlocks) > +/ sizeof (COMPONENT_BLOCK_ENTRY)); } > + > +/** > + Get ME config block table total size. > + > + @retval Size of ME config block table > +**/ > +UINT16 > +EFIAPI > +MeGetConfigBlockTotalSize ( > + VOID > + ) > +{ > + return GetComponentConfigBlockTotalSize > (&mMeCompontBlockBlocks[0], > +sizeof (mMeCompontBlockBlocks) / sizeof (COMPONENT_BLOCK_ENTRY)); } > + > +/** > + MeAddConfigBlocksPreMem add all config blocks. > + > + @param[in] ConfigBlockTableAddress The pointer to add config blocks > + > + @retval EFI_SUCCESS The policy default is initialized. > + @retval EFI_OUT_OF_RESOURCES Insufficient resources to create > buffer > +**/ > +EFI_STATUS > +EFIAPI > +MeAddConfigBlocksPreMem ( > + IN VOID *ConfigBlockTableAddress > + ) > +{ > + DEBUG ((DEBUG_INFO, "Me AddConfigBlocks. TotalBlockCount = 0x%x\n", > +sizeof (mMeCompontBlockPreMemBlocks) / sizeof > +(COMPONENT_BLOCK_ENTRY))); > + > + return AddComponentConfigBlocks (ConfigBlockTableAddress, > +&mMeCompontBlockPreMemBlocks[0], sizeof > (mMeCompontBlockPreMemBlocks) / > +sizeof (COMPONENT_BLOCK_ENTRY)); } > + > +/** > + MeAddConfigBlocks add all config blocks. > + > + @param[in] ConfigBlockTableAddress The pointer to add config blocks > + > + @retval EFI_SUCCESS The policy default is initialized. > + @retval EFI_OUT_OF_RESOURCES Insufficient resources to create > buffer > +**/ > +EFI_STATUS > +EFIAPI > +MeAddConfigBlocks ( > + IN VOID *ConfigBlockTableAddress > + ) > +{ > + DEBUG ((DEBUG_INFO, "ME AddConfigBlocks. TotalBlockCount = 0x%x\n", > +sizeof (mMeCompontBlockBlocks) / sizeof (COMPONENT_BLOCK_ENTRY))); > + > + return AddComponentConfigBlocks (ConfigBlockTableAddress, > +&mMeCompontBlockBlocks[0], sizeof (mMeCompontBlockBlocks) / sizeof > +(COMPONENT_BLOCK_ENTRY)); } > -- > 2.16.2.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#45979): https://edk2.groups.io/g/devel/message/45979 Mute This Topic: https://groups.io/mt/32918185/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-