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 | |
download | zprj-b7c51c9cf4864df6aabb99a1ae843becd577237c.tar.xz |
Diffstat (limited to 'Board/EM/MeWrapper/MeSetup')
23 files changed, 2887 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 diff --git a/Board/EM/MeWrapper/MeSetup/MeSetup.c b/Board/EM/MeWrapper/MeSetup/MeSetup.c new file mode 100644 index 0000000..74efeca --- /dev/null +++ b/Board/EM/MeWrapper/MeSetup/MeSetup.c @@ -0,0 +1,263 @@ +//************************************************************************* +//************************************************************************* +//** ** +//** (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/MeSetup.c 3 11/02/14 9:48p Tristinchou $ +// +// $Revision: 3 $ +// +// $Date: 11/02/14 9:48p $ +// +//********************************************************************** +// Revision History +// ---------------- +// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/MeSetup/MeSetup.c $ +// +// 3 11/02/14 9:48p Tristinchou +// [TAG] EIP189985 +// [Category] Improvement +// [Description] For ME 9.1.20.1035, add NFC related option in setup +// +// 2 2/20/13 10:50p Klzhan +// [TAG] EIP114344 +// [Category] Improvement +// [Description] Update PTT capability / State information in Setup. +// +// 1 2/08/12 1:04a Klzhan +// Initial Check in +// +// 1 2/25/11 1:41a Klzhan +// Initial Check-in +// +// 1 12/03/10 5:09a Klzhan +// Initial Check-in. +// +// +//********************************************************************** + +//<AMI_FHDR_START> +//---------------------------------------------------------------------------- +// +// Name: MeSetup.c +// +// Description: Setup hooks for MeSetup module. +// +//---------------------------------------------------------------------------- +//<AMI_FHDR_END> +/*++ +Copyright (c) 2008-2009 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: + + MeSetup.c + +Abstract: + + +--*/ +#include <Setup.h> +#include <SetupStrTokens.h> +#include <AmiDxeLib.h> +#if EFI_SPECIFICATION_VERSION>0x20000 +#include <Protocol\HiiDatabase.h> +#include <Protocol\HiiString.h> +#else +#include <Protocol/Hii.h> +#endif +#include "MeSetup.h" +#if NFC_SUPPORT_DXE_SUPPORT == 1 +#include "NfcSupportDxe\NfcSupportDxe.h" +#endif + +typedef struct{ + UINT8 MeFirmwareInfo; + UINT32 MeMajor; + UINT32 MeMinor; + UINT32 MeHotFix; + UINT32 MeBuildNo; +} ME_INFO_SETUP_DATA; + +#define ME_INFO_SETUP_GUID \ + {0x78259433, 0x7B6D, 0x4DB3, 0x9A, 0xE8, 0x36, 0xC4, 0xC2, 0xC3, 0xA1, 0x7D} + +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} + +EFI_GUID PttInfoVariableGuid = PTT_INFO_VARIABLE_GUID; +PTT_INFO_VARIABLE_DATA gPttInfoVariable; + +EFI_GUID gMeInfoSetupGuid = ME_INFO_SETUP_GUID; +EFI_GUID gSetupGuid = SETUP_GUID; +ME_INFO_SETUP_DATA mMeInfoSetupData; +SETUP_DATA gSetupData; + +VOID InitMeInfo(EFI_HII_HANDLE HiiHandle) +{ + EFI_STATUS Status; + UINTN VariableSize; + UINT8 *MeFwSkuValue; + CHAR16 String[0x100]; + UINTN StringLength; +#if EFI_SPECIFICATION_VERSION>0x20000 +static EFI_HII_STRING_PROTOCOL *HiiString=NULL; +static EFI_HII_DATABASE_PROTOCOL *HiiDatabase=NULL; +#else + EFI_GUID guidHII = EFI_HII_PROTOCOL_GUID; + EFI_HII_PROTOCOL *Hii = NULL; +#endif + STRING_REF MeMode[] = { + STRING_TOKEN(STR_ME_NORMAL_MODE), +#ifdef Ibexpeak_SUPPORT + STRING_TOKEN(STR_ME_IGNITION), +#else + STRING_TOKEN(STR_ME_FAILED), +#endif + STRING_TOKEN(STR_ME_ALT_DISABLED), + STRING_TOKEN(STR_ME_TEMP_DISABLED), + STRING_TOKEN(STR_ME_SECOVER), + STRING_TOKEN(STR_ME_FAILED), + + }; + UINT8 *FwMeSku[] = { + STR_ME_FW_SKU_1_5MB, + STR_ME_FW_SKU_5MB, + STR_ME_FW_SKU_UNIDENTIFIED + }; +#if NFC_SUPPORT_DXE_SUPPORT == 1 + EFI_GUID NfcSupportDataGuid = NFC_SUPPORT_DATA_GUID; + NFC_SUPPORT_DATA NfcSupportData; +#endif + // + // Set default string size assumption at no more than 256 bytes + // + StringLength = 0x100; +#if EFI_SPECIFICATION_VERSION<=0x20000 + pBS->LocateProtocol(&guidHII, NULL, &Hii); +#endif + VariableSize = sizeof(ME_INFO_SETUP_DATA); + Status = pRS->GetVariable( + L"MeInfoSetup", + &gMeInfoSetupGuid, + NULL, + &VariableSize, + &mMeInfoSetupData + ); + if (EFI_ERROR(Status)) return; + + InitString( + HiiHandle,STRING_TOKEN(STR_ME_FW_VERSION_VALUE), + L"%d.%d.%d.%d", + mMeInfoSetupData.MeMajor,mMeInfoSetupData.MeMinor, + mMeInfoSetupData.MeHotFix,mMeInfoSetupData.MeBuildNo + ); + + VariableSize = sizeof (PTT_INFO_VARIABLE_DATA); + Status = pRS->GetVariable ( + L"PttInfoVariable", + &PttInfoVariableGuid, + NULL, + &VariableSize, + &gPttInfoVariable + ); + + if (!EFI_ERROR(Status)) + { + InitString( + HiiHandle,STRING_TOKEN(STR_PTT_CAPABILITY_STATE_VALUE), + L"%d / %d", + gPttInfoVariable.PTTCapability,gPttInfoVariable.PTTState + ); + } + +#if NFC_SUPPORT_DXE_SUPPORT == 1 + VariableSize = sizeof(NFC_SUPPORT_DATA); + Status = pRS->GetVariable( + L"NfcSupportData", + &NfcSupportDataGuid, + NULL, + &VariableSize, + &NfcSupportData ); + if( !EFI_ERROR(Status) ) + { + if( NfcSupportData.NFCCapability == 1 ) + InitString( HiiHandle, STRING_TOKEN(STR_NFC_SUPPORT_VALUE), L"Enabled" ); + else + InitString( HiiHandle, STRING_TOKEN(STR_NFC_SUPPORT_VALUE), L"Disabled" ); + } +#endif + + +#if EFI_SPECIFICATION_VERSION>0x20000 + Status = HiiLibGetString( + HiiHandle, MeMode[(mMeInfoSetupData.MeFirmwareInfo & ME_MODE_MASK)], + &StringLength, String); +#else + Status = Hii->GetString(Hii, HiiHandle, MeMode[(mMeInfoSetupData.MeFirmwareInfo & ME_MODE_MASK)], FALSE, NULL, &StringLength, String); +#endif + InitString( + HiiHandle,STRING_TOKEN(STR_ME_FW_INFO_VALUE), + L"%s", + String + ); + + VariableSize = sizeof(SETUP_DATA); + Status = pRS->GetVariable( + L"Setup", + &gSetupGuid, + NULL, + &VariableSize, + &gSetupData + ); + ASSERT_EFI_ERROR(Status); + + if (gSetupData.MeImageType == ME_IMAGE_1_5MB_FW) { + MeFwSkuValue = FwMeSku[0]; + } else if (gSetupData.MeImageType == ME_IMAGE_5MB_FW) { + MeFwSkuValue = FwMeSku[1]; + } else { + MeFwSkuValue = FwMeSku[2]; + } + InitString ( + HiiHandle, + STRING_TOKEN (STR_ME_FW_SKU_VALUE), + L"%S", + MeFwSkuValue + ); + +} +//************************************************************************* +//************************************************************************* +//** ** +//** (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/MeSetup.cif b/Board/EM/MeWrapper/MeSetup/MeSetup.cif new file mode 100644 index 0000000..d7e4b42 --- /dev/null +++ b/Board/EM/MeWrapper/MeSetup/MeSetup.cif @@ -0,0 +1,18 @@ +<component> + name = "MeSetup" + category = ModulePart + LocalRoot = "Board\EM\MeWrapper\MeSetup" + RefName = "MeSetup" +[files] +"MeSetup.sdl" +"MeSetup.mak" +"MeSetup.sd" +"MeSetup.uni" +"MeSetup.c" +"MeSetup.h" +"MebxPrompt.c" +"MeSetupReset.c" +[parts] +"MeSetupDxe" +"NfcSupportDxe" +<endComponent> diff --git a/Board/EM/MeWrapper/MeSetup/MeSetup.h b/Board/EM/MeWrapper/MeSetup/MeSetup.h new file mode 100644 index 0000000..0a27a88 --- /dev/null +++ b/Board/EM/MeWrapper/MeSetup/MeSetup.h @@ -0,0 +1,113 @@ +//************************************************************************* +//************************************************************************* +//** ** +//** (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/MeSetup.h 1 2/08/12 1:04a Klzhan $ +// +// $Revision: 1 $ +// +// $Date: 2/08/12 1:04a $ +// +//********************************************************************** +// Revision History +// ---------------- +// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/MeSetup/MeSetup.h $ +// +// 1 2/08/12 1:04a Klzhan +// Initial Check in +// +// 1 2/25/11 1:41a Klzhan +// Initial Check-in +// +// 1 12/03/10 5:09a Klzhan +// Initial Check-in. +// +// +//********************************************************************** + +//<AMI_FHDR_START> +//---------------------------------------------------------------------------- +// +// Name: MeSetup.h +// +// Description: Header file for MeSetup module. +// +//---------------------------------------------------------------------------- +//<AMI_FHDR_END> +/*++ + +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) 2009 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: + + MeSetup.h + +Abstract: + + +--*/ +#ifndef __ME_SETUP_H__ +#define __ME_SETUP_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#define ME_MODE_MASK 0x0F + +#define NORMAL_MODE 0x00 +#define QUALIFIER_MODE 0xE0 +#define LOCAL_FW_UPD_MODE 0xF0 + +#define TEMP_DISABLE_MODE 0x03 +#define ME_IMAGE_1_5MB_FW 0x03 +#define ME_IMAGE_5MB_FW 0x04 + +#define STR_ME_FW_SKU_1_5MB "1.5MB" +#define STR_ME_FW_SKU_5MB "5MB" +#define STR_ME_FW_SKU_UNIDENTIFIED "Unidentified" + +/****** DO NOT WRITE BELOW THIS LINE *******/ +#ifdef __cplusplus +} +#endif +#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/MeSetup.mak b/Board/EM/MeWrapper/MeSetup/MeSetup.mak new file mode 100644 index 0000000..c012aff --- /dev/null +++ b/Board/EM/MeWrapper/MeSetup/MeSetup.mak @@ -0,0 +1,130 @@ +#************************************************************************* +#************************************************************************* +#** ** +#** (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/MeSetup.mak 3 3/01/13 3:11a Klzhan $ +# +# $Revision: 3 $ +# +# $Date: 3/01/13 3:11a $ +# +#********************************************************************** +# Revision History +# ---------------- +# $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/MeSetup/MeSetup.mak $ +# +# 3 3/01/13 3:11a Klzhan +# [TAG] EIPNone +# [Category] Improvement +# [Description] Fix ICBO project build error. +# [Files] MeSetup.sdl +# MeSetup.mak +# MeSetup.sd +# MeSetup.uni +# MeSetup.c +# MeSetup.h +# MebxPrompt.c +# MeSetupReset.c +# MeSetup.cif +# +# 2 2/07/13 3:24a Klzhan +# +# 1 2/08/12 1:04a Klzhan +# Initial Check in +# +# 6 9/06/11 3:51a Klzhan +# Read key by RegisterKeyNofity. +# +# 5 6/28/11 2:41a Klzhan +# Fix build error when iAMT_Support is off. +# +# 4 6/20/11 8:17a Klzhan +# Not Show Remote Assistance message when SOL and KVM. +# +# 3 6/20/11 4:18a Klzhan +# Support Remote assistance hot key detect. +# +# 2 5/23/11 8:42a Klzhan +# Support CTRL + P check. +# +# 1 2/25/11 1:41a Klzhan +# Initial Check-in +# +# 1 12/03/10 5:09a Klzhan +# Initial Check-in. +# +# +#********************************************************************** +# +#<AMI_FHDR_START> +#---------------------------------------------------------------------------- +# +# Name: Me Setup.mak +# +# Description: Makfile for ME Setup module. +# +#---------------------------------------------------------------------------- +#<AMI_FHDR_END> +All : MeSetup + +MeSetup : $(BUILD_DIR)\MeSetup.mak + +SetupSdbs : $(BUILD_DIR)\MeSetup.sdb + +$(BUILD_DIR)\MeSetup.sdb : $(ME_SETUP_DIR)\$(@B).sd $(ME_SETUP_DIR)\$(@B).uni + $(STRGATHER) -i INCLUDE -parse -newdb -db $(BUILD_DIR)\$(@B).sdb $(ME_SETUP_DIR)\$(@B).uni + $(STRGATHER) -scan -db $(BUILD_DIR)\$(@B).sdb -od $(BUILD_DIR)\$(@B).sdb $(ME_SETUP_DIR)\$(@B).sd + +$(BUILD_DIR)\MeSetup.mak : $(ME_SETUP_DIR)\$(@B).cif $(ME_SETUP_DIR)\$(@B).mak $(BUILD_RULES) + $(CIF2MAK) $(ME_SETUP_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS) + +SetupBin : $(BUILD_DIR)\MeSetup.obj + +$(BUILD_DIR)\MeSetup.obj : $(PROJECT_DIR)\$(ME_SETUP_DIR)\MeSetup.c $(BUILD_DIR)\SetupStrTokens.h + $(CC) $(CFLAGS) /Fo$(BUILD_DIR)\ $(ME_SETUP_DIR)\MeSetup.c + +!IF DEFINED(IntelPTT_SUPPORT) && "$(IntelPTT_SUPPORT)" == "1" +SetupData : $(BUILD_DIR)\MebxPrompt.obj $(BUILD_DIR)\MeSetupReset.obj +!ELSE +SetupData : $(BUILD_DIR)\MebxPrompt.obj +!ENDIF + +MebxPrompt_CFLAGS=$(CFLAGS) \ + -I $(TSEBIN_DIR)\Inc \ + -I $(TSEBIN_DIR)\ + -I ReferenceCode\ME\Protocol\ +!IF DEFINED(AmtWrapper_SUPPORT) && "$(AmtWrapper_SUPPORT)" == "1" + -I $(AmtWrapperProtocolLib_DIR)\ +!ENDIF + -I $(MeGuidLib_DIR)\ + $(ME_INCLUDES) + +$(BUILD_DIR)\MebxPrompt.obj : $(ME_SETUP_DIR)\MebxPrompt.c + $(CC) $(MebxPrompt_CFLAGS) /Fo$(BUILD_DIR)\ $(ME_SETUP_DIR)\MebxPrompt.c + +$(BUILD_DIR)\MeSetupReset.obj : $(ME_SETUP_DIR)\MeSetupReset.c + $(CC) $(MebxPrompt_CFLAGS) /Fo$(BUILD_DIR)\ $(ME_SETUP_DIR)\MeSetupReset.c +#************************************************************************* +#************************************************************************* +#** ** +#** (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/MeSetup.sd b/Board/EM/MeWrapper/MeSetup/MeSetup.sd new file mode 100644 index 0000000..ab985af --- /dev/null +++ b/Board/EM/MeWrapper/MeSetup/MeSetup.sd @@ -0,0 +1,309 @@ +//************************************************************************* +//************************************************************************* +//** ** +//** (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/MeSetup.sd 7 11/02/14 9:47p Tristinchou $ +// +// $Revision: 7 $ +// +// $Date: 11/02/14 9:47p $ +// +//********************************************************************** +// Revision History +// ---------------- +// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/MeSetup/MeSetup.sd $ +// +// 7 11/02/14 9:47p Tristinchou +// [TAG] EIP189985 +// [Category] Improvement +// [Description] For ME 9.1.20.1035, add NFC related option in setup +// +// 6 3/14/13 2:37a Klzhan +// Add PTT setup itrem default value. +// +// 5 3/01/13 3:11a Klzhan +// [TAG] EIPNone +// [Category] Improvement +// [Description] Fix ICBO project build error. +// [Files] MeSetup.sdl +// MeSetup.mak +// MeSetup.sd +// MeSetup.uni +// MeSetup.c +// MeSetup.h +// MebxPrompt.c +// MeSetupReset.c +// MeSetup.cif +// +// 4 2/07/13 1:57a Klzhan +// [TAG] EIP114334 +// [Category] Improvement +// [Description] Create a setup item for TPM Device Selection +// [Files] MeSetup.sdl +// MeSetup.mak +// MeSetup.sd +// MeSetup.uni +// MeSetup.c +// MeSetup.h +// MebxPrompt.c +// MeSetup.cif +// +// 3 11/20/12 4:32a Klzhan +// Add Setup Item for Ftpm +// +// 2 4/23/12 11:09p Klzhan +// +// 1 2/08/12 1:04a Klzhan +// Initial Check in +// +// 1 2/25/11 1:41a Klzhan +// Initial Check-in +// +// 1 12/03/10 5:09a Klzhan +// Initial Check-in. +// +// +//********************************************************************** + +//<AMI_FHDR_START> +//---------------------------------------------------------------------------- +// +// Name: Me Setup.sd +// +// Description: Setup for ME Setup. +// +//---------------------------------------------------------------------------- +//<AMI_FHDR_END> +#ifdef SETUP_DATA_DEFINITION +/***********************************************************/ +/* Put NVRAM data definitions here. +/* For example: UINT8 Data1; +/* These definitions will be converted by the build process +/* to a definitions of SETUP_DATA fields. +/***********************************************************/ + + UINT8 MeFirmwareInfo; + UINT8 MeImageType; + UINT8 MeFwDowngrade; + UINT8 LocalFwUpdEnabled; + UINT8 LocalFwQualifier; + UINT8 MebxType; + UINT8 MDESForBiosState; + UINT8 FTpmSwitch; + UINT8 TpmDeviceSelection; + UINT8 TpmDeviceSelectionUpdate; +#endif + +#ifdef CONTROL_DEFINITION + #define MESETUP_GOTO_PCHFWCONFIG\ + goto ME_FORM_ID,\ + prompt = STRING_TOKEN(STR_ME_FORM),\ + help = STRING_TOKEN(STR_ME_FORM_HELP); + +#if defined NFC_SUPPORT_DXE_SUPPORT && NFC_SUPPORT_DXE_SUPPORT == 1 + #define NFC_STATE \ + oneof varid = NFC_SUPPORT_DATA.NFCEnable, \ + prompt = STRING_TOKEN(STR_NFC_STATE_PROMPT), \ + help = STRING_TOKEN(STR_NFC_STATE_HELP), \ + default = DEFAULT_NFC_SETTING,\ + option text = STRING_TOKEN(STR_DISABLED_STRING), value = 0, flags = MANUFACTURING | RESET_REQUIRED; \ + option text = STRING_TOKEN(STR_ENABLED_STRING), value = 1, flags = RESET_REQUIRED; \ + endoneof; +#endif + +#endif +//********************************************************************** +// Advanced - ME Configuration Form +//********************************************************************** + +#ifdef ADVANCED_FORM_SET + +#ifdef FORM_SET_TYPEDEF + #include <MeSetup.h> +#if defined NFC_SUPPORT_DXE_SUPPORT && NFC_SUPPORT_DXE_SUPPORT == 1 + #include "NfcSupportDxe.h" +#endif +#endif + +#ifdef FORM_SET_VARSTORE +#if defined NFC_SUPPORT_DXE_SUPPORT && NFC_SUPPORT_DXE_SUPPORT == 1 + varstore NFC_SUPPORT_DATA, + key = AUTO_ID(NFC_SUPPORT_DATA_ID), + name = NfcSupportData, + guid = NFC_SUPPORT_DATA_GUID; +#endif +#endif + + #ifdef FORM_SET_GOTO + // Define goto commands for the forms defined in this file + MESETUP_GOTO_PCHFWCONFIG + #endif + + #ifdef FORM_SET_FORM + // Define forms + #ifndef ME_FORM_SETUP + #define ME_FORM_SETUP + + form formid = AUTO_ID(ME_FORM_ID), + title = STRING_TOKEN(STR_ME_FORM); + + text + help = STRING_TOKEN(STR_ME_FW_VERSION_HELP), + text = STRING_TOKEN(STR_ME_FW_VERSION_PROMPT), + text = STRING_TOKEN(STR_ME_FW_VERSION_VALUE), + flags = 0, + key = 0; + + suppressif + NOT ideqval SETUP_DATA.MeFirmwareInfo == 0xFF; + + INVENTORY(STRING_TOKEN(STR_ME_FW_INFO_PROMPT),STRING_TOKEN(STR_ME_NORMAL_MODE)) + INVENTORY(STRING_TOKEN(STR_ME_FW_INFO_PROMPT),STRING_TOKEN(STR_ME_ALT_DISABLED)) + INVENTORY(STRING_TOKEN(STR_ME_FW_INFO_PROMPT),STRING_TOKEN(STR_ME_TEMP_DISABLED)) + INVENTORY(STRING_TOKEN(STR_ME_FW_INFO_PROMPT),STRING_TOKEN(STR_ME_SECOVER)) + INVENTORY(STRING_TOKEN(STR_ME_FW_INFO_PROMPT),STRING_TOKEN(STR_ME_FAILED)) + endif; + + text + help = STRING_TOKEN(STR_ME_FW_INFO_HELP), + text = STRING_TOKEN(STR_ME_FW_INFO_PROMPT), + text = STRING_TOKEN(STR_ME_FW_INFO_VALUE), + flags = 0, + key = 0; + + suppressif + NOT ideqval SETUP_DATA.MeFirmwareInfo == QUALIFIER_MODE + AND NOT ideqval SETUP_DATA.MeFirmwareInfo == LOCAL_FW_UPD_MODE; + text + help = STRING_TOKEN(STR_ME_FW_TYPE_HELP), + text = STRING_TOKEN(STR_ME_FW_TYPE_PROMPT), + text = STRING_TOKEN(STR_ME_FW_TYPE_MIN), + flags = 0, + key = 0; + endif; + + suppressif + ideqval SETUP_DATA.MeFirmwareInfo == QUALIFIER_MODE + AND ideqval SETUP_DATA.MeFirmwareInfo == LOCAL_FW_UPD_MODE; + text + help = STRING_TOKEN(STR_ME_FW_TYPE_HELP), + text = STRING_TOKEN(STR_ME_FW_TYPE_PROMPT), + text = STRING_TOKEN(STR_ME_FW_TYPE_NORMAL), + flags = 0, + key = 0; + endif; + + + text + help = STRING_TOKEN(STR_ME_FW_SKU_HELP), + text = STRING_TOKEN(STR_ME_FW_SKU_PROMPT), + text = STRING_TOKEN(STR_ME_FW_SKU_VALUE), + flags = 0, + key = 0; +#if IntelPTT_SUPPORT + suppressif ideqval SB_PLATFORM_DATA.LPTType == 0; + text + help = STRING_TOKEN(STR_PTT_CAPABILITY_STATE_HELP), + text = STRING_TOKEN(STR_PTT_CAPABILITY_STATE_PROMPT), + text = STRING_TOKEN(STR_PTT_CAPABILITY_STATE_VALUE), + flags = 0, + key = 0; + endif; +#endif + +#if defined NFC_SUPPORT_DXE_SUPPORT && NFC_SUPPORT_DXE_SUPPORT == 1 + text + help = STRING_TOKEN(STR_NFC_SUPPORT_PROMPT), + text = STRING_TOKEN(STR_NFC_SUPPORT_HELP), + text = STRING_TOKEN(STR_NFC_SUPPORT_VALUE); + + suppressif ideqval NFC_SUPPORT_DATA.NFCCapability == 0; + grayoutif ideqval NFC_SUPPORT_DATA.MeSupportNFC == 0; + NFC_STATE + SUPPRESS_GRAYOUT_ENDIF +#endif + + suppressif NOT ideqval SETUP_DATA.MeImageType == ME_IMAGE_1_5MB_FW; + oneof varid = SETUP_DATA.MebxType, + prompt = STRING_TOKEN(STR_MEBX_TYPE_PROMPT), + help = STRING_TOKEN(STR_MEBX_TYPE_HELP), + option text = STRING_TOKEN(STR_MEBX_TYPE_NONE), value = 0, flags = DEFAULT | MANUFACTURING | RESET_REQUIRED, key = 0; + option text = STRING_TOKEN(STR_MEBX_TYPE_MEBX), value = 1, flags = RESET_REQUIRED, key = 0; + endoneof; + endif; + +#if MdesStatusCode_SUPPORT + oneof varid = SETUP_DATA.MDESForBiosState, + prompt = STRING_TOKEN(STR_MDES_STATUS_PROMPT), + help = STRING_TOKEN(STR_MDES_STATUS_HELP), + option text = STRING_TOKEN(STR_DISABLED_STRING), value = 0, flags = DEFAULT | MANUFACTURING | RESET_REQUIRED, key = 0; + option text = STRING_TOKEN(STR_ENABLED_STRING), value = 1, flags = RESET_REQUIRED, key = 0; + endoneof; +#endif + +#if IntelPTT_SUPPORT + suppressif ideqval SB_PLATFORM_DATA.LPTType == 0; + oneof varid = SETUP_DATA.FTpmSwitch, + prompt = STRING_TOKEN(STR_FTPMSWITCH_STATUS_PROMPT), + help = STRING_TOKEN(STR_FTPMSWITCH_STATUS_HELP), + option text = STRING_TOKEN(STR_GPDMA_STRING), value = 0, flags = DEFAULT | MANUFACTURING | RESET_REQUIRED, key = 0; + option text = STRING_TOKEN(STR_MSFT_STRING), value = 1, flags = RESET_REQUIRED, key = 0; + endoneof; + + oneof varid = SETUP_DATA.TpmDeviceSelection, + prompt = STRING_TOKEN(STR_TPMDEVICE_SELECTION_PROMPT), + help = STRING_TOKEN(STR_TPMDEVICE_SELECTION_HELP), + default = DefaultTpmDeviceSelection, + option text = STRING_TOKEN(STR_DTPM_STRING), value = 0, flags = RESET_REQUIRED, key = 0; + option text = STRING_TOKEN(STR_PTT_STRING), value = 1, flags = MANUFACTURING | RESET_REQUIRED, key = 0; + endoneof; + endif; +#endif + + goto ME_FW_UPGRADE_ID, + prompt = STRING_TOKEN(STR_FW_UPGRADE_FORM), + help = STRING_TOKEN(STR_FW_UPGRADE_FORM_HELP); + + endform; + + form formid = AUTO_ID(ME_FW_UPGRADE_ID), + title = STRING_TOKEN(STR_FW_UPGRADE_FORM); + + grayoutif ideqval SYSTEM_ACCESS.Access == SYSTEM_PASSWORD_USER; + oneof varid = SETUP_DATA.MeFwDowngrade, + prompt = STRING_TOKEN(STR_AMT_ME_FW_DOWNGRADE_PROMPT), + help = STRING_TOKEN(STR_AMT_ME_FW_DOWNGRADE_HELP), + option text = STRING_TOKEN(STR_DISABLED), value = 0, flags = DEFAULT | MANUFACTURING | RESET_REQUIRED, key = 0; + option text = STRING_TOKEN(STR_ENABLED), value = 1, flags = RESET_REQUIRED, key = 0; + endoneof; + endif; + + endform; + #endif // ME_FW_UPGRADE_FORM_SETUP + #endif +#endif // ADVANCED_FORM_SET + +//************************************************************************* +//************************************************************************* +//** ** +//** (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/MeSetup.sdl b/Board/EM/MeWrapper/MeSetup/MeSetup.sdl new file mode 100644 index 0000000..8742e82 --- /dev/null +++ b/Board/EM/MeWrapper/MeSetup/MeSetup.sdl @@ -0,0 +1,192 @@ +TOKEN + Name = "ME_Setup" + Value = "1" + Help = "Main switch to enable ME Setup support in Project" + TokenType = Boolean + TargetEQU = Yes + TargetMAK = Yes + Master = Yes +End + +TOKEN + Name = "CIRA_SUPPORT" + Value = "1" + Help = "Enable Disable CIRA" + TokenType = Boolean + TargetH = Yes + Token = "iAMT_SUPPORT" "=" "1" +End + +TOKEN + Name = "MEBX_SCANCODE" + Value = "0" + Help = "The scancode of MEBX in Project" + TokenType = Integer + TargetH = Yes +End + +TOKEN + Name = "MEBX_UNICODE" + Value = "0x50" + Help = "The unicode of MEBX in Project" + TokenType = integer + TargetH = Yes +End + +TOKEN + Name = "MEBX_KeyShiftState" + Value = "RIGHT_CONTROL_PRESSED | LEFT_CONTROL_PRESSED | SHIFT_STATE_VALID" + Help = "The KeyShiftState of MEBX in Project" + TokenType = Expression + TargetH = Yes +End + +TOKEN + Name = "MEBX_KeyToggleState" + Value = "0" + Help = "The KeyToggleState of MEBX in Project" + TokenType = integer + TargetH = Yes +End + +TOKEN + Name = "CIRA_SCANCODE" + Value = "EFI_SCAN_F1" + Help = "The scancode value of CIRA in Project" + TokenType = Expression + TargetH = Yes + Token = "CIRA_SUPPORT" "=" "1" +End + +TOKEN + Name = "CIRA_UNICODE" + Value = "0" + Help = "The unicode value of CIRA in Project" + TokenType = integer + TargetH = Yes + Token = "CIRA_SUPPORT" "=" "1" +End + +TOKEN + Name = "CIRA_KeyShiftState" + Value = "RIGHT_CONTROL_PRESSED | LEFT_CONTROL_PRESSED | SHIFT_STATE_VALID | RIGHT_ALT_PRESSED | LEFT_ALT_PRESSED" + Help = "The KeyShiftState of CIRA in Project" + TokenType = Expression + TargetH = Yes + Token = "CIRA_SUPPORT" "=" "1" +End + +TOKEN + Name = "CIRA_KeyToggleState" + Value = "0" + Help = "The KeyToggleState of CIRA in Project" + TokenType = integer + TargetH = Yes + Token = "CIRA_SUPPORT" "=" "1" +End + +TOKEN + Name = "DefaultTpmDeviceSelection" + Value = "1" + Help = "dTpm set to 0, PTT set to 1 for default setup setting" + TokenType = Boolean + TargetEQU = Yes + TargetMAK = Yes + TargetH = Yes +End + +PATH + Name = "ME_SETUP_DIR" +End + +MODULE + Help = "Includes MeSetup.mak to Project" + File = "MeSetup.mak" +End + +ELINK + Name = "$(BUILD_DIR)\MeSetup.sdb" + Parent = "SETUP_SDBS" + Priority = 30 + Help = "Includes generic ME setup screens to the project" + InvokeOrder = AfterParent +End + +ELINK + Name = "$(ME_SETUP_DIR)\MeSetup.sd" + Parent = "SETUP_DEFINITIONS" + Priority = 30 + InvokeOrder = AfterParent +End + +ELINK + Name = "/I$(ME_SETUP_DIR)" + Parent = "ME_INCLUDES" + InvokeOrder = AfterParent +End + +ELINK + Name = "-i $(ME_SETUP_DIR)" + Parent = "SETUP_VFR_INCLUDES" + InvokeOrder = AfterParent +End + +ELINK + Name = "InitMeInfo," + Parent = "SetupStringInit" + InvokeOrder = AfterParent +End + +ELINK + Name = "$(BUILD_DIR)\MebxPrompt.obj" + Parent = "AMITSE_Objects" + InvokeOrder = AfterParent +End + +ELINK + Name = "MebxPromptConInAvailabilityHook," + Parent = "ProcessConInAvailabilityHook," + InvokeOrder = AfterParent +End + +ELINK + Name = "RemoteAssistConInAvailabilityHook," + Parent = "ProcessConInAvailabilityHook," + InvokeOrder = AfterParent + Token = "CIRA_SUPPORT" "=" "1" +End + +ELINK + Name = "MEProcessEnterSetup," + Parent = "ProcessEnterSetup," + InvokeOrder = AfterParent +End + +ELINK + Name = "MEProcessEnterSetup," + Parent = "BeforeEfiBootLaunchHook," + InvokeOrder = AfterParent +End + +ELINK + Name = "$(BUILD_DIR)\MeSetupReset.obj" + Parent = "AMITSE_Objects" + InvokeOrder = AfterParent + Token = "IntelPTT_SUPPORT" "=" "1" +End + +ELINK + Name = "MeSetupProcessEnterSetupForPTT," + Parent = "ProcessEnterSetup," + InvokeOrder = AfterParent + Token = "IntelPTT_SUPPORT" "=" "1" +End + +ELINK + Name = "MeSetupResetHookForPTT," + Parent = "PreSystemResetHook," + Priority = 60 + InvokeOrder = AfterParent + Token = "IntelPTT_SUPPORT" "=" "1" +End + diff --git a/Board/EM/MeWrapper/MeSetup/MeSetup.uni b/Board/EM/MeWrapper/MeSetup/MeSetup.uni Binary files differnew file mode 100644 index 0000000..feae8ed --- /dev/null +++ b/Board/EM/MeWrapper/MeSetup/MeSetup.uni diff --git a/Board/EM/MeWrapper/MeSetup/MeSetupReset.c b/Board/EM/MeWrapper/MeSetup/MeSetupReset.c new file mode 100644 index 0000000..3e8e13d --- /dev/null +++ b/Board/EM/MeWrapper/MeSetup/MeSetupReset.c @@ -0,0 +1,156 @@ +//************************************************************************* +//************************************************************************* +//** ** +//** (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/MeSetupReset.c 2 5/14/14 10:02p Tristinchou $ +// +// $Revision: 2 $ +// +// $Date: 5/14/14 10:02p $ +// +//********************************************************************** +// Revision History +// ---------------- +// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/MeSetup/MeSetupReset.c $ +// +// 2 5/14/14 10:02p Tristinchou +// [TAG] EIP167030 +// [Category] Improvement +// [Description] Remove the variable runtime attribute and keep original +// attributes. +// +// 1 2/07/13 1:59a Klzhan +// [TAG] EIP114334 +// [Category] Improvement +// [Description] Create a setup item for TPM Device Selection +// +// +//********************************************************************** + +//<AMI_FHDR_START> +//---------------------------------------------------------------------------- +// +// Name: MeSetupReset.c +// +// Description: Setup hooks for MeSetup module. +// +//---------------------------------------------------------------------------- +//<AMI_FHDR_END> +#include <Token.h> +#include <Setup.h> +#include <AmiLib.h> +#include <AmiDxeLib.h> +#include <AmiCSPLib.h> + +//---------------------------------------------------------------------------- +// Variable and External Declaration(s) +//---------------------------------------------------------------------------- +// Variable Declaration(s) +static SETUP_DATA gNewSetupData; +static SETUP_DATA gOldSetupData; + +// GUID Definition(s) +static EFI_GUID gEfiSetupGuid = SETUP_GUID; + +//<AMI_PHDR_START> +//---------------------------------------------------------------------------- +// Procedure: MeSetupProcessEnterSetupForPTT +// +// Description: This function is a hook called when TSE determines +// that it has to load the boot options in the boot +// order. This function is available as ELINK. +// +// Input: VOID +// +// Output: VOID +// +//---------------------------------------------------------------------------- +//<AMI_PHDR_END> +VOID +MeSetupProcessEnterSetupForPTT ( + VOID +) +{ + EFI_STATUS Status; + UINT32 VarAttr; + UINTN VariableSize; + + VariableSize = sizeof (SETUP_DATA); + Status = pRS->GetVariable( + L"Setup", + &gEfiSetupGuid, + &VarAttr, + &VariableSize, + &gOldSetupData ); + return; +} +//<AMI_PHDR_START> +//---------------------------------------------------------------------------- +// Procedure: MeSetupResetHookForPTT +// +// Description: This function is a hook called after some control +// modified in the setup utility by user. This +// function is available as ELINK. +// +// Input: VOID +// +// Output: VOID +// +//---------------------------------------------------------------------------- +//<AMI_PHDR_END> +VOID +MeSetupResetHookForPTT ( + VOID +) +{ + EFI_STATUS Status; + UINT32 VarAttr; + UINTN VariableSize; + + VariableSize = sizeof (SETUP_DATA); + Status = pRS->GetVariable( + L"Setup", + &gEfiSetupGuid, + &VarAttr, + &VariableSize, + &gNewSetupData ); + + if ( !EFI_ERROR (Status) ) { + if (gNewSetupData.TpmDeviceSelection != gOldSetupData.TpmDeviceSelection) { + gNewSetupData.TpmDeviceSelectionUpdate = 1; + + Status = pRS->SetVariable ( + L"Setup", + &gEfiSetupGuid, + VarAttr, + VariableSize, + &gNewSetupData ); + } + } + + return; +} +//************************************************************************* +//************************************************************************* +//** ** +//** (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/MebxPrompt.c b/Board/EM/MeWrapper/MeSetup/MebxPrompt.c new file mode 100644 index 0000000..aaa2635 --- /dev/null +++ b/Board/EM/MeWrapper/MeSetup/MebxPrompt.c @@ -0,0 +1,520 @@ +//************************************************************************* +//************************************************************************* +//** ** +//** (C)Copyright 1985-2011, 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/MebxPrompt.c 5 11/06/12 5:34a Klzhan $ +// +// $Revision: 5 $ +// +// $Date: 11/06/12 5:34a $ +//********************************************************************** +// Revision History +// ---------------- +// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/MeSetup/MebxPrompt.c $ +// +// 5 11/06/12 5:34a Klzhan +// Improvement : Support MEBX full screen when enable Hot key pressed in +// AMT setup page. +// Fix : Sometimes Mebx not full screen(CreateEvent) +// +// 4 10/04/12 8:43a Klzhan +// [TAG] EIP102464 +// [Category] Improvement +// [Description] Make Mebx setup full screen. +// +// 3 9/19/12 5:51a Klzhan +// Read MEFwType from Setup Variable. +// +// 2 4/23/12 11:09p Klzhan +// +// 1 2/08/12 1:04a Klzhan +// Initial Check in +// +// 12 10/04/11 5:22a Klzhan +// Fix build error when iAMT_SUPPORT is disabled. +// +// 11 9/27/11 5:41a Klzhan +// Add Tokens for Hot key detected. +// +// 10 9/07/11 4:54a Klzhan +// Remove keynotify when entering Setup. +// +// 9 9/06/11 3:51a Klzhan +// Read key by RegisterKeyNofity. +// +// 8 7/19/11 4:41a Klzhan +// Skip MEBX detect when SOL and KVM is running. +// +// 7 7/19/11 1:49a Klzhan +// [TAG] EIP62343 +// [Category] Bug Fix +// [Severity] Important +// [Symptom] Can't Enter MEBX when S4 resume +// [RootCause] BIOS block CTRL + P +// +// 6 6/28/11 7:46a Klzhan +// Fix Remote Assistance can't work property. +// +// 5 6/28/11 2:39a Klzhan +// Fix build error when iAMT_Support is off. +// +// 4 6/20/11 8:19a Klzhan +// Not Show Remote Assistance message when SOL and KVM. +// +// 3 6/20/11 4:20a Klzhan +// 1. Support Remote assistance hot key detect. +// 2. Not prompt CTRL + P when S4 resume. +// +// 2 5/26/11 2:36a Klzhan +// No Prompt Press CTRL + P to enter MEBX message with 1.5M ME. +// +// 1 5/24/11 4:38a Klzhan +// Support Mebx prompt. +// +// +//********************************************************************** + +//<AMI_FHDR_START> +//--------------------------------------------------------------------------- +// Name: MebxPrompt.c +// +// Description: AMT TSE Functions. +// +//--------------------------------------------------------------------------- +//<AMI_FHDR_END> +#include <Setup.h> +#include "variable.h" +#include "AmiDxeLib.h" +#include "Protocol\ConsoleControl.h" +#include "Protocol\SimpleTextInEx.h" +#include "AmtPlatformPolicy\AmtPlatformPolicy.h" +#include "MeBiosExtensionSetup\MeBiosExtensionSetup.h" +#include "MeBiosPayloadData\MeBiosPayloadData.h" +#include "Heci\Heci.h" + +#if defined iAMT_SUPPORT && iAMT_SUPPORT == 1 +#include "AmtWrapper\AmtWrapper.h" +#endif +extern EFI_STATUS PostManagerDisplayPostMessage( CHAR16 *message ); + +extern EFI_BOOT_SERVICES *gBS; +extern EFI_SYSTEM_TABLE *gST; +extern EFI_RUNTIME_SERVICES *gRT; +ME_BIOS_EXTENSION_SETUP MeBiosExtensionSetupData; + +EFI_HANDLE MebxKeyHandle[2]; +EFI_HANDLE CIRAKeyHandle[2]; +DXE_AMT_POLICY_PROTOCOL *mDxePlatformAmtPolicy = NULL; +EFI_GUID gDxePlatformAmtPolicyGuid = DXE_PLATFORM_AMT_POLICY_GUID; +#define EFI_EVENT_ME_PLATFORM_READY_TO_BOOT \ + { \ + 0x3fdf171, 0x1d67, 0x4ace, 0xa9, 0x4, 0x3e, 0x36, 0xd3, 0x38, 0xfa, 0x74 \ + } +EFI_GUID gMePlatformReadyToBootGuid = EFI_EVENT_ME_PLATFORM_READY_TO_BOOT; +//<AMI_PHDR_START> +//******************************************************************************* +// Procedure: SetConsoleControlModeBack +// +// Description: Set to GraphicMode +// +// Input: Event +// Context +// +// Output: VOID +// +//******************************************************************************* +//<AMI_PHDR_END> +EFI_STATUS +SetConsoleControlModeBack( + EFI_EVENT Event, + VOID *ParentImageHandle +) +{ + + EFI_STATUS Status; + EFI_CONSOLE_CONTROL_PROTOCOL *ConsoleControl; + + Status = gBS->LocateProtocol( &gEfiConsoleControlProtocolGuid, NULL, &ConsoleControl); + + //Set back to Graphics + Status = ConsoleControl->SetMode( ConsoleControl, EfiConsoleControlScreenGraphics ); + + gBS->CloseEvent(Event); + return Status; +} + +//<AMI_PHDR_START> +//******************************************************************************* +// Procedure: CIRACheckForKey +// +// Description: +// +// Input: Event: Timer event. +// Context: Event context; always NULL +// +// Output: VOID +// +//******************************************************************************* +//<AMI_PHDR_END> +EFI_STATUS CIRACheckForKey +( + IN EFI_KEY_DATA *Key +) +{ +#if CIRA_SCANCODE + EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *SimpleTextInEX; + EFI_STATUS Status; + + if(mDxePlatformAmtPolicy == NULL) + { + Status = gBS->LocateProtocol (&gDxePlatformAmtPolicyGuid, NULL, &mDxePlatformAmtPolicy); + if (EFI_ERROR(Status)) return Status; + } + + Status = gBS->HandleProtocol(gST->ConsoleInHandle, + &gEfiSimpleTextInExProtocolGuid, + (void*)&SimpleTextInEX); + + if (EFI_ERROR(Status)) return Status; + + Status = SimpleTextInEX->UnregisterKeyNotify (SimpleTextInEX, CIRAKeyHandle[0]); + if((CIRA_UNICODE>0x40 && CIRA_UNICODE<0x5b) || (CIRA_UNICODE>0x60 && CIRA_UNICODE<0x7b)){ + Status = SimpleTextInEX->UnregisterKeyNotify (SimpleTextInEX, CIRAKeyHandle[1]); + } + + mDxePlatformAmtPolicy->AmtConfig.CiraRequest = 1; + PostManagerDisplayPostMessage(L"Requesting CIRA ......"); +#endif + return EFI_SUCCESS; +} +//<AMI_PHDR_START> +//******************************************************************************* +// Procedure: MebxCheckForKey +// +// Description: +// +// Input: Event: Timer event. +// Context: Event context; always NULL +// +// Output: VOID +// +//******************************************************************************* +//<AMI_PHDR_END> +EFI_STATUS MebxCheckForKey +( + IN EFI_KEY_DATA *Key +) +{ + EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *SimpleTextInEX; + EFI_STATUS Status; + EFI_CONSOLE_CONTROL_PROTOCOL *ConsoleControl; + EFI_EVENT SetConsoleControlModeBackEvent; + EFI_CONSOLE_CONTROL_SCREEN_MODE ScreenMode; + + if(mDxePlatformAmtPolicy == NULL) + { + Status = gBS->LocateProtocol (&gDxePlatformAmtPolicyGuid, NULL, &mDxePlatformAmtPolicy); + if (EFI_ERROR(Status)) return Status; + } + + Status = gBS->HandleProtocol(gST->ConsoleInHandle, + &gEfiSimpleTextInExProtocolGuid, + (void*)&SimpleTextInEX); + + if (EFI_ERROR(Status)) return Status; + + Status = SimpleTextInEX->UnregisterKeyNotify (SimpleTextInEX, MebxKeyHandle[0]); + if((MEBX_UNICODE>0x40 && MEBX_UNICODE<0x5b) || (MEBX_UNICODE>0x60 && MEBX_UNICODE<0x7b)){ + Status = SimpleTextInEX->UnregisterKeyNotify (SimpleTextInEX, MebxKeyHandle[1]); + } + + mDxePlatformAmtPolicy->AmtConfig.iAmtbxHotkeyPressed = 1; + PostManagerDisplayPostMessage(L"Entering MEBX setup menu ......"); + + // Fix Mebx Setup screen not full screen. + Status = gBS->LocateProtocol( &gEfiConsoleControlProtocolGuid, NULL, &ConsoleControl); + + ConsoleControl->GetMode(ConsoleControl, &ScreenMode, NULL, NULL); + + if (ScreenMode == EfiConsoleControlScreenGraphics) + { + ConsoleControl->SetMode( ConsoleControl, EfiConsoleControlScreenText ); + Status = gBS->CreateEventEx ( + EFI_EVENT_NOTIFY_SIGNAL, + TPL_CALLBACK, + SetConsoleControlModeBack, + NULL, + &gMePlatformReadyToBootGuid, + &SetConsoleControlModeBackEvent + ); + } + + return EFI_SUCCESS; +} +//<AMI_PHDR_START> +//---------------------------------------------------------------------------- +// Procedure: MebxPromptConInAvailabilityHook +// +// Description: This function is a hook called when TSE determines +// that SETUP utility has to be displayed. This function +// is available as ELINK. In the generic implementation +// setup password is prompted in this function. +// +// Input: VOID +// +// Output: VOID +// +//---------------------------------------------------------------------------- +//<AMI_PHDR_END> +BOOLEAN MebxPromptConInAvailabilityHook (VOID) +{ + EFI_STATUS Status; + EFI_GUID gSetupGuid = SETUP_GUID; + UINTN VarSize; + SETUP_DATA SetupData; +#if MEBX_UNICODE>0x40 && MEBX_UNICODE<0x5b == 1 + // ScanCode, UnicodeChar, KeyShiftState, KeyToggleState + EFI_KEY_DATA Key[] = {{MEBX_SCANCODE, MEBX_UNICODE, MEBX_KeyShiftState, MEBX_KeyToggleState}, + {MEBX_SCANCODE, MEBX_UNICODE+0x20, MEBX_KeyShiftState, MEBX_KeyToggleState}}; + +#else +#if MEBX_UNICODE>0x60 && MEBX_UNICODE<0x7b == 1 + EFI_KEY_DATA Key[] = {{MEBX_SCANCODE, MEBX_UNICODE-0x20, MEBX_KeyShiftState, MEBX_KeyToggleState}, + {MEBX_SCANCODE, MEBX_UNICODE, MEBX_KeyShiftState, MEBX_KeyToggleState}}; +#else + EFI_KEY_DATA Key[] = {{MEBX_SCANCODE, MEBX_UNICODE, MEBX_KeyShiftState, MEBX_KeyToggleState}}; +#endif +#endif + EFI_HECI_PROTOCOL *Heci; + UINT32 MeMode = ME_MODE_FAILED; + EFI_GUID gEfiHeciProtocolGuid = HECI_PROTOCOL_GUID; + EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *SimpleTextInEX; + EFI_GUID gMeBiosPayloadDataProtocolGuid = + ME_BIOS_PAYLOAD_DATA_PROTOCOL_GUID; +#if defined iAMT_SUPPORT && iAMT_SUPPORT == 1 + EFI_GUID gEfiAmtWrapperGuid = EFI_AMT_WRAPPER_PROTOCOL_GUID; + AMT_WRAPPER_PROTOCOL *AmtWrapperProtocol; + + Status = gBS->LocateProtocol (&gEfiAmtWrapperGuid, NULL, &AmtWrapperProtocol); + if (EFI_ERROR(Status)) return FALSE; + if ((AmtWrapperProtocol->ActiveManagementEnableKvm()) || + (AmtWrapperProtocol->ActiveManagementEnableSol())) + return FALSE; +#endif + VarSize = sizeof(SETUP_DATA); + Status = gRT->GetVariable ( + L"Setup", + &gSetupGuid, + NULL, + &VarSize, + &SetupData + ); + + if (EFI_ERROR(Status)) return FALSE; + if(SetupData.MeImageType == 3) + return FALSE; + + Status = pBS->LocateProtocol ( + &gEfiHeciProtocolGuid, + NULL, + &Heci + ); + + if (EFI_ERROR(Status)) return EFI_SUCCESS; + + Status = Heci->GetMeMode (&MeMode); + + // If not normal mode + if(MeMode != 0) + return FALSE; + + if(mDxePlatformAmtPolicy == NULL) + { + Status = gBS->LocateProtocol (&gDxePlatformAmtPolicyGuid, NULL, &mDxePlatformAmtPolicy); + + if (EFI_ERROR(Status)) + return FALSE; + } + + if(mDxePlatformAmtPolicy->AmtConfig.iAmtbxHotkeyPressed == 1) + { + EFI_EVENT SetConsoleControlModeBackEvent; + EFI_CONSOLE_CONTROL_PROTOCOL *ConsoleControl; + EFI_CONSOLE_CONTROL_SCREEN_MODE ScreenMode; + + // Fix Mebx Setup screen not full screen. + Status = gBS->LocateProtocol( + &gEfiConsoleControlProtocolGuid, NULL, &ConsoleControl); + + + + ConsoleControl->GetMode(ConsoleControl, &ScreenMode, NULL, NULL); + if (ScreenMode == EfiConsoleControlScreenGraphics) { + ConsoleControl->SetMode( ConsoleControl, EfiConsoleControlScreenText ); + + Status = gBS->CreateEventEx ( + EFI_EVENT_NOTIFY_SIGNAL, + TPL_CALLBACK, + SetConsoleControlModeBack, + NULL, + &gMePlatformReadyToBootGuid, + &SetConsoleControlModeBackEvent + ); + } + return FALSE; + } + + PostManagerDisplayPostMessage(L"Press <CTRL + P> to Enter MEBX setup menu "); + + Status = gBS->HandleProtocol(gST->ConsoleInHandle, &gEfiSimpleTextInExProtocolGuid, (void*)&SimpleTextInEX); + if (EFI_ERROR(Status)) return FALSE; + + + Status = SimpleTextInEX->RegisterKeyNotify (SimpleTextInEX, &Key[0], &MebxCheckForKey, &MebxKeyHandle[0]); + if((MEBX_UNICODE>0x40 && MEBX_UNICODE<0x5b) || (MEBX_UNICODE>0x60 && MEBX_UNICODE<0x7b)){ + Status = SimpleTextInEX->RegisterKeyNotify (SimpleTextInEX, &Key[1], &MebxCheckForKey, &MebxKeyHandle[1]); + } + + return FALSE; +} +//<AMI_PHDR_START> +//---------------------------------------------------------------------------- +// Procedure: RemoteAssistConInAvailabilityHook +// +// Description: This function is a hook called when TSE determines +// that SETUP utility has to be displayed. This function +// is available as ELINK. In the generic implementation +// setup password is prompted in this function. +// +// Input: VOID +// +// Output: VOID +// +//---------------------------------------------------------------------------- +//<AMI_PHDR_END> +BOOLEAN RemoteAssistConInAvailabilityHook (VOID) +{ +#if CIRA_SUPPORT + EFI_STATUS Status; + UINTN VariableSize = sizeof (ME_BIOS_EXTENSION_SETUP); + EFI_GUID gEfiMeBiosExtensionSetupGuid = EFI_ME_BIOS_EXTENSION_SETUP_GUID; + CHAR16 gEfiMeBiosExtensionSetupName[] = EFI_ME_BIOS_EXTENSION_SETUP_VARIABLE_NAME; + EFI_GUID gEfiAmtWrapperGuid = EFI_AMT_WRAPPER_PROTOCOL_GUID; + AMT_WRAPPER_PROTOCOL *AmtWrapperProtocol; + + Status = gBS->LocateProtocol (&gDxePlatformAmtPolicyGuid, NULL, &mDxePlatformAmtPolicy); + if (EFI_ERROR(Status)) return FALSE; + + Status = gBS->LocateProtocol (&gEfiAmtWrapperGuid, NULL, &AmtWrapperProtocol); + if (EFI_ERROR(Status)) return FALSE; + + Status = gRT->GetVariable ( + gEfiMeBiosExtensionSetupName, + &gEfiMeBiosExtensionSetupGuid, + NULL, + &VariableSize, + &MeBiosExtensionSetupData); + + if(EFI_ERROR(Status)) + return FALSE; + + if((MeBiosExtensionSetupData.RemoteAssistanceTriggerAvailablilty) && + (mDxePlatformAmtPolicy->AmtConfig.iAmtEnabled) && + (!AmtWrapperProtocol->ActiveManagementEnableKvm()) && + (!AmtWrapperProtocol->ActiveManagementEnableSol())) + { +#if CIRA_UNICODE>0x40 && CIRA_UNICODE<0x5b == 1 + // ScanCode, UnicodeChar, KeyShiftState, KeyToggleState + EFI_KEY_DATA Key[] = {{CIRA_SCANCODE, CIRA_UNICODE, CIRA_KeyShiftState, CIRA_KeyToggleState}, + {CIRA_SCANCODE, CIRA_UNICODE+0x20, CIRA_KeyShiftState, CIRA_KeyToggleState}}; + +#else +#if CIRA_UNICODE>0x60 && CIRA_UNICODE<0x7b == 1 + // ScanCode, UnicodeChar, KeyShiftState, KeyToggleState + EFI_KEY_DATA Key[] = {{CIRA_SCANCODE, CIRA_UNICODE-0x20, CIRA_KeyShiftState, CIRA_KeyToggleState}, + {CIRA_SCANCODE, CIRA_UNICODE, CIRA_KeyShiftState, CIRA_KeyToggleState}}; +#else + EFI_KEY_DATA Key[] = {{CIRA_SCANCODE, CIRA_UNICODE, CIRA_KeyShiftState, CIRA_KeyToggleState}}; +#endif +#endif + + EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *SimpleTextInEX; + + + Status = gBS->HandleProtocol(gST->ConsoleInHandle, + &gEfiSimpleTextInExProtocolGuid, (void*)&SimpleTextInEX); + + if (EFI_ERROR(Status)) return FALSE; + PostManagerDisplayPostMessage(L"Press <CTRL + ALT + F1> Remote Assistance"); + Status = SimpleTextInEX->RegisterKeyNotify (SimpleTextInEX, &Key[0], + &CIRACheckForKey, &CIRAKeyHandle[0]); + if((CIRA_UNICODE>0x40 && CIRA_UNICODE<0x5b) || (CIRA_UNICODE>0x60 && CIRA_UNICODE<0x7b)){ + Status = SimpleTextInEX->RegisterKeyNotify (SimpleTextInEX, &Key[1], + &CIRACheckForKey, &CIRAKeyHandle[1]); + } + + } +#endif //CIRA_SUPPORT + return FALSE; +} +//<AMI_PHDR_START> +//---------------------------------------------------------------------------- +// Procedure: MEProcessEnterSetup +// +// Description: This function is a hook called when TSE determines +// that it has to load the boot options in the boot +// order. This function is available as ELINK. +// +// Input: VOID +// +// Output: VOID +// +//---------------------------------------------------------------------------- +//<AMI_PHDR_END> +VOID MEProcessEnterSetup(VOID) +{ + EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *SimpleTextInEX; + EFI_STATUS Status; + + Status = gBS->HandleProtocol(gST->ConsoleInHandle, + &gEfiSimpleTextInExProtocolGuid, + (void*)&SimpleTextInEX); + if(EFI_ERROR(Status)) + return; + +#if CIRA_SUPPORT + Status = SimpleTextInEX->UnregisterKeyNotify (SimpleTextInEX, CIRAKeyHandle[0]); + if((CIRA_UNICODE>0x40 && CIRA_UNICODE<0x5b) || (CIRA_UNICODE>0x60 && CIRA_UNICODE<0x7b)){ + Status = SimpleTextInEX->UnregisterKeyNotify (SimpleTextInEX, CIRAKeyHandle[1]); + } +#endif + + Status = SimpleTextInEX->UnregisterKeyNotify (SimpleTextInEX, MebxKeyHandle[0]); + if((MEBX_UNICODE>0x40 && MEBX_UNICODE<0x5b) || (MEBX_UNICODE>0x60 && MEBX_UNICODE<0x7b)){ + Status = SimpleTextInEX->UnregisterKeyNotify (SimpleTextInEX, MebxKeyHandle[1]); + } +} +//************************************************************************* +//************************************************************************* +//** ** +//** (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/NfcSupportDxe/NfcSupportDxe.c b/Board/EM/MeWrapper/MeSetup/NfcSupportDxe/NfcSupportDxe.c new file mode 100644 index 0000000..b490873 --- /dev/null +++ b/Board/EM/MeWrapper/MeSetup/NfcSupportDxe/NfcSupportDxe.c @@ -0,0 +1,190 @@ +//************************************************************************* +//************************************************************************* +//** ** +//** (C)Copyright 1985-2014, 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/NfcSupportDxe/NfcSupportDxe.c 1 11/02/14 9:43p Tristinchou $ +// +// $Revision: 1 $ +// +// $Date: 11/02/14 9:43p $ +// +//********************************************************************** +// Revision History +// ---------------- +// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/MeSetup/NfcSupportDxe/NfcSupportDxe.c $ +// +// 1 11/02/14 9:43p Tristinchou +// [TAG] EIP189985 +// [Category] Improvement +// [Description] For ME 9.1.20.1035, add NFC related option in setup +// [Files] NfcSupportDxe.cif +// NfcSupportDxe.c +// NfcSupportDxe.h +// NfcSupportDxe.sdl +// NfcSupportDxe.dxs +// NfcSupportDxe.mak +// +//********************************************************************** +#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000) +#include "EdkIIGlueDxe.h" +#include "HeciMsgLib.h" +#include EFI_PROTOCOL_DEFINITION (MeBiosPayloadData) +#include "MELib.h" +#include <token.h> +#endif + +#include "NfcSupportDxe.h" + +//<AMI_PHDR_START> +//---------------------------------------------------------------------------- +// Procedure: MeSupportNfc +// +// Description: This function determines ME firmware support enable/disable +// NFC state. From ME 9.1.20.1035, ME firmware support this +// feature. +// +// Input: DXE_MBP_DATA_PROTOCOL *MbpDataProtocol +// +// Output: BOOLEAN +// +//---------------------------------------------------------------------------- +//<AMI_PHDR_END> +BOOLEAN +MeSupportNfc( + IN DXE_MBP_DATA_PROTOCOL *MbpDataProtocol +) +{ + //If ME version is above 9.1.20.1035 + if( (MbpDataProtocol != NULL) && + ( (MbpDataProtocol->MeBiosPayload.FwVersionName.MajorVersion == 0x09) && + (MbpDataProtocol->MeBiosPayload.FwVersionName.MinorVersion == 0x01) && + ( (MbpDataProtocol->MeBiosPayload.FwVersionName.HotfixVersion >= 0x14) || + (MbpDataProtocol->MeBiosPayload.FwVersionName.BuildVersion >= 0x040B) ) ) ) + { + return TRUE; + } + + return FALSE; +} +//<AMI_PHDR_START> +//---------------------------------------------------------------------------- +// Procedure: NfcSupportDxeEntryPoint +// +// Description: Module entry point +// +// Input: EFI_HANDLE ImageHandle +// EFI_SYSTEM_TABLE *SystemTable +// +// Output: EFI_STATUS +// +//---------------------------------------------------------------------------- +//<AMI_PHDR_END> +EFI_STATUS +NfcSupportDxeEntryPoint ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable +) +{ + EFI_STATUS Status; + DXE_MBP_DATA_PROTOCOL *MbpData = NULL; + UINT32 VarAttr; + UINTN VarSize; + EFI_GUID NfcSupportDataGuid = NFC_SUPPORT_DATA_GUID; + NFC_SUPPORT_DATA NfcSupportData; + MEFWCAPS_SKU FwFeatureState; + + DEBUG ((EFI_D_INFO, "[NfcSupportDxe.c] : Entry Point...\n")); + + Status = gBS->LocateProtocol( + &gMeBiosPayloadDataProtocolGuid, + NULL, + (VOID**)&MbpData ); + if( EFI_ERROR(Status) ) + MbpData = NULL; + + VarAttr = 0; + VarSize = sizeof( NFC_SUPPORT_DATA ); + Status = gRT->GetVariable ( + L"NfcSupportData", + &NfcSupportDataGuid, + &VarAttr, + &VarSize, + &NfcSupportData ); + if( EFI_ERROR(Status) ) + VarAttr = EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_NON_VOLATILE; + + if( MbpData != NULL ) + { + NfcSupportData.NFCCapability = MbpData->MeBiosPayload.FwCapsSku.FwCapabilities.Fields.NFC;; + NfcSupportData.NFCDeviceType = MbpData->MeBiosPayload.NfcSupport.NfcData.DeviceType; + } + else + { + NfcSupportData.NFCCapability = 0; + NfcSupportData.NFCDeviceType = 0; + } + + Status = HeciGetFwFeatureStateMsg( &FwFeatureState ); + if( !EFI_ERROR(Status) ) + NfcSupportData.NFCState = FwFeatureState.Fields.NFC; + else + NfcSupportData.NFCState = 0; + + if( MeSupportNfc(MbpData) ) + NfcSupportData.MeSupportNFC = 1; + else + NfcSupportData.MeSupportNFC = 0; + + Status = gRT->SetVariable( + L"NfcSupportData", + &NfcSupportDataGuid, + VarAttr, + VarSize, + &NfcSupportData ); + if ( EFI_ERROR(Status) ) + return EFI_SUCCESS; + + //If ME support NFC and NFC capability is on + if( (NfcSupportData.MeSupportNFC == 1) && + (NfcSupportData.NFCCapability == 1) ) + { + if( (NfcSupportData.NFCEnableUpdate == 1) && + (NfcSupportData.NFCState != NfcSupportData.NFCEnable) ) + { + if( NfcSupportData.NFCEnable == 1 ) + Status = HeciFwFeatureStateOverride( 0x80000000, 0 ); + else + Status = HeciFwFeatureStateOverride( 0, 0x80000000 ); + + Status = HeciSendCbmResetRequest(CBM_RR_REQ_ORIGIN_BIOS_POST, CBM_HRR_GLOBAL_RESET); +// if( !EFI_ERROR(Status) ) +// EFI_DEADLOOP(); + } + } + + return EFI_SUCCESS; +} +//************************************************************************* +//************************************************************************* +//** ** +//** (C)Copyright 1985-2014, 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/NfcSupportDxe/NfcSupportDxe.cif b/Board/EM/MeWrapper/MeSetup/NfcSupportDxe/NfcSupportDxe.cif new file mode 100644 index 0000000..4c5ff29 --- /dev/null +++ b/Board/EM/MeWrapper/MeSetup/NfcSupportDxe/NfcSupportDxe.cif @@ -0,0 +1,14 @@ +<component> + name = "NfcSupportDxe" + category = ModulePart + LocalRoot = "Board\EM\MeWrapper\MeSetup\NfcSupportDxe" + RefName = "NfcSupportDxe" +[files] +"NfcSupportDxe.c" +"NfcSupportDxe.h" +"NfcSupportDxe.sdl" +"NfcSupportDxe.dxs" +"NfcSupportDxe.mak" +[parts] +"NfcSupportSetupHook" +<endComponent> diff --git a/Board/EM/MeWrapper/MeSetup/NfcSupportDxe/NfcSupportDxe.dxs b/Board/EM/MeWrapper/MeSetup/NfcSupportDxe/NfcSupportDxe.dxs new file mode 100644 index 0000000..8395065 --- /dev/null +++ b/Board/EM/MeWrapper/MeSetup/NfcSupportDxe/NfcSupportDxe.dxs @@ -0,0 +1,70 @@ +//************************************************************************* +//************************************************************************* +//** ** +//** (C)Copyright 1985-2014, 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/NfcSupportDxe/NfcSupportDxe.dxs 1 11/02/14 9:43p Tristinchou $ +// +// $Revision: 1 $ +// +// $Date: 11/02/14 9:43p $ +// +//********************************************************************** +// Revision History +// ---------------- +// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/MeSetup/NfcSupportDxe/NfcSupportDxe.dxs $ +// +// 1 11/02/14 9:43p Tristinchou +// [TAG] EIP189985 +// [Category] Improvement +// [Description] For ME 9.1.20.1035, add NFC related option in setup +// [Files] NfcSupportDxe.cif +// NfcSupportDxe.c +// NfcSupportDxe.h +// NfcSupportDxe.sdl +// NfcSupportDxe.dxs +// NfcSupportDxe.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) +#include EFI_PROTOCOL_DEFINITION (MeBiosPayloadData) + +#endif + +DEPENDENCY_START + EFI_HECI_PROTOCOL_GUID AND + PCH_RESET_PROTOCOL_GUID AND + EFI_VARIABLE_ARCH_PROTOCOL_GUID AND + ME_BIOS_PAYLOAD_DATA_PROTOCOL_GUID +DEPENDENCY_END +//************************************************************************* +//************************************************************************* +//** ** +//** (C)Copyright 1985-2014, 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/NfcSupportDxe/NfcSupportDxe.h b/Board/EM/MeWrapper/MeSetup/NfcSupportDxe/NfcSupportDxe.h new file mode 100644 index 0000000..6e12a2d --- /dev/null +++ b/Board/EM/MeWrapper/MeSetup/NfcSupportDxe/NfcSupportDxe.h @@ -0,0 +1,71 @@ +//************************************************************************* +//************************************************************************* +//** ** +//** (C)Copyright 1985-2014, 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/NfcSupportDxe/NfcSupportDxe.h 1 11/02/14 9:43p Tristinchou $ +// +// $Revision: 1 $ +// +// $Date: 11/02/14 9:43p $ +// +//********************************************************************** +// Revision History +// ---------------- +// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/MeSetup/NfcSupportDxe/NfcSupportDxe.h $ +// +// 1 11/02/14 9:43p Tristinchou +// [TAG] EIP189985 +// [Category] Improvement +// [Description] For ME 9.1.20.1035, add NFC related option in setup +// [Files] NfcSupportDxe.cif +// NfcSupportDxe.c +// NfcSupportDxe.h +// NfcSupportDxe.sdl +// NfcSupportDxe.dxs +// NfcSupportDxe.mak +// +// +//********************************************************************** +#ifndef _NfcSupportDxe_H_ +#define _NfcSupportDxe_H_ + +#pragma pack(push, 1) +typedef struct { + BOOLEAN NFCCapability; + BOOLEAN NFCState; + UINT8 NFCDeviceType; + UINT8 MeSupportNFC; + UINT8 NFCEnable; + UINT8 NFCEnableUpdate; +} NFC_SUPPORT_DATA; +#pragma pack(pop) + +//1E5ACFFE-ED4C-4BC0-AE51-511EFDA0522E +#define NFC_SUPPORT_DATA_GUID \ + {0x1E5ACFFE, 0xED4C, 0x4BC0, 0xAE, 0x51, 0x51, 0x1E, 0xFD, 0xA0, 0x52, 0x2E} + +#endif +//************************************************************************* +//************************************************************************* +//** ** +//** (C)Copyright 1985-2014, 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/NfcSupportDxe/NfcSupportDxe.mak b/Board/EM/MeWrapper/MeSetup/NfcSupportDxe/NfcSupportDxe.mak new file mode 100644 index 0000000..567adc0 --- /dev/null +++ b/Board/EM/MeWrapper/MeSetup/NfcSupportDxe/NfcSupportDxe.mak @@ -0,0 +1,134 @@ +#************************************************************************* +#************************************************************************* +#** ** +#** (C)Copyright 1985-2014, 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/NfcSupportDxe/NfcSupportDxe.mak 1 11/02/14 9:43p Tristinchou $ +# +# $Revision: 1 $ +# +# $Date: 11/02/14 9:43p $ +# +#********************************************************************** +# Revision History +# ---------------- +# $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/MeSetup/NfcSupportDxe/NfcSupportDxe.mak $ +# +# 1 11/02/14 9:43p Tristinchou +# [TAG] EIP189985 +# [Category] Improvement +# [Description] For ME 9.1.20.1035, add NFC related option in setup +# [Files] NfcSupportDxe.cif +# NfcSupportDxe.c +# NfcSupportDxe.h +# NfcSupportDxe.sdl +# NfcSupportDxe.dxs +# NfcSupportDxe.mak +# +# +#********************************************************************** +# +#<AMI_FHDR_START> +#---------------------------------------------------------------------------- +# +# Name: NfcSupportDxe.mak +# +# Description: Makfile for ME NFC Setup module. +# +#---------------------------------------------------------------------------- +#<AMI_FHDR_END> +all : NfcSupportDxe + +NfcSupportDxe : $(BUILD_DIR)\NfcSupportDxe.mak NfcSupportDxe_Bin + +$(BUILD_DIR)\NfcSupportDxe.mak : $(NFC_SUPPORT_DXE_PATH)\$(@B).cif $(NFC_SUPPORT_DXE_PATH)\$(@B).mak $(BUILD_RULES) + $(CIF2MAK) $(NFC_SUPPORT_DXE_PATH)\$(@B).cif $(CIF2MAK_DEFAULTS) + +NfcSupportDxe_INCLUDES=\ + $(EdkIIGlueLib_INCLUDES)\ + $(EDK_INCLUDES)\ + $(ME_INCLUDES)\ + $(INTEL_PCH_INCLUDES)\ + +NfcSupportDxe_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)\ + $(MeLibDxe_LIB)\ + $(PchPlatformDxeLib_LIB)\ + +NfcSupportDxe_DEFINES=\ + $(MY_DEFINES)\ + /D"__EDKII_GLUE_MODULE_ENTRY_POINT__=NfcSupportDxeEntryPoint"\ + /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__ \ + +NfcSupportDxe_Bin : $(NfcSupportDxe_LIBS) + $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\ + /f $(BUILD_DIR)\NfcSupportDxe.mak all\ + "MY_INCLUDES=$(NfcSupportDxe_INCLUDES)"\ + "MY_DEFINES=$(NfcSupportDxe_DEFINES)"\ + GUID=1E5ACFFE-ED4C-4BC0-AE51-511EFDA0522E \ + ENTRY_POINT=_ModuleEntryPoint \ + EDKIIModule=DXEDRIVER\ + TYPE=BS_DRIVER \ + DEPEX1=$(NFC_SUPPORT_DXE_PATH)\NfcSupportDxe.dxs \ + DEPEX1_TYPE=EFI_SECTION_DXE_DEPEX \ + COMPRESS=1\ + +!IF DEFINED(NFC_SUPPORT_DXE_SUPPORT) && "$(NFC_SUPPORT_DXE_SUPPORT)" == "1" +SetupData : $(BUILD_DIR)\NfcSupportSetupHook.obj +!ENDIF + +NfcSupportSetupHook_CFLAGS=$(CFLAGS) \ + -I $(TSEBIN_DIR)\Inc \ + -I $(TSEBIN_DIR)\ + -I $(NFC_SUPPORT_DXE_PATH)\ + -I $(PROJECT_DIR)\Include + +$(BUILD_DIR)\NfcSupportSetupHook.obj : $(NFC_SUPPORT_DXE_PATH)\NfcSupportSetupHook.c + $(CC) $(NfcSupportSetupHook_CFLAGS) /Fo$(BUILD_DIR)\ $(NFC_SUPPORT_DXE_PATH)\NfcSupportSetupHook.c +#************************************************************************* +#************************************************************************* +#** ** +#** (C)Copyright 1985-2014, 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/NfcSupportDxe/NfcSupportDxe.sdl b/Board/EM/MeWrapper/MeSetup/NfcSupportDxe/NfcSupportDxe.sdl new file mode 100644 index 0000000..4e3500d --- /dev/null +++ b/Board/EM/MeWrapper/MeSetup/NfcSupportDxe/NfcSupportDxe.sdl @@ -0,0 +1,62 @@ +TOKEN + Name = "NFC_SUPPORT_DXE_SUPPORT" + Value = "1" + Help = "Main switch to enable NfcSupportDxe support in DXE Phase" + TokenType = Boolean + TargetEQU = Yes + TargetMAK = Yes + TargetH = Yes + Master = Yes +End + +TOKEN + Name = "DEFAULT_NFC_SETTING" + Value = "1" + Help = "Default value of NFC Enable option" + TokenType = Integer + TargetH = Yes +End + +PATH + Name = "NFC_SUPPORT_DXE_PATH" +End + +MODULE + Help = "Includes NfcSupportDxe.mak to Project" + File = "NfcSupportDxe.mak" +End + +ELINK + Name = "NfcSupportResetHook," + Parent = "PreSystemResetHook," + Priority = 60 + Token = "NFC_SUPPORT_DXE_SUPPORT" "=" "1" + InvokeOrder = AfterParent +End + +ELINK + Name = "$(BUILD_DIR)\NfcSupportDxe.ffs" + Parent = "FV_MAIN" + InvokeOrder = AfterParent +End + +ELINK + Name = "-i $(NFC_SUPPORT_DXE_PATH)" + Parent = "SETUP_VFR_INCLUDES" + InvokeOrder = AfterParent +End + +ELINK + Name = "$(BUILD_DIR)\NfcSupportSetupHook.obj" + Parent = "AMITSE_Objects" + Token = "NFC_SUPPORT_DXE_SUPPORT" "=" "1" + InvokeOrder = AfterParent +End + +ELINK + Name = "NfcSupportEnterSetup," + Parent = "ProcessEnterSetup," + Token = "NFC_SUPPORT_DXE_SUPPORT" "=" "1" + InvokeOrder = AfterParent +End + diff --git a/Board/EM/MeWrapper/MeSetup/NfcSupportDxe/NfcSupportSetupHook.c b/Board/EM/MeWrapper/MeSetup/NfcSupportDxe/NfcSupportSetupHook.c new file mode 100644 index 0000000..98cecc2 --- /dev/null +++ b/Board/EM/MeWrapper/MeSetup/NfcSupportDxe/NfcSupportSetupHook.c @@ -0,0 +1,154 @@ +//************************************************************************* +//************************************************************************* +//** ** +//** (C)Copyright 1985-2014, 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/NfcSupportDxe/NfcSupportSetupHook.c 1 11/02/14 9:43p Tristinchou $ +// +// $Revision: 1 $ +// +// $Date: 11/02/14 9:43p $ +// +//********************************************************************** +// Revision History +// ---------------- +// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/MeSetup/NfcSupportDxe/NfcSupportSetupHook.c $ +// +// 1 11/02/14 9:43p Tristinchou +// [TAG] EIP189985 +// [Category] Improvement +// [Description] For ME 9.1.20.1035, add NFC related option in setup +// [Files] NfcSupportSetupHook.cif +// NfcSupportSetupHook.c +// +// +// +//********************************************************************** + +//<AMI_FHDR_START> +//---------------------------------------------------------------------------- +// +// Name: NfcSupportSetupHook.c +// +// Description: Setup hooks for NfcSupportDxe module. +// +//---------------------------------------------------------------------------- +//<AMI_FHDR_END> +#include <Token.h> +#include <Setup.h> +#include <AmiLib.h> +#include <AmiDxeLib.h> +#include "NfcSupportDxe.h" + +//---------------------------------------------------------------------------- +// Variable and External Declaration(s) +//---------------------------------------------------------------------------- +// Variable Declaration(s) +static NFC_SUPPORT_DATA gNewNfcSupportData; +static NFC_SUPPORT_DATA gOldNfcSupportData; + +// GUID Definition(s) +static EFI_GUID gNfcSupportDataGuid = NFC_SUPPORT_DATA_GUID; + +//<AMI_PHDR_START> +//---------------------------------------------------------------------------- +// Procedure: NfcSupportEnterSetup +// +// Description: This function is a hook called when TSE determines +// that it has to load the boot options in the boot +// order. This function is available as ELINK. +// +// Input: VOID +// +// Output: VOID +// +//---------------------------------------------------------------------------- +//<AMI_PHDR_END> +VOID +NfcSupportEnterSetup( + VOID +) +{ + EFI_STATUS Status; + UINT32 VarAttr; + UINTN VariableSize; + + VariableSize = sizeof(NFC_SUPPORT_DATA); + Status = pRS->GetVariable( + L"NfcSupportData", + &gNfcSupportDataGuid, + &VarAttr, + &VariableSize, + &gOldNfcSupportData ); + return; +} +//<AMI_PHDR_START> +//---------------------------------------------------------------------------- +// Procedure: NfcSupportResetHook +// +// Description: This function is a hook called after some control +// modified in the setup utility by user. This +// function is available as ELINK. +// +// Input: VOID +// +// Output: VOID +// +//---------------------------------------------------------------------------- +//<AMI_PHDR_END> +VOID +NfcSupportResetHook( + VOID +) +{ + EFI_STATUS Status; + UINT32 VarAttr; + UINTN VariableSize; + + VariableSize = sizeof(NFC_SUPPORT_DATA); + Status = pRS->GetVariable( + L"NfcSupportData", + &gNfcSupportDataGuid, + &VarAttr, + &VariableSize, + &gNewNfcSupportData ); + if ( !EFI_ERROR (Status) ) + { + if( gNewNfcSupportData.NFCEnable != gOldNfcSupportData.NFCEnable ) + { + gNewNfcSupportData.NFCEnableUpdate = 1; + + Status = pRS->SetVariable ( + L"NfcSupportData", + &gNfcSupportDataGuid, + VarAttr, + VariableSize, + &gNewNfcSupportData ); + } + } + + return; +} +//************************************************************************* +//************************************************************************* +//** ** +//** (C)Copyright 1985-2014, 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/NfcSupportDxe/NfcSupportSetupHook.cif b/Board/EM/MeWrapper/MeSetup/NfcSupportDxe/NfcSupportSetupHook.cif new file mode 100644 index 0000000..f07c1a0 --- /dev/null +++ b/Board/EM/MeWrapper/MeSetup/NfcSupportDxe/NfcSupportSetupHook.cif @@ -0,0 +1,8 @@ +<component> + name = "NfcSupportSetupHook" + category = ModulePart + LocalRoot = "Board\EM\MeWrapper\MeSetup\NfcSupportDxe" + RefName = "NfcSupportSetupHook" +[files] +"NfcSupportSetupHook.c" +<endComponent>
\ No newline at end of file |