diff options
Diffstat (limited to 'Board/EM/MeWrapper/MePlatformPolicy/Pei')
6 files changed, 443 insertions, 0 deletions
diff --git a/Board/EM/MeWrapper/MePlatformPolicy/Pei/MePeiPolicyInit.c b/Board/EM/MeWrapper/MePlatformPolicy/Pei/MePeiPolicyInit.c new file mode 100644 index 0000000..f534303 --- /dev/null +++ b/Board/EM/MeWrapper/MePlatformPolicy/Pei/MePeiPolicyInit.c @@ -0,0 +1,196 @@ +/*++ + This file contains a 'Sample Driver' and is licensed as such + under the terms of your license agreement with Intel or your + vendor. This file may be modified by the user, subject to + the additional terms of the license agreement +--*/ + +/*++ + +Copyright (c) 1999 - 2010 Intel Corporation. All rights reserved +This software and associated documentation (if any) is furnished +under a license and may only be used or copied in accordance +with the terms of the license. Except as permitted by such +license, no part of this software or documentation may be +reproduced, stored in a retrieval system, or transmitted in any +form or by any means without the express written consent of +Intel Corporation. + +Module Name: + + MePeiPolicyInit.c + +Abstract: + + This file is SampleCode for Intel ME PEI Platform Policy initialzation. + +--*/ +#include <Token.h> +#include "MePeiPolicyInit.h" +#include <Ppi\PchPlatformPolicy\PchPlatformPolicy.h> +#include <SetupDataDefinition.h> + +#define SETUP_GUID { 0xEC87D643, 0xEBA4, 0x4BB5, 0xA1, 0xE5, 0x3F, 0x3E, 0x36, 0xB2, 0x0D, 0xA9 } +static EFI_GUID gSetupGuid = SETUP_GUID; + + +// +// Function implementations +// +VOID +PrepareThermalHob ( + IN EFI_PEI_SERVICES **PeiServices +) +{ + EFI_STATUS Status; + EFI_HOB_GUID_TYPE *Hob; + UINT8 TsOnDimm[4]; + EFI_GUID gPchPolicyPpiGuid = PCH_PLATFORM_POLICY_PPI_GUID; + PCH_PLATFORM_POLICY_PPI *PchPlatformPolicy; + EFI_GUID gDimmTsInfoGuid = DIMM_TS_INFO_GUID; + + Status = (**PeiServices).LocatePpi (PeiServices, &gPchPolicyPpiGuid, 0, + NULL, (VOID **)&PchPlatformPolicy); + + if(EFI_ERROR(Status)) + { + return; + } + // Build the GUID'd HOB for DXE + Status = (*PeiServices)->CreateHob ( + PeiServices, + EFI_HOB_TYPE_GUID_EXTENSION, + (UINT16) (sizeof (EFI_HOB_GUID_TYPE) + 4), + &Hob + ); + + if (EFI_ERROR (Status))return; + + ((EFI_HOB_GUID_TYPE *)(Hob))->Name = gDimmTsInfoGuid; + + Hob++; + +//- TsOnDimm[0] = PchPlatformPolicy->ThermalReportConfig->ThermalReportControl->Dimm1TempReadEnable; +//- TsOnDimm[1] = PchPlatformPolicy->ThermalReportConfig->ThermalReportControl->Dimm2TempReadEnable; +//- TsOnDimm[2] = PchPlatformPolicy->ThermalReportConfig->ThermalReportControl->Dimm3TempReadEnable; +//- TsOnDimm[3] = PchPlatformPolicy->ThermalReportConfig->ThermalReportControl->Dimm4TempReadEnable; + + GlueCopyMem (Hob, TsOnDimm, sizeof(TsOnDimm)); + +} + +EFI_STATUS +MePeiPolicyInitEntryPoint ( + IN EFI_FFS_FILE_HEADER *FfsHeader, + IN EFI_PEI_SERVICES **PeiServices + ) +/*++ + +Routine Description: + + Initilize Intel ME PEI Platform Policy + +Arguments: + + FfsHeader Pointer to Firmware File System file header. + PeiServices General purpose services available to every PEIM. + +Returns: + + EFI_STATUS + +--*/ +{ + EFI_STATUS Status; + PEI_ME_PLATFORM_POLICY_PPI *MePlatformPolicyPpi; + EFI_PEI_PPI_DESCRIPTOR *MePlatformPolicyPpiDesc; + EFI_PEI_READ_ONLY_VARIABLE_PPI *VariableServices; + UINTN VariableSize; + SETUP_DATA SetupData; + + // + // Allocate descriptor and PPI structures + // + MePlatformPolicyPpi = (PEI_ME_PLATFORM_POLICY_PPI *) AllocateZeroPool (sizeof (PEI_ME_PLATFORM_POLICY_PPI)); + ASSERT (MePlatformPolicyPpi != NULL); + if (MePlatformPolicyPpi == NULL) { + return EFI_OUT_OF_RESOURCES; + } + + MePlatformPolicyPpiDesc = (EFI_PEI_PPI_DESCRIPTOR *) AllocateZeroPool (sizeof (EFI_PEI_PPI_DESCRIPTOR)); + ASSERT (MePlatformPolicyPpiDesc != NULL); + if (MePlatformPolicyPpiDesc == NULL) { + return EFI_OUT_OF_RESOURCES; + } + + // + // Locate Variable Ppi + // + Status = (*PeiServices)->LocatePpi(PeiServices, + &gPeiReadOnlyVariablePpiGuid, + 0, + NULL, + &VariableServices); + + // + // Make sure we have a PPI, if not, just return. + // + if (!VariableServices) { + return EFI_UNSUPPORTED; + } + VariableSize = sizeof(SETUP_DATA); + // + // Get Setup Variable + // + Status = VariableServices->PeiGetVariable ( + PeiServices, + L"Setup", + &gSetupGuid, + NULL, + &VariableSize, + &SetupData); + + // + // Update Itnel PPT + // + if ( !EFI_ERROR(Status) ) { +#if IntelPTT_SUPPORT + MePlatformPolicyPpi->FTpmSwitch = SetupData.FTpmSwitch; +#else + MePlatformPolicyPpi->FTpmSwitch = 0; +#endif + } else { + MePlatformPolicyPpi->FTpmSwitch = 0; + } + + // + // Initialize the PPI + // + MePlatformPolicyPpiDesc->Flags = EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST; + MePlatformPolicyPpiDesc->Guid = &gPeiMePlatformPolicyPpiGuid; + + // + // Update the REVISION number + // + MePlatformPolicyPpi->Revision = PEI_ME_PLATFORM_POLICY_PPI_REVISION_2; + + + // + // Initialize the Platform Configuration + // +// Debug UpdatePeiMePlatformPolicy (PeiServices, MePlatformPolicyPpi); + + MePlatformPolicyPpiDesc->Ppi = MePlatformPolicyPpi; + + /// + /// TBD put initialize codes in here if needs + /// + /// + /// Install the ME PEI Platform Policy PPI + /// + Status = (**PeiServices).InstallPpi (PeiServices, MePlatformPolicyPpiDesc); + ASSERT_PEI_ERROR (PeiServices, Status); + DEBUG ((EFI_D_INFO, "ME PEI Platform Policy PPI Installed\n")); + + return Status; +} diff --git a/Board/EM/MeWrapper/MePlatformPolicy/Pei/MePeiPolicyInit.cif b/Board/EM/MeWrapper/MePlatformPolicy/Pei/MePeiPolicyInit.cif new file mode 100644 index 0000000..2c5d34f --- /dev/null +++ b/Board/EM/MeWrapper/MePlatformPolicy/Pei/MePeiPolicyInit.cif @@ -0,0 +1,12 @@ +<component> + name = "MePeiPolicyInit" + category = ModulePart + LocalRoot = "Board\EM\MeWrapper\MePlatformPolicy\Pei" + RefName = "MePeiPolicyInit" +[files] +"MePeiPolicyInit.c" +"MePeiPolicyInit.h" +"MePeiPolicyInit.sdl" +"MePeiPolicyInit.mak" +"MePeiPolicyInit.dxs" +<endComponent> diff --git a/Board/EM/MeWrapper/MePlatformPolicy/Pei/MePeiPolicyInit.dxs b/Board/EM/MeWrapper/MePlatformPolicy/Pei/MePeiPolicyInit.dxs new file mode 100644 index 0000000..01778d0 --- /dev/null +++ b/Board/EM/MeWrapper/MePlatformPolicy/Pei/MePeiPolicyInit.dxs @@ -0,0 +1,35 @@ +/*++ + This file contains a 'Sample Driver' and is licensed as such + under the terms of your license agreement with Intel or your + vendor. This file may be modified by the user, subject to + the additional terms of the license agreement +--*/ + +/*++ + +Copyright (c) 1999 - 2010 Intel Corporation. All rights reserved +This software and associated documentation (if any) is furnished +under a license and may only be used or copied in accordance +with the terms of the license. Except as permitted by such +license, no part of this software or documentation may be +reproduced, stored in a retrieval system, or transmitted in any +form or by any means without the express written consent of +Intel Corporation. + +Module Name: + + MePeiPolicyInit.dxs + +Abstract: + + Dependency expression source file. + +--*/ + +#include "EfiDepex.h" +#include <Ppi\PchPlatformPolicy\PchPlatformPolicy.h> +DEPENDENCY_START + PCH_PLATFORM_POLICY_PPI_GUID +DEPENDENCY_END + + diff --git a/Board/EM/MeWrapper/MePlatformPolicy/Pei/MePeiPolicyInit.h b/Board/EM/MeWrapper/MePlatformPolicy/Pei/MePeiPolicyInit.h new file mode 100644 index 0000000..5d64667 --- /dev/null +++ b/Board/EM/MeWrapper/MePlatformPolicy/Pei/MePeiPolicyInit.h @@ -0,0 +1,64 @@ +/*++ + This file contains a 'Sample Driver' and is licensed as such + under the terms of your license agreement with Intel or your + vendor. This file may be modified by the user, subject to + the additional terms of the license agreement +--*/ + +/*++ + +Copyright (c) 1999 - 2010 Intel Corporation. All rights reserved +This software and associated documentation (if any) is furnished +under a license and may only be used or copied in accordance +with the terms of the license. Except as permitted by such +license, no part of this software or documentation may be +reproduced, stored in a retrieval system, or transmitted in any +form or by any means without the express written consent of +Intel Corporation. + +Module Name: + + MePeiPolicyInit.h + +Abstract: + + Header file for the MePeiPolicyInit PEIM. + +--*/ +#ifndef _ME_PEI_PLATFORM_POLICY_H_ +#define _ME_PEI_PLATFORM_POLICY_H_ + +#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000) +#include "EdkIIGluePeim.h" +#endif + +#include EFI_PPI_DEFINITION (MePlatformPolicyPei) +// Debug #include "MePlatformPolicyUpdatePeiLib.h" +#define DIMM_TS_INFO_GUID \ + { \ + 0xce673a28, 0x800d, 0x4b4a, 0x83, 0x16, 0x26, 0x61, 0xf9, 0xb3, 0xd9, 0xc6 \ + } + +EFI_STATUS +MePeiPolicyInitEntryPoint ( + IN EFI_FFS_FILE_HEADER *FfsHeader, + IN EFI_PEI_SERVICES **PeiServices + ) +/*++ + +Routine Description: + + Initilize Intel ME PEI Platform Policy + +Arguments: + + FfsHeader Pointer to Firmware File System file header. + PeiServices General purpose services available to every PEIM. + +Returns: + + EFI_STATUS + +--*/ +; +#endif diff --git a/Board/EM/MeWrapper/MePlatformPolicy/Pei/MePeiPolicyInit.mak b/Board/EM/MeWrapper/MePlatformPolicy/Pei/MePeiPolicyInit.mak new file mode 100644 index 0000000..4a097e0 --- /dev/null +++ b/Board/EM/MeWrapper/MePlatformPolicy/Pei/MePeiPolicyInit.mak @@ -0,0 +1,111 @@ +#************************************************************************* +#************************************************************************* +#** ** +#** (C)Copyright 1985-2010, American Megatrends, Inc. ** +#** ** +#** All Rights Reserved. ** +#** ** +#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 ** +#** ** +#** Phone: (770)-246-8600 ** +#** ** +#************************************************************************* +#************************************************************************* + +#********************************************************************** +# $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/MePlatformPolicy/MePeiPolicyInit/MePeiPolicyInit.mak 2 2/23/12 8:56a Klzhan $ +# +# $Revision: 2 $ +# +# $Date: 2/23/12 8:56a $ +#********************************************************************** +# Revision History +# ---------------- +# $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/MePlatformPolicy/MePeiPolicyInit/MePeiPolicyInit.mak $ +# +# 2 2/23/12 8:56a Klzhan +# Support New EDK +# +# 1 2/08/12 1:05a Klzhan +# Initial Check in +# +# 1 3/29/11 4:53a Klzhan +# +# 1 2/25/11 1:45a Klzhan +# Initial Check-in +# +# 1 12/03/10 5:11a Klzhan +# Initial Check-in. +# +# +#********************************************************************** +#<AMI_FHDR_START> +# +# Name: AmtPlatformPolicy.mak +# +# Description: +# +#<AMI_FHDR_END> +#********************************************************************** +All : MEPeiPolicyInit + +MEPeiPolicyInit : $(BUILD_DIR)\MEPeiPolicyInit.mak MEPeiPolicyInitBin + +$(BUILD_DIR)\MEPeiPolicyInit.mak : $(MEPeiPlatformPolicy_DIR)\$(@B).cif $(MEPeiPlatformPolicy_DIR)\$(@B).mak $(BUILD_RULES) + $(CIF2MAK) $(MEPeiPlatformPolicy_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS) + +MEPeiPlatformPolicy_INCLUDES=\ + $(EDK_INCLUDES)\ + $(EdkIIGlueLib_INCLUDES)\ + $(ME_INCLUDES)\ + $(INTEL_PCH_INCLUDES) + + +MEPeiPlatformPolicy_DEFINES=$(MY_DEFINES)\ + /D "__EDKII_GLUE_MODULE_ENTRY_POINT__=MePeiPolicyInitEntryPoint" \ + /D __EDKII_GLUE_BASE_LIB__ \ + /D __EDKII_GLUE_BASE_MEMORY_LIB__ \ + /D __EDKII_GLUE_PEI_DEBUG_LIB_REPORT_STATUS_CODE__ \ + /D __EDKII_GLUE_PEI_REPORT_STATUS_CODE_LIB__ \ + /D __EDKII_GLUE_PEI_SERVICES_LIB__ \ + /D __EDKII_GLUE_PEI_MEMORY_ALLOCATION_LIB__ \ + +MEPeiPlatformPolicy_LIBS=\ + $(EDKPROTOCOLLIB)\ + $(EdkIIGlueBaseLib_LIB)\ + $(EdkIIGlueBaseLibIA32_LIB)\ + $(EdkIIGlueBaseIoLibIntrinsic_LIB)\ + $(EdkIIGluePeiDebugLibReportStatusCode_LIB)\ + $(EdkIIGluePeiReportStatusCodeLib_LIB)\ + $(EdkIIGluePeiServicesLib_LIB)\ + $(MeLibPpi_LIB)\ + $(EdkIIGluePeiHobLib_LIB)\ + $(EdkIIGluePeiMemoryAllocationLib_LIB)\ + $(PEILIB) + +MEPeiPolicyInitBin : $(MEPeiPlatformPolicy_LIBS) + $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\ + /f $(BUILD_DIR)\MEPeiPolicyInit.mak all\ + GUID=12C67BE1-AD2E-4f13-A95F-6EDC2C4392DE\ + "MY_INCLUDES = $(MEPeiPlatformPolicy_INCLUDES)" \ + "MY_DEFINES=$(MEPeiPlatformPolicy_DEFINES)"\ + ENTRY_POINT=MePeiPolicyInitEntryPoint\ + TYPE=PEIM\ + EDKIIModule=PEIM\ + DEPEX1=$(MEPeiPlatformPolicy_DIR)\MEPeiPolicyInit.dxs\ + DEPEX1_TYPE=EFI_SECTION_PEI_DEPEX\ + COMPRESS=0 + +#************************************************************************* +#************************************************************************* +#** ** +#** (C)Copyright 1985-2010, American Megatrends, Inc. ** +#** ** +#** All Rights Reserved. ** +#** ** +#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 ** +#** ** +#** Phone: (770)-246-8600 ** +#** ** +#************************************************************************* +#************************************************************************* diff --git a/Board/EM/MeWrapper/MePlatformPolicy/Pei/MePeiPolicyInit.sdl b/Board/EM/MeWrapper/MePlatformPolicy/Pei/MePeiPolicyInit.sdl new file mode 100644 index 0000000..ff7d692 --- /dev/null +++ b/Board/EM/MeWrapper/MePlatformPolicy/Pei/MePeiPolicyInit.sdl @@ -0,0 +1,25 @@ +TOKEN + Name = "MEPeiPlatformPolicy_SUPPORT" + Value = "1" + Help = "Main switch to enable AmtPlatformPolicy support in Project" + TokenType = Boolean + TargetEQU = Yes + TargetMAK = Yes + Master = Yes +End + +PATH + Name = "MEPeiPlatformPolicy_DIR" +End + +MODULE + Help = "Includes AmtPlatformPolicy.mak to Project" + File = "MEPeiPolicyInit.mak" +End + +ELINK + Name = "$(BUILD_DIR)\MEPeiPolicyInit.ffs" + Parent = "FV_BB" + InvokeOrder = AfterParent +End + |