diff options
author | raywu <raywu0301@gmail.com> | 2018-06-15 00:00:50 +0800 |
---|---|---|
committer | raywu <raywu0301@gmail.com> | 2018-06-15 00:00:50 +0800 |
commit | b7c51c9cf4864df6aabb99a1ae843becd577237c (patch) | |
tree | eebe9b0d0ca03062955223097e57da84dd618b9a /Board/EM/MeWrapper/MeSetup/Dxe | |
download | zprj-b7c51c9cf4864df6aabb99a1ae843becd577237c.tar.xz |
Diffstat (limited to 'Board/EM/MeWrapper/MeSetup/Dxe')
-rw-r--r-- | Board/EM/MeWrapper/MeSetup/Dxe/MeSetupDxe.c | 171 | ||||
-rw-r--r-- | Board/EM/MeWrapper/MeSetup/Dxe/MeSetupDxe.cif | 12 | ||||
-rw-r--r-- | Board/EM/MeWrapper/MeSetup/Dxe/MeSetupDxe.dxs | 68 | ||||
-rw-r--r-- | Board/EM/MeWrapper/MeSetup/Dxe/MeSetupDxe.h | 79 | ||||
-rw-r--r-- | Board/EM/MeWrapper/MeSetup/Dxe/MeSetupDxe.mak | 126 | ||||
-rw-r--r-- | Board/EM/MeWrapper/MeSetup/Dxe/MeSetupDxe.sdl | 27 |
6 files changed, 483 insertions, 0 deletions
diff --git a/Board/EM/MeWrapper/MeSetup/Dxe/MeSetupDxe.c b/Board/EM/MeWrapper/MeSetup/Dxe/MeSetupDxe.c new file mode 100644 index 0000000..e9525c8 --- /dev/null +++ b/Board/EM/MeWrapper/MeSetup/Dxe/MeSetupDxe.c @@ -0,0 +1,171 @@ +//************************************************************************* +//************************************************************************* +//** ** +//** (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/MeSetup/Dxe/MeSetupDxe.c 5 5/14/14 10:01p Tristinchou $ +// +// $Revision: 5 $ +// +// $Date: 5/14/14 10:01p $ +// +//********************************************************************** +// Revision History +// ---------------- +// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/MeSetup/Dxe/MeSetupDxe.c $ +// +// 5 5/14/14 10:01p Tristinchou +// [TAG] EIP167030 +// [Category] Improvement +// [Description] Remove the variable runtime attribute and keep original +// attributes. +// +// 4 3/14/13 2:39a Klzhan +// Modify for PTT check +// +// 2 2/23/13 1:27a Klzhan +// [TAG] EIPNone +// [Category] Improvement +// [Description] Return SUCCESS in entry point. +// +// 1 2/07/13 2:04a Klzhan +// [TAG] EIP114344 +// [Category] Improvement +// [Description] Create a setup item for TPM Device Selection +// [Files] MeSetupDxe.cif +// MeSetupDxe.c +// MeSetupDxe.h +// MeSetupDxe.sdl +// MeSetupDxe.dxs +// MeSetupDxe.mak +// +// +//********************************************************************** +#include "MeSetupDxe.h" + +EFI_STATUS +MeSetupDxeEntryPoint ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable +) +{ + EFI_STATUS Status; + UINT32 SetupVarAttr; + UINT32 PttInfoVarAttr; + UINTN VariableSize; + EFI_GUID SetupGuid = SYSTEM_CONFIGURATION_GUID; + EFI_GUID PttInfoVariableGuid = PTT_INFO_VARIABLE_GUID; + SETUP_DATA gSetupData; + PTT_INFO_VARIABLE_DATA gPttInfoVariable; + PCH_SERIES PchSeries = GetPchSeries(); + + DEBUG ((EFI_D_INFO, "[MeSetupDxe.c] : Entry Point...\n")); + + if ( PchSeries != PchLp ) { + return EFI_SUCCESS; + } + + PttInfoVarAttr = 0; + VariableSize = sizeof (PTT_INFO_VARIABLE_DATA); + Status = gRT->GetVariable ( + L"PttInfoVariable", + &PttInfoVariableGuid, + &PttInfoVarAttr, + &VariableSize, + &gPttInfoVariable ); + if( EFI_ERROR(Status) ) + PttInfoVarAttr = EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS; + + PttHeciGetCapability(&gPttInfoVariable.PTTCapability); + PttHeciGetState(&gPttInfoVariable.PTTState); + + Status = gRT->SetVariable ( + L"PttInfoVariable", + &PttInfoVariableGuid, + PttInfoVarAttr, + VariableSize, + &gPttInfoVariable + ); + + if ( EFI_ERROR (Status) ) { + DEBUG((EFI_D_INFO, "[MeSetupDxe.c] : Failed to Set PttInfoVariable Status = %x\n", Status)); + return EFI_SUCCESS; + } + + SetupVarAttr = 0; + VariableSize = sizeof (SETUP_DATA); + Status = gRT->GetVariable( + L"Setup", + &SetupGuid, + &SetupVarAttr, + &VariableSize, + &gSetupData ); + + if ( gPttInfoVariable.PTTCapability ) { + if ( (gSetupData.TpmDeviceSelectionUpdate == 1) && (gPttInfoVariable.PTTState != gSetupData.TpmDeviceSelection) ) { + if ( gSetupData.TpmDeviceSelection == 1 ) { + PttHeciSetState(TRUE); + } else { + PttHeciSetState(FALSE); + } + gSetupData.TpmDeviceSelectionUpdate = 0; + + Status = gRT->SetVariable( + L"Setup", + &SetupGuid, + SetupVarAttr, + VariableSize, + &gSetupData ); + + Status = HeciSendCbmResetRequest (CBM_RR_REQ_ORIGIN_BIOS_POST, CBM_HRR_GLOBAL_RESET); + if( !EFI_ERROR(Status) ) { + EFI_DEADLOOP(); + } + } + } + + if ( gPttInfoVariable.PTTState ) { + gSetupData.TpmDeviceSelection = 1; + } else { + gSetupData.TpmDeviceSelection = 0; + } + + Status = gRT->SetVariable( + L"Setup", + &SetupGuid, + SetupVarAttr, + VariableSize, + &gSetupData ); + + if ( EFI_ERROR (Status) ) { + DEBUG((EFI_D_INFO, "[MeSetupDxe.c] : Failed to Set SetupVariable Status = %x\n", Status)); + return EFI_SUCCESS; + } + + DEBUG ((EFI_D_INFO, "[MeSetupDxe.c] : Entry End...\n")); + + return EFI_SUCCESS; +} +//************************************************************************* +//************************************************************************* +//** ** +//** (C)Copyright 1985-2010, American Megatrends, Inc. ** +//** ** +//** All Rights Reserved. ** +//** ** +//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 ** +//** ** +//** Phone: (770)-246-8600 ** +//** ** +//************************************************************************* +//*************************************************************************
\ No newline at end of file diff --git a/Board/EM/MeWrapper/MeSetup/Dxe/MeSetupDxe.cif b/Board/EM/MeWrapper/MeSetup/Dxe/MeSetupDxe.cif new file mode 100644 index 0000000..7835bf7 --- /dev/null +++ b/Board/EM/MeWrapper/MeSetup/Dxe/MeSetupDxe.cif @@ -0,0 +1,12 @@ +<component> + name = "MeSetupDxe" + category = ModulePart + LocalRoot = "Board\EM\MeWrapper\MeSetup\Dxe" + RefName = "MeSetupDxe" +[files] +"MeSetupDxe.c" +"MeSetupDxe.h" +"MeSetupDxe.sdl" +"MeSetupDxe.dxs" +"MeSetupDxe.mak" +<endComponent> diff --git a/Board/EM/MeWrapper/MeSetup/Dxe/MeSetupDxe.dxs b/Board/EM/MeWrapper/MeSetup/Dxe/MeSetupDxe.dxs new file mode 100644 index 0000000..e6a5140 --- /dev/null +++ b/Board/EM/MeWrapper/MeSetup/Dxe/MeSetupDxe.dxs @@ -0,0 +1,68 @@ +//************************************************************************* +//************************************************************************* +//** ** +//** (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/MeSetup/Dxe/MeSetupDxe.dxs 1 2/07/13 2:04a Klzhan $ +// +// $Revision: 1 $ +// +// $Date: 2/07/13 2:04a $ +// +//********************************************************************** +// Revision History +// ---------------- +// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/MeSetup/Dxe/MeSetupDxe.dxs $ +// +// 1 2/07/13 2:04a Klzhan +// [TAG] EIP114344 +// [Category] Improvement +// [Description] Create a setup item for TPM Device Selection +// [Files] MeSetupDxe.cif +// MeSetupDxe.c +// MeSetupDxe.h +// MeSetupDxe.sdl +// MeSetupDxe.dxs +// MeSetupDxe.mak +// +// +//********************************************************************** +#include "AutoGen.h" +#include "DxeDepex.h" +#if defined (BUILD_WITH_GLUELIB) || defined (BUILD_WITH_EDKII_GLUE_LIB) +#include "EfiDepex.h" + +#include EFI_PROTOCOL_DEFINITION (Heci) +#include EFI_ARCH_PROTOCOL_DEFINITION (Variable) +#include EFI_PROTOCOL_DEFINITION (PchReset) + +#endif + +DEPENDENCY_START + EFI_HECI_PROTOCOL_GUID AND + PCH_RESET_PROTOCOL_GUID AND + EFI_VARIABLE_ARCH_PROTOCOL_GUID +DEPENDENCY_END +//************************************************************************* +//************************************************************************* +//** ** +//** (C)Copyright 1985-2010, American Megatrends, Inc. ** +//** ** +//** All Rights Reserved. ** +//** ** +//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 ** +//** ** +//** Phone: (770)-246-8600 ** +//** ** +//************************************************************************* +//*************************************************************************
\ No newline at end of file diff --git a/Board/EM/MeWrapper/MeSetup/Dxe/MeSetupDxe.h b/Board/EM/MeWrapper/MeSetup/Dxe/MeSetupDxe.h new file mode 100644 index 0000000..eca06b6 --- /dev/null +++ b/Board/EM/MeWrapper/MeSetup/Dxe/MeSetupDxe.h @@ -0,0 +1,79 @@ +//************************************************************************* +//************************************************************************* +//** ** +//** (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/MeSetup/Dxe/MeSetupDxe.h 2 3/01/13 3:13a Klzhan $ +// +// $Revision: 2 $ +// +// $Date: 3/01/13 3:13a $ +// +//********************************************************************** +// Revision History +// ---------------- +// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/MeSetup/Dxe/MeSetupDxe.h $ +// +// 2 3/01/13 3:13a Klzhan +// +// 1 2/07/13 2:04a Klzhan +// [TAG] EIP114344 +// [Category] Improvement +// [Description] Create a setup item for TPM Device Selection +// [Files] MeSetupDxe.cif +// MeSetupDxe.c +// MeSetupDxe.h +// MeSetupDxe.sdl +// MeSetupDxe.dxs +// MeSetupDxe.mak +// +// +//********************************************************************** +#ifndef _MeSetupDxe_H_ +#define _MeSetupDxe_H_ + +#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000) +#include "EdkIIGlueDxe.h" +#include "PttHciDeviceDxeLib.h" +#include "PttHeciDxeLib.h" +#include "PchAccess.h" +#include "PchPlatformLib.h" +#include "MELib.h" +#include <token.h> + +#include <SetupDataDefinition.h> +#define SYSTEM_CONFIGURATION_GUID { 0xEC87D643, 0xEBA4, 0x4BB5, 0xA1, 0xE5, 0x3F, 0x3E, 0x36, 0xB2, 0x0D, 0xA9 } +#endif + +typedef struct { + BOOLEAN PTTCapability; + BOOLEAN PTTState; +} PTT_INFO_VARIABLE_DATA; + +#define PTT_INFO_VARIABLE_GUID \ + {0x9e6eae27, 0xc452, 0x49e6, 0x99, 0xd9, 0xb4, 0x5d, 0x1c, 0xf9, 0x1c, 0x5a} + +#endif +//************************************************************************* +//************************************************************************* +//** ** +//** (C)Copyright 1985-2010, American Megatrends, Inc. ** +//** ** +//** All Rights Reserved. ** +//** ** +//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 ** +//** ** +//** Phone: (770)-246-8600 ** +//** ** +//************************************************************************* +//*************************************************************************
\ No newline at end of file diff --git a/Board/EM/MeWrapper/MeSetup/Dxe/MeSetupDxe.mak b/Board/EM/MeWrapper/MeSetup/Dxe/MeSetupDxe.mak new file mode 100644 index 0000000..7a5ba6e --- /dev/null +++ b/Board/EM/MeWrapper/MeSetup/Dxe/MeSetupDxe.mak @@ -0,0 +1,126 @@ +#************************************************************************* +#************************************************************************* +#** ** +#** (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/MeSetup/Dxe/MeSetupDxe.mak 2 3/01/13 3:13a Klzhan $ +# +# $Revision: 2 $ +# +# $Date: 3/01/13 3:13a $ +# +#********************************************************************** +# Revision History +# ---------------- +# $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/MeSetup/Dxe/MeSetupDxe.mak $ +# +# 2 3/01/13 3:13a Klzhan +# +# 1 2/07/13 2:04a Klzhan +# [TAG] EIP114344 +# [Category] Improvement +# [Description] Create a setup item for TPM Device Selection +# [Files] MeSetupDxe.cif +# MeSetupDxe.c +# MeSetupDxe.h +# MeSetupDxe.sdl +# MeSetupDxe.dxs +# MeSetupDxe.mak +# +# +#********************************************************************** +# +#<AMI_FHDR_START> +#---------------------------------------------------------------------------- +# +# Name: MeSetupDxe.mak +# +# Description: Makfile for ME Setup Dxe module. +# +#---------------------------------------------------------------------------- +#<AMI_FHDR_END> +all : MeSetupDxe + +MeSetupDxe : $(BUILD_DIR)\MeSetupDxe.mak MeSetupDxe_Bin + +$(BUILD_DIR)\MeSetupDxe.mak : $(ME_SETUP_DXE_PATH)\$(@B).cif $(ME_SETUP_DXE_PATH)\$(@B).mak $(BUILD_RULES) + $(CIF2MAK) $(ME_SETUP_DXE_PATH)\$(@B).cif $(CIF2MAK_DEFAULTS) + +MeSetupDxe_INCLUDES=\ + $(EdkIIGlueLib_INCLUDES)\ + $(EDK_INCLUDES)\ + $(ME_INCLUDES)\ + $(INTEL_PCH_INCLUDES)\ + +MeSetupDxe_LIBS=\ + $(EDKPROTOCOLLIB)\ + $(EFIGUIDLIB)\ + $(EdkIIGlueBaseLib_LIB)\ +!IF "$(x64_BUILD)"=="1" + $(EdkIIGlueBaseLibX64_LIB)\ +!ELSE + $(EdkIIGlueBaseLibIA32_LIB)\ +!ENDIF + $(EDKFRAMEWORKGUIDLIB)\ + $(EDKFRAMEWORKPROTOCOLLIB)\ + $(EdkIIGlueBaseIoLibIntrinsic_LIB)\ + $(EdkIIGlueBaseMemoryLib_LIB)\ + $(EdkIIGlueDxeReportStatusCodeLib_LIB)\ + $(EdkIIGlueDxeServicesTableLib_LIB)\ + $(EdkIIGlueDxeDebugLibReportStatusCode_LIB)\ + $(EdkIIGlueUefiBootServicesTableLib_LIB)\ + $(EdkIIGlueUefiDevicePathLib_LIB)\ + $(EdkIIGlueBasePciLibPciExpress_LIB)\ + $(EdkIIGlueEdkDxeRuntimeDriverLib_LIB)\ + $(EdkIIGlueDxeHobLib_LIB)\ + $(PttDxe_LIB)\ + $(PttHeciDxeLib_LIB)\ + $(MeLibDxe_LIB)\ + $(PchPlatformDxeLib_LIB)\ + +MeSetupDxe_DEFINES=\ + $(MY_DEFINES)\ + /D"__EDKII_GLUE_MODULE_ENTRY_POINT__=MeSetupDxeEntryPoint"\ + /D __EDKII_GLUE_BASE_MEMORY_LIB__ \ + /D __EDKII_GLUE_DXE_REPORT_STATUS_CODE_LIB__ \ + /D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \ + /D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__\ + /D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \ + /D __EDKII_GLUE_DXE_SERVICES_TABLE_LIB__ \ + /D __EDKII_GLUE_DXE_HOB_LIB__ \ + +MeSetupDxe_Bin : $(MeSetupDxe_LIBS) + $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\ + /f $(BUILD_DIR)\MeSetupDxe.mak all\ + "MY_INCLUDES=$(MeSetupDxe_INCLUDES)"\ + "MY_DEFINES=$(MeSetupDxe_DEFINES)"\ + GUID=D27AC0E1-D553-4c59-BCFE-89E5FFE9BEA6 \ + ENTRY_POINT=_ModuleEntryPoint \ + EDKIIModule=DXEDRIVER\ + TYPE=BS_DRIVER \ + DEPEX1=$(ME_SETUP_DXE_PATH)\MeSetupDxe.dxs \ + DEPEX1_TYPE=EFI_SECTION_DXE_DEPEX \ + COMPRESS=1\ +#************************************************************************* +#************************************************************************* +#** ** +#** (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/MeSetup/Dxe/MeSetupDxe.sdl b/Board/EM/MeWrapper/MeSetup/Dxe/MeSetupDxe.sdl new file mode 100644 index 0000000..88b0f63 --- /dev/null +++ b/Board/EM/MeWrapper/MeSetup/Dxe/MeSetupDxe.sdl @@ -0,0 +1,27 @@ + +TOKEN + Name = "ME_SETUP_DXE_SUPPORT" + Value = "1" + TokenType = Boolean + TargetEQU = Yes + TargetMAK = Yes + TargetH = Yes + Master = Yes + Help = "Main switch to enable MeSetupDxe support in DXE Phase" + Token = "IntelPTT_SUPPORT" "=" "1" +End + +MODULE + File = "MeSetupDxe.mak" + Help = "Includes MeSetupDxe.mak to Project" +End + +PATH + Name = "ME_SETUP_DXE_PATH" +End + +ELINK + Name = "$(BUILD_DIR)\MeSetupDxe.ffs" + Parent = "FV_MAIN" + InvokeOrder = AfterParent +End |