summaryrefslogtreecommitdiff
path: root/Board/CPU/TxtDxe
diff options
context:
space:
mode:
authorraywu <raywu0301@gmail.com>2018-06-15 00:00:50 +0800
committerraywu <raywu0301@gmail.com>2018-06-15 00:00:50 +0800
commitb7c51c9cf4864df6aabb99a1ae843becd577237c (patch)
treeeebe9b0d0ca03062955223097e57da84dd618b9a /Board/CPU/TxtDxe
downloadzprj-b7c51c9cf4864df6aabb99a1ae843becd577237c.tar.xz
init. 1AQQW051HEADmaster
Diffstat (limited to 'Board/CPU/TxtDxe')
-rw-r--r--Board/CPU/TxtDxe/AmiTxtDxe.c534
-rw-r--r--Board/CPU/TxtDxe/AmiTxtDxe.cif21
-rw-r--r--Board/CPU/TxtDxe/AmiTxtDxe.dxs48
-rw-r--r--Board/CPU/TxtDxe/AmiTxtDxe.h112
-rw-r--r--Board/CPU/TxtDxe/AmiTxtDxe.mak132
-rw-r--r--Board/CPU/TxtDxe/AmiTxtDxe.sdl133
-rw-r--r--Board/CPU/TxtDxe/AmiTxtInfoHook.c167
-rw-r--r--Board/CPU/TxtDxe/AmiTxtInfoSetup.c176
-rw-r--r--Board/CPU/TxtDxe/AmiTxtInfoSetup.sd149
-rw-r--r--Board/CPU/TxtDxe/AmiTxtInfoSetup.unibin0 -> 8286 bytes
-rw-r--r--Board/CPU/TxtDxe/Include/Protocol/AmiTxtInfo.h117
-rw-r--r--Board/CPU/TxtDxe/SinitAcm/HSW_SINITAC_DBG_Rev1_5.BINbin0 -> 52800 bytes
-rw-r--r--Board/CPU/TxtDxe/SinitAcm/HSW_SINITAC_PRO_NPW_Rev1_5.BINbin0 -> 52800 bytes
-rw-r--r--Board/CPU/TxtDxe/SinitAcm/HSW_SINITAC_PRO_Rev1_5.BINbin0 -> 52800 bytes
-rw-r--r--Board/CPU/TxtDxe/SinitAcm/TxtSinitAcm.cif12
-rw-r--r--Board/CPU/TxtDxe/SinitAcm/TxtSinitAcm.mak69
-rw-r--r--Board/CPU/TxtDxe/SinitAcm/TxtSinitAcm.sdl32
-rw-r--r--Board/CPU/TxtDxe/TxtSetup.c135
-rw-r--r--Board/CPU/TxtDxe/TxtTcgService.h277
19 files changed, 2114 insertions, 0 deletions
diff --git a/Board/CPU/TxtDxe/AmiTxtDxe.c b/Board/CPU/TxtDxe/AmiTxtDxe.c
new file mode 100644
index 0000000..3db2503
--- /dev/null
+++ b/Board/CPU/TxtDxe/AmiTxtDxe.c
@@ -0,0 +1,534 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (C)Copyright 1987-2013, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//*************************************************************************
+//*************************************************************************
+
+//**********************************************************************
+// $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/Haswell/AMI Cpu PKG/AMI TXT DXE/AmiTxtDxe.c 11 6/11/15 10:31p Crystallee $
+//
+// $Revision: 11 $
+//
+// $Date: 6/11/15 10:31p $
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/Haswell/AMI Cpu PKG/AMI TXT DXE/AmiTxtDxe.c $
+//
+// 11 6/11/15 10:31p Crystallee
+// [TAG] EIP207854
+// [Category] Bug Fix
+// [Severity] Important
+// [Symptom] Txt test fail with TCG2 module
+// [RootCause] Tokne TCG_SUPPORT was removed.
+// [Solution] Add TCG2Support token.
+//
+// 10 4/10/15 3:11a Crystallee
+//
+// 9 5/05/14 11:57p Hsingyingchung
+// [TAG] EIP167029
+// [Category] Improvement
+// [Description] Keep the original attribute of "Setup" variable when
+// use SetVariable().
+//
+// 8 1/17/14 4:08a Crystallee
+// [TAG] None
+// [Category] Improvement
+// [Description] Show Txt information in setup->Advanced ->Intel Txt
+// Information page.
+//
+// 7 8/28/13 5:57a Crystallee
+// [TAG] EIP134339
+// [Category] Bug Fix
+// [Severity] Important
+// [Symptom] [Sharkbay]Build error after update Haswell Cpu module
+// [RootCause] If token TCG_SUPPORT is disabled, TpmSupport setup data
+// will not define, then cause built error.
+// [Solution] Add token TCG_SUPPORT condition when use TpmSupport setup
+// data.
+//
+// 6 8/14/13 5:07a Davidhsieh
+//
+// 4 7/23/13 7:47a Crystallee
+// [TAG] EIP128089
+// [Category] Improvement
+// [Description] TXT will be disabled and grayed out in Setup when TPM
+// Support is disabled.
+//
+// 3 9/13/12 4:13a Davidhsieh
+// [TAG] None
+// [Category] Bug Fix
+// [Severity] Important
+// [Symptom] Desable TCG causes BIOS building error
+// [RootCause] TCG setup data is used in TxtPei and the data is not
+// exist when TCG disabled.
+// [Solution] Do not use the TCG setup data when TCG disabled
+//
+// 2 9/05/12 1:36a Davidhsieh
+// [TAG] EIP97350
+// [Category] Improvement
+// [Description] Add AUX index define in TPM NVRAM to avoid system keep
+// reset when TXT enabled
+//
+// 1 7/18/12 2:07a Davidhsieh
+// [TAG] None
+// [Category] Improvement
+// [Description] AMI TXT Dxe module part create
+//
+//
+//**********************************************************************
+//<AMI_FHDR_START>
+//
+// Name: AmiTxtDxe.c
+//
+// Description:
+//
+//<AMI_FHDR_END>
+//**********************************************************************
+//
+#include "AmiTxtDxe.h"
+#include "Txt.h"
+
+AMI_TXT_INFO_PROTOCOL gAmiTxtInfoProtocol = {0};
+AMI_TXT_INFO_DATA gAmiTxtInfoData = {0};
+
+EFI_GUID gHobListGuid = HOB_LIST_GUID;
+EFI_GUID gAmiTxtInfoProtocolGuid = AMI_TXT_INFO_PROTOCOL_GUID;
+
+#if TCG_SUPPORT || TCG2Support
+EFI_GUID gSetupGuid = SETUP_GUID;
+EFI_GUID gEfiTcgProtocolGuid = EFI_TCG_PROTOCOL_GUID;
+EFI_GUID gEfiTpmDeviceProtocolGuid = EFI_TPM_DEVICE_PROTOCOL_GUID;
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+//
+// Procedure: LtSendTpmCommand
+//
+// Description: Sends a command to the TPM
+//
+// Input: *EFI_TCG_PROTOCOL - Tcg Protocol type.
+// UINT32 - Tcg Command ordinal.
+// int - cmd datasize.
+// VOID* - cmd data.
+//
+// Output: UINT32 - TPM_RESULT
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+UINT32
+LtSendTpmCommand (
+ IN EFI_TCG_PROTOCOL *tcg,
+ IN UINT32 ord,
+ IN int dataSize,
+ IN VOID *data
+)
+{
+ EFI_STATUS Status;
+ static UINT8 result[0x400];
+ TPM_1_2_RET_HEADER* tpmResult;
+ struct {
+ TPM_1_2_CMD_HEADER hdr;
+ UINT8 data[0x100];
+ } cmd;
+
+ cmd.hdr.Tag = TPM_H2NS (TPM_TAG_RQU_COMMAND);
+ cmd.hdr.ParamSize = TPM_H2NL (sizeof(TPM_1_2_RET_HEADER) + dataSize);
+ cmd.hdr.Ordinal = TPM_H2NL (ord);
+ pBS->CopyMem(cmd.data, data, dataSize);
+ Status = tcg->PassThroughToTpm ( tcg, \
+ sizeof(TPM_1_2_CMD_HEADER) + dataSize, \
+ (UINT8*)&cmd, \
+ sizeof (result), \
+ (UINT8*)&result );
+ tpmResult = (TPM_1_2_RET_HEADER*)result;
+ if ( EFI_ERROR(Status) || (tpmResult->RetCode != 0))
+ TRACE((TRACE_ALWAYS, "TXT (TPM Error) Status: %r; RetCode: %x.\n", \
+ Status, \
+ TPM_H2NL(tpmResult->RetCode) ));
+ return tpmResult->RetCode;
+}
+
+#if defined SINIT_ACM_SUPPORT && SINIT_ACM_SUPPORT == 1
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: EventUpdateSinitAcmToMemory
+//
+// Description: This routine copy SINIT ACM to SINIT meory for BIOS-Base SINI
+// AC Module implementation.
+//
+// Input: IN EFI_EVENT Event
+// IN VOID *Context
+//
+// Output: None
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID
+EventUpdateSinitAcmToMemory (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+)
+{
+ EFI_STATUS Status = EFI_SUCCESS;
+ EFI_HANDLE *FvHandle;
+ UINTN Number, i, SinitacmSize = 0;
+ UINT32 Authentication, TxtMemBase;
+ VOID *pSinitacmPtr = NULL;
+ EFI_FIRMWARE_VOLUME_PROTOCOL *Fv;
+ EFI_GUID SinitAcmFfsGuid = \
+ { 0x7fbfe0ea, 0x0e9d, 0x406b, 0xa2, 0x2, 0xca, 0x6a, 0x7d, 0x0e, 0x0f, 0x1e};
+ EFI_GUID gEfiFirmwareVolume2ProtocolGuid =
+ { 0x220e73b6, 0x6bdb, 0x4413, 0x84, 0x5, 0xb9, 0x74, 0xb1, 0x8, 0x61, 0x9a };
+
+ pBS->CloseEvent (Event);
+ Status = pBS->LocateHandleBuffer (ByProtocol, \
+ &gEfiFirmwareVolume2ProtocolGuid, \
+ NULL, \
+ &Number, \
+ &FvHandle);
+ if (EFI_ERROR(Status)) return;
+
+ for (i = 0; i < Number; i++) {
+
+ Status = pBS->HandleProtocol (\
+ FvHandle[i], &gEfiFirmwareVolume2ProtocolGuid, &Fv);
+ if (EFI_ERROR(Status)) continue;
+
+ // Read SINIT AC module from Firmware Volume
+ SinitacmSize = 0;
+ pSinitacmPtr = NULL;
+ Status = Fv->ReadSection ( Fv,
+ &SinitAcmFfsGuid,
+ EFI_SECTION_RAW,
+ 0,
+ &pSinitacmPtr,
+ &SinitacmSize,
+ &Authentication );
+ if (!EFI_ERROR(Status)) {
+ // SINIT Memory Base = TXT Public Space + 270h
+ TxtMemBase = *(UINT32*)0xfed30270;
+ // copy SINIT ACM to SINIT memory
+ pBS->CopyMem ((VOID*)TxtMemBase, pSinitacmPtr, SinitacmSize);
+ // BiosToOS Region Base = TXT Public Space + 300h
+ TxtMemBase = *(UINT32*)0xfed30300;
+ // Update SINIT ACM size to BiosToOS region
+ *(UINT32*)(TxtMemBase + 12) = (UINT32)SinitacmSize;
+ pBS->FreePool (pSinitacmPtr);
+ break;
+ }
+ }
+ pBS->FreePool (FvHandle);
+}
+#endif
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+//
+// Procedure: LtDefineTpmNvramSpace
+//
+// Description: This routine for define the TPM Nvram space.
+//
+// Input: None.
+//
+// Output: TURE - Success.
+// FALSE - Failed.
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+BOOLEAN
+LtDefineTpmNvramSpace (
+ VOID
+)
+{
+ EFI_STATUS Status;
+ EFI_TCG_PROTOCOL *tcg;
+ EFI_TPM_DEVICE_PROTOCOL *TpmDevice;
+ UINT32 CmdReadNvram[3] = { TPM_H2NL(0x50000002),
+ TPM_H2NL(0x00000000),
+ TPM_H2NL(0x40) };
+ TPM_DEF_NV_DATA CmdDefineNvram [] = { \
+ // TPM_NV_DATA_PUBLIC1 & TPM_NV_DATA_PUBLIC1.TPM_PCR_INFO_SHORT
+ TPM_H2NS(0x18), TPM_H2NL(0x50000003), TPM_H2NS(0x03), 0, 0, 0 , 0x1f, \
+ // TPM_NV_DATA_PUBLIC1.TPM_PCR_INFO_SHORT.TCPA_DIGEST
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
+ // TPM_NV_DATA_PUBLIC2.TPM_PCR_INFO_SHORT
+ TPM_H2NS(0x3), 0, 0, 0 , 0x18, \
+ // TPM_NV_DATA_PUBLIC2.TPM_PCR_INFO_SHORT.TCPA_DIGEST
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
+ // TPM_NV_DATA_PUBLIC2
+ TPM_H2NS(0x17), TPM_H2NL(0), 0, 0, 0, TPM_H2NL(0x40), \
+ // TCPA_DIGEST
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+
+ // locate the TPM Device Protocol for sending TPM command.
+ Status = pBS->LocateProtocol ( &gEfiTpmDeviceProtocolGuid, \
+ NULL, \
+ &TpmDevice );
+ if (EFI_ERROR(Status)) {
+ TRACE ((TRACE_ALWAYS, \
+ "TXT (TPM Error) : failed to locate TPM Device protocol.\n"));
+ return FALSE;
+ }
+ // locate the TCG Protocol for sending TPM command.
+ Status = pBS->LocateProtocol ( &gEfiTcgProtocolGuid, NULL, &tcg );
+ if (EFI_ERROR (Status)) {
+ TRACE ((TRACE_ALWAYS, \
+ "TXT (TPM Error) : failed to locate TCG protocol.\n"));
+ return FALSE;
+ }
+#if defined SINIT_ACM_SUPPORT && SINIT_ACM_SUPPORT == 1
+{
+ // BIOS-Based SINIT AC module support.
+ EFI_EVENT SinitEvent;
+
+ Status = CreateReadyToBootEvent(TPL_CALLBACK, \
+ EventUpdateSinitAcmToMemory, \
+ NULL, \
+ &SinitEvent );
+}
+#endif
+ TpmDevice->Init(TpmDevice);
+ // Send TPM command to read TPM NVRAM space.
+ Status = LtSendTpmCommand ( tcg, \
+ TPM_ORD_NV_READVALUE, \
+ sizeof(CmdReadNvram), \
+ CmdReadNvram );
+ // if TPM NVRAM isn't defined, Send TPM command to define TPM NVRAM space.
+ if (Status != 0) {
+ CmdReadNvram[0] = TPM_H2NL(0x50000003);
+ Status = LtSendTpmCommand ( tcg, \
+ TPM_ORD_NV_READVALUE, \
+ sizeof(CmdReadNvram), \
+ CmdReadNvram );
+ if (Status != 0) {
+ Status = LtSendTpmCommand ( tcg, \
+ TPM_ORD_NV_DEFINESPACE, \
+ sizeof(TPM_DEF_NV_DATA), \
+ &CmdDefineNvram );
+ }
+ }
+ Status = TpmDevice->Close(TpmDevice);
+
+ if ( Status ) return FALSE;
+ return TRUE;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+//
+// Procedure: TxtTpmNvRamDefine
+//
+// Description:
+//
+// Input: None
+//
+// Output: None
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+
+VOID TxtTpmNvRamDefine()
+{
+ UINTN VariableSize;
+ SETUP_DATA SetupData;
+ EFI_STATUS Status;
+
+ VariableSize = sizeof(SETUP_DATA);
+ Status = pRS->GetVariable ( L"Setup", \
+ &gSetupGuid, \
+ NULL, \
+ &VariableSize, \
+ &SetupData );
+ if (EFI_ERROR(Status))
+ return;
+
+ if (SetupData.TxtSupport != 0) {
+ if (SetupData.TpmSupport != 0) LtDefineTpmNvramSpace();
+ }
+}
+#else
+VOID TxtTpmNvRamDefine()
+{
+ return;
+}
+#endif
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+//
+// Procedure: GetTxtInfo
+//
+// Description: Get Txt information
+//
+// Input: None
+//
+// Output: None.
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+
+EFI_STATUS GetTxtInfo (
+ IN AMI_TXT_INFO_PROTOCOL *AMI_TXT_INFO_PROTOCOL,
+ OUT VOID **AmiTxtInfoData
+){
+ *AmiTxtInfoData = (VOID*)(&gAmiTxtInfoData);
+ return 0;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+//
+// Procedure: InitAmiTxtInfo
+//
+// Description: Initialize Txt information
+//
+// Input: None
+//
+// Output: None.
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID InitAmiTxtInfo()
+{
+ EFI_STATUS Status;
+ VOID *HobList;
+ TXT_INFO_HOB *TxtInfoHob;
+ UINT32 RegEax, RegEbx, RegEcx, RegEdx;
+ UINT32 *TxtErrCode = (UINT32*)(TXT_PUBLIC_BASE + 0x0030);
+ EFI_GUID gTxtInfoHobGuid = TXT_INFO_HOB_GUID;
+
+
+ HobList = GetEfiConfigurationTable(pST,&gHobListGuid);
+ if (!HobList) return;
+
+ //Find RC Txt Info Hob.
+ TxtInfoHob = (TXT_INFO_HOB*)HobList;
+ while (!EFI_ERROR(Status = FindNextHobByType(EFI_HOB_TYPE_GUID_EXTENSION, &TxtInfoHob))) {
+ if (guidcmp(&TxtInfoHob->EfiHobGuidType.Name, &gTxtInfoHobGuid) == 0) break;
+ }
+ if (EFI_ERROR(Status)) return;
+
+ //Initialize AmiTxtInfoProtocol
+ gAmiTxtInfoProtocol.ProtocolVer = AMI_TXT_INFO_PROTOCOL_VERSION;
+ gAmiTxtInfoProtocol.GetTxtInfo = GetTxtInfo;
+
+ //Initialize AMI TXT info data from HOB created by Intel Txt RC
+ gAmiTxtInfoData.ChipsetIsTxtCapable = TxtInfoHob->Data.ChipsetIsTxtCapable;
+ gAmiTxtInfoData.TxtDprMemoryBase = TxtInfoHob->Data.TxtDprMemoryBase;
+ gAmiTxtInfoData.BiosAcmBase = TxtInfoHob->Data.BiosAcmBase;
+ gAmiTxtInfoData.McuUpdateDataAddr = TxtInfoHob->Data.McuUpdateDataAddr;
+ gAmiTxtInfoData.SinitAcmBase = TxtInfoHob->Data.SinitAcmBase;
+
+ //Initializing ChipsetIsProduction default value
+ gAmiTxtInfoData.ChipsetIsProduction = (*(UINT32 *) (TXT_PUBLIC_BASE + 0x200) & BIT31) ? TRUE : FALSE;
+
+ //Check ACM is production or not
+ gAmiTxtInfoData.BiosAcmIsProduction = (((ACM_HEADER*)(gAmiTxtInfoData.BiosAcmBase))->ModuleID & BIT31) ? FALSE : TRUE;
+
+ //CPUID funciton 1 ECX[6], Secure Mode Extensions check
+ CPULib_CpuID(1, &RegEax, &RegEbx, &RegEcx, &RegEdx);
+ gAmiTxtInfoData.CpuIsTxtCapable = (RegEcx & BIT6) ? TRUE : FALSE;
+
+ //TXT.CRASH register, TXT_PUBLIC_BASE + 0x30
+ gAmiTxtInfoData.TxtErrCode = *TxtErrCode;
+
+ Status = pBS->InstallProtocolInterface(
+ &TheImageHandle,
+ &gAmiTxtInfoProtocolGuid,
+ EFI_NATIVE_INTERFACE,
+ &gAmiTxtInfoProtocol
+ );
+
+ if (EFI_ERROR(Status))
+ TRACE ((TRACE_ALWAYS, "AmiTXTDxe : Install Protocol error, Status = %x\n", Status));
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+//
+// Procedure: AmiTxtDxeEntry
+//
+// Description: DXE Entry Point for Intel TXT Driver.
+//
+// Input: EFI_HANDLE - ImageHandle
+// EFI_SYSTEM_TABLE* - SystemTable
+//
+// Output: None.
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS
+AmiTxtDxeEntry (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+)
+{
+#if TCG_SUPPORT || TCG2Support
+ EFI_STATUS Status;
+ UINTN DataSize;
+ SETUP_DATA SetupData;
+ UINT8 *TpmBaseAddr = (UINT8*)0xfed40000;
+ UINT32 Attributes = 0;
+#endif
+
+ InitAmiLib(ImageHandle, SystemTable);
+ InitAmiTxtInfo();
+
+#if TCG_SUPPORT || TCG2Support
+ DataSize = sizeof(SETUP_DATA);
+
+ Status = pRS->GetVariable(
+ L"Setup",
+ &gSetupGuid,
+ &Attributes,
+ &DataSize,
+ &SetupData
+ );
+
+ ASSERT_EFI_ERROR(Status);
+ if (EFI_ERROR(Status)) return EFI_SUCCESS;
+ //If TxtSupport on, but Tpm device is not present or TpmSupport off,
+ //then turn off TxtSupport.
+ if (SetupData.TxtSupport){
+ if ((*TpmBaseAddr == 0xff) || (!SetupData.TpmSupport)){
+ SetupData.TxtSupport = 0;
+
+ Status = pRS->SetVariable(
+ L"Setup",
+ &gSetupGuid,
+ Attributes,
+ sizeof(SETUP_DATA),
+ &SetupData
+ );
+
+ ASSERT_EFI_ERROR(Status);
+ }
+ }
+#endif
+
+ TxtTpmNvRamDefine();
+
+ return EFI_SUCCESS;
+}
+
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (C)Copyright 1987-2013, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//*************************************************************************
+//*************************************************************************
diff --git a/Board/CPU/TxtDxe/AmiTxtDxe.cif b/Board/CPU/TxtDxe/AmiTxtDxe.cif
new file mode 100644
index 0000000..6b9d1ea
--- /dev/null
+++ b/Board/CPU/TxtDxe/AmiTxtDxe.cif
@@ -0,0 +1,21 @@
+<component>
+ name = "AMI TXT Dxe"
+ category = ModulePart
+ LocalRoot = "Board\Cpu\TxtDxe"
+ RefName = "AmiTxtDxe"
+[files]
+"AmiTxtDxe.sdl"
+"AmiTxtDxe.mak"
+"AmiTxtDxe.c"
+"AmiTxtDxe.dxs"
+"TxtTcgService.h"
+"TxtSetup.c"
+"Include\Protocol\AmiTxtInfo.h"
+"AmiTxtDxe.h"
+"AmiTxtInfoSetup.c"
+"AmiTxtInfoSetup.sd"
+"AmiTxtInfoSetup.uni"
+"AmiTxtInfoHook.c"
+[parts]
+"TxtSinitAcm"
+<endComponent>
diff --git a/Board/CPU/TxtDxe/AmiTxtDxe.dxs b/Board/CPU/TxtDxe/AmiTxtDxe.dxs
new file mode 100644
index 0000000..4b2c032
--- /dev/null
+++ b/Board/CPU/TxtDxe/AmiTxtDxe.dxs
@@ -0,0 +1,48 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (C)Copyright 1987-2013, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//*************************************************************************
+//*************************************************************************
+
+//**********************************************************************
+// $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/Haswell/AMI Cpu PKG/AMI TXT DXE/AmiTxtDxe.dxs 1 9/05/12 1:33a Davidhsieh $
+//
+// $Revision: 1 $
+//
+// $Date: 9/05/12 1:33a $
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/Haswell/AMI Cpu PKG/AMI TXT DXE/AmiTxtDxe.dxs $
+//
+// 1 9/05/12 1:33a Davidhsieh
+//
+//
+//
+//**********************************************************************
+#include <Protocol/SmmSwDispatch.h>
+
+DEPENDENCY_START
+ EFI_SMM_SW_DISPATCH_PROTOCOL_GUID
+DEPENDENCY_END
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (C)Copyright 1987-2013, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//*************************************************************************
+//*************************************************************************
diff --git a/Board/CPU/TxtDxe/AmiTxtDxe.h b/Board/CPU/TxtDxe/AmiTxtDxe.h
new file mode 100644
index 0000000..b92ad14
--- /dev/null
+++ b/Board/CPU/TxtDxe/AmiTxtDxe.h
@@ -0,0 +1,112 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (C)Copyright 1987-2013, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//*************************************************************************
+//*************************************************************************
+
+//**********************************************************************
+// $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/Haswell/AMI Cpu PKG/AMI TXT DXE/AmiTxtDxe.h 1 1/17/14 3:45a Crystallee $
+//
+// $Revision: 1 $
+//
+// $Date: 1/17/14 3:45a $
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/Haswell/AMI Cpu PKG/AMI TXT DXE/AmiTxtDxe.h $
+//
+// 1 1/17/14 3:45a Crystallee
+// [TAG] None
+// [Category] Improvement
+// [Description] Show Txt information in setup->Advanced ->Intel Txt
+// Information page.
+//
+
+//**********************************************************************
+
+//<AMI_FHDR_START>
+//---------------------------------------------------------------------------
+//
+// Name: AmiTxtDxe.h
+//
+// Description: AmiTxt Dxe header file.
+//
+//---------------------------------------------------------------------------
+//<AMI_FHDR_END>
+
+#ifndef __AMI_TXT_DXE_H__
+#define __AMI_TXT_DXE_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <token.h>
+#include <AmiDxeLib.h>
+#include "TxtTcgService.h"
+#include <Setup.h>
+#include <hob.h>
+#include <Guid/TxtInfoHob/TxtInfoHob.h>
+#include "Include/Protocol/AmiTxtInfo.h"
+//#include <Protocol/CpuPlatformPolicy.h>
+
+VOID CPULib_CpuID(UINT32 CpuIDIndex, UINT32 * RegEAX, UINT32 * RegEBX,
+ UINT32 * RegECX, UINT32 * RegEDX);
+
+typedef struct _ACM_HEADER {
+ UINT32 ModuleType; ///< Module type
+ UINT32 HeaderLen; ///< 4 4 Header length (in multiples of four bytes)
+ /// (161 for version 0.0)
+ ///
+ UINT32 HeaderVersion; ///< 8 4 Module format version
+ UINT32 ModuleID; ///< 12 4 Module release identifier
+ UINT32 ModuleVendor; ///< 16 4 Module vendor identifier
+ UINT32 Date; ///< 20 4 Creation date (BCD format:
+ /// year.month.day)
+ ///
+ UINT32 Size; ///< 24 4 Module size (in multiples of four bytes)
+ UINT32 Reserved1; ///< 28 4 Reserved for future extensions
+ UINT32 CodeControl; ///< 32 4 Authenticated code control flags
+ UINT32 ErrorEntryPoint; ///< 36 4 Error response entry point offset (bytes)
+ UINT32 GDTLimit; ///< 40 4 GDT limit (defines last byte of GDT)
+ UINT32 GDTBasePtr; ///< 44 4 GDT base pointer offset (bytes)
+ UINT32 SegSel; ///< 48 4 Segment selector initializer
+ UINT32 EntryPoint; ///< 52 4 Authenticated code entry point offset (bytes)
+ UINT32 Reserved2; ///< 56 64 Reserved for future extensions
+ UINT32 KeySize; ///< 120 4 Module public key size less the exponent
+ /// (in multiples of four bytes
+ /// - 64 for version 0.0)
+ ///
+ UINT32 ScratchSize; ///< 124 4 Scratch field size (in multiples of four bytes)
+ /// (2 * KeySize + 15 for version 0.0)
+ ///
+ UINT8 RSAPubKey[65 * 4]; ///< 128 KeySize * 4 + 4 Module public key
+ UINT8 RSASig[256]; ///< 388 256 PKCS #1.5 RSA Signature.
+} ACM_HEADER;
+/****** DO NOT WRITE BELOW THIS LINE *******/
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (C)Copyright 1987-2013, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//*************************************************************************
+//*************************************************************************
diff --git a/Board/CPU/TxtDxe/AmiTxtDxe.mak b/Board/CPU/TxtDxe/AmiTxtDxe.mak
new file mode 100644
index 0000000..f29aae9
--- /dev/null
+++ b/Board/CPU/TxtDxe/AmiTxtDxe.mak
@@ -0,0 +1,132 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1987-2013, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
+#*************************************************************************
+# $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/Haswell/AMI Cpu PKG/AMI TXT DXE/AmiTxtDxe.mak 5 1/17/14 4:08a Crystallee $
+#
+# $Revision: 5 $
+#
+# $Date: 1/17/14 4:08a $
+#**********************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/Haswell/AMI Cpu PKG/AMI TXT DXE/AmiTxtDxe.mak $
+#
+# 5 1/17/14 4:08a Crystallee
+# [TAG] None
+# [Category] Improvement
+# [Description] Show Txt information in setup->Advanced ->Intel Txt
+# Information page.
+#
+# 4 10/14/12 11:49p Davidhsieh
+# [TAG] None
+# [Category] Improvement
+# [Description] Use SBLib_ExtResetSystem when pRS->ResetSystem does not
+# support GlobaRest type in the project
+#
+# 3 9/05/12 1:36a Davidhsieh
+# [TAG] EIP97350
+# [Category] Improvement
+# [Description] Add AUX index define in TPM NVRAM to avoid system keep
+# reset when TXT enabled
+#
+# 2 8/14/12 5:06a Davidhsieh
+# [TAG] EIP97190
+# [Category] Improvement
+# [Description] Changes in TXT Configuration require a Powercycle reset
+#
+# 1 7/18/12 2:07a Davidhsieh
+# [TAG] None
+# [Category] Improvement
+# [Description] AMI TXT Dxe module part create
+#
+#
+#**********************************************************************
+
+#**********************************************************************
+#<AMI_FHDR_START>
+#
+# Name: AmiTxtDxe.mak
+#
+# Description: Makefile for TxtWrapper.
+#
+#<AMI_FHDR_END>
+#**********************************************************************
+
+all : AmiTxtDxe
+
+AmiTxtDxe: $(BUILD_DIR)\AmiTxtDxe.mak AmiTxtDxeBin
+
+$(BUILD_DIR)\AmiTxtDxe.mak : $(AmiTxtDxe_DIR)\$(@B).cif $(AmiTxtDxe_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(AmiTxtDxe_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+CPU_TXTDXE_INCLUDE = \
+ $(PROJECT_CPU_INCLUDES)
+
+AmiTxtDxeBin : $(AMIDXELIB) $(AMICSPLib)
+ $(MAKE) /$(MAKEFLAGS) $(BUILD_DEFAULTS)\
+ /f $(BUILD_DIR)\AmiTxtDxe.mak all\
+ MAKEFILE=$(BUILD_DIR)\AmiTxtDxe.mak \
+ "MY_INCLUDES=$(CPU_TXTDXE_INCLUDE)" \
+ OBJECTS=$(BUILD_DIR)\$(AmiTxtDxe_DIR)\AmiTxtDxe.obj\
+ GUID=87D402CD-8B07-4B93-B38B-F8799F28B033 \
+ ENTRY_POINT=AmiTxtDxeEntry\
+ TYPE=BS_DRIVER \
+ DEPEX1=$(AmiTxtDxe_DIR)\AmiTxtDxe.dxs\
+ DEPEX1_TYPE=EFI_SECTION_DXE_DEPEX\
+ COMPRESS=1
+
+#---------------------------------------------------------------------------
+# TSE Elink component
+#---------------------------------------------------------------------------
+TXTTSE_CFLAGS = \
+$(CFLAGS) \
+-I $(TSEBIN_DIR)\Inc \
+-I $(TSEBIN_DIR)\ \
+/D _TSE_HOOK_
+
+AMITSEBin : $(BUILD_DIR)\TXTTseHook.obj $(BUILD_DIR)\AmiTxtInfoHook.obj
+
+$(BUILD_DIR)\TXTTseHook.obj : $(AmiTxtDxe_DIR)\TXTSetup.c
+ $(CC) $(TXTTSE_CFLAGS) /Fo$(BUILD_DIR)\TXTTseHook.obj $(AmiTxtDxe_DIR)\TXTSetup.c
+
+$(BUILD_DIR)\AmiTxtInfoHook.obj : $(AmiTxtDxe_DIR)\AmiTxtInfoHook.c
+ $(CC) $(TXTTSE_CFLAGS) /Fo$(BUILD_DIR)\AmiTxtInfoHook.obj $(AmiTxtDxe_DIR)\AmiTxtInfoHook.c
+
+#---------------------------------------------------------------------------
+# TSE Elink component
+#---------------------------------------------------------------------------
+SetupSdbs : $(BUILD_DIR)\AmiTxtDxe.mak AmiTxtInfoSetupSDB
+SetupBin : $(BUILD_DIR)\AmiTxtInfoSetup.obj
+
+AmiTxtInfoSetupSDB :
+ $(MAKE) /$(MAKEFLAGS) $(BUILD_DEFAULTS)\
+ /f $(BUILD_DIR)\AmiTxtDxe.mak all\
+ TYPE=SDB NAME=AmiTxtInfoSetup MAKEFILE=$(BUILD_DIR)\AmiTxtDxe.mak "STRING_CONSUMERS=$(AmiTxtDxe_DIR)\AmiTxtInfoSetup.sd $(AmiTxtDxe_DIR)\AmiTxtInfoSetup.c"
+
+$(BUILD_DIR)\AmiTxtInfoSetup.obj: $(PROJECT_DIR)\$(AmiTxtDxe_DIR)\AmiTxtInfoSetup.c $(BUILD_DIR)\SetupStrTokens.h
+ $(CC) $(CFLAGS) /Fo$@ $(PROJECT_DIR)\$(AmiTxtDxe_DIR)\AmiTxtInfoSetup.c
+
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1987-2013, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/Board/CPU/TxtDxe/AmiTxtDxe.sdl b/Board/CPU/TxtDxe/AmiTxtDxe.sdl
new file mode 100644
index 0000000..d3cbb3a
--- /dev/null
+++ b/Board/CPU/TxtDxe/AmiTxtDxe.sdl
@@ -0,0 +1,133 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1987-2013, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
+
+#**********************************************************************
+# $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/Haswell/AMI Cpu PKG/AMI TXT DXE/AmiTxtDxe.sdl 3 1/17/14 4:08a Crystallee $
+#
+# $Revision: 3 $
+#
+# $Date: 1/17/14 4:08a $
+#**********************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/Haswell/AMI Cpu PKG/AMI TXT DXE/AmiTxtDxe.sdl $
+#
+# 3 1/17/14 4:08a Crystallee
+# [TAG] None
+# [Category] Improvement
+# [Description] Show Txt information in setup->Advanced ->Intel Txt
+# Information page.
+#
+# 2 8/14/12 5:06a Davidhsieh
+# [TAG] EIP97190
+# [Category] Improvement
+# [Description] Changes in TXT Configuration require a Powercycle reset
+#
+# 1 7/18/12 2:07a Davidhsieh
+# [TAG] None
+# [Category] Improvement
+# [Description] AMI TXT Dxe module part create
+#
+#
+#**********************************************************************
+TOKEN
+ Name = "AMI_TXT_DXE_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable AMI TXT DXE support in Project"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+End
+
+TOKEN
+ Name = "AMI_TXT_INFO_IN_SETUP"
+ Value = "1"
+ TokenType = Boolean
+End
+
+TOKEN
+ Name = "AMI_POSE_SHOW_TXT_INFO"
+ Value = "0"
+ Help = "Show txt information in pose time when quiet boot disable."
+ TokenType = Integer
+ TargetH = Yes
+ Token = "AMI_TXT_INFO_IN_SETUP" "=" "1"
+End
+
+PATH
+ Name = "AmiTxtDxe_DIR"
+End
+
+MODULE
+ Help = "Includes TxtDxe.mak to Project"
+ File = "AmiTxtDxe.mak"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\AmiTxtDxe.ffs"
+ Parent = "FV_MAIN"
+ Help = "Intel Txt DXE component"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "TxtExitSetupEvent,"
+ Parent = "PreSystemResetHook,"
+ InvokeOrder = BeforeParent
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\AmiTxtInfoSetup.sdb"
+ Parent = "SETUP_SDBS"
+ Priority = 50
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "$(AmiTxtDxe_DIR)\AmiTxtInfoSetup.sd"
+ Parent = "SETUP_DEFINITIONS"
+ Priority = 50
+ InvokeOrder = AfterParent
+ Token = "AMI_TXT_INFO_IN_SETUP" "=" "1"
+End
+
+ELINK
+ Name = "InitAmiTxtInfoStrings,"
+ Parent = "SetupStringInit"
+ InvokeOrder = AfterParent
+ Token = "AMI_TXT_INFO_IN_SETUP" "=" "1"
+End
+
+ELINK
+ Name = "AmiTxtHook,"
+ Parent = "ProcessConInAvailabilityHook,"
+ InvokeOrder = AfterParent
+ Token = "AMI_TXT_INFO_IN_SETUP" "=" "1"
+ Token = "AMI_POSE_SHOW_TXT_INFO" "=" "1"
+End
+
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1987-2013, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/Board/CPU/TxtDxe/AmiTxtInfoHook.c b/Board/CPU/TxtDxe/AmiTxtInfoHook.c
new file mode 100644
index 0000000..a7fb7bc
--- /dev/null
+++ b/Board/CPU/TxtDxe/AmiTxtInfoHook.c
@@ -0,0 +1,167 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (C)Copyright 1987-2013, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//*************************************************************************
+//*************************************************************************
+
+//**********************************************************************
+// $Header: /Alaska/Projects/Intel/Haswell/LynxPoint_SharkBay-DT_Crb_1AQQW/Board/Cpu/TxtDxe/AmiTxtInfoHook.c 1 7/08/15 4:26a Chienhsieh $
+//
+// $Revision: 1 $
+//
+// $Date: 7/08/15 4:26a $
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log:
+//
+//**********************************************************************
+
+//<AMI_FHDR_START>
+//---------------------------------------------------------------------------
+//
+// Name: AmiTxtInfoHook.c
+//
+// Description: AmiTxtInfo Rountines
+//
+//---------------------------------------------------------------------------
+//<AMI_FHDR_END>
+
+#include <Setup.h>
+#include <AmiDxeLib.h>
+#include <AmiHobs.h>
+#include <Protocol/SimpleTextIn.h>
+#include <Protocol/AMIPostMgr.h>
+#include "Include/Protocol/AmiTxtInfo.h"
+
+extern EFI_BOOT_SERVICES *gBS;
+extern EFI_SYSTEM_TABLE *gST;
+extern EFI_RUNTIME_SERVICES *gRT;
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: AmiTxtHook
+//
+// Description: Initialize CPU strings.
+//
+// Input:
+// IN EFI_HII_HANDLE HiiHandle
+// IN UINT16 Class
+//
+// Output:
+// VOID
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+
+BOOLEAN AmiTxtHook (VOID)
+{
+ EFI_STATUS Status;
+ EFI_GUID AmiTseSetupguid = AMITSESETUP_GUID;
+ EFI_GUID gAmiTxtInfoProtocolGuid = AMI_TXT_INFO_PROTOCOL_GUID;
+ EFI_GUID gAmiPostManagerProtocolGuid = AMI_POST_MANAGER_PROTOCOL_GUID;
+ AMI_POST_MANAGER_PROTOCOL *gAmiPostMgr = NULL;
+ AMI_TXT_INFO_PROTOCOL *gAmiTxtInfoProt;
+ AMI_TXT_INFO_DATA *AmiTxtInfoData = NULL;
+ UINTN Index;
+ EFI_INPUT_KEY Key;
+ AMITSESETUP TSEVar;
+ UINTN Size;
+ CHAR16 Str[30];
+
+ Size = sizeof (AMITSESETUP);
+
+ Status = gRT->GetVariable(L"AMITSESetup", \
+ &AmiTseSetupguid, \
+ NULL, \
+ &Size, \
+ &TSEVar );
+ if (EFI_ERROR(Status)) return EFI_SUCCESS;
+
+ Status = pBS->LocateProtocol( &gAmiPostManagerProtocolGuid, NULL, &gAmiPostMgr );
+ if (EFI_ERROR(Status)) return EFI_SUCCESS;
+
+ Status = pBS->LocateProtocol (&gAmiTxtInfoProtocolGuid, NULL, &gAmiTxtInfoProt);
+ if (EFI_ERROR(Status)) return EFI_SUCCESS;
+
+ //Get AmiTxt info data
+ gAmiTxtInfoProt->GetTxtInfo(gAmiTxtInfoProt, &AmiTxtInfoData);
+
+ //Only display txtinfor when error occur
+ if (!AmiTxtInfoData->TxtErrCode) return EFI_SUCCESS;
+
+ //If it's silent boot, change to post screen
+ if(TSEVar.AMISilentBoot != 0) gAmiPostMgr->SwitchToPostScreen();
+
+ gAmiPostMgr->DisplayPostMessage(L"Intel Txt Information:");
+
+ if (AmiTxtInfoData->ChipsetIsProduction)
+ gAmiPostMgr->DisplayPostMessage(L"Chipset Production Fused");
+ else
+ gAmiPostMgr->DisplayPostMessage(L"Chipset Debug Fused");
+
+ if (AmiTxtInfoData->ChipsetIsTxtCapable)
+ gAmiPostMgr->DisplayPostMessage(L"Chipset Txt Supported");
+ else
+ gAmiPostMgr->DisplayPostMessage(L"Chipset Txt Don't Support");
+
+ if (AmiTxtInfoData->CpuIsTxtCapable) //CPUID eax=1 ecx[6]
+ gAmiPostMgr->DisplayPostMessage(L"Cpu Txt Supported");
+ else
+ gAmiPostMgr->DisplayPostMessage(L"Cpu Txt don't Support");
+
+ if (AmiTxtInfoData->TxtErrCode) {
+ UINT32 ClassCode = (AmiTxtInfoData->TxtErrCode >> 4) & 0x3f; //ErrorCode[9:4]
+ UINT32 MajorCode = (AmiTxtInfoData->TxtErrCode >> 10) & 0x1f; //ErrorCode[14:10]
+ UINT32 MinorCode = (AmiTxtInfoData->TxtErrCode >> 16) & 0x1ff; //ErrorCode[24:16]
+
+ Swprintf(Str,L"Error Code %x", AmiTxtInfoData->TxtErrCode);
+ gAmiPostMgr->DisplayPostMessage(Str);
+
+ Swprintf(Str,L" Class Code %x", ClassCode);
+ gAmiPostMgr->DisplayPostMessage(Str);
+
+ Swprintf(Str,L" Major Code %x", MajorCode);
+ gAmiPostMgr->DisplayPostMessage(Str);
+
+ Swprintf(Str,L" Minor Code %x", MinorCode);
+ gAmiPostMgr->DisplayPostMessage(Str);
+ } else {
+ gAmiPostMgr->DisplayPostMessage(L"Error Code None");
+ gAmiPostMgr->DisplayPostMessage(L" Class Code None");
+ gAmiPostMgr->DisplayPostMessage(L" Major Code None");
+ gAmiPostMgr->DisplayPostMessage(L" Minor Code None");
+ }
+
+ gAmiPostMgr->DisplayPostMessage(L"Press anykey to continue");
+
+ while(1){
+ gBS->WaitForEvent(1, &(gST->ConIn->WaitForKey), &Index);
+ gST->ConIn->ReadKeyStroke(gST->ConIn, &Key);
+ if((Key.UnicodeChar != 0) || (Key.ScanCode != 0)) break;
+ }
+
+ return EFI_SUCCESS;
+}
+
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (C)Copyright 1987-2013, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//*************************************************************************
+//*************************************************************************
diff --git a/Board/CPU/TxtDxe/AmiTxtInfoSetup.c b/Board/CPU/TxtDxe/AmiTxtInfoSetup.c
new file mode 100644
index 0000000..302db9d
--- /dev/null
+++ b/Board/CPU/TxtDxe/AmiTxtInfoSetup.c
@@ -0,0 +1,176 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (C)Copyright 1987-2013, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//*************************************************************************
+//*************************************************************************
+
+//**********************************************************************
+// $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/Haswell/AMI Cpu PKG/AMI TXT DXE/AmiTxtInfoSetup.c 2 1/17/14 4:00a Crystallee $
+//
+// $Revision: 2 $
+//
+// $Date: 1/17/14 4:00a $
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/Haswell/AMI Cpu PKG/AMI TXT DXE/AmiTxtInfoSetup.c $
+//
+// 2 1/17/14 4:00a Crystallee
+//
+//**********************************************************************
+
+//<AMI_FHDR_START>
+//---------------------------------------------------------------------------
+//
+// Name: HaswellSetup.c
+//
+// Description: CPU Setup Rountines
+//
+//---------------------------------------------------------------------------
+//<AMI_FHDR_END>
+
+#include <Setup.h>
+#include <AmiDxeLib.h>
+#include <AmiHobs.h>
+#include "Include/Protocol/AmiTxtInfo.h"
+#include <SetupStrTokens.h>
+
+AMI_TXT_INFO_PROTOCOL *gAmiTxtInfoProt;
+
+
+#pragma pack(push, 1)
+
+typedef struct {
+ STRING_REF ChipsetFuse;
+ STRING_REF ChipsetTxtsupport;
+ STRING_REF CpuTxtsupport;
+ STRING_REF ErrorCode;
+ STRING_REF ClassCode;
+ STRING_REF MajorCode;
+ STRING_REF MinorCode;
+} SKT_STR_TOK;
+
+static SKT_STR_TOK gSktStrTok[] = {
+{ STRING_TOKEN(STR_CPUTXT_CHIP_FUSE_VALUE),
+ STRING_TOKEN(STR_CPUTXT_CHIP_SUPPORT_VALUE),
+ STRING_TOKEN(STR_CPUTXT_CPU_SUPPORT_VALUE),
+ STRING_TOKEN(STR_CPUTXT_ERROR_CODE_VALUE),
+ STRING_TOKEN(STR_CPUTXT_CLASS_CODE_VALUE),
+ STRING_TOKEN(STR_CPUTXT_MAJOR_CODE_VALUE),
+ STRING_TOKEN(STR_CPUTXT_MINOR_CODE_VALUE)
+}};
+
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: InitAmiTxtInfoStrings
+//
+// Description: Initialize CPU strings.
+//
+// Input:
+// IN EFI_HII_HANDLE HiiHandle
+// IN UINT16 Class
+//
+// Output:
+// VOID
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+
+VOID InitAmiTxtInfoStrings(EFI_HII_HANDLE HiiHandle, UINT16 Class)
+{
+ EFI_STATUS Status;
+ AMI_TXT_INFO_DATA *AmiTxtInfoData = NULL;
+ EFI_GUID gAmiTxtInfoProtocolGuid = AMI_TXT_INFO_PROTOCOL_GUID;
+
+ if (Class != ADVANCED_FORM_SET_CLASS) return;
+
+ Status = pBS->LocateProtocol (&gAmiTxtInfoProtocolGuid, NULL, &gAmiTxtInfoProt);
+ if (EFI_ERROR(Status)) return;
+
+ //Stop if protocl version incorrect
+ if (gAmiTxtInfoProt->ProtocolVer != AMI_TXT_INFO_PROTOCOL_VERSION) return;
+
+ //Get AmiTxt info data
+ gAmiTxtInfoProt->GetTxtInfo(gAmiTxtInfoProt, &AmiTxtInfoData);
+
+ //Update setup string
+ if (AmiTxtInfoData->ChipsetIsProduction) {
+ InitString(
+ HiiHandle,
+ gSktStrTok[0].ChipsetFuse,
+ L"%a",
+ "Production Fused"
+ );
+ }
+
+ if (AmiTxtInfoData->ChipsetIsTxtCapable) {
+ InitString(
+ HiiHandle,
+ gSktStrTok[0].ChipsetTxtsupport,
+ L"%a",
+ "Supported"
+ );
+ }
+
+ if (AmiTxtInfoData->CpuIsTxtCapable) {
+ InitString(
+ HiiHandle,
+ gSktStrTok[0].CpuTxtsupport,
+ L"%a",
+ "Supported"
+ );
+ }
+
+ if (AmiTxtInfoData->TxtErrCode) {
+ InitString(
+ HiiHandle,
+ gSktStrTok[0].ErrorCode,
+ L"%x",
+ AmiTxtInfoData->TxtErrCode
+ );
+
+ InitString(
+ HiiHandle,
+ gSktStrTok[0].ClassCode,
+ L"%x",
+ (AmiTxtInfoData->TxtErrCode >> 4) & 0x3f //ErrorCode[9:4]
+ );
+
+ InitString(
+ HiiHandle,
+ gSktStrTok[0].MajorCode,
+ L"%x",
+ (AmiTxtInfoData->TxtErrCode >> 10) & 0x1f //ErrorCode[14:10]
+ );
+
+ InitString(
+ HiiHandle,
+ gSktStrTok[0].MinorCode,
+ L"%x",
+ (AmiTxtInfoData->TxtErrCode >> 16) & 0x1ff //ErrorCode[24:16]
+ );
+ }
+}
+
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (C)Copyright 1987-2013, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//*************************************************************************
+//*************************************************************************
diff --git a/Board/CPU/TxtDxe/AmiTxtInfoSetup.sd b/Board/CPU/TxtDxe/AmiTxtInfoSetup.sd
new file mode 100644
index 0000000..b42126e
--- /dev/null
+++ b/Board/CPU/TxtDxe/AmiTxtInfoSetup.sd
@@ -0,0 +1,149 @@
+//**********************************************************************
+//**********************************************************************
+//** **
+//** (C)Copyright 1987-2013, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//**********************************************************************
+//**********************************************************************
+
+//**********************************************************************
+// $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/Haswell/AMI Cpu PKG/AMI TXT DXE/AmiTxtInfoSetup.sd 2 1/17/14 4:02a Crystallee $
+//
+// $Revision: 2 $
+//
+// $Date: 1/17/14 4:02a $
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log:
+//
+//
+//**********************************************************************
+
+//<AMI_FHDR_START>
+//---------------------------------------------------------------------------
+// Name: AmiTxtInfoSetup.sd.sd
+//
+// Description: Setup definition for Intel Txt Info.
+//
+//---------------------------------------------------------------------------
+//<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 XDBit;
+#endif
+
+//---------------------------------------------------------------------------
+#if defined(VFRCOMPILE) && !defined(CONTROLS_ARE_DEFINED)
+#define CONTROL_DEFINITION
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#ifdef CONTROL_DEFINITION
+
+#endif //#ifdef CONTROL_DEFINITION
+
+#ifdef CONTROLS_WITH_DEFAULTS
+
+#endif //#ifdef CONTROLS_WITH_DEFAULTS
+
+#ifdef ADVANCED_FORM_SET
+
+ #ifndef SUPPRESS_GRAYOUT_ENDIF
+ #define SUPPRESS_GRAYOUT_ENDIF endif;
+ #endif
+
+ #ifdef FORM_SET_TYPEDEF
+
+ #endif
+
+ #ifdef FORM_SET_VARSTORE
+
+ #endif
+
+ #ifdef FORM_SET_ITEM
+ // Define controls to be added to the main page of the formset
+ #endif
+
+ #ifdef FORM_SET_GOTO
+ // Define goto commands for the forms defined in this file
+ goto CPUTXT_FORM_ID,
+ prompt = STRING_TOKEN(STR_CPUTXT_FORM),
+ help = STRING_TOKEN(STR_CPUTXT_HELP);
+ #endif
+
+ #ifdef FORM_SET_FORM
+
+
+ // Define forms
+ form formid = AUTO_ID(CPUTXT_FORM_ID),
+ title = STRING_TOKEN(STR_CPUTXT_FORM);
+
+ SUBTITLE(STRING_TOKEN(STR_CPUTXT_FORM))
+ SEPARATOR
+
+ text
+ help = STRING_TOKEN(STR_CPUTXT_CHIP_FUSE_HELP),
+ text = STRING_TOKEN(STR_CPUTXT_CHIP_FUSE_STRING),
+ text = STRING_TOKEN(STR_CPUTXT_CHIP_FUSE_VALUE);
+
+ text
+ help = STRING_TOKEN(STR_CPUTXT_CHIP_SUPPORT_HELP),
+ text = STRING_TOKEN(STR_CPUTXT_CHIP_SUPPORT_STRING),
+ text = STRING_TOKEN(STR_CPUTXT_CHIP_SUPPORT_VALUE);
+
+ text
+ help = STRING_TOKEN(STR_CPUTXT_CPU_SUPPORT_HELP),
+ text = STRING_TOKEN(STR_CPUTXT_CPU_SUPPORT_STRING),
+ text = STRING_TOKEN(STR_CPUTXT_CPU_SUPPORT_VALUE);
+
+ text
+ help = STRING_TOKEN(STR_CPUTXT_ERROR_CODE_HELP),
+ text = STRING_TOKEN(STR_CPUTXT_ERROR_CODE_STRING),
+ text = STRING_TOKEN(STR_CPUTXT_ERROR_CODE_VALUE);
+
+ text
+ help = STRING_TOKEN(STR_CPUTXT_CLASS_CODE_HELP),
+ text = STRING_TOKEN(STR_CPUTXT_CLASS_CODE_STRING),
+ text = STRING_TOKEN(STR_CPUTXT_CLASS_CODE_VALUE);
+
+ text
+ help = STRING_TOKEN(STR_CPUTXT_MAJOR_CODE_HELP),
+ text = STRING_TOKEN(STR_CPUTXT_MAJOR_CODE_STRING),
+ text = STRING_TOKEN(STR_CPUTXT_MAJOR_CODE_VALUE);
+
+ text
+ help = STRING_TOKEN(STR_CPUTXT_MINOR_CODE_HELP),
+ text = STRING_TOKEN(STR_CPUTXT_MINOR_CODE_STRING),
+ text = STRING_TOKEN(STR_CPUTXT_MINOR_CODE_VALUE);
+
+ endform;
+ #endif
+#endif
+
+//**********************************************************************
+//**********************************************************************
+//** **
+//** (C)Copyright 1987-2013, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//**********************************************************************
+//**********************************************************************
diff --git a/Board/CPU/TxtDxe/AmiTxtInfoSetup.uni b/Board/CPU/TxtDxe/AmiTxtInfoSetup.uni
new file mode 100644
index 0000000..98de491
--- /dev/null
+++ b/Board/CPU/TxtDxe/AmiTxtInfoSetup.uni
Binary files differ
diff --git a/Board/CPU/TxtDxe/Include/Protocol/AmiTxtInfo.h b/Board/CPU/TxtDxe/Include/Protocol/AmiTxtInfo.h
new file mode 100644
index 0000000..b9986de
--- /dev/null
+++ b/Board/CPU/TxtDxe/Include/Protocol/AmiTxtInfo.h
@@ -0,0 +1,117 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (C)Copyright 1987-2013, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//*************************************************************************
+//*************************************************************************
+
+//**********************************************************************
+// $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/Haswell/AMI Cpu PKG/AMI TXT DXE/Include/Protocol/AmiTxtInfo.h 2 4/10/15 3:11a Crystallee $
+//
+// $Revision: 2 $
+//
+// $Date: 4/10/15 3:11a $
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/Haswell/AMI Cpu PKG/AMI TXT DXE/Include/Protocol/AmiTxtInfo.h $
+//
+// 2 4/10/15 3:11a Crystallee
+//
+// 1 1/17/14 3:47a Crystallee
+// [TAG] None
+// [Category] Improvement
+// [Description] Show Txt information in setup->Advanced ->Intel Txt
+// Information page.
+//
+
+//**********************************************************************
+
+//<AMI_FHDR_START>
+//---------------------------------------------------------------------------
+//
+// Name: AmiTxtInfo.h
+//
+// Description:
+//
+//---------------------------------------------------------------------------
+//<AMI_FHDR_END>
+
+#ifndef __AMI_TXT_INFO_H__
+#define __AMI_TXT_INFO_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define AMI_TXT_INFO_PROTOCOL_GUID \
+ {0x1c92f0ab, 0x3351, 0x1be5, 0xaf, 0xba, 0xc1, 0x25, 0x61, 0xbb, 0x32, 0xa3}
+
+#define AMI_TXT_INFO_PROTOCOL_VERSION 1
+
+
+typedef struct {
+ BOOLEAN ChipsetIsTxtCapable; ///< Value is set to 1 if chipset is Intel TXT capable.
+ UINT64 SinitMemorySize; ///< Size of memory reserved for placement of SINIT module. This memory is used by MLE.
+ UINT64 TxtHeapMemorySize; ///< Size of memory reserved for TXT Heap. This memory is used by MLE.
+ EFI_PHYSICAL_ADDRESS TxtDprMemoryBase; ///< Base address of DPR protected memory reserved for Intel TXT component.
+ UINT64 TxtDprMemorySize; ///< Size of DPR protected memory reserved for TXT component
+ EFI_PHYSICAL_ADDRESS BiosAcmBase; ///< Base address of BIOS ACM in system firmware. Intel TXT reference code would skip searching the BIOS ACM in PEI firmware volume if the field is not zero.
+ EFI_PHYSICAL_ADDRESS McuUpdateDataAddr; ///< Base address of CPU micro code patch loaded into BSP. Intel TXT reference code would skip searching the micro code path in PEI firmware volume if the field is not zero.
+ EFI_PHYSICAL_ADDRESS SinitAcmBase; ///< Base address of SINIT module if installed in system firmware. Zero otherwise.
+ UINT64 TgaSize; ///< Size of Trusted Graphics Aperture if supported by chipset.
+ EFI_PHYSICAL_ADDRESS TxtLcpPdBase; ///< Base address of Platform Default Launch Control Policy data if installed in system firmware. Zero otherwise.
+ UINT64 TxtLcpPdSize; ///< Size of Platform Default Launch Control Policy data if installed in system firmware. Zero otherwise.
+ /**
+ Flags passed from BIOS to OS or MRC
+ - BIT0: FLAGS0 for compatible definition
+ - BIT1: TXT_CPU_RESET_REQUIRED for MRC to issue reset if required
+ - BIT2: TPM_INIT_FAILED for indicate TPM initiate status. If the bit set, ResetEstablishmentBit is skipped in Dxe driver.
+ **/
+ UINT64 Flags;
+ //
+ BOOLEAN ChipsetIsProduction; ///<TRUE Production Fuse, FALSE Debug Fuse>
+ BOOLEAN BiosAcmIsProduction; ///<TRUE Production Fuse, FALSE Debug Fuse>
+ BOOLEAN CpuIsTxtCapable;
+ UINT32 TxtErrCode;
+} AMI_TXT_INFO_DATA;
+
+typedef struct _AMI_TXT_INFO_PROTOCOL AMI_TXT_INFO_PROTOCOL;
+
+typedef EFI_STATUS (*GET_TXT_INFO) (
+ IN AMI_TXT_INFO_PROTOCOL *AMI_TXT_INFO_PROTOCOL,
+ OUT VOID **AmiTxtInfoData
+);
+
+struct _AMI_TXT_INFO_PROTOCOL {
+ //Protocol Ver 0
+ UINT32 ProtocolVer;
+ UINT64 Flags;
+ GET_TXT_INFO GetTxtInfo;
+};
+/****** DO NOT WRITE BELOW THIS LINE *******/
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (C)Copyright 1987-2013, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//*************************************************************************
+//*************************************************************************
diff --git a/Board/CPU/TxtDxe/SinitAcm/HSW_SINITAC_DBG_Rev1_5.BIN b/Board/CPU/TxtDxe/SinitAcm/HSW_SINITAC_DBG_Rev1_5.BIN
new file mode 100644
index 0000000..62c0f10
--- /dev/null
+++ b/Board/CPU/TxtDxe/SinitAcm/HSW_SINITAC_DBG_Rev1_5.BIN
Binary files differ
diff --git a/Board/CPU/TxtDxe/SinitAcm/HSW_SINITAC_PRO_NPW_Rev1_5.BIN b/Board/CPU/TxtDxe/SinitAcm/HSW_SINITAC_PRO_NPW_Rev1_5.BIN
new file mode 100644
index 0000000..86ee7d9
--- /dev/null
+++ b/Board/CPU/TxtDxe/SinitAcm/HSW_SINITAC_PRO_NPW_Rev1_5.BIN
Binary files differ
diff --git a/Board/CPU/TxtDxe/SinitAcm/HSW_SINITAC_PRO_Rev1_5.BIN b/Board/CPU/TxtDxe/SinitAcm/HSW_SINITAC_PRO_Rev1_5.BIN
new file mode 100644
index 0000000..e271644
--- /dev/null
+++ b/Board/CPU/TxtDxe/SinitAcm/HSW_SINITAC_PRO_Rev1_5.BIN
Binary files differ
diff --git a/Board/CPU/TxtDxe/SinitAcm/TxtSinitAcm.cif b/Board/CPU/TxtDxe/SinitAcm/TxtSinitAcm.cif
new file mode 100644
index 0000000..0ae3772
--- /dev/null
+++ b/Board/CPU/TxtDxe/SinitAcm/TxtSinitAcm.cif
@@ -0,0 +1,12 @@
+<component>
+ name = "TxtSinitAcm"
+ category = ModulePart
+ LocalRoot = "Board\Cpu\TxtDxe\SinitAcm"
+ RefName = "TxtSinitAcm"
+[files]
+"TxtSinitAcm.sdl"
+"TxtSinitAcm.mak"
+"HSW_SINITAC_PRO_Rev1_5.BIN"
+"HSW_SINITAC_PRO_NPW_Rev1_5.BIN"
+"HSW_SINITAC_DBG_Rev1_5.BIN"
+<endComponent>
diff --git a/Board/CPU/TxtDxe/SinitAcm/TxtSinitAcm.mak b/Board/CPU/TxtDxe/SinitAcm/TxtSinitAcm.mak
new file mode 100644
index 0000000..7f8daa5
--- /dev/null
+++ b/Board/CPU/TxtDxe/SinitAcm/TxtSinitAcm.mak
@@ -0,0 +1,69 @@
+#**********************************************************************
+#**********************************************************************
+#** **
+#** (C)Copyright 1987-2013, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#**********************************************************************
+#**********************************************************************
+
+#**********************************************************************
+# $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/Haswell/AMI Cpu PKG/AMI TXT DXE/TxtSinitAcm/TxtSinitAcm.mak 1 8/14/13 4:35a Davidhsieh $
+#
+# $Revision: 1 $
+#
+# $Date: 8/14/13 4:35a $
+#**********************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/Haswell/AMI Cpu PKG/AMI TXT DXE/TxtSinitAcm/TxtSinitAcm.mak $
+#
+# 1 8/14/13 4:35a Davidhsieh
+# [TAG] None
+# [Category] New Feature
+# [Description] Txt Sinit ACM is included in BIOS
+#
+#
+#**********************************************************************
+#<AMI_FHDR_START>
+#
+# Name: Sinitacm.mak
+#
+# Description:
+#
+#
+#<AMI_FHDR_END>
+#**********************************************************************
+all : SinitAcmBin
+
+#---------------------------------------------------------------------------
+# SINIT ACM
+#---------------------------------------------------------------------------
+
+SinitAcmBin : $(BUILD_DIR)\SinitAcmBin.ffs
+
+$(BUILD_DIR)\SinitAcmBin.ffs : $(SINITACM_FILE)
+ $(MAKE) /f Core\FFS.mak \
+ BUILD_DIR=$(BUILD_DIR) \
+ GUID=7fbfe0ea-0e9d-406b-a202-ca6a7d0e0f1e \
+ TYPE=EFI_FV_FILETYPE_FREEFORM \
+ BINFILE=$** FFSFILE=$@ COMPRESS=1 NAME=$(**B)
+
+#**********************************************************************
+#**********************************************************************
+#** **
+#** (C)Copyright 1987-2013, 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/CPU/TxtDxe/SinitAcm/TxtSinitAcm.sdl b/Board/CPU/TxtDxe/SinitAcm/TxtSinitAcm.sdl
new file mode 100644
index 0000000..bdb35b7
--- /dev/null
+++ b/Board/CPU/TxtDxe/SinitAcm/TxtSinitAcm.sdl
@@ -0,0 +1,32 @@
+TOKEN
+ Name = "SINIT_ACM_SUPPORT"
+ Value = "0"
+ Help = "Main switch to enable TXT BIOS AC Module support in Project"
+ TokenType = Boolean
+ TargetMAK = Yes
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "SINITACM_FILE"
+ Value = "Board\CPU\TxtDxe\SinitAcm\HSW_SINITAC_PRO_Rev1_5.BIN"
+ TokenType = File
+ TargetMAK = Yes
+End
+
+PATH
+ Name = "SinitAcm_DIR"
+End
+
+MODULE
+ Help = "Includes TxtSinitAcm.mak to Project"
+ File = "TxtSinitAcm.mak"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\SinitAcmBin.ffs"
+ Parent = "FV_MAIN"
+ Token = "SINIT_ACM_SUPPORT" "=" "1"
+ InvokeOrder = AfterParent
+End
+
diff --git a/Board/CPU/TxtDxe/TxtSetup.c b/Board/CPU/TxtDxe/TxtSetup.c
new file mode 100644
index 0000000..2565714
--- /dev/null
+++ b/Board/CPU/TxtDxe/TxtSetup.c
@@ -0,0 +1,135 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (C)Copyright 1987-2013, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//*************************************************************************
+//*************************************************************************
+
+//**********************************************************************
+// $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/Haswell/AMI Cpu PKG/AMI TXT DXE/TxtSetup.c 2 10/14/12 11:49p Davidhsieh $
+//
+// $Revision: 2 $
+//
+// $Date: 10/14/12 11:49p $
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/Haswell/AMI Cpu PKG/AMI TXT DXE/TxtSetup.c $
+//
+// 2 10/14/12 11:49p Davidhsieh
+// [TAG] None
+// [Category] Improvement
+// [Description] Use SBLib_ExtResetSystem when pRS->ResetSystem does not
+// support GlobaRest type in the project
+//
+// 1 8/14/12 5:05a Davidhsieh
+// [TAG] EIP97190
+// [Category] Improvement
+// [Description] Changes in TXT Configuration require a Powercycle reset
+//
+//
+//
+//**********************************************************************
+//<AMI_FHDR_START>
+//
+// Name: TXTSetup.c
+//
+// Description:
+//
+//<AMI_FHDR_END>
+//**********************************************************************
+//----------------------------------------------------------------------------
+// Includes
+#include <AmiLib.h>
+#include <AmiDxeLib.h>
+#include <Setup.h>
+#include <AmiCspLib.h>
+#include <SetupStrTokens.h>
+
+#pragma pack (1)
+typedef struct {
+ UINT8 SMXSupport;
+} SETUP_TXT_FEATURES;
+#pragma pack ()
+
+//----------------------------------------------------------------------------
+// Local Variables
+
+//----------------------------------------------------------------------------
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+//
+// Procedure: TxtExitSetupEvent
+//
+// Description: This routine for calling global reset if necessary.
+//
+// Input: EFI_EVENT - Efi event.
+// VOID* - Image handle.
+//
+// Output: None.
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+typedef enum {
+ mColdReset,
+ mWarmReset,
+ mShutdownReset,
+ mPowerCycleReset,
+ mGlobalReset,
+ mGlobalResetWithEc
+} PCH_RESET_TYPE;
+
+EFI_STATUS
+TxtExitSetupEvent (VOID)
+{
+ EFI_STATUS Status;
+ SETUP_DATA SetupData;
+ UINTN VariableSize;
+ EFI_GUID SetupGuid = SETUP_GUID;
+ // Get current Setup Data.
+ VariableSize = sizeof(SETUP_DATA);
+ Status = pRS->GetVariable ( L"Setup", \
+ &SetupGuid, \
+ NULL, \
+ &VariableSize, \
+ &SetupData );
+ if (EFI_ERROR(Status)) return (Status);
+
+ if ( SetupData.TxtSupport != 0 ) {
+ // Generate Global Reset System if TXT is enabled w/o SMX enabled
+ if ((UINT16)(ReadMsr(0x3A) & 0xFF03) == 0xFF03) return EFI_SUCCESS;
+ } else {
+ // Generate Global Reset System if TXT is disabled with SMX enabled.
+ if ((UINT16)(ReadMsr(0x3A) & 0xFF03) != 0xFF03) return EFI_SUCCESS;
+ }
+ // PlatformResetSystem() of ReferenceCode\ME\..\PlatformReset.c
+#if defined(RESET_RUNTIME_SERVICES_SUPPORT) && (RESET_RUNTIME_SERVICES_SUPPORT == 0)
+ pRS->ResetSystem (mGlobalReset, EFI_SUCCESS, 0, NULL);
+#else
+ SBLib_ExtResetSystem (SbResetGlobal);
+#endif
+ EFI_DEADLOOP()
+ return EFI_SUCCESS;
+}
+
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (C)Copyright 1987-2013, 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/CPU/TxtDxe/TxtTcgService.h b/Board/CPU/TxtDxe/TxtTcgService.h
new file mode 100644
index 0000000..8d6ad53
--- /dev/null
+++ b/Board/CPU/TxtDxe/TxtTcgService.h
@@ -0,0 +1,277 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (C)Copyright 1985-2009, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//*************************************************************************
+//*************************************************************************
+
+//**********************************************************************
+// $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/Haswell/AMI Cpu PKG/AMI TXT DXE/TxtTcgService.h 1 7/18/12 2:07a Davidhsieh $
+//
+// $Revision: 1 $
+//
+// $Date: 7/18/12 2:07a $
+//
+//**********************************************************************
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/Haswell/AMI Cpu PKG/AMI TXT DXE/TxtTcgService.h $
+//
+// 1 7/18/12 2:07a Davidhsieh
+// [TAG] None
+// [Category] Improvement
+// [Description] AMI TXT Dxe module part create
+//
+// 1 2/25/11 3:55a Hpbirdchen
+// Initial 0.5 RC Check-in
+//
+// 1 12/01/10 11:11p Calvinchen
+//
+// 2 10/05/25 3:07p Calvinchen
+//
+// 4 7/27/09 7:12a Calvinchen
+// TXT module uses internal TPM startup procedure instead of TCG
+// library.(EIP#20424)
+//
+// 3 6/24/09 12:10a Calvinchen
+// (EIP#22177)Updated for Aptio Source Enhancement.
+//
+//
+//**********************************************************************
+//
+// Statements that include other header files.
+//
+typedef struct _EFI_TCG_PROTOCOL EFI_TCG_PROTOCOL;
+typedef struct _EFI_TPM_DEVICE_PROTOCOL EFI_TPM_DEVICE_PROTOCOL;
+typedef UINT16 TPM_STRUCTURE_TAG;
+typedef UINT16 TPM_TAG;
+typedef UINT32 TPM_COMMAND_CODE;
+typedef UINT32 TPM_RESULT;
+typedef UINT16 TPM_STARTUP_TYPE;
+
+// The TPM is starting up from a clean state
+#define TPM_ST_CLEAR ((TPM_STARTUP_TYPE) 0x0001)
+#define ST_CLEAR 0
+// The TPM is starting up from a saved state
+#define TPM_ST_STATE ((TPM_STARTUP_TYPE) 0x0002)
+#define ST_STATE 1
+#define TPM_ORD_Startup ((TPM_COMMAND_CODE) 0x00000099)
+#define TPM_ORD_ContinueSelfTest ((TPM_COMMAND_CODE) 0x00000053)
+#define TPM_ORD_NV_READVALUE ((TPM_COMMAND_CODE) 0x000000CF) // 207
+#define TPM_ORD_NV_WRITEVALUE ((TPM_COMMAND_CODE) 0x000000CD) // 205
+#define TPM_ORD_NV_DEFINESPACE ((TPM_COMMAND_CODE) 0x000000CC) // 204
+#define TPM_ORD_VERIFY 0x020000001
+#define TPM_NV_INDEX_LOCK 0x0FFFFFFFF
+#define TPM_TAG_RQU_COMMAND ((TPM_STRUCTURE_TAG) 0x00C1)
+#define TPM_TAG_RQU_AUTH1_COMMAND ((TPM_STRUCTURE_TAG) 0x00C2)
+#define EFI_TCG_PROTOCOL_GUID \
+ {0xf541796d, 0xa62e, 0x4954, 0xa7, 0x75, 0x95, 0x84, 0xf6, 0x1b, 0x9c, 0xdd}
+#define EFI_TPM_DEVICE_PROTOCOL_GUID \
+ { 0xde161cfe, 0x1e60, 0x42a1, 0x8c, 0xc3, 0xee, 0x7e, 0xf0, 0x73, 0x52, 0x12 }
+#define TPM_H2NS(x) \
+ (((UINT16)(x) << 8) | ((UINT16)(x) >> 8))
+#define TPM_H2NL(x) \
+ (UINT32)((((UINT32)(x)) >> 24) | \
+ (((x) >> 8) & 0xff00) | \
+ ((x) << 24) | \
+ (((x) & 0xff00) << 8))
+//----------------------------------------------------------------------------
+// NVram definition
+//----------------------------------------------------------------------------
+#pragma pack (push)
+#pragma pack (1)
+
+typedef struct _TCPA_DIGEST {
+ UINT8 digest[20];
+} TCPA_DIGEST;
+
+typedef struct _TPM_PCR_SELECTION {
+ UINT16 sizeOfSelect;
+ UINT8 pcrSelect[3];
+} TPM_PCR_SELECTION;
+
+typedef struct _TPM_PCR_INFO_SHORT {
+//- TPM_PCR_SELECTION pcrSelection;
+ UINT16 sizeOfSelect;
+ UINT8 pcrSelect[3];
+ UINT8 localityAtRelease;
+ TCPA_DIGEST digestAtRelease;
+} TPM_PCR_INFO_SHORT;
+
+typedef struct _TPM_NV_ATTRIBUTES {
+ UINT16 tag;
+ UINT32 attributes;
+} TPM_NV_ATTRIBUTES;
+
+typedef struct _TPM_NV_DATA_PUBLIC1 {
+ UINT16 Tag_;
+ UINT32 NvIndex;
+ TPM_PCR_INFO_SHORT PcrInfoRead;
+} TPM_NV_DATA_PUBLIC1;
+
+typedef struct _TPM_NV_DATA_PUBLIC2 {
+ TPM_PCR_INFO_SHORT PcrInfoWrite;
+ TPM_NV_ATTRIBUTES PerMission;
+ UINT8 bReadSTClear;
+ UINT8 bWriteSTClear;
+ UINT8 bWriteDefine;
+ UINT32 DataSize;
+} TPM_NV_DATA_PUBLIC2;
+
+typedef struct _TPM_DEF_NV_DATA {
+ TPM_NV_DATA_PUBLIC1 TpmDefineSpaceIn_pubinfo1;
+ TPM_NV_DATA_PUBLIC2 TpmDefineSpaceIn_pubinfo2;
+ TCPA_DIGEST TpmDefineSpaceIn_encAuth;
+} TPM_DEF_NV_DATA;
+
+//----------------------------------------------------------------------------
+// TCG definition
+//----------------------------------------------------------------------------
+typedef struct _TPM_1_2_CMD_HEADER {
+ TPM_TAG Tag;
+ UINT32 ParamSize;
+ TPM_COMMAND_CODE Ordinal;
+} TPM_1_2_CMD_HEADER;
+
+typedef struct _TPM_1_2_RET_HEADER {
+ TPM_TAG Tag;
+ UINT32 ParamSize;
+ TPM_RESULT RetCode;
+} TPM_1_2_RET_HEADER;
+
+typedef struct _TPM_1_2_CMD_STARTUP {
+ TPM_1_2_CMD_HEADER Header;
+ TPM_STARTUP_TYPE StartupType;
+} TPM_1_2_CMD_STARTUP;
+
+typedef struct _TPM_1_2_REGISTERS {
+ UINT8 Access; // 0
+ UINT8 Reserved1[7]; // 1
+ UINT32 IntEnable; // 8
+ UINT8 IntVector; // 0ch
+ UINT8 Reserved2[3]; // 0dh
+ UINT32 IntSts; // 10h
+ UINT32 IntfCapability; // 14h
+ UINT8 Sts; // 18h
+ UINT16 BurstCount; // 19h
+ UINT8 Reserved3[9];
+ UINT32 DataFifo; // 24h
+ UINT8 Reserved4[0xed8]; // 28h
+ UINT16 Vid; // 0f00h
+ UINT16 Did; // 0f02h
+ UINT8 Rid; // 0f04h
+ UINT8 TcgDefined[0x7b]; // 0f05h
+ UINT32 LegacyAddress1; // 0f80h
+ UINT32 LegacyAddress1Ex; // 0f84h
+ UINT32 LegacyAddress2; // 0f88h
+ UINT32 LegacyAddress2Ex; // 0f8ch
+ UINT8 VendorDefined[0x70];// 0f90h
+} TPM_1_2_REGISTERS;
+
+#pragma pack (pop)
+
+typedef EFI_STATUS (EFIAPI *EFI_TCG_STATUS_CHECK) (
+//- IN EFI_TCG_PROTOCOL *This,
+//- OUT TCG_EFI_BOOT_SERVICE_CAPABILITY
+//- *ProtocolCapability,
+//- OUT UINT32 *TCGFeatureFlags,
+//- OUT EFI_PHYSICAL_ADDRESS *EventLogLocation,
+//- OUT EFI_PHYSICAL_ADDRESS *EventLogLastEntry
+);
+
+typedef EFI_STATUS (EFIAPI *EFI_TCG_HASH_ALL) (
+//- IN EFI_TCG_PROTOCOL *This,
+//- IN UINT8 *HashData,
+//- IN UINT64 HashDataLen,
+//- IN TCG_ALGORITHM_ID AlgorithmId,
+//- IN OUT UINT64 *HashedDataLen,
+//- IN OUT UINT8 **HashedDataResult
+);
+
+typedef EFI_STATUS (EFIAPI *EFI_TCG_LOG_EVENT) (
+//- IN EFI_TCG_PROTOCOL *This,
+//- IN TCG_PCR_EVENT *TCGLogData,
+//- IN OUT UINT32 *EventNumber,
+//- IN UINT32 Flags
+);
+
+typedef EFI_STATUS (EFIAPI *EFI_TCG_PASS_THROUGH_TO_TPM) (
+ IN EFI_TCG_PROTOCOL *This,
+ IN UINT32 TpmInputParamterBlockSize,
+ IN UINT8 *TpmInputParamterBlock,
+ IN UINT32 TpmOutputParameterBlockSize,
+ IN UINT8 *TpmOutputParameterBlock
+ );
+
+typedef EFI_STATUS (EFIAPI *EFI_TCG_HASH_LOG_EXTEND_EVENT) (
+//- IN EFI_TCG_PROTOCOL *This,
+//- IN UINT8 *HashData,
+//- IN UINT64 HashDataLen,
+//- IN TCG_ALGORITHM_ID AlgorithmId,
+//- IN OUT TCG_PCR_EVENT *TCGLogData,
+//- IN OUT UINT32 *EventNumber,
+//- OUT EFI_PHYSICAL_ADDRESS *EventLogLastEntry
+);
+
+typedef struct _EFI_TCG_PROTOCOL {
+ EFI_TCG_STATUS_CHECK StatusCheck;
+ EFI_TCG_HASH_ALL HashAll;
+ EFI_TCG_LOG_EVENT LogEvent;
+ EFI_TCG_PASS_THROUGH_TO_TPM PassThroughToTpm;
+ EFI_TCG_HASH_LOG_EXTEND_EVENT HashLogExtendEvent;
+} EFI_TCG_PROTOCOL;
+
+typedef EFI_STATUS (EFIAPI *EFI_TPM_MP_INIT) (
+ IN EFI_TPM_DEVICE_PROTOCOL *This
+ );
+
+typedef EFI_STATUS (EFIAPI *EFI_TPM_MP_CLOSE) (
+ IN EFI_TPM_DEVICE_PROTOCOL *This
+ );
+
+typedef EFI_STATUS (EFIAPI *EFI_TPM_MP_GET_STATUS_INFO) (
+ IN EFI_TPM_DEVICE_PROTOCOL *This
+ );
+
+typedef EFI_STATUS (EFIAPI *EFI_TPM_MP_TRANSMIT) (
+//- IN EFI_TPM_DEVICE_PROTOCOL *This,
+//- IN UINTN NoInBuffers,
+//- IN TPM_TRANSMIT_BUFFER *InBuffers,
+//- IN UINTN NoOutBuffers,
+//- IN OUT TPM_TRANSMIT_BUFFER *OutBuffers
+ );
+
+typedef struct _EFI_TPM_DEVICE_PROTOCOL {
+ EFI_TPM_MP_INIT Init;
+ EFI_TPM_MP_CLOSE Close;
+ EFI_TPM_MP_GET_STATUS_INFO GetStatusInfo;
+ EFI_TPM_MP_TRANSMIT Transmit;
+} EFI_TPM_DEVICE_PROTOCOL;
+
+typedef struct _TPM_TRANSMIT_BUFFER {
+ VOID *Buffer;
+ UINTN Size;
+} TPM_TRANSMIT_BUFFER;
+typedef volatile TPM_1_2_REGISTERS *TPM_1_2_REGISTERS_PTR;
+
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (C)Copyright 1985-2009, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//*************************************************************************
+//*************************************************************************