summaryrefslogtreecommitdiff
path: root/Board/EM/MeWrapper
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/EM/MeWrapper
downloadzprj-b7c51c9cf4864df6aabb99a1ae843becd577237c.tar.xz
init. 1AQQW051HEADmaster
Diffstat (limited to 'Board/EM/MeWrapper')
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/ASFVerbosity/ASFVerbosity.c485
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/ASFVerbosity/ASFVerbosity.cif10
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/ASFVerbosity/ASFVerbosity.mak89
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/ASFVerbosity/ASFVerbosity.sdl78
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/AmtLockKBD/AmtInt9.asm277
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/AmtLockKBD/AmtLockKBD.c507
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/AmtLockKBD/AmtLockKBD.cif13
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/AmtLockKBD/AmtLockKBD.dxs6
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/AmtLockKBD/AmtLockKBD.h77
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/AmtLockKBD/AmtLockKBD.mak88
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/AmtLockKBD/AmtLockKBD.sdl38
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/AmtPetAlert/AmtPetAlert.c863
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/AmtPetAlert/AmtPetAlert.cif14
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/AmtPetAlert/AmtPetAlert.dxs68
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/AmtPetAlert/AmtPetAlert.h205
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/AmtPetAlert/AmtPetAlert.mak82
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/AmtPetAlert/AmtPetAlert.sdl24
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/AmtPetAlert/DevicePath.c1049
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/AmtPetAlert/DevicePath.h93
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/AmtPlatformPolicy/AmtPlatformPolicy.c558
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/AmtPlatformPolicy/AmtPlatformPolicy.cif14
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/AmtPlatformPolicy/AmtPlatformPolicy.dxs54
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/AmtPlatformPolicy/AmtPlatformPolicy.h209
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/AmtPlatformPolicy/AmtPlatformPolicy.mak116
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/AmtPlatformPolicy/AmtPlatformPolicy.sdl42
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/AmtPlatformPolicy/Pei/AmtPeiPolicyInit.c233
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/AmtPlatformPolicy/Pei/AmtPeiPolicyInit.cif13
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/AmtPlatformPolicy/Pei/AmtPeiPolicyInit.dxs35
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/AmtPlatformPolicy/Pei/AmtPeiPolicyInit.h60
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/AmtPlatformPolicy/Pei/AmtPeiPolicyInit.inf81
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/AmtPlatformPolicy/Pei/AmtPeiPolicyInit.mak113
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/AmtPlatformPolicy/Pei/AmtPeiPolicyInit.sdl25
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/AmtSetup/AmtSMIFlashElink.c128
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/AmtSetup/AmtSetup.c236
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/AmtSetup/AmtSetup.cif16
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/AmtSetup/AmtSetup.dxs70
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/AmtSetup/AmtSetup.h74
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/AmtSetup/AmtSetup.mak166
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/AmtSetup/AmtSetup.sd382
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/AmtSetup/AmtSetup.sdl107
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/AmtSetup/AmtSetup.unibin0 -> 15810 bytes
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/AmtSetup/AmtTseFunc.c447
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/AmtSmbios/AmtSmbios.c376
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/AmtSmbios/AmtSmbios.cif12
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/AmtSmbios/AmtSmbios.dxs70
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/AmtSmbios/AmtSmbios.h124
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/AmtSmbios/AmtSmbios.mak108
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/AmtSmbios/AmtSmbios.sdl25
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/AmtStatusCode/AmtStatusCode.cif12
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/AmtStatusCode/AmtStatusCode.mak81
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/AmtStatusCode/AmtStatusCode.sdl42
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/AmtStatusCode/AmtStatusCodeDxe.c151
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/AmtStatusCode/AmtStatusCodePei.c224
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/AmtStatusCode/AmtStatusCodeSmm.c368
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/AmtWrapper.cif19
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/AmtWrapper.sdl20
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/AsfTable/AsfTable.c300
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/AsfTable/AsfTable.cif12
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/AsfTable/AsfTable.dxs66
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/AsfTable/AsfTable.h70
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/AsfTable/AsfTable.mak79
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/AsfTable/AsfTable.sdl24
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/Dxe/AmtWrapperDxe.c883
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/Dxe/AmtWrapperDxe.cif25
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/Dxe/AmtWrapperDxe.dxs75
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/Dxe/AmtWrapperDxe.h268
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/Dxe/AmtWrapperDxe.mak117
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/Dxe/AmtWrapperDxe.sdl57
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/Dxe/AsfSupport.c1919
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/Dxe/AsfSupport.h270
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/Dxe/BdsBoot.c809
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/Dxe/BdsConnect.c175
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/Dxe/BdsConsole.c251
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/Dxe/BdsLib.h459
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/Dxe/BdsMisc.c594
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/Dxe/BmMachine.h102
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/Dxe/DevicePath.c1078
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/Dxe/KvmSupport.c135
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/Dxe/KvmSupport.h119
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/Dxe/Performance.c431
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/Dxe/Performance.h87
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/Protocol/AmtWrapper/AmtWrapper.c68
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/Protocol/AmtWrapper/AmtWrapper.h180
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/Protocol/AmtWrapperProtocolLib.cif11
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/Protocol/AmtWrapperProtocolLib.mak65
-rw-r--r--Board/EM/MeWrapper/AmtWrapper/Protocol/AmtWrapperProtocolLib.sdl34
-rw-r--r--Board/EM/MeWrapper/AtAmUi/AtAmUi.c1120
-rw-r--r--Board/EM/MeWrapper/AtAmUi/AtAmUi.cif14
-rw-r--r--Board/EM/MeWrapper/AtAmUi/AtAmUi.dxs42
-rw-r--r--Board/EM/MeWrapper/AtAmUi/AtAmUi.h150
-rw-r--r--Board/EM/MeWrapper/AtAmUi/AtAmUi.mak148
-rw-r--r--Board/EM/MeWrapper/AtAmUi/AtAmUi.sdl27
-rw-r--r--Board/EM/MeWrapper/AtAmUi/AtAmUiString.c242
-rw-r--r--Board/EM/MeWrapper/AtAmUi/AtAmUiString.h208
-rw-r--r--Board/EM/MeWrapper/Icc/Icc.cif13
-rw-r--r--Board/EM/MeWrapper/Icc/Icc.sdl25
-rw-r--r--Board/EM/MeWrapper/Icc/IccPlatform/IccPlatform.c1187
-rw-r--r--Board/EM/MeWrapper/Icc/IccPlatform/IccPlatform.cif12
-rw-r--r--Board/EM/MeWrapper/Icc/IccPlatform/IccPlatform.dxs116
-rw-r--r--Board/EM/MeWrapper/Icc/IccPlatform/IccPlatform.h260
-rw-r--r--Board/EM/MeWrapper/Icc/IccPlatform/IccPlatform.mak171
-rw-r--r--Board/EM/MeWrapper/Icc/IccPlatform/IccPlatform.sdl67
-rw-r--r--Board/EM/MeWrapper/Icc/IccSetup/IccCallbacks.c1272
-rw-r--r--Board/EM/MeWrapper/Icc/IccSetup/IccCallbacks.h167
-rw-r--r--Board/EM/MeWrapper/Icc/IccSetup/IccLoadDefault.c141
-rw-r--r--Board/EM/MeWrapper/Icc/IccSetup/IccSetup.cif16
-rw-r--r--Board/EM/MeWrapper/Icc/IccSetup/IccSetup.h139
-rw-r--r--Board/EM/MeWrapper/Icc/IccSetup/IccSetup.mak99
-rw-r--r--Board/EM/MeWrapper/Icc/IccSetup/IccSetup.sdl263
-rw-r--r--Board/EM/MeWrapper/Icc/IccSetup/IccSetupMenu.sd438
-rw-r--r--Board/EM/MeWrapper/Icc/IccSetup/IccSetupSubmenu.sd239
-rw-r--r--Board/EM/MeWrapper/Icc/IccSetup/IccStrings.unibin0 -> 24896 bytes
-rw-r--r--Board/EM/MeWrapper/Icc/OverClocking/IccOverClocking.cif14
-rw-r--r--Board/EM/MeWrapper/Icc/OverClocking/IccOverClocking.dxs109
-rw-r--r--Board/EM/MeWrapper/Icc/OverClocking/IccOverClocking.efibin0 -> 43840 bytes
-rw-r--r--Board/EM/MeWrapper/Icc/OverClocking/IccOverClocking.mak111
-rw-r--r--Board/EM/MeWrapper/Icc/OverClocking/IccOverClocking.sdl32
-rw-r--r--Board/EM/MeWrapper/Icc/OverClocking/IccOverClocking9_5.dxs101
-rw-r--r--Board/EM/MeWrapper/Icc/OverClocking/IccOverClocking9_5.efibin0 -> 43840 bytes
-rw-r--r--Board/EM/MeWrapper/Icc/OverClocking/IccProtocol.h67
-rw-r--r--Board/EM/MeWrapper/Icc/Protocol/IccOverClocking/IccOverClocking.c98
-rw-r--r--Board/EM/MeWrapper/Icc/Protocol/IccOverClocking/IccOverClocking.h278
-rw-r--r--Board/EM/MeWrapper/Icc/Protocol/IccProtocolLib.cif11
-rw-r--r--Board/EM/MeWrapper/Icc/Protocol/IccProtocolLib.mak78
-rw-r--r--Board/EM/MeWrapper/Icc/Protocol/IccProtocolLib.sdl29
-rw-r--r--Board/EM/MeWrapper/MdesStatusCode/MdesStatusCode.cif10
-rw-r--r--Board/EM/MeWrapper/MdesStatusCode/MdesStatusCode.mak89
-rw-r--r--Board/EM/MeWrapper/MdesStatusCode/MdesStatusCode.sdl31
-rw-r--r--Board/EM/MeWrapper/MdesStatusCode/MdesStatusCodeDxe.c206
-rw-r--r--Board/EM/MeWrapper/MePciPlatform/MePciPlatform.c342
-rw-r--r--Board/EM/MeWrapper/MePciPlatform/MePciPlatform.cif12
-rw-r--r--Board/EM/MeWrapper/MePciPlatform/MePciPlatform.dxs98
-rw-r--r--Board/EM/MeWrapper/MePciPlatform/MePciPlatform.h154
-rw-r--r--Board/EM/MeWrapper/MePciPlatform/MePciPlatform.mak122
-rw-r--r--Board/EM/MeWrapper/MePciPlatform/MePciPlatform.sdl24
-rw-r--r--Board/EM/MeWrapper/MePlatformPolicy/MePlatformPolicy.c692
-rw-r--r--Board/EM/MeWrapper/MePlatformPolicy/MePlatformPolicy.cif13
-rw-r--r--Board/EM/MeWrapper/MePlatformPolicy/MePlatformPolicy.h232
-rw-r--r--Board/EM/MeWrapper/MePlatformPolicy/MePlatformPolicy.mak139
-rw-r--r--Board/EM/MeWrapper/MePlatformPolicy/MePlatformPolicy.sdl24
-rw-r--r--Board/EM/MeWrapper/MePlatformPolicy/Pei/MePeiPolicyInit.c196
-rw-r--r--Board/EM/MeWrapper/MePlatformPolicy/Pei/MePeiPolicyInit.cif12
-rw-r--r--Board/EM/MeWrapper/MePlatformPolicy/Pei/MePeiPolicyInit.dxs35
-rw-r--r--Board/EM/MeWrapper/MePlatformPolicy/Pei/MePeiPolicyInit.h64
-rw-r--r--Board/EM/MeWrapper/MePlatformPolicy/Pei/MePeiPolicyInit.mak111
-rw-r--r--Board/EM/MeWrapper/MePlatformPolicy/Pei/MePeiPolicyInit.sdl25
-rw-r--r--Board/EM/MeWrapper/MeSetup/Dxe/MeSetupDxe.c171
-rw-r--r--Board/EM/MeWrapper/MeSetup/Dxe/MeSetupDxe.cif12
-rw-r--r--Board/EM/MeWrapper/MeSetup/Dxe/MeSetupDxe.dxs68
-rw-r--r--Board/EM/MeWrapper/MeSetup/Dxe/MeSetupDxe.h79
-rw-r--r--Board/EM/MeWrapper/MeSetup/Dxe/MeSetupDxe.mak126
-rw-r--r--Board/EM/MeWrapper/MeSetup/Dxe/MeSetupDxe.sdl27
-rw-r--r--Board/EM/MeWrapper/MeSetup/MeSetup.c263
-rw-r--r--Board/EM/MeWrapper/MeSetup/MeSetup.cif18
-rw-r--r--Board/EM/MeWrapper/MeSetup/MeSetup.h113
-rw-r--r--Board/EM/MeWrapper/MeSetup/MeSetup.mak130
-rw-r--r--Board/EM/MeWrapper/MeSetup/MeSetup.sd309
-rw-r--r--Board/EM/MeWrapper/MeSetup/MeSetup.sdl192
-rw-r--r--Board/EM/MeWrapper/MeSetup/MeSetup.unibin0 -> 18422 bytes
-rw-r--r--Board/EM/MeWrapper/MeSetup/MeSetupReset.c156
-rw-r--r--Board/EM/MeWrapper/MeSetup/MebxPrompt.c520
-rw-r--r--Board/EM/MeWrapper/MeSetup/NfcSupportDxe/NfcSupportDxe.c190
-rw-r--r--Board/EM/MeWrapper/MeSetup/NfcSupportDxe/NfcSupportDxe.cif14
-rw-r--r--Board/EM/MeWrapper/MeSetup/NfcSupportDxe/NfcSupportDxe.dxs70
-rw-r--r--Board/EM/MeWrapper/MeSetup/NfcSupportDxe/NfcSupportDxe.h71
-rw-r--r--Board/EM/MeWrapper/MeSetup/NfcSupportDxe/NfcSupportDxe.mak134
-rw-r--r--Board/EM/MeWrapper/MeSetup/NfcSupportDxe/NfcSupportDxe.sdl62
-rw-r--r--Board/EM/MeWrapper/MeSetup/NfcSupportDxe/NfcSupportSetupHook.c154
-rw-r--r--Board/EM/MeWrapper/MeSetup/NfcSupportDxe/NfcSupportSetupHook.cif8
-rw-r--r--Board/EM/MeWrapper/MeWrapper.cif18
-rw-r--r--Board/EM/MeWrapper/MeWrapper.sdl20
-rw-r--r--Board/EM/MeWrapper/PttWrapper/PttWrapper.c142
-rw-r--r--Board/EM/MeWrapper/PttWrapper/PttWrapper.cif11
-rw-r--r--Board/EM/MeWrapper/PttWrapper/PttWrapper.dxs99
-rw-r--r--Board/EM/MeWrapper/PttWrapper/PttWrapper.mak68
-rw-r--r--Board/EM/MeWrapper/PttWrapper/PttWrapper.sdl27
-rw-r--r--Board/EM/MeWrapper/Smbios131/Smbios131.c553
-rw-r--r--Board/EM/MeWrapper/Smbios131/Smbios131.cif12
-rw-r--r--Board/EM/MeWrapper/Smbios131/Smbios131.dxs72
-rw-r--r--Board/EM/MeWrapper/Smbios131/Smbios131.h176
-rw-r--r--Board/EM/MeWrapper/Smbios131/Smbios131.mak158
-rw-r--r--Board/EM/MeWrapper/Smbios131/Smbios131.sdl33
-rw-r--r--Board/EM/MeWrapper/TdtWrapper/TDTSetup.sd161
-rw-r--r--Board/EM/MeWrapper/TdtWrapper/TDTSetup.unibin0 -> 8966 bytes
-rw-r--r--Board/EM/MeWrapper/TdtWrapper/TDTWrapper.c521
-rw-r--r--Board/EM/MeWrapper/TdtWrapper/TDTWrapper.cif15
-rw-r--r--Board/EM/MeWrapper/TdtWrapper/TDTWrapper.dxs93
-rw-r--r--Board/EM/MeWrapper/TdtWrapper/TDTWrapper.mak158
-rw-r--r--Board/EM/MeWrapper/TdtWrapper/TDTWrapper.sdl98
-rw-r--r--Board/EM/MeWrapper/TdtWrapper/TdtCallback.h69
-rw-r--r--Board/EM/MeWrapper/TdtWrapper/TdtOfbd.c296
191 files changed, 33462 insertions, 0 deletions
diff --git a/Board/EM/MeWrapper/AmtWrapper/ASFVerbosity/ASFVerbosity.c b/Board/EM/MeWrapper/AmtWrapper/ASFVerbosity/ASFVerbosity.c
new file mode 100644
index 0000000..4315c31
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/ASFVerbosity/ASFVerbosity.c
@@ -0,0 +1,485 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/AmtWrapper/ASF Verbosity/ASFVerbosity.c 2 4/24/12 12:46a Klzhan $
+//
+// $Revision: 2 $
+//
+// $Date: 4/24/12 12:46a $
+//
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/AmtWrapper/ASF Verbosity/ASFVerbosity.c $
+//
+// 2 4/24/12 12:46a Klzhan
+// Update module to latest
+//
+// 1 2/08/12 1:10a Klzhan
+// Initial Check in
+//
+// 2 6/10/11 4:21a Klzhan
+// Update ASF_INDUSTRY_IANA and ASF_INTEL_IANA ID.
+//
+// 1 2/25/11 1:44a Klzhan
+// Initial Check-in
+//
+// 1 12/03/10 5:10a Klzhan
+// Initial Check-in.
+//
+//
+//**********************************************************************
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: ASFVerbosity.c
+//
+// Description: Shows ASF POST Message
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+#include <AmiDxeLib.h>
+#include <Protocol\ConsoleControl.h>
+#include <Protocol\SimpleTextOut.h>
+#include <Protocol\SmBios.h>
+#include <Protocol\SmbiosGetFlashDataProtocol.h>
+#include <ReferenceCode\ME\Protocol\AlertStandardFormat\AlertStandardFormat.h>
+#include <ReferenceCode\ME\Library\Amt\Include\Amt.h>
+
+#define AMI_EFI_SOL_POST_MESSAGE_GUID \
+{ 0xf42f3752, 0x12e, 0x4812, 0x99, 0xe6, 0x49, 0xf9, 0x43, 0x4, 0x84, 0x54 }
+
+#define SOL_NORMAL 0x00
+#define SOL_VERB 0x40
+#define SOL_QUIET 0x20
+#define SOL_BLANK 0x60
+#define SOL_SETUP 0x00
+
+EFI_GUID guidEfiVar = EFI_GLOBAL_VARIABLE;
+EFI_GUID gSmbiosProtocolGuid = EFI_SMBIOS_PROTOCOL_GUID;
+EFI_GUID gConsoleControlProtocolGuid = EFI_CONSOLE_CONTROL_PROTOCOL_GUID;
+EFI_GUID gAmiEfiSolPostMessageGuid = AMI_EFI_SOL_POST_MESSAGE_GUID;
+
+
+SMBIOS_TABLE_ENTRY_POINT *SmBiosTableEntryPoint = 0;
+
+static CHAR16 *SolString[] = {
+ L"Intel Corporation. Copyright 2004-2009.\r\n",
+ L"Intel Active Management Technology - Serial Over LAN operational mode.\r\n\r\n",
+ L"BIOS Revision: ",
+ L"\r\n\r\nBIOS Settings: <F2>\r\n",
+#if defined SETUP_BBS_POPUP_ENABLE && SETUP_BBS_POPUP_ENABLE
+ L"One Time Boot Menu: <F7>\r\n",
+#else
+ L"\r\n",
+#endif
+ L"Intel(R) AMT Client BIOS Setup Entry\r\n",
+ L"Intel Remote PC Assist Technology - Serial Over LAN operational mode.\r\n\r\n",
+};
+
+//<AMI_SHDR_START>
+//----------------------------------------------------------------------------
+// Name: DMIHDR
+//
+// Description: This structure represents DMI variable
+//
+// Fields: Name Type Description
+// ------------------------------------------------------------------
+// Type UINT8 Type of DMI variable
+// Length UINT8 Length of the variable
+// Handle UINT16 SmBios handle for DMI
+//
+//----------------------------------------------------------------------------
+//<AMI_SHDR_END>
+typedef struct {
+ UINT8 Type;
+ UINT8 Length;
+ UINT16 Handle;
+} DMIHDR;
+
+//<AMI_PHDR_START>
+//---------------------------------------------------------------------------
+//
+// Procedure: AsciiStrLength
+//
+// Description: Computes Ascii string length including 0-terminator
+//
+// Input:
+// IN CHAR8 *String Pointer to input ASCII string
+//
+//
+//
+// Output:
+// UINTN
+//
+//---------------------------------------------------------------------------
+//<AMI_PHDR_END>
+UINTN AsciiStrLength(IN CHAR8* String)
+{
+
+ UINTN Length = 0;
+ if (String == NULL)
+ return Length;
+ while (String[Length++] != 0);
+
+ return Length;
+}
+//<AMI_PHDR_START>
+//---------------------------------------------------------------------------
+//
+// Procedure: AsciiToUnicode
+//
+// Description: Transfer Ascii code to Unicode
+//
+// Input:
+// IN CHAR8 *String Pointer to input ASCII string
+//
+//
+//
+// Output:
+// UINTN
+//
+//---------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID AsciiToUnicode (
+ IN CHAR8 *AsciiString,
+ OUT CHAR16 *UnicodeString
+)
+{
+ UINT8 Index = 0;
+
+ while (AsciiString[Index] != 0) {
+ UnicodeString[Index] = (CHAR16) AsciiString[Index];
+ Index++;
+ }
+}
+
+//<AMI_PHDR_START>
+//---------------------------------------------------------------------------
+//
+// Procedure: AsciiToUnicodeSmBiosString
+//
+// Description: Converts Ascii string to Unicode string
+//
+// Input:
+// IN CHAR8 *AsciiString Pointer to input Ascii string
+// OUT CHAR16* UnicodeString Pointer to output Unicode string
+//
+//
+// Output:
+// VOID
+//
+//---------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID AsciiToUnicodeSmBiosString
+(
+ IN CHAR8* AsciiString,
+ OUT CHAR16* UnicodeString
+)
+{
+
+
+ do {
+ *(UnicodeString++) = (CHAR16)*AsciiString ;
+ } while (*(AsciiString++) != 0);
+
+}
+
+
+//<AMI_PHDR_START>
+//---------------------------------------------------------------------------
+//
+// Procedure: GetSmBiosStructureLength
+//
+// Description: Finds the length of SmBios structure
+//
+// Input:
+// IN VOID* SmBiosStructure Pointer to SmBios structure
+//
+// Output:
+// UINTN
+//
+//---------------------------------------------------------------------------
+//<AMI_PHDR_END>
+UINTN GetSmBiosStructureLength
+(
+ IN VOID* SmBiosStructure
+)
+{
+
+ UINT8* SmBiosStringsBlockPtr;
+ UINTN Length = 0;
+ SmBiosStringsBlockPtr = (UINT8*) SmBiosStructure + \
+ ((DMIHDR*)SmBiosStructure)->Length;
+ while ( *(CHAR16*)(SmBiosStringsBlockPtr + Length) != 0) Length++;
+
+ // determine the right value
+ return ((DMIHDR*)SmBiosStructure)->Length + Length + 2;
+}
+//<AMI_PHDR_START>
+//---------------------------------------------------------------------------
+//
+// Procedure: GetSmBiosStructureByHandle
+//
+// Description: Finds SmBios structure given a handle
+//
+// Input:
+// IN UINT16 Handle Handle to SmBios structure
+//
+// Output:
+// VOID* Pointer to SmBios structure
+//
+//---------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID* GetSmBiosStructureByHandle
+(
+ IN UINT16 Handle
+)
+{
+
+ UINT8* SmBiosStructurePtr = (UINT8*)(SmBiosTableEntryPoint->TableAddress);
+ UINT8* SmBiosEnd = SmBiosStructurePtr + SmBiosTableEntryPoint->TableLength;
+
+ while (SmBiosStructurePtr < SmBiosEnd) {
+
+ if (((DMIHDR*)SmBiosStructurePtr)->Handle == Handle)
+ return SmBiosStructurePtr;
+ SmBiosStructurePtr += GetSmBiosStructureLength(SmBiosStructurePtr);
+ }
+
+ return NULL;
+}
+
+//<AMI_PHDR_START>
+//---------------------------------------------------------------------------
+//
+// Procedure: GetSmBiosAsciiString
+//
+// Description: Finds SmBios data (Ascii string) inside SmBios structure
+//
+// Input:
+// IN VOID* SmBiosStructure Pointer to SmBios structure
+// IN UINT8 StringNumber SmBios String number
+//
+// Output:
+// CHAR8*
+//
+//---------------------------------------------------------------------------
+//<AMI_PHDR_END>
+CHAR8* GetSmBiosAsciiString
+(
+ IN VOID* SmBiosStructure,
+ IN UINT8 StringOffset
+)
+{
+
+ CHAR8* SmBiosStringPtr;
+ UINT8 StringNumber = *((UINT8*)SmBiosStructure + StringOffset);
+
+ SmBiosStringPtr = (CHAR8*)SmBiosStructure + \
+ ((DMIHDR*)SmBiosStructure)->Length;
+ if (StringNumber == 0)
+ return NULL;
+
+ if (SmBiosStructure != NULL)
+ while ( (StringNumber--) != 1)
+ SmBiosStringPtr += AsciiStrLength(SmBiosStringPtr);
+
+ return SmBiosStringPtr;
+}
+EFI_ASF_BOOT_OPTIONS *mAsfBootOptions = NULL;
+//<AMI_PHDR_START>
+//---------------------------------------------------------------------------
+//
+// Procedure: DisplaySolMessageEvent
+//
+// Description: Dispaly Sol Message
+//
+// Input:
+//
+//
+//
+// Output:
+//
+//
+//---------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID DisplaySolMessageEvent(IN EFI_EVENT Event, IN VOID *Context)
+{
+ EFI_STATUS Status;
+ UINT8 i;
+ UINT8 CastlePeak;
+ UINTN Size = 0;
+ CHAR8 *SmBiosData = NULL;
+ CHAR16 *SmBiosString;
+ EFI_SMBIOS_PROTOCOL *SmbiosProtocol;
+ EFI_CONSOLE_CONTROL_SCREEN_MODE ScreenMode;
+ EFI_CONSOLE_CONTROL_PROTOCOL *ConsoleControl;
+ EFI_GUID gEfiAlertStandardFormatProtocolGuid = EFI_ALERT_STANDARD_FORMAT_PROTOCOL_GUID;
+ EFI_ALERT_STANDARD_FORMAT_PROTOCOL *Asf;
+ Status = pBS->LocateProtocol (
+ &gEfiAlertStandardFormatProtocolGuid,
+ NULL,
+ &Asf
+ );
+ if (EFI_ERROR (Status))
+ return;
+
+ Status = Asf->GetBootOptions (Asf, &mAsfBootOptions);
+ if((mAsfBootOptions->IanaId != ASF_INTEL_CONVERTED_IANA) &&
+ (mAsfBootOptions->IanaId != ASF_INDUSTRY_CONVERTED_IANA))
+ return;
+ Status = pBS->LocateProtocol (&gSmbiosProtocolGuid, NULL, &SmbiosProtocol);
+ if (EFI_ERROR(Status))return;
+
+ Status = pBS->LocateProtocol (&gEfiConsoleControlProtocolGuid, \
+ NULL, (VOID**)&ConsoleControl);
+ if (EFI_ERROR(Status))return;
+
+
+ SmBiosTableEntryPoint = SmbiosProtocol->SmbiosGetTableEntryPoint();
+
+ SmBiosData = GetSmBiosAsciiString( GetSmBiosStructureByHandle(0x00), 0x05);
+
+ Size = AsciiStrLength(SmBiosData) + 1;
+
+ Status = pBS->AllocatePool(EfiBootServicesData, \
+ Size*sizeof(CHAR16), &SmBiosString);
+ if (EFI_ERROR(Status))return;
+
+ if (SmBiosData[0] != 0x20) {
+ MemSet(SmBiosString, Size*sizeof(CHAR16), 0);
+ AsciiToUnicodeSmBiosString(SmBiosData, SmBiosString);
+ }
+
+ CastlePeak = FALSE;
+ ConsoleControl->GetMode(ConsoleControl, &ScreenMode, NULL, NULL);
+ if (ScreenMode == EfiConsoleControlScreenGraphics) {
+ ConsoleControl->SetMode( ConsoleControl, EfiConsoleControlScreenText );
+ }
+ pST->ConOut->EnableCursor( pST->ConOut, FALSE );
+ pST->ConOut->ClearScreen( pST->ConOut);
+ pST->ConOut->SetCursorPosition( pST->ConOut, 0, 0 );
+
+ TRACE((-1,"mAsfBootOptions->BootOptions = %08x",mAsfBootOptions->BootOptions));
+
+ // SOL Normal Mode and SOL Setup Mode
+ switch (((mAsfBootOptions->BootOptions)>>8)) {
+ case SOL_NORMAL:
+ case SOL_VERB:
+
+ for (i = 0; i <= 4; i++) {
+ // AMT or Castle Peak ?
+ if (i == 1 && CastlePeak) {
+ pST->ConOut->OutputString ( pST->ConOut, SolString[6]);
+ } else pST->ConOut->OutputString ( pST->ConOut, SolString[i]);
+
+ if (i == 2)pST->ConOut->OutputString ( pST->ConOut, SmBiosString );
+ }
+
+ break;
+
+ case SOL_QUIET:
+ pST->ConOut->OutputString ( pST->ConOut, SolString[0]);
+ pST->ConOut->OutputString ( pST->ConOut, L"\n\r");
+ pST->ConOut->OutputString ( pST->ConOut, SolString[2]);
+ pST->ConOut->OutputString ( pST->ConOut, SmBiosString);
+ pST->ConOut->OutputString ( pST->ConOut, L"\n\r\n\r" );
+ break;
+
+ case SOL_BLANK:
+ break;
+ default:
+ break;
+ }//switch
+
+ // SOL_SETUP
+ if ((mAsfBootOptions->SpecialCommandParam & BIT3))
+ pST->ConOut->OutputString ( pST->ConOut, SolString[5]);
+
+ // Kill Event
+ pBS->CloseEvent(Event);
+}
+
+//<AMI_PHDR_START>
+//---------------------------------------------------------------------------
+//
+// Procedure: SolPostMessage
+//
+// Description: Sol Post Message
+//
+// Input: NULL
+//
+//
+// Output: EFI_STATUS
+//
+//
+//---------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS SolPostMessage(VOID)
+{
+ EFI_STATUS Status;
+ VOID* Registration;
+ EFI_EVENT gEvtSolMessage;
+
+
+ //
+ // Register for callback to 'AmiEfiSolPostMessage' protocol installation
+ //
+ Status = pBS->CreateEvent(
+ EFI_EVENT_NOTIFY_SIGNAL,
+ TPL_CALLBACK,
+ DisplaySolMessageEvent,
+ NULL,
+ &gEvtSolMessage
+ );
+ ASSERT_EFI_ERROR(Status);
+
+
+ //
+ // Register for protocol notifications on this event
+ //
+ Status = pBS->RegisterProtocolNotify (&gAmiEfiSolPostMessageGuid,
+ gEvtSolMessage,
+ &Registration);
+ ASSERT_EFI_ERROR (Status);
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS ASFVerbosityEntryPoint(
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+)
+{
+ InitAmiLib(ImageHandle, SystemTable);
+ SolPostMessage();
+ return EFI_SUCCESS;
+}
+
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (C)Copyright 1985-2009, 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/AmtWrapper/ASFVerbosity/ASFVerbosity.cif b/Board/EM/MeWrapper/AmtWrapper/ASFVerbosity/ASFVerbosity.cif
new file mode 100644
index 0000000..23ba968
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/ASFVerbosity/ASFVerbosity.cif
@@ -0,0 +1,10 @@
+<component>
+ name = "ASF Verbosity"
+ category = ModulePart
+ LocalRoot = "Board\EM\MEWrapper\AmtWrapper\ASFVerbosity"
+ RefName = "ASFVerbosity"
+[files]
+"ASFVerbosity.mak"
+"ASFVerbosity.sdl"
+"ASFVerbosity.c"
+<endComponent>
diff --git a/Board/EM/MeWrapper/AmtWrapper/ASFVerbosity/ASFVerbosity.mak b/Board/EM/MeWrapper/AmtWrapper/ASFVerbosity/ASFVerbosity.mak
new file mode 100644
index 0000000..64a3a0a
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/ASFVerbosity/ASFVerbosity.mak
@@ -0,0 +1,89 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/AmtWrapper/ASF Verbosity/ASFVerbosity.mak 1 2/08/12 1:10a Klzhan $
+#
+# $Revision: 1 $
+#
+# $Date: 2/08/12 1:10a $
+#
+#**********************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/AmtWrapper/ASF Verbosity/ASFVerbosity.mak $
+#
+# 1 2/08/12 1:10a Klzhan
+# Initial Check in
+#
+# 1 2/25/11 1:44a Klzhan
+# Initial Check-in
+#
+# 1 12/03/10 5:10a Klzhan
+# Initial Check-in.
+#
+#
+#**********************************************************************
+
+#<AMI_FHDR_START>
+#-----------------------------------------------------------------------
+#
+# Name: ASFVerbosity.mak
+#
+# Description: This make file build ASFVerbosity
+# components and link them to respective binary
+#
+#-----------------------------------------------------------------------
+#<AMI_FHDR_END>
+
+all : ASFVERB
+
+BUILD_ASF_VWEBOSITY_DIR = $(BUILD_DIR)\$(ASF_VWEBOSITY_DIR)
+
+#---------------------------------------------------------------------------
+# Generic AMT dependencies
+#---------------------------------------------------------------------------
+$(BUILD_DIR)\ASFVerbosity.mak : $(ASF_VWEBOSITY_DIR)\ASFVerbosity.cif $(BUILD_RULES)
+ $(CIF2MAK) $(ASF_VWEBOSITY_DIR)\ASFVerbosity.cif $(CIF2MAK_DEFAULTS)
+#---------------------------------------------------------------------------
+
+#---------------------------------------------------------------------------
+# Create ASF Verbosity DXE Component
+#---------------------------------------------------------------------------
+ASFVERB: $(BUILD_DIR)\ASFVerbosity.mak ASFVERBBin
+
+ASFVERBBin : $(AMIDXELIB)
+ $(MAKE) /$(MAKEFLAGS) $(BUILD_DEFAULTS)\
+ /f $(BUILD_DIR)\ASFVerbosity.mak all\
+ GUID=4f4ff580-b8a0-4332-a6b0-e2e568e36c9c \
+ ENTRY_POINT=ASFVerbosityEntryPoint \
+ TYPE=BS_DRIVER \
+ 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/AmtWrapper/ASFVerbosity/ASFVerbosity.sdl b/Board/EM/MeWrapper/AmtWrapper/ASFVerbosity/ASFVerbosity.sdl
new file mode 100644
index 0000000..acb2810
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/ASFVerbosity/ASFVerbosity.sdl
@@ -0,0 +1,78 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/AmtWrapper/ASF Verbosity/ASFVerbosity.sdl 1 2/08/12 1:10a Klzhan $
+#
+# $Revision: 1 $
+#
+# $Date: 2/08/12 1:10a $
+#**********************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/AmtWrapper/ASF Verbosity/ASFVerbosity.sdl $
+#
+# 1 2/08/12 1:10a Klzhan
+# Initial Check in
+#
+# 1 2/25/11 1:44a Klzhan
+# Initial Check-in
+#
+# 1 12/03/10 5:10a Klzhan
+# Initial Check-in.
+#
+# 1 10/05/25 5:56p Klzhan
+# Initial Check-in with RC 0.71.
+#
+#**********************************************************************
+
+TOKEN
+ Name = "ASF_VERB_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ TargetH = Yes
+ Master = Yes
+End
+
+PATH
+ Name = "ASF_VWEBOSITY_DIR"
+End
+
+MODULE
+ Help = "Includes AMTSetup.mak to Project"
+ File = "ASFVerbosity.mak"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\ASFVerbosity.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End
+
+
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/AmtWrapper/AmtLockKBD/AmtInt9.asm b/Board/EM/MeWrapper/AmtWrapper/AmtLockKBD/AmtInt9.asm
new file mode 100644
index 0000000..a40f50e
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/AmtLockKBD/AmtInt9.asm
@@ -0,0 +1,277 @@
+
+ TITLE AMTINT9.ASM -- OEM INTERRUPT IMPLEMENTATION
+
+;*************************************************************************
+;*************************************************************************
+;** **
+;** (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/AmtWrapper/AmtLockKBD/AmtInt9.asm 1 2/08/12 1:10a Klzhan $
+;
+; $Date: 2/08/12 1:10a $
+;
+;****************************************************************************
+; Revision History
+; ----------------
+; $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/AmtWrapper/AmtLockKBD/AmtInt9.asm $
+;
+; 1 2/08/12 1:10a Klzhan
+; Initial Check in
+;
+; 2 7/13/11 4:03a Klzhan
+; Fix Lock KBD can't work without SOL enable.
+;
+; 1 2/25/11 1:45a Klzhan
+; Initial Check-in
+;
+; 1 12/03/10 5:11a Klzhan
+; Initial Check-in.
+;
+;
+;****************************************************************************
+;<AMI_FHDR_START>
+;
+; Name: AMTInt9.asm
+;
+; Description: Hook Int 9 for Legacy Serial Redirection.
+;
+;<AMI_FHDR_END>
+;****************************************************************************
+
+;----------------------------------------------------------------------------
+; INCLUDE FILES
+;----------------------------------------------------------------------------
+include token.equ
+;----------------------------------------------------------------------------
+; EQUATES & STRUCTURES
+;----------------------------------------------------------------------------
+refresh_port equ 61h
+kb_data_port equ 60h ; keyboard data port
+kb_stat_port equ 64h ; keyboard status port
+kbcCMDPort EQU 64h ; Keyboard controller command port
+enKeyboardCMD EQU 0aeh ; Enable keyboard command
+diKeyboardCMD EQU 0adh ; Disable keyboard command
+IBFTimeoutCount EQU 0f000h ; Check keyboart input buffer count
+kbcIBF EQU 00000010b; Keyboard input buffer full
+;----------------------------------------------------------------------------
+; EXTERNS USED
+;----------------------------------------------------------------------------
+
+;----------------------------------------------------------------------------
+; CSMOEM_CSEG S E G M E N T STARTS
+;----------------------------------------------------------------------------
+CSMOEM_CSEG SEGMENT PARA PUBLIC 'CODE' USE16
+ ASSUME cs:CSMOEM_CSEG, ds:CSMOEM_CSEG
+.386p
+;----------------------------------------------------------------------------
+
+OldIntHandler LABEL DWORD
+ IntSegSav dw 0
+ IntOfsSav dw 0
+
+;<AMI_PHDR_START>
+;----------------------------------------------------------------------------
+;
+; Procedure: AMTINT09Proc
+;
+; Description:
+;
+; Input:
+;
+; Output:
+;
+; Modified:
+;
+;----------------------------------------------------------------------------
+;<AMI_PHDR_END>
+AMTINT09Proc PROC NEAR PUBLIC
+ pushf
+ cmp cs:dSredirInterruptPtr, 0
+ jnz lock_local_keyboard
+ popf
+ jmp DWORD PTR cs:[OldIntHandler]
+lock_local_keyboard:
+ push ds
+ push si
+ ; DS:SI = *dSredirInterruptPtr
+ lds si, DWORD PTR cs:dSredirInterruptPtr
+; cmp WORD PTR ds:[si], 0 ; does interrutp come from redirection ?
+ test BYTE PTR ds:[si], 1 ; does interrutp come from redirection ?
+ jz not_serial_redirection_interrupt ; br not redirection interrupt
+ ; jmp to original Int 9 vector to service redirection interrupt
+ pushf
+ push cs
+ push OFFSET returnFromInt9
+ push DWORD PTR cs:OldIntHandler
+ retf
+returnFromInt9:
+; mov WORD PTR ds:[si], 0 ; clear redirection interrupt flag
+ mov BYTE PTR ds:[si], 0 ; clear redirection interrupt flag
+ jmp redirection_return_to_caller
+not_serial_redirection_interrupt:
+ ; do nothing and return to caller.
+ push ax
+ call disable_keyboard
+ call enable_keyboard
+ ; clear EOI
+ mov al, 20h ; end of INT code
+ out 20h, al ; out to INT CONTROLLER port
+ pop ax
+redirection_return_to_caller:
+ pop si
+ pop ds
+ popf
+ retf 2
+
+AMTINT09Proc ENDP
+;<AMI_PHDR_START>
+;----------------------------------------------------------------------------
+; Procedure: CheckKBCController
+;
+; Description: Check KBC controller present.
+;
+; Input: None.
+;
+; Output: None.
+;
+; Modified: ZF = 0 KBC controller present.
+; = 1 No KBC controller.
+;
+; Referrals:
+;
+;----------------------------------------------------------------------------
+;<AMI_PHDR_END>
+CheckKBCController PROC NEAR
+ push ax
+ in al, kb_stat_port
+ cmp al, 0ffh
+ pop ax
+ ret
+CheckKBCController ENDP
+;<AMI_PHDR_START>
+;----------------------------------------------------------------------------
+; Procedure: enable_keyboard
+;
+; Description: Enables KBD interface. Also CPU interrupt will be enabled
+; here.
+;
+; Input: None.
+;
+; Output: None.
+;
+; Modified: AL.
+;
+; Referrals: ib_free.
+;
+;----------------------------------------------------------------------------
+;<AMI_PHDR_END>
+
+enable_keyboard PROC NEAR PUBLIC
+
+ call CheckKBCController
+ jz short Enable_keyboardExit
+ call ib_free ; Wait for input buffer free.
+ mov al, enKeyboardCMD ; CMD to enable KBD interface.
+ out kbcCMDPort, al ; Write command to KBC.
+ call ib_free ; Wait for input buffer free.
+Enable_keyboardExit: ;(BUG4128+)
+ sti
+ ret
+
+enable_keyboard ENDP
+;<AMI_PHDR_START>
+;----------------------------------------------------------------------------
+; Procedure: disable_keyboard
+;
+; Description: Disables KBD interface and reads the data from KBC data port.
+;
+; Input: None.
+;
+; Output: AL - Data read from KBC data port.
+;
+; Modified: AL.
+;
+; Referrals: ib_free.
+;
+;----------------------------------------------------------------------------
+;<AMI_PHDR_END>
+
+disable_keyboard PROC NEAR PUBLIC
+ call CheckKBCController
+ jz short Disable_keyboardExit
+ call ib_free ; Wait for input buffer free.
+ mov al, diKeyboardCMD ; CMD to disable KBD interface.
+ out kbcCMDPort, al ; Write command to KBC.
+ call ib_free ; Wait for input buffer free.
+ in al, kb_data_port ; Read the data.(BUG2673+)
+Disable_keyboardExit: ;
+ ret
+
+disable_keyboard ENDP
+;<AMI_PHDR_START>
+;----------------------------------------------------------------------------
+; Procedure: ib_free
+;
+; Description: This routine waits until the KBC input buffer is free.
+;
+; Input: None.
+;
+; Output: None.
+;
+; Modified: AL.
+;
+; Referrals: None.
+;
+; Notes: DO NOT USE STACK. This routine may be called with RET_SP
+; macro.
+;
+;----------------------------------------------------------------------------
+;<AMI_PHDR_END>
+ib_free PROC NEAR PUBLIC
+ push cx
+ mov cx, IBFTimeoutCount
+IbFreeLp:
+ in al, kb_stat_port
+ call CheckKBCController
+ jz short IbFreeExit
+ out 0ebh, al
+ out 0ebh, al
+ out 0ebh, al
+ test al, kbcIBF
+ loopnz IbFreeLp
+IbFreeExit:
+ pop cx
+ ret
+ib_free ENDP
+
+;----------------------------------------------------------------------------
+LockKeyBoardSignature DB '$LKb'
+dSredirInterruptPtr DD 0
+dLockKBD DD 0
+;----------------------------------------------------------------------------
+; CSMOEM_CSEG S E G M E N T ENDS
+;----------------------------------------------------------------------------
+CSMOEM_CSEG ENDS
+END
+;****************************************************************************
+;****************************************************************************
+;** **
+;** (C)Copyright 1985-2009, 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/AmtWrapper/AmtLockKBD/AmtLockKBD.c b/Board/EM/MeWrapper/AmtWrapper/AmtLockKBD/AmtLockKBD.c
new file mode 100644
index 0000000..aea8c99
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/AmtLockKBD/AmtLockKBD.c
@@ -0,0 +1,507 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/AmtWrapper/AmtLockKBD/AmtLockKBD.c 4 4/30/13 3:35a Tristinchou $
+//
+// $Revision: 4 $
+//
+// $Date: 4/30/13 3:35a $
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/AmtWrapper/AmtLockKBD/AmtLockKBD.c $
+//
+// 4 4/30/13 3:35a Tristinchou
+// [TAG] EIP119188
+// [Category] Bug Fix
+// [Severity] Normal
+// [Symptom] Lock keyboard will be no function
+// [Solution] Lock keyboard directly
+// [Files] AmtLockKBD.c
+//
+// 3 12/11/12 2:40a Klzhan
+// Fix exception error when Secure Boot Enabled.
+//
+// 2 4/24/12 12:45a Klzhan
+// Update module to latest
+//
+// 1 2/08/12 1:10a Klzhan
+// Initial Check in
+//
+// 4 7/24/11 10:12a Klzhan
+// Remove un-used debug message.
+//
+// 3 7/13/11 4:03a Klzhan
+// Fix Lock KBD can't work without SOL enable.
+//
+// 2 6/28/11 7:32a Klzhan
+// Enable Legacy SreDir before getting signature.
+//
+// 1 2/25/11 1:45a Klzhan
+// Initial Check-in
+//
+// 1 12/03/10 5:11a Klzhan
+// Initial Check-in.
+//
+//**********************************************************************
+
+//<AMI_FHDR_START>
+//---------------------------------------------------------------------------
+// Name: AMTLockKBD.c
+//
+// Description: AMT Lock KeyBoard Functions.
+//
+//---------------------------------------------------------------------------
+//<AMI_FHDR_END>
+#include <token.h>
+#include <EFI.h>
+#include <DXE.h>
+#include <AmiDxeLib.h>
+#include <..\Include\Protocol\ConsoleControl.h>
+#if (defined(CSM_SUPPORT) && (CSM_SUPPORT != 0))
+#include "..\core\em\csm\csm.h"
+#endif
+#include "..\Include\Protocol\DevicePath.h"
+#include "..\Include\Protocol\DataHub.h"
+#include "..\Include\Protocol\SimpleTextIn.h"
+#include "..\Include\Protocol\SimpleTextInEx.h"
+#include <ReferenceCode\ME\Protocol\AlertStandardFormat\AlertStandardFormat.h>
+#include "Protocol\LegacySredir.h"
+#include <Protocol\SmmPowerButtonDispatch.h>
+
+//============================================================================
+// Local defines for transaction types
+//============================================================================
+#define EFI_SIGNATURE_16(A,B) ((A) | ((B)<<8))
+#define EFI_SIGNATURE_32(A,B,C,D) \
+ (EFI_SIGNATURE_16((A),(B)) | (EFI_SIGNATURE_16((C),(D)) << 16))
+
+#define AMT_INT9_SIGNATURE EFI_SIGNATURE_32 ('$', 'L', 'K', 'b')
+#define SREDIR_FLAG_SIGNATURE EFI_SIGNATURE_32 ('$', 'S', 'r', 'F')
+
+#define BDS_ALL_DRIVERS_CONNECTED_PROTOCOL_GUID \
+ { 0xdbc9fd21, 0xfad8, 0x45b0, 0x9e, 0x78, 0x27, 0x15, 0x88, 0x67, 0xcc, 0x93 }
+EFI_GUID gBdsAllDriversConnectedProtocolGuid = \
+ BDS_ALL_DRIVERS_CONNECTED_PROTOCOL_GUID;
+EFI_GUID gEfiSimpleTextInExProtocolGuid = \
+ EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_GUID;
+EFI_GUID gEfiSimpleTextInProtocolGuid = EFI_SIMPLE_TEXT_INPUT_PROTOCOL_GUID;
+EFI_GUID ConInStartedProtocolGuid = CONSOLE_IN_DEVICES_STARTED_PROTOCOL_GUID;
+
+#define BDS_CONNECT_DRIVERS_PROTOCOL_GUID \
+ { 0x3aa83745, 0x9454, 0x4f7a, 0xa7, 0xc0, 0x90, 0xdb, 0xd0, 0x2f, 0xab, 0x8e }
+EFI_GUID gEfiSmmPowerButtonDispatchProtocolGuid = \
+ EFI_SMM_POWER_BUTTON_DISPATCH_PROTOCOL_GUID;
+EFI_GUID gBdsConnectDriversProtocolGuid = \
+ BDS_CONNECT_DRIVERS_PROTOCOL_GUID;
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: ClearPowerButtonSmi
+//
+// Description: This routine disables Power Button SMI if Lock Power Button
+// bit of Boot Option BitMask is set.
+//
+// Input: None.
+//
+// Output: None.
+//
+// Notes: None.
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID
+ClearPowerButtonSmi (VOID)
+{
+ UINT32 dPwrMgValue;
+
+ // Read PM_1 Status/Enable Register
+ dPwrMgValue = IoRead32(PM_BASE_ADDRESS);
+ dPwrMgValue |= BIT08; // clear Power Button Status
+ dPwrMgValue &= ~BIT24; // clear Power Button Enable
+ IoWrite32 ( PM_BASE_ADDRESS, dPwrMgValue );
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: DisablePowerButtonSmiEvent
+//
+// Description: This routine disables Power Button SMI if Lock Power Button
+// bit of Boot Option BitMask is set.
+//
+// Input: EFI_EVENT - Event
+// VOID* - Context
+//
+// Output: EFI_STATUS
+//
+// Notes: None.
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS
+DisablePowerButtonSmiEvent (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+{
+ EFI_STATUS Status;
+ EFI_SMM_POWER_BUTTON_DISPATCH_PROTOCOL *PowerButton;
+
+ Status = pBS->LocateProtocol ( &gEfiSmmPowerButtonDispatchProtocolGuid, \
+ NULL, \
+ &PowerButton );
+ if(EFI_ERROR( Status )) return Status;
+
+ ClearPowerButtonSmi();
+
+ pBS->CloseEvent(Event);
+
+ return EFI_SUCCESS;
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: ASFRegisterPowerButtonCallBack
+//
+// Description: This routine register a Protocol Callback for Lock Power Button
+// if Lock Power Button bit of Boot Option BitMask is set.
+//
+// Input: None.
+//
+// Output: None.
+//
+// Notes: None.
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID
+ASFRegisterPowerButtonCallBack (VOID)
+{
+ EFI_STATUS Status = EFI_SUCCESS;
+ EFI_EVENT EvtASFSmmPwrBtn, EvtASFBdsConnectDrivers;
+ VOID *RgnASFSmmPwrBtn, *RgnASFBdsConnectDrivers;
+
+ // Clear Power Button Status before Power Button SMI is registered.
+ Status = RegisterProtocolCallback ( \
+ &gEfiSmmPowerButtonDispatchProtocolGuid, \
+ DisablePowerButtonSmiEvent, \
+ NULL, \
+ &EvtASFSmmPwrBtn, \
+ &RgnASFSmmPwrBtn );
+
+ DisablePowerButtonSmiEvent ( EvtASFSmmPwrBtn, NULL );
+
+ Status = RegisterProtocolCallback ( \
+ &gBdsConnectDriversProtocolGuid, \
+ DisablePowerButtonSmiEvent, \
+ NULL, \
+ &EvtASFBdsConnectDrivers, \
+ &RgnASFBdsConnectDrivers );
+ return ;
+}
+#if (defined(CSM_SUPPORT) && (CSM_SUPPORT != 0))
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: GetLegacyDriverSignaturePtr
+//
+// Description: Aux roution to find the Signature in Legacy Reagon
+//
+// Input:
+//
+// Output:
+//
+// Notes:
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+UINT32
+GetLegacyDriverSignaturePtr (
+ IN UINT32 dStartAddress,
+ IN UINT32 dSize,
+ IN UINT32 dSignature
+)
+{
+ UINT8 *pStartAddr = (UINT8 *)(UINTN)dStartAddress;
+
+ for ( ;(UINTN)pStartAddr < (UINTN)(dStartAddress + dSize); pStartAddr++ )
+ if ( *(UINT32 *)pStartAddr == dSignature ) return ((UINT32)pStartAddr);
+ return FALSE;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: LegacyBiosLockLocalKeyboard
+//
+// Description: Sub-roution lock keyboard.
+//
+// Input:
+//
+// Output:
+//
+// Notes:
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID
+LegacyBiosLockLocalKeyboard (VOID)
+{
+
+ EFI_STATUS Status;
+ UINT32 dAMTInt9Ptr = 0, dSRedirFlagPtr = 0;
+ EFI_LEGACY_BIOS_PROTOCOL *LegacyBios;
+ BIOS_INFO *Private;
+
+ // Get AMT Int 9h signature pointer.
+ dAMTInt9Ptr = GetLegacyDriverSignaturePtr ( \
+ 0xe0000, 0x20000, AMT_INT9_SIGNATURE );
+ // Get Legacy Serial Redirection Flag signature pointer.
+ dSRedirFlagPtr = GetLegacyDriverSignaturePtr ( \
+ 0x90000, 0x10000, SREDIR_FLAG_SIGNATURE );
+ if ( !dAMTInt9Ptr ) return ;
+ // Locate Legacy Bios Protocol for lock/unlock shadow ram.
+ Status = pBS->LocateProtocol ( &gEfiLegacyBiosProtocolGuid, \
+ NULL, \
+ &LegacyBios );
+ if ( EFI_ERROR( Status ) ) return;
+ Private = (BIOS_INFO *) LegacyBios;
+ // Unlock Shadow ram.
+ Private->iRegion->UnLock ( Private->iRegion, 0xE0000, 0x20000, NULL );
+ // Update Legacy Serial Redirection Flag pointer to AMT Int 9h.
+ if(!dSRedirFlagPtr)
+ dSRedirFlagPtr = (dAMTInt9Ptr + 4);
+ *(UINT32*)(dAMTInt9Ptr + 4) = (UINT32)(((UINTN)dSRedirFlagPtr & 0xFFFF) + \
+ (((UINTN)dSRedirFlagPtr & 0xF0000) << 12) + \
+ sizeof ( SREDIR_FLAG_SIGNATURE ));
+ // Lock Shadow ram.
+ Private->iRegion->Lock ( Private->iRegion, 0xE0000, 0x20000, NULL );
+
+}
+#endif
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: EventAllConsoleDevicesStarted
+//
+// Description: Sub-Roution to check if need disable keyboard or not
+// from IntelAMT extersion ASF Boot Option Message.
+//
+// Input:
+//
+// Output:
+//
+// Notes:
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID
+EventAllConsoleDevicesStarted
+(
+ IN EFI_EVENT Event,
+ IN VOID *Context
+)
+{
+ EFI_STATUS Status;
+ EFI_HANDLE *SimpleTextInHandle;
+ UINTN HandleNum, Index;
+ EFI_DEVICE_PATH_PROTOCOL *DevicePathNode;
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;
+ EFI_SIMPLE_TEXT_INPUT_PROTOCOL *SimpleTextIn;
+ EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *SimpleTextInEx;
+ PCI_DEVICE_PATH *PciDevicePath;
+ EFI_GUID gEfiAlertStandardFormatProtocolGuid = EFI_ALERT_STANDARD_FORMAT_PROTOCOL_GUID;
+ EFI_ALERT_STANDARD_FORMAT_PROTOCOL *Asf;
+ EFI_ASF_BOOT_OPTIONS *mAsfBootOptions;
+
+ Status = pBS->LocateProtocol (
+ &gEfiAlertStandardFormatProtocolGuid,
+ NULL,
+ &Asf
+ );
+
+ if (EFI_ERROR (Status)) {
+ return;
+ }
+
+ Status = Asf->GetBootOptions (Asf, &mAsfBootOptions);
+ // If not Lock keyboard, return !!
+ if(!((mAsfBootOptions->BootOptions) & 0x20))
+ return;
+
+ // 2. Uninstall all the console spliter drivers except SOL.
+ // Locate Simple Text Input Protocol Handle Buffer.
+ Status = pBS->LocateHandleBuffer ( ByProtocol, \
+ &gEfiSimpleTextInProtocolGuid, \
+ NULL, \
+ &HandleNum, \
+ &SimpleTextInHandle );
+ if ( EFI_ERROR ( Status ) ) return ;
+
+ // Search USB keyboard and Generic PS2 Keyboard Device Path.
+ for ( Index = 0; Index < HandleNum; Index++ ) {
+
+ // Locate Simple Text Input Protocol.
+ Status = pBS->HandleProtocol ( SimpleTextInHandle[Index], \
+ &gEfiDevicePathProtocolGuid, \
+ (VOID *)&DevicePath );
+ if ( EFI_ERROR ( Status ) ) continue;
+
+ DevicePathNode = DevicePath;
+ while ( !isEndNode ( DevicePathNode ) ) {
+ PciDevicePath = (PCI_DEVICE_PATH *) DevicePathNode;
+ // Is USB Device Path or Generic SIO Device Path (SouthBridge)?
+ if ((( DevicePathNode->Type == MESSAGING_DEVICE_PATH ) && \
+ ( DevicePathNode->SubType == MSG_USB_DP )) || \
+ (( DevicePathNode->Type == HARDWARE_DEVICE_PATH ) && \
+ ( DevicePathNode->SubType == HW_PCI_DP ) && \
+ ( PciDevicePath->Device == 0x1f ) && \
+ ( PciDevicePath->Function == 0 ))) {
+
+ // Locate Simple Text Input Protocol.
+ Status = pBS->HandleProtocol ( SimpleTextInHandle[Index], \
+ &gEfiSimpleTextInProtocolGuid, \
+ (VOID **)&SimpleTextIn );
+ if ( EFI_ERROR ( Status ) ) break;
+
+ // Uninstall Simple Text Input Protocol for stopping keyboard.
+ Status = pBS->UninstallProtocolInterface ( \
+ SimpleTextInHandle[Index], \
+ &gEfiSimpleTextInProtocolGuid, \
+ SimpleTextIn );
+ if ( EFI_ERROR ( Status ) ) break;
+
+ // Locate Simple Text Input EX Protocol.
+ Status = pBS->HandleProtocol ( \
+ SimpleTextInHandle[Index], \
+ &gEfiSimpleTextInExProtocolGuid, \
+ (VOID **)&SimpleTextInEx );
+ if ( EFI_ERROR ( Status ) ) break;
+
+ // Uninstall Simple Text Input EX Protocol for stopping
+ // SIO keyboard.
+ Status = pBS->UninstallProtocolInterface ( \
+ SimpleTextInHandle[Index], \
+ &gEfiSimpleTextInExProtocolGuid, \
+ SimpleTextInEx );
+ break;
+ }
+ DevicePathNode = NEXT_NODE ( DevicePathNode );
+ }
+ }
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: LockLegacyKBD
+//
+// Description: Sub-Roution to check if need disable keyboard or not
+// from IntelAMT extersion ASF Boot Option Message.
+//
+// Input:
+//
+// Output:
+//
+// Notes:
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID
+LockLegacyKBD
+(
+ IN EFI_EVENT Event,
+ IN VOID *Context
+)
+{
+ // 1. Hook Int 9h for locking local keyboard but keep the Legacy SOL
+ // working in CSM and Legacy OS.
+#if (defined(CSM_SUPPORT) && (CSM_SUPPORT != 0))
+ LegacyBiosLockLocalKeyboard ();
+#endif
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: AMTLOCKKBDEntryPoint
+//
+// Description: Lock keyboard Entrypoint.
+//
+// Input:
+//
+// Output:
+//
+// Notes:
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS AMTLOCKKBDEntryPoint(
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+)
+{
+ EFI_STATUS Status;
+ EFI_EVENT ConInConnectEvt;
+ VOID *ConInNotifyReg;
+ EFI_EVENT ConInExConnectEvt;
+ VOID *ConInExNotifyReg;
+ EFI_EVENT AllDriverConnectEvt;
+ VOID *AllDriverExNotifyReg;
+
+ EFI_GUID gEfiAlertStandardFormatProtocolGuid = EFI_ALERT_STANDARD_FORMAT_PROTOCOL_GUID;
+ EFI_ALERT_STANDARD_FORMAT_PROTOCOL *Asf;
+ EFI_ASF_BOOT_OPTIONS *mAsfBootOptions;
+
+ InitAmiLib(ImageHandle, SystemTable);
+ Status = pBS->LocateProtocol (&gEfiAlertStandardFormatProtocolGuid, \
+ NULL, &Asf );
+ if (EFI_ERROR (Status)) return Status;
+
+ Status = Asf->GetBootOptions (Asf, &mAsfBootOptions);
+ if (EFI_ERROR (Status)) return Status;
+
+ // If not Lock keyboard, return !!
+ if (mAsfBootOptions->BootOptions & 0x20) {
+
+ Status = RegisterProtocolCallback(
+ &gEfiSimpleTextInExProtocolGuid,
+ EventAllConsoleDevicesStarted,
+ NULL,
+ &ConInExConnectEvt,
+ &ConInExNotifyReg);
+
+ Status = RegisterProtocolCallback(
+ &gEfiSimpleTextInProtocolGuid,
+ EventAllConsoleDevicesStarted,
+ NULL,
+ &ConInConnectEvt,
+ &ConInNotifyReg);
+
+ Status = RegisterProtocolCallback(
+ &gBdsAllDriversConnectedProtocolGuid,
+ LockLegacyKBD,
+ NULL,
+ &AllDriverConnectEvt,
+ &AllDriverExNotifyReg);
+
+ }
+ if (mAsfBootOptions->BootOptions & 0x2) ASFRegisterPowerButtonCallBack ();
+ 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/AmtWrapper/AmtLockKBD/AmtLockKBD.cif b/Board/EM/MeWrapper/AmtWrapper/AmtLockKBD/AmtLockKBD.cif
new file mode 100644
index 0000000..33e5afa
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/AmtLockKBD/AmtLockKBD.cif
@@ -0,0 +1,13 @@
+<component>
+ name = "AmtLockKBD"
+ category = ModulePart
+ LocalRoot = "Board\EM\MeWrapper\AmtWrapper\AmtLockKBD\"
+ RefName = "AmtLockKBD"
+[files]
+"AmtLockKBD.sdl"
+"AmtLockKBD.mak"
+"AmtLockKBD.c"
+"AmtLockKBD.h"
+"AmtLockKBD.dxs"
+"AmtInt9.asm"
+<endComponent>
diff --git a/Board/EM/MeWrapper/AmtWrapper/AmtLockKBD/AmtLockKBD.dxs b/Board/EM/MeWrapper/AmtWrapper/AmtLockKBD/AmtLockKBD.dxs
new file mode 100644
index 0000000..87b05c8
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/AmtLockKBD/AmtLockKBD.dxs
@@ -0,0 +1,6 @@
+#include <ReferenceCode\ME\Protocol\AlertStandardFormat\AlertStandardFormat.h>
+
+DEPENDENCY_START
+ EFI_ALERT_STANDARD_FORMAT_PROTOCOL_GUID
+DEPENDENCY_END
+
diff --git a/Board/EM/MeWrapper/AmtWrapper/AmtLockKBD/AmtLockKBD.h b/Board/EM/MeWrapper/AmtWrapper/AmtLockKBD/AmtLockKBD.h
new file mode 100644
index 0000000..6e23ec6
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/AmtLockKBD/AmtLockKBD.h
@@ -0,0 +1,77 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/AmtWrapper/AmtLockKBD/AmtLockKBD.h 1 2/08/12 1:10a Klzhan $
+//
+// $Revision: 1 $
+//
+// $Date: 2/08/12 1:10a $
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/AmtWrapper/AmtLockKBD/AmtLockKBD.h $
+//
+// 1 2/08/12 1:10a Klzhan
+// Initial Check in
+//
+// 1 2/25/11 1:45a Klzhan
+// Initial Check-in
+//
+// 1 12/03/10 5:11a Klzhan
+// Initial Check-in.
+//
+//**********************************************************************
+
+//<AMI_FHDR_START>
+//---------------------------------------------------------------------------
+// Name: AMTLockKBD.h
+//
+// Description: AMT Lock KeyBoard Includes.
+//
+//---------------------------------------------------------------------------
+//<AMI_FHDR_END>
+#ifndef _AMT_INT16_H
+#define _AMT_INT16_H
+
+#include "Tiano.h"
+#include "EfiDriverLib.h"
+#include "Protocol\AmtWrapper\AmtWrapper.h"
+
+#include EFI_PROTOCOL_CONSUMER (AmtWrapper)
+#include EFI_PROTOCOL_CONSUMER (LegacyBios)
+
+#define AMT_INT16_CSM_GUID \
+ {0x6046e678, 0x24ef, 0x4005, 0xba, 0x39, 0xbd, 0xa1, 0x1f, 0x6d, 0x55, 0x5d}
+
+EFI_GUID gEfiFirmwareVolumeProtocolGuid = EFI_FIRMWARE_VOLUME_PROTOCOL_GUID;
+EFI_GUID gAmtInt16CsmGuid = AMT_INT16_CSM_GUID;
+EFI_GUID gLegacyBiosProtocolGuid = EFI_LEGACY_BIOS_PROTOCOL_GUID;
+EFI_GUID gEfiAmtWrapperProtocolGuid = EFI_AMT_WRAPPER_PROTOCOL_GUID;
+EFI_GUID gEfiEventReadyToBootGuid = EFI_EVENT_GROUP_READY_TO_BOOT;
+
+#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/AmtWrapper/AmtLockKBD/AmtLockKBD.mak b/Board/EM/MeWrapper/AmtWrapper/AmtLockKBD/AmtLockKBD.mak
new file mode 100644
index 0000000..0680ae3
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/AmtLockKBD/AmtLockKBD.mak
@@ -0,0 +1,88 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/AmtWrapper/AmtLockKBD/AmtLockKBD.mak 1 2/08/12 1:10a Klzhan $
+#
+# $Revision: 1 $
+#
+# $Date: 2/08/12 1:10a $
+#**********************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/AmtWrapper/AmtLockKBD/AmtLockKBD.mak $
+#
+# 1 2/08/12 1:10a Klzhan
+# Initial Check in
+#
+# 1 2/25/11 1:45a Klzhan
+# Initial Check-in
+#
+# 1 12/03/10 5:11a Klzhan
+# Initial Check-in.
+#
+#**********************************************************************
+
+#<AMI_FHDR_START>
+#---------------------------------------------------------------------------
+# Name: AMTLockKBD.mak
+#
+# Description: AMT Lock KeyBoard.
+#
+#---------------------------------------------------------------------------
+#<AMI_FHDR_END>
+all : AMTLOCKKBD $(BUILD_DIR)\AmtInt9.obj
+
+AMT_LOCKKBD_BUILD_DIR = $(BUILD_DIR)\$(AmtLockKBD_DIR)
+
+#---------------------------------------------------------------------------
+# Generic AMT dependencies
+#---------------------------------------------------------------------------
+$(BUILD_DIR)\AmtLockKBD.mak : $(AmtLockKBD_DIR)\AmtLockKBD.cif $(BUILD_RULES)
+ $(CIF2MAK) $(AmtLockKBD_DIR)\AmtLockKBD.cif $(CIF2MAK_DEFAULTS)
+
+$(BUILD_DIR)\AmtInt9.obj: $(AmtLockKBD_DIR)\AmtInt9.asm
+ $(ASM16) /c /nologo /Fo$(BUILD_DIR)\ $(AmtLockKBD_DIR)\AmtInt9.asm
+
+#---------------------------------------------------------------------------
+
+AMT_LOCKKBD_OBJECTS = \
+$(BUILD_DIR)\$(AmtLockKBD_DIR)\AmtLockKBD.obj
+
+#---------------------------------------------------------------------------
+# Create ASF Verbosity DXE Component
+#---------------------------------------------------------------------------
+AMTLOCKKBD: $(BUILD_DIR)\AmtLockKBD.mak AMTLOCKKBDBin
+
+AMTLOCKKBDBin : $(AMIDXELIB)
+ $(MAKE) /$(MAKEFLAGS) $(BUILD_DEFAULTS)\
+ /f $(BUILD_DIR)\AmtLockKBD.mak all\
+ MAKEFILE=$(BUILD_DIR)\AmtLockKBD.mak \
+ OBJECTS="$(AMT_LOCKKBD_OBJECTS)" \
+ GUID=5507247A-846B-4f22-B55F-72B4049435EF \
+ ENTRY_POINT=AMTLOCKKBDEntryPoint \
+ TYPE=BS_DRIVER \
+ COMPRESS=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/AmtWrapper/AmtLockKBD/AmtLockKBD.sdl b/Board/EM/MeWrapper/AmtWrapper/AmtLockKBD/AmtLockKBD.sdl
new file mode 100644
index 0000000..ad810bd
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/AmtLockKBD/AmtLockKBD.sdl
@@ -0,0 +1,38 @@
+TOKEN
+ Name = "AmtLockKBD_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable AmtInt16 support in Project"
+End
+
+MODULE
+ Help = "Includes AmtInt16.mak to Project"
+ File = "AmtLockKBD.mak"
+End
+
+PATH
+ Name = "AmtLockKBD_DIR"
+End
+
+ELINK
+ Name = "AMTINT09Proc"
+ Parent = "CsmOemInterrupts"
+ ProcID = 09h
+ SrcFile = "Board\EM\MEWrapper\AmtWrapper\Dxe\AmtInt9.asm"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\AmtInt9.obj"
+ Parent = "CSM_OEMINT_OBJS"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\AmtLockKBD.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End \ No newline at end of file
diff --git a/Board/EM/MeWrapper/AmtWrapper/AmtPetAlert/AmtPetAlert.c b/Board/EM/MeWrapper/AmtWrapper/AmtPetAlert/AmtPetAlert.c
new file mode 100644
index 0000000..774d8f9
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/AmtPetAlert/AmtPetAlert.c
@@ -0,0 +1,863 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/AmtWrapper/AmtPetAlert/AmtPetAlert.c 8 6/18/14 3:16a Larryliu $
+//
+// $Revision: 8 $
+//
+// $Date: 6/18/14 3:16a $
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/AmtWrapper/AmtPetAlert/AmtPetAlert.c $
+//
+// 8 6/18/14 3:16a Larryliu
+// [TAG] EIP173999
+// [Category] Improvement
+// [Description] [HWR]Remove useless comments from Intel ME
+// component.(except RC)
+// [Files] AmtPetAlert.c
+//
+// 6 5/14/14 9:38p Tristinchou
+// [TAG] EIP160730
+// [Category] Improvement
+// [Description] Remove the variable runtime attribute and keep original
+// attributes.
+//
+// 5 12/25/12 12:56a Klzhan
+// Fix AMT_TC007 fail.
+//
+// 4 11/07/12 8:45a Klzhan
+// Improvement : Set Booted HDD as expected Boot device
+//
+// 3 9/19/12 6:58a Klzhan
+// Correct PET Alert behavior.
+//
+// 2 6/05/12 2:33a Klzhan
+// [TAG] EIP90325
+// [Category] Improvement
+// [Description] To pass Win8 SCT test.
+//
+// 1 2/08/12 1:10a Klzhan
+// Initial Check in
+//
+// 2 6/30/11 5:49a Klzhan
+// Fix AMT TC007 fail with Fixed bootorder.
+//
+// 1 2/25/11 1:45a Klzhan
+// Initial Check-in
+//
+// 1 12/03/10 5:11a Klzhan
+// Initial Check-in.
+//
+//**********************************************************************
+
+//<AMI_FHDR_START>
+//---------------------------------------------------------------------------
+// Name: AmtPetAlert.c
+//
+// Description: AMT Pet Alert Functions.
+//
+//---------------------------------------------------------------------------
+//<AMI_FHDR_END>
+#include "AmtPetAlert.h"
+#include <ReferenceCode\ME\Protocol\AlertStandardFormat\AlertStandardFormat.h>
+
+EFI_GUID gEfiAmtWrapperProtocolGuid = EFI_AMT_WRAPPER_PROTOCOL_GUID;
+EFI_GUID gEfiSetupGuid = SETUP_GUID;
+EFI_GUID gEfiGlobalVariableGuid = EFI_GLOBAL_VARIABLE_GUID;
+EFI_GUID gEfiLegacyBiosProtocolGuid = EFI_LEGACY_BIOS_PROTOCOL_GUID;
+EFI_GUID gEfiEventReadyToBootGuid = EFI_EVENT_GROUP_READY_TO_BOOT;
+EFI_GUID gEfiDiskInfoProtocolGuid = EFI_DISK_INFO_PROTOCOL_GUID;
+EFI_GUID gEfiDevicePathProtocolGuid = EFI_DEVICE_PATH_PROTOCOL_GUID;
+EFI_GUID gEfiHeciProtocolGuid = HECI_PROTOCOL_GUID;
+EFI_GUID gEfiBlockIoProtocolGuid = EFI_BLOCK_IO_PROTOCOL_GUID;
+EFI_GUID gEfiSimpleFileSystemProtocolGuid = EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID;
+
+VOID
+InitializeAmtPetAlert (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+)
+{
+ EFI_STATUS Status;
+ EFI_EVENT ReadyToBootEvent;
+ EFI_EVENT LegacyBootEvent;
+
+ EfiInitializeDriverLib (ImageHandle, SystemTable);
+
+ //
+ // Register Ready to Boot Event for AMT Wrapper
+ //
+ Status = EfiCreateEventReadyToBoot(
+ EFI_TPL_CALLBACK,
+ AmtPetAlertReadyToBoot,
+ (VOID *)&ImageHandle,
+ &ReadyToBootEvent
+ );
+
+ Status = EfiCreateEventLegacyBoot(
+ EFI_TPL_CALLBACK,
+ AmtPetAlertLegacyBoot,
+ NULL,
+ &LegacyBootEvent
+ );
+
+ return;
+}
+
+VOID SwapEntries (
+ IN CHAR8 *Data,
+ IN UINT16 Size
+)
+{
+ UINT16 Index;
+ CHAR8 Temp8;
+
+ for (Index = 0; (Index+1) < Size; Index+=2) {
+ Temp8 = Data[Index];
+ Data[Index] = Data[Index + 1];
+ Data[Index + 1] = Temp8;
+ }
+}
+
+CHAR8 *
+ConvertChar16ToChar8 (
+ IN CHAR16 *Src
+)
+{
+ UINTN l;
+ CHAR8 *Output;
+ CHAR8 *Dest;
+ EFI_STATUS Status;
+
+ l = EfiStrLen(Src) + 1;
+ Status = gBS->AllocatePool(
+ EfiBootServicesData,
+ l,
+ &Output
+ );
+ ASSERT_EFI_ERROR(Status);
+
+ Dest = Output;
+ while (*Src) {
+ *Dest++ = (UINT8) (*Src++);
+ }
+ *Dest = 0;
+
+ return Output;
+}
+
+// Example 1: 16 10 0F 6F 02 68 08 FF FF 00 00 40 13 XX XX XX
+// Example 2: 15 10 0F 6F 02 68 10 FF FF 22 00 AA 13 03 03 02
+BOOT_AUDIT_ENTRY PetAlertWithoutChange = {
+ 0x15, 0x10, 0x0F, 0x6F, 0x02, 0x68, 0x08, 0xFF, 0xFF, 0x22, 0x00, 0x40, 0x13, 0x00, 0x00, 0x00
+};
+
+BOOT_AUDIT_ENTRY PetAlertWithChange = {
+ 0x15, 0x10, 0x0F, 0x6F, 0x02, 0x68, 0x10, 0xFF, 0xFF, 0x22, 0x00, 0xAA, 0x13, 0x03, 0x03, 0x02
+};
+
+EFI_STATUS
+SendBaeMessage(
+ BOOT_AUDIT_ENTRY *Buffer
+)
+{
+ EFI_HECI_PROTOCOL *Heci;
+ UINT32 HeciLength;
+ BOOT_AUDIT_ENTRY_PACK Pack;
+ UINT32 MeStatus;
+ EFI_STATUS TempStatus;
+ EFI_STATUS Status;
+
+ gBS->CopyMem(&Pack.Data, Buffer, sizeof(BOOT_AUDIT_ENTRY));
+ Pack.Command = EFI_ASF_MESSAGE_COMMAND_MESSAGE; // 0x04
+ Pack.ByteCount = sizeof(BOOT_AUDIT_ENTRY);
+ HeciLength = sizeof(BOOT_AUDIT_ENTRY_PACK); // length include Command & ByteCount
+
+ Status = gBS->LocateProtocol (
+ &gEfiHeciProtocolGuid,
+ NULL,
+ &Heci
+ );
+ if (!EFI_ERROR(Status)) {
+ TempStatus = Heci->GetMeStatus(&MeStatus);
+ ASSERT_EFI_ERROR(TempStatus);
+
+ //
+ // Only send ASF Push Progress code when ME is ready. Ignore FW Init Status.
+ //
+ if (ME_STATUS_ME_STATE_ONLY(MeStatus) == ME_READY) {
+ Status = Heci->SendMsg(
+ (UINT32*)&Pack,
+ HeciLength,
+ BIOS_ASF_HOST_ADDR,
+ HECI_ASF_MESSAGE_ADDR
+ );
+ if (EFI_ERROR(Status)) {
+
+ }
+ } else {
+
+ }
+ } else {
+
+ }
+
+ return Status;
+}
+
+EFI_STATUS
+PetAlert(
+ UINT8 DeviceType,
+ CHAR8 *HarddriveTag
+)
+{
+ PET_ALERT_CFG PetAlertCfg[4];
+ UINTN VarSize;
+ UINT32 VarAttr;
+ BOOLEAN BootChange = FALSE;
+ EFI_STATUS Status;
+ UINT8 BootHDD = 0, i;
+
+ VarSize = sizeof(PetAlertCfg);
+ Status = gRT->GetVariable (
+ L"PetAlertCfg",
+ &gEfiAmtWrapperProtocolGuid,
+ &VarAttr,
+ &VarSize,
+ &PetAlertCfg
+ );
+ if (EFI_ERROR (Status)) {
+ VarAttr = EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS;
+
+ PetAlertCfg[0].BootQueue = DeviceType;
+ PetAlertCfg[1].BootQueue = DeviceType;
+ PetAlertCfg[2].BootQueue = DeviceType;
+ PetAlertCfg[3].BootQueue = DeviceType;
+
+ if(DeviceType == BBS_TYPE_HARDDRIVE)
+ EfiAsciiStrCpy(PetAlertCfg[0].BootHarddriveTag, HarddriveTag);
+ else
+ EfiAsciiStrCpy(PetAlertCfg[0].BootHarddriveTag, "");
+ EfiAsciiStrCpy(PetAlertCfg[1].BootHarddriveTag, "");
+ EfiAsciiStrCpy(PetAlertCfg[2].BootHarddriveTag, "");
+ EfiAsciiStrCpy(PetAlertCfg[3].BootHarddriveTag, "");
+ BootChange = TRUE;
+ }else
+ {
+ if(DeviceType != BBS_HARDDISK)
+ BootChange = TRUE;
+ else
+ // If Boot HDD, check ModelSerialNumber
+ {
+ // last boot is not HD boot
+ if(PetAlertCfg[0].BootQueue != DeviceType)
+ {
+ BootChange = TRUE;
+ }else
+ {
+ // If this HDD is "excepted" or not
+ for(i = 0 ; i < 4 ; i++)
+ {
+ if((!EfiAsciiStrCmp(HarddriveTag,PetAlertCfg[i].BootHarddriveTag)))
+ BootHDD++;
+ }
+ // Not "Excepted", Set BootChanged
+ if(BootHDD == 0)
+ BootChange = TRUE;
+ }
+ }
+ if((DeviceType == BBS_HARDDISK) && BootChange)
+ PetAlertWithChange.EventData3 = 0x02;
+ // Not Frist Boot, update PET BAE variable.
+ PetAlertCfg[3].BootQueue = PetAlertCfg[2].BootQueue;
+ PetAlertCfg[2].BootQueue = PetAlertCfg[1].BootQueue;
+ PetAlertCfg[1].BootQueue = PetAlertCfg[0].BootQueue;
+ PetAlertCfg[0].BootQueue = DeviceType;
+
+ // Update for HDD string
+ EfiAsciiStrCpy(PetAlertCfg[3].BootHarddriveTag, PetAlertCfg[2].BootHarddriveTag);
+ EfiAsciiStrCpy(PetAlertCfg[2].BootHarddriveTag, PetAlertCfg[1].BootHarddriveTag);
+ EfiAsciiStrCpy(PetAlertCfg[1].BootHarddriveTag, PetAlertCfg[0].BootHarddriveTag);
+ EfiAsciiStrCpy(PetAlertCfg[0].BootHarddriveTag, HarddriveTag);
+ }
+
+ if (BootChange)
+ SendBaeMessage(&PetAlertWithChange);
+ else
+ SendBaeMessage(&PetAlertWithoutChange);
+
+ VarSize = sizeof(PetAlertCfg);
+ Status = gRT->SetVariable (
+ L"PetAlertCfg",
+ &gEfiAmtWrapperProtocolGuid,
+ VarAttr,
+ VarSize,
+ PetAlertCfg
+ );
+
+ return Status;
+}
+
+BOOLEAN
+ComparePathNode(
+ IN EFI_DEVICE_PATH_PROTOCOL *PathNode1,
+ IN EFI_DEVICE_PATH_PROTOCOL *PathNode2
+)
+{
+ BOOLEAN st = FALSE;
+ UINTN Size1, Size2;
+ UINT8 *p1, *p2;
+
+ if (PathNode1 == PathNode2) {
+ st = TRUE;
+ } else if (PathNode1 == NULL) {
+ } else if (PathNode2 == NULL) {
+ } else {
+ Size1 = DevicePathNodeLength(PathNode1);
+ Size2 = DevicePathNodeLength(PathNode2);
+ p1 = (UINT8 *)PathNode1;
+ p2 = (UINT8 *)PathNode2;
+ if ((Size1 == Size2)
+ && (DevicePathType(PathNode1) == DevicePathType(PathNode2))
+ && (EfiCompareMem(p1+1, p2+1, Size1-1) == 0)) {
+ st = TRUE;
+ }
+ }
+
+ return st;
+}
+
+UINT8
+GetDeviceType(
+ IN EFI_DEVICE_PATH_PROTOCOL *DevPath
+ )
+{
+ UINT8 DeviceType = 0;
+ EFI_DEVICE_PATH_PROTOCOL *DevPathNode;
+
+ //
+ // Find HDD Node in BootDevPath
+ //
+ DevPathNode = BdsLibUnpackDevicePath(DevPath);
+ ASSERT (DevPathNode);
+
+ while (!IsDevicePathEnd(DevPathNode)) {
+ if (DevicePathType(DevPathNode) == MEDIA_DEVICE_PATH) {
+ if (DevicePathSubType(DevPathNode) == MEDIA_HARDDRIVE_DP) {
+ DeviceType = BBS_TYPE_HARDDRIVE; // 2
+ break;
+ } else if (DevicePathSubType(DevPathNode) == MEDIA_CDROM_DP) {
+ DeviceType = BBS_TYPE_CDROM; // 3
+ break;
+ } else if (DevicePathSubType(DevPathNode) == MEDIA_FILEPATH_DP) {
+ DeviceType = BBS_TYPE_FLOPPY; // 1
+ break;
+ }
+ }
+ //
+ // Next device path node
+ //
+ DevPathNode = NextDevicePathNode(DevPathNode);
+ }
+
+ return DeviceType;
+}
+
+EFI_DEVICE_PATH_PROTOCOL *
+GetMediaPathNode (
+ IN EFI_DEVICE_PATH_PROTOCOL *DevPath
+)
+{
+ EFI_DEVICE_PATH_PROTOCOL *DevPathNode;
+ EFI_DEVICE_PATH_PROTOCOL *MediaPathNode = NULL;
+
+ //
+ // Find HDD Node in BootDevPath
+ //
+ DevPathNode = BdsLibUnpackDevicePath(DevPath);
+ ASSERT (DevPathNode);
+
+ while (!IsDevicePathEnd(DevPathNode)) {
+ if (DevicePathType(DevPathNode) == MEDIA_FILEPATH_DP) {
+ MediaPathNode = DevPathNode;
+ break;
+ }
+ //
+ // Next device path node
+ //
+ DevPathNode = NextDevicePathNode(DevPathNode);
+ }
+
+ return MediaPathNode;
+}
+
+BOOLEAN
+CompareMediaPathNode(
+ IN EFI_DEVICE_PATH_PROTOCOL *DevPath1,
+ IN EFI_DEVICE_PATH_PROTOCOL *DevPath2
+)
+{
+ EFI_DEVICE_PATH_PROTOCOL *PathNode1;
+ EFI_DEVICE_PATH_PROTOCOL *PathNode2;
+ BOOLEAN st = FALSE;
+
+ PathNode1 = GetMediaPathNode(DevPath1);
+ PathNode2 = GetMediaPathNode(DevPath2);
+ st = ComparePathNode(PathNode1, PathNode2);
+
+ return st;
+}
+
+VOID
+Trim(
+ CHAR8 *sDesc,
+ CHAR8 *sSrc
+)
+{
+ UINTN p1 ,p2;
+ CHAR8 ch;
+ UINTN i,l;
+
+ p1 = 0xFF;
+ p2 = 0xFF;
+ i = 0;
+ for(;;) {
+ ch = *(sSrc+i);
+ if (ch == 0) {
+ break;
+ } else if (ch != 0x20) {
+ p2 = i;
+ if (p1 == 0xFF) {
+ p1 = i;
+ }
+ }
+ i++;
+ }
+
+ l = (p2 - p1) + 1;
+ gBS->CopyMem(sDesc, sSrc+p1, l);
+ *(sDesc+l) = 0;
+}
+
+EFI_STATUS
+GetModelSerialNumber(
+ IN EFI_HANDLE Handle,
+ OUT CHAR8 *ModelSerialNumber
+)
+{
+ EFI_STATUS Status = EFI_NOT_FOUND;
+ EFI_DISK_INFO_PROTOCOL *DiskInfo;
+ IDENTIFY_DATA *IdentifyDriveInfo = NULL;
+ UINT32 BufferSize;
+ CHAR8 ModelNumber[42];
+ CHAR8 SerialNumber[22];
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath = NULL;
+
+ EfiAsciiStrCpy(ModelSerialNumber, "");
+
+ for(;;) {
+ Status = gBS->HandleProtocol(
+ Handle,
+ &gEfiDevicePathProtocolGuid,
+ &DevicePath);
+ if (EFI_ERROR(Status))
+ break;
+
+ Status = gBS->LocateDevicePath (
+ &gEfiDiskInfoProtocolGuid,
+ &DevicePath,
+ &Handle
+ );
+ if (EFI_ERROR (Status)) {
+ break;
+ }
+
+ Status = gBS->HandleProtocol (
+ Handle,
+ &gEfiDiskInfoProtocolGuid,
+ &DiskInfo
+ );
+ if (EFI_ERROR(Status))
+ break;
+
+ Status = gBS->AllocatePool(
+ EfiBootServicesData,
+ sizeof (IDENTIFY_DATA),
+ &IdentifyDriveInfo
+ );
+ if (EFI_ERROR(Status))
+ break;
+
+ gBS->SetMem(IdentifyDriveInfo, sizeof (IDENTIFY_DATA), 0);
+ BufferSize = sizeof (IDENTIFY_DATA);
+ Status = DiskInfo->Identify (
+ DiskInfo,
+ IdentifyDriveInfo,
+ &BufferSize
+ );
+ if (EFI_ERROR(Status))
+ break;
+
+ gBS->CopyMem(SerialNumber, IdentifyDriveInfo->Serial_Number_10, 20);
+ SwapEntries (SerialNumber, 20);
+ SerialNumber[20] = '\0';
+ Trim(SerialNumber, SerialNumber);
+
+ gBS->CopyMem(ModelNumber, IdentifyDriveInfo->Model_Number_27, 40);
+ SwapEntries (ModelNumber, 40);
+ ModelNumber[40] = '\0';
+ Trim(ModelNumber, ModelNumber);
+
+ EfiAsciiStrCpy(ModelSerialNumber, ModelNumber);
+ EfiAsciiStrCat(ModelSerialNumber, "_");
+ EfiAsciiStrCat(ModelSerialNumber, SerialNumber);
+
+ Status = EFI_SUCCESS;
+ break;
+ }
+
+ if (IdentifyDriveInfo != NULL)
+ gBS->FreePool(IdentifyDriveInfo);
+
+ return Status;
+}
+
+EFI_DEVICE_PATH_PROTOCOL *
+GetDevicePathFromBBS(
+ UINT8 DeviceType,
+ CHAR8 *ModelSerialNumber
+
+)
+{
+ EFI_LEGACY_BIOS_PROTOCOL *LegacyBios;
+ UINT16 HddCount = 0;
+ HDD_INFO *LocalHddInfo = NULL;
+ UINT16 BbsCount = 0;
+ BBS_TABLE *BbsTable;
+ EFI_STATUS Status;
+ BBS_TABLE *BbsEntry;
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath = NULL;
+ UINTN i;
+ EFI_HANDLE Handle;
+ UINTN DeviceIndex;
+ UINTN DevicePriority;
+
+ Status = gBS->LocateProtocol (&gEfiLegacyBiosProtocolGuid, NULL, &LegacyBios);
+ if (!EFI_ERROR (Status)) {
+ Status = LegacyBios->GetBbsInfo (
+ LegacyBios,
+ &HddCount,
+ &LocalHddInfo,
+ &BbsCount,
+ &BbsTable
+ );
+ if (!EFI_ERROR (Status)) {
+ //
+ // Find match index by prioridy
+ //
+ DeviceIndex = (UINTN)-1;
+ DevicePriority = (UINTN)-1;
+ for (i = 0; i < BbsCount; i++) {
+ BbsEntry = BbsTable+i;
+ if (BbsEntry->BootPriority == BBS_IGNORE_ENTRY)
+ continue;
+ if (BbsEntry->DeviceType == DeviceType) {
+ if (DevicePriority > BbsEntry->BootPriority) {
+ DevicePriority = BbsEntry->BootPriority;
+ DeviceIndex = i;
+ }
+ }
+ }
+
+ //
+ // Get model and serial number
+ //
+ if (DeviceIndex != (UINTN)-1) {
+ BbsEntry = BbsTable + DeviceIndex;
+ Handle = *(VOID**)(&BbsEntry->IBV1);
+ GetModelSerialNumber(Handle, ModelSerialNumber);
+ }
+ }
+ }
+
+ return DevicePath;
+}
+
+EFI_STATUS
+NotifyPetAlert(
+ EFI_EVENT Event,
+ VOID *ParentImageHandle
+)
+{
+ EFI_STATUS Status = EFI_SUCCESS;
+ UINTN i;
+ UINT16 BootCurrent;
+ UINTN VarSize;
+ CHAR16 BootXXXX[16];
+ EFI_LOAD_OPTION *BootOption = NULL;
+ UINT8 *pDP;
+ BBS_BBS_DEVICE_PATH *bDP; // DP for BBS
+ UINTN LegacyBoot = 1;
+ EFI_DEVICE_PATH_PROTOCOL *BootDevicePath = NULL;
+ UINT8 DeviceType;
+ CHAR8 ModelSerialNumber[64];
+ EFI_ASF_BOOT_OPTIONS *mAsfBootOptions;
+ EFI_ALERT_STANDARD_FORMAT_PROTOCOL *Asf;
+ EFI_GUID gEfiAlertStandardFormatProtocolGuid = EFI_ALERT_STANDARD_FORMAT_PROTOCOL_GUID;
+
+ Status = gBS->LocateProtocol (
+ &gEfiAlertStandardFormatProtocolGuid,
+ NULL,
+ &Asf
+ );
+
+ if (EFI_ERROR (Status)) return Status;
+ Status = Asf->GetBootOptions (Asf, &mAsfBootOptions);
+ if (EFI_ERROR (Status)) mAsfBootOptions = NULL;
+
+ EfiAsciiStrCpy(ModelSerialNumber, "");
+
+ //
+ // BootCurrent
+ //
+ VarSize = sizeof (UINT16);
+ Status = gRT->GetVariable (
+ L"BootCurrent",
+ &gEfiGlobalVariableGuid,
+ NULL,
+ &VarSize,
+ &BootCurrent
+ );
+ if (!EFI_ERROR (Status)) {
+ } else {
+ BootCurrent = 0;
+ }
+
+ SPrint(BootXXXX, sizeof(BootXXXX), L"Boot%04x", BootCurrent);
+
+ VarSize = 0;
+ Status = gRT->GetVariable (
+ BootXXXX,
+ &gEfiGlobalVariableGuid,
+ NULL,
+ &VarSize,
+ NULL
+ );
+ if (Status != EFI_BUFFER_TOO_SMALL) {
+ return Status;
+ }
+
+ //
+ // Allocate Memory for BootXXXX
+ //
+ Status = gBS->AllocatePool(
+ EfiBootServicesData,
+ VarSize,
+ &BootOption
+ );
+ ASSERT_EFI_ERROR(Status);
+
+ Status = gRT->GetVariable (
+ BootXXXX,
+ &gEfiGlobalVariableGuid,
+ NULL,
+ &VarSize,
+ BootOption
+ );
+ if (!EFI_ERROR (Status)) {
+ pDP = (UINT8*)(BootOption+1);
+ pDP += (EfiStrLen((CHAR16*)pDP) + 1) * sizeof(CHAR16);
+
+ BootDevicePath = EfiDuplicateDevicePath((EFI_DEVICE_PATH_PROTOCOL *)pDP);
+
+ //
+ // Free Memory for BootXXXX
+ //
+ if (BootOption != NULL) {
+ gBS->FreePool(BootOption);
+ BootOption = NULL;
+ }
+ }
+
+ if (BootDevicePath != NULL) {
+ bDP = (BBS_BBS_DEVICE_PATH *)BootDevicePath;
+ if (bDP->Header.Type == BBS_DEVICE_PATH && bDP->Header.SubType == BBS_BBS_DP) {
+ LegacyBoot = 1;
+ } else {
+ LegacyBoot = 0;
+ }
+ }
+
+ //-------------------------------------------------------------------------
+ // EFI Boot
+ //-------------------------------------------------------------------------
+ if (LegacyBoot == 0) {
+ UINTN HandleCount;
+ EFI_HANDLE *HandleBuffer;
+ EFI_HANDLE Handle;
+ EFI_DEVICE_PATH_PROTOCOL *DPath;
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;
+ EFI_DEVICE_PATH_PROTOCOL *BootDeviceHandle;
+
+ if (BootDevicePath == NULL) {
+ //
+ // Boot to EFI Shell
+ //
+ //Need Save "BootXXXX" in setup when launch entry after add boot option without Save
+ }
+ else {
+ DevicePath = EfiDuplicateDevicePath(BootDevicePath);
+ Status = gBS->LocateDevicePath (
+ &gEfiSimpleFileSystemProtocolGuid,
+ &DevicePath,
+ &BootDeviceHandle
+ );
+ if (EFI_ERROR (Status)) {
+ BootDeviceHandle = NULL;
+ }
+
+ Status = gBS->LocateHandleBuffer (
+ ByProtocol,
+ &gEfiSimpleFileSystemProtocolGuid,
+ NULL,
+ &HandleCount,
+ &HandleBuffer
+ );
+ if (!EFI_ERROR (Status)) {
+ for (i = 0; i < HandleCount; i ++) {
+ BOOLEAN st;
+
+ Handle = HandleBuffer[i];
+ Status = gBS->HandleProtocol (
+ Handle,
+ &gEfiDevicePathProtocolGuid,
+ &DPath
+ );
+ if (!EFI_ERROR (Status)) {
+ //
+ // !!! CompareMedia only work with HDD & CD-ROM !!!
+ //
+ st = CompareMediaPathNode(BootDevicePath, DPath);
+ if (st == FALSE) {
+ //
+ // for USB MassStorage
+ //
+ if (Handle == BootDeviceHandle) {
+ st = TRUE;
+ }
+ }
+
+ if (st) {
+ DeviceType = GetDeviceType(BootDevicePath);
+
+ if (DeviceType == BBS_TYPE_HARDDRIVE) {
+ GetModelSerialNumber(Handle, ModelSerialNumber);
+ } else {
+ EfiAsciiStrCpy(ModelSerialNumber, "");
+ }
+ PetAlert(DeviceType, ModelSerialNumber);
+ }
+ }
+ }
+ if (HandleBuffer != NULL) {
+ gBS->FreePool (HandleBuffer);
+ }
+ }
+ }
+ }
+ //-------------------------------------------------------------------------
+ // Legacy Boot
+ //-------------------------------------------------------------------------
+ else {
+ if (BootDevicePath != NULL) {
+ bDP = (BBS_BBS_DEVICE_PATH *)BootDevicePath;
+ DeviceType = (UINT8) bDP->DeviceType;
+ } else {
+ DeviceType = BBS_TYPE_HARDDRIVE;
+ }
+ if ((mAsfBootOptions != NULL) && (mAsfBootOptions->SubCommand == 0x16)) {
+ switch (mAsfBootOptions->SpecialCommand ) {
+ case 1: DeviceType = BBS_TYPE_EMBEDDED_NETWORK;
+ break;
+ case 2:
+ case 3: DeviceType = BBS_TYPE_HARDDRIVE;
+ break;
+ case 5: DeviceType = BBS_TYPE_CDROM;
+ break;
+ }
+ }
+
+ switch (DeviceType) {
+ case BBS_TYPE_EMBEDDED_NETWORK:
+ case BBS_TYPE_FLOPPY:
+ case BBS_TYPE_CDROM:
+ PetAlert(DeviceType, NULL);
+ break;
+
+ case BBS_TYPE_HARDDRIVE:
+ GetDevicePathFromBBS(BBS_TYPE_HARDDRIVE, ModelSerialNumber);
+ PetAlert(DeviceType, ModelSerialNumber);
+ break;
+
+ default:
+ //
+ // Add code for process if run here
+ //
+ PetAlert(DeviceType, NULL);
+ break;
+ }
+ }
+
+ return Status;
+}
+
+EFI_STATUS
+AmtPetAlertReadyToBoot(
+ EFI_EVENT Event,
+ VOID *ParentImageHandle
+)
+{
+ EFI_STATUS Status = EFI_SUCCESS;
+
+ Status = NotifyPetAlert(Event, ParentImageHandle);
+
+ return Status;
+}
+
+EFI_STATUS
+AmtPetAlertLegacyBoot(
+ EFI_EVENT Event,
+ VOID *ParentImageHandle
+)
+{
+ EFI_STATUS Status = EFI_SUCCESS;
+
+ return Status;
+}
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/AmtWrapper/AmtPetAlert/AmtPetAlert.cif b/Board/EM/MeWrapper/AmtWrapper/AmtPetAlert/AmtPetAlert.cif
new file mode 100644
index 0000000..d346ae9
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/AmtPetAlert/AmtPetAlert.cif
@@ -0,0 +1,14 @@
+<component>
+ name = "AmtPetAlert"
+ category = ModulePart
+ LocalRoot = "Board\EM\MeWrapper\AmtWrapper\AmtPetAlert\"
+ RefName = "AmtPetAlert"
+[files]
+"AmtPetAlert.sdl"
+"AmtPetAlert.mak"
+"AmtPetAlert.c"
+"AmtPetAlert.h"
+"AmtPetAlert.dxs"
+"DevicePath.h"
+"DevicePath.c"
+<endComponent>
diff --git a/Board/EM/MeWrapper/AmtWrapper/AmtPetAlert/AmtPetAlert.dxs b/Board/EM/MeWrapper/AmtWrapper/AmtPetAlert/AmtPetAlert.dxs
new file mode 100644
index 0000000..29ac1c9
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/AmtPetAlert/AmtPetAlert.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/AmtWrapper/AmtPetAlert/AmtPetAlert.dxs 1 2/08/12 1:10a Klzhan $
+//
+// $Revision: 1 $
+//
+// $Date: 2/08/12 1:10a $
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/AmtWrapper/AmtPetAlert/AmtPetAlert.dxs $
+//
+// 1 2/08/12 1:10a Klzhan
+// Initial Check in
+//
+// 1 2/25/11 1:45a Klzhan
+// Initial Check-in
+//
+// 1 12/03/10 5:11a Klzhan
+// Initial Check-in.
+//
+//**********************************************************************
+
+//<AMI_FHDR_START>
+//---------------------------------------------------------------------------
+// Name: AmtPeiAlert.dxs
+//
+// Description: This file is the dependency file for AmtPetAlert driver.
+//
+//---------------------------------------------------------------------------
+//<AMI_FHDR_END>
+#include <Protocol\Variable.h>
+
+#include EFI_PROTOCOL_DEFINITION (ActiveManagement)
+#include EFI_PROTOCOL_DEFINITION (Heci)
+
+DEPENDENCY_START
+ EFI_HECI_PROTOCOL_GUID AND
+ EFI_ACTIVE_MANAGEMENT_PROTOCOL_GUID AND
+ EFI_VARIABLE_ARCH_PROTOCOL_GUID AND
+ EFI_VARIABLE_WRITE_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 **
+//** **
+//*************************************************************************
+//*************************************************************************
diff --git a/Board/EM/MeWrapper/AmtWrapper/AmtPetAlert/AmtPetAlert.h b/Board/EM/MeWrapper/AmtWrapper/AmtPetAlert/AmtPetAlert.h
new file mode 100644
index 0000000..de37961
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/AmtPetAlert/AmtPetAlert.h
@@ -0,0 +1,205 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/AmtWrapper/AmtPetAlert/AmtPetAlert.h 1 2/08/12 1:10a Klzhan $
+//
+// $Revision: 1 $
+//
+// $Date: 2/08/12 1:10a $
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/AmtWrapper/AmtPetAlert/AmtPetAlert.h $
+//
+// 1 2/08/12 1:10a Klzhan
+// Initial Check in
+//
+// 1 2/25/11 1:45a Klzhan
+// Initial Check-in
+//
+// 1 12/03/10 5:11a Klzhan
+// Initial Check-in.
+//
+//**********************************************************************
+
+//<AMI_FHDR_START>
+//---------------------------------------------------------------------------
+// Name: AmtPetAlert.h
+//
+// Description: Header file of AmtPetAlert module.
+//
+//---------------------------------------------------------------------------
+//<AMI_FHDR_END>
+#ifndef __AMT_PET_ALERT_H__
+#define __AMT_PET_ALERT_H__
+
+#include "Tiano.h"
+#include "EfiDriverLib.h"
+#include "EfiPrintLib.h"
+#include "EfiCommonLib.h"
+#include "Amt.h"
+#include "EfiScriptLib.h"
+#include "AmtLib.h"
+#include "MeLib.h"
+#include "Include\Protocol\PDiskInfo.h"
+#include "DevicePath.h"
+#include "HeciRegs.h"
+
+#include EFI_PROTOCOL_CONSUMER (AmtPlatformPolicy)
+#include EFI_PROTOCOL_CONSUMER (AmtWrapper)
+#include EFI_PROTOCOL_CONSUMER (DiskInfo)
+#include EFI_PROTOCOL_CONSUMER (Heci)
+#include EFI_PROTOCOL_CONSUMER (BlockIo)
+#include EFI_PROTOCOL_CONSUMER (SimpleFileSystem)
+#include EFI_PROTOCOL_DEFINITION (LegacyBios)
+#include EFI_GUID_DEFINITION (GlobalVariable)
+
+#define SETUP_GUID { 0xEC87D643, 0xEBA4, 0x4BB5, 0xA1, 0xE5, 0x3F, 0x3E, 0x36, 0xB2, 0x0D, 0xA9 }
+//#define EFI_GLOBAL_VARIABLE_GUID { 0x8BE4DF61, 0x93CA, 0x11D2, 0xAA, 0x0D, 0x00, 0xE0, 0x98, 0x03, 0x2B, 0x8C }
+
+// Based on ATA/ATAPI-6
+typedef struct _IDENTIFY_DATA{
+
+ UINT16 General_Config_0;
+ UINT16 Reserved_1;
+ UINT16 Special_Config_2;
+ UINT16 Reserved_3;
+ UINT16 Reserved_4;
+ UINT16 Reserved_5;
+ UINT16 Reserved_6;
+ UINT16 Reserved_7;
+ UINT16 Reserved_8;
+ UINT16 Reserved_9;
+ UINT8 Serial_Number_10[20];
+ UINT16 Reserved_20;
+ UINT16 Reserved_21;
+ UINT16 Reserved_22;
+ UINT8 Firmware_Revision_23[8];
+ UINT8 Model_Number_27[40];
+ UINT16 Maximum_Sector_Multiple_Command_47;
+ UINT16 Reserved_48;
+ UINT16 Capabilities_49;
+ UINT16 Capabilities_50;
+ UINT16 PIO_Mode_51;
+ UINT16 Reserved_52;
+ UINT16 Valid_Bits_53;
+ UINT16 Reserved_54_58[5];
+ UINT16 Valid_Bits_59;
+ UINT32 Addressable_Sector_60;
+ UINT16 SingleWord_DMA_62;
+ UINT16 MultiWord_DMA_63;
+ UINT16 PIO_Mode_64;
+ UINT16 Min_Multiword_DMA_timing_65;
+ UINT16 Manuf_Multiword_DMA_timing_66;
+ UINT16 Min_PIO_Mode_timing_67;
+ UINT16 Min_PIO_Mode_timing_68;
+ UINT16 Reserved_69_74[6];
+ UINT16 Queue_Depth_75;
+ UINT16 Reserved_76_79[4];
+ UINT16 Major_Revision_80;
+ UINT16 Minor_Revision_81;
+ UINT16 Command_Set_Supported_82;
+ UINT16 Command_Set_Supported_83;
+ UINT16 Command_Set_Supported_84;
+ UINT16 Command_Set_Enabled_85;
+ UINT16 Command_Set_Enabled_86;
+ UINT16 Command_Set_Enabled_87;
+ UINT16 UDMA_Mode_88;
+ UINT16 Time_security_Earse_89;
+ UINT16 Time_Esecurity_Earse_90;
+ UINT16 Current_Power_Level_91;
+ UINT16 Master_Password_Rev_92;
+ UINT16 Hard_Reset_Value_93;
+ UINT16 Acoustic_Level_94;
+ UINT16 Reserved_95_99[5];
+ UINT64 LBA_48;
+ UINT16 Reserved_104_126[23];
+ UINT16 Status_Notification_127;
+ UINT16 Security_Status_128;
+ UINT16 Reserved_129_159[31];
+ UINT16 CFA_Power_Mode_160;
+ UINT16 Reserved_161_175[15];
+ UINT16 Media_Serial_Number_176_205[30];
+ UINT16 Reserved_206_254[49];
+ UINT16 Checksum_255;
+} IDENTIFY_DATA;
+
+#pragma pack(push,1)
+typedef struct {
+ UINT32 Attributes;
+ UINT16 FilePathListLength;
+} EFI_LOAD_OPTION;
+
+// Example 1: 16 10 0F 6F 02 68 08 FF FF 00 00 40 13 XX XX XX
+// Example 2: 15 10 0F 6F 02 68 10 FF FF 22 00 AA 13 03 03 02
+
+typedef struct {
+ UINT8 SubCommand; // 0x00
+ UINT8 VersionNumber; // 0x01
+ UINT8 EventSensorType; // 0x02
+ UINT8 EventType; // 0x03
+ UINT8 EventOffset; // 0x04
+ UINT8 EventSourceType; // 0x05
+ UINT8 EventSeverity; // 0x06
+ UINT8 SensorDevice; // 0x07
+ UINT8 Sensornumber; // 0x08
+ UINT8 Entity; // 0x09
+ UINT8 EntityInstance; // 0x0A
+ UINT8 EventData1; // 0x0B
+ UINT8 EventData2; // 0x0C
+ UINT8 EventData3; // 0x0D
+ UINT8 EventData4; // 0x0E
+ UINT8 EventData5; // 0x0F
+} BOOT_AUDIT_ENTRY;
+
+typedef struct {
+ UINT8 Command;
+ UINT8 ByteCount;
+ BOOT_AUDIT_ENTRY Data;
+} BOOT_AUDIT_ENTRY_PACK;
+
+typedef struct {
+ UINT8 BootQueue;
+ UINT8 BootHarddriveTag[64];
+} PET_ALERT_CFG;
+
+#pragma pack(pop)
+
+EFI_STATUS
+AmtPetAlertReadyToBoot(
+ EFI_EVENT Event,
+ VOID *ParentImageHandle
+);
+
+EFI_STATUS
+AmtPetAlertLegacyBoot(
+ EFI_EVENT Event,
+ VOID *ParentImageHandle
+);
+
+#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/AmtWrapper/AmtPetAlert/AmtPetAlert.mak b/Board/EM/MeWrapper/AmtWrapper/AmtPetAlert/AmtPetAlert.mak
new file mode 100644
index 0000000..cf5d5a4
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/AmtPetAlert/AmtPetAlert.mak
@@ -0,0 +1,82 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/AmtWrapper/AmtPetAlert/AmtPetAlert.mak 1 2/08/12 1:10a Klzhan $
+#
+# $Revision: 1 $
+#
+# $Date: 2/08/12 1:10a $
+#**********************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/AmtWrapper/AmtPetAlert/AmtPetAlert.mak $
+#
+# 1 2/08/12 1:10a Klzhan
+# Initial Check in
+#
+# 1 2/25/11 1:45a Klzhan
+# Initial Check-in
+#
+# 1 12/03/10 5:11a Klzhan
+# Initial Check-in.
+#
+#**********************************************************************
+#
+#<AMI_FHDR_START>
+#---------------------------------------------------------------------------
+# Name: AmtPetAlert.mak
+#
+# Description: Makefile for AMT Pet Alert Module.
+#
+#---------------------------------------------------------------------------
+#<AMI_FHDR_END>
+#---------------------------------------------------------------------------
+# Create AMT PET Alert Screens
+#---------------------------------------------------------------------------
+All : AmtPetAlert
+
+AmtPetAlert : $(BUILD_DIR)\AmtPetAlert.mak AmtPetAlertBin
+
+$(BUILD_DIR)\AmtPetAlert.mak : $(AMT_PET_ALERT_DIR)\$(@B).cif $(AMT_PET_ALERT_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(AMT_PET_ALERT_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+AmtPetAlert_INCLUDES= \
+ $(EDK_INCLUDES) \
+ $(MISCFRAMEWORK_INCLUDES) \
+ $(ME_INCLUDES) \
+ $(IndustryStandard_INCLUDES)\
+
+AmtPetAlertBin : $(EFIDRIVERLIB) $(EDKFRAMEWORKPROTOCOLLIB) $(PRINTLIB) $(EFICOMMONLIB)
+ $(MAKE) /$(MAKEFLAGS) $(EDK_DEFAULTS)\
+ /f $(BUILD_DIR)\AmtPetAlert.mak all \
+ "MY_INCLUDES=$(AmtPetAlert_INCLUDES)"\
+ GUID=290EA249-6E88-423c-B0DA-75CDDE7920CC \
+ TYPE=BS_DRIVER \
+ ENTRY_POINT=InitializeAmtPetAlert \
+ DEPEX1=$(AMT_PET_ALERT_DIR)\AmtPetAlert.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 **
+#** **
+#*************************************************************************
+#************************************************************************* \ No newline at end of file
diff --git a/Board/EM/MeWrapper/AmtWrapper/AmtPetAlert/AmtPetAlert.sdl b/Board/EM/MeWrapper/AmtWrapper/AmtPetAlert/AmtPetAlert.sdl
new file mode 100644
index 0000000..36ac23b
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/AmtPetAlert/AmtPetAlert.sdl
@@ -0,0 +1,24 @@
+TOKEN
+ Name = "AmtPetAlert_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable AMT PET Alert support in Project"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+End
+
+PATH
+ Name = "AMT_PET_ALERT_DIR"
+End
+
+MODULE
+ Help = "Includes AmtPetAlert.mak to Project"
+ File = "AmtPetAlert.mak"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\AmtPetAlert.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End \ No newline at end of file
diff --git a/Board/EM/MeWrapper/AmtWrapper/AmtPetAlert/DevicePath.c b/Board/EM/MeWrapper/AmtWrapper/AmtPetAlert/DevicePath.c
new file mode 100644
index 0000000..0aec0b3
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/AmtPetAlert/DevicePath.c
@@ -0,0 +1,1049 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/AmtWrapper/AmtPetAlert/DevicePath.c 1 2/08/12 1:10a Klzhan $
+//
+// $Revision: 1 $
+//
+// $Date: 2/08/12 1:10a $
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/AmtWrapper/AmtPetAlert/DevicePath.c $
+//
+// 1 2/08/12 1:10a Klzhan
+// Initial Check in
+//
+// 1 2/25/11 1:45a Klzhan
+// Initial Check-in
+//
+// 1 12/03/10 5:11a Klzhan
+// Initial Check-in.
+//
+//**********************************************************************
+//
+//<AMI_FHDR_START>
+//---------------------------------------------------------------------------
+// Name: DevicePath.c
+//
+// Description: DevicePath functions for AMT Pet Alert.
+//
+//---------------------------------------------------------------------------
+//<AMI_FHDR_END>
+#include "DevicePath.h"
+
+EFI_GUID UnknownDeviceGuid = UNKNOWN_DEVICE_GUID;
+
+EFI_GUID mEfiMsgPcAnsiGuid = DEVICE_PATH_MESSAGING_PC_ANSI;
+EFI_GUID mEfiMsgVt100Guid = DEVICE_PATH_MESSAGING_VT_100;
+EFI_GUID mEfiMsgVt100PlusGuid = DEVICE_PATH_MESSAGING_VT_100_PLUS;
+EFI_GUID mEfiMsgVt100Utf8Guid = DEVICE_PATH_MESSAGING_VT_UTF8;
+
+VOID *
+ReallocatePool (
+ IN VOID *OldPool,
+ IN UINTN OldSize,
+ IN UINTN NewSize
+)
+/*++
+
+Routine Description:
+
+ Adjusts the size of a previously allocated buffer.
+
+Arguments:
+
+ OldPool - A pointer to the buffer whose size is being adjusted.
+
+ OldSize - The size of the current buffer.
+
+ NewSize - The size of the new buffer.
+
+Returns:
+
+ EFI_SUCEESS - The requested number of bytes were allocated.
+
+ EFI_OUT_OF_RESOURCES - The pool requested could not be allocated.
+
+ EFI_INVALID_PARAMETER - The buffer was invalid.
+
+--*/
+{
+ VOID *NewPool;
+
+ NewPool = NULL;
+ if (NewSize)
+ {
+ NewPool = EfiLibAllocateZeroPool (NewSize);
+ }
+
+ if (OldPool)
+ {
+ if (NewPool)
+ {
+ EfiCopyMem (NewPool, OldPool, OldSize < NewSize ? OldSize : NewSize);
+ }
+
+ gBS->FreePool (OldPool);
+ }
+
+ return NewPool;
+}
+
+CHAR16 *
+CatPrint (
+ IN OUT POOL_PRINT *Str,
+ IN CHAR16 *fmt,
+ ...
+)
+/*++
+
+Routine Description:
+
+ Concatenates a formatted unicode string to allocated pool.
+ The caller must free the resulting buffer.
+
+Arguments:
+
+ Str - Tracks the allocated pool, size in use, and
+ amount of pool allocated.
+
+ fmt - The format string
+
+Returns:
+
+ Allocated buffer with the formatted string printed in it.
+ The caller must free the allocated buffer. The buffer
+ allocation is not packed.
+
+--*/
+{
+ UINT16 *AppendStr;
+ VA_LIST args;
+ UINTN strsize;
+
+ AppendStr = EfiLibAllocateZeroPool (0x1000);
+ if (AppendStr == NULL)
+ {
+ return Str->str;
+ }
+
+ VA_START (args, fmt);
+ VSPrint (AppendStr, 0x1000, fmt, args);
+ VA_END (args);
+ if (NULL == Str->str)
+ {
+ strsize = EfiStrSize (AppendStr);
+ Str->str = EfiLibAllocateZeroPool (strsize);
+ ASSERT (Str->str != NULL);
+ }
+ else
+ {
+ strsize = EfiStrSize (AppendStr) + EfiStrSize (Str->str) - sizeof (UINT16);
+ Str->str = ReallocatePool (
+ Str->str,
+ EfiStrSize (Str->str),
+ strsize
+ );
+ ASSERT (Str->str != NULL);
+ }
+
+ Str->maxlen = MAX_CHAR * sizeof (UINT16);
+ if (strsize < Str->maxlen)
+ {
+ EfiStrCat (Str->str, AppendStr);
+ Str->len = strsize - sizeof (UINT16);
+ }
+
+ gBS->FreePool (AppendStr);
+ return Str->str;
+}
+
+EFI_DEVICE_PATH_PROTOCOL *
+BdsLibUnpackDevicePath (
+ IN EFI_DEVICE_PATH_PROTOCOL *DevPath
+)
+/*++
+
+Routine Description:
+
+ Function unpacks a device path data structure so that all the nodes
+ of a device path are naturally aligned.
+
+Arguments:
+
+ DevPath - A pointer to a device path data structure
+
+Returns:
+
+ If the memory for the device path is successfully allocated, then a
+ pointer to the new device path is returned. Otherwise, NULL is returned.
+
+--*/
+{
+ EFI_DEVICE_PATH_PROTOCOL *Src;
+ EFI_DEVICE_PATH_PROTOCOL *Dest;
+ EFI_DEVICE_PATH_PROTOCOL *NewPath;
+ UINTN Size;
+
+ //
+ // Walk device path and round sizes to valid boundries
+ //
+ Src = DevPath;
+ Size = 0;
+ for (;;)
+ {
+ Size += DevicePathNodeLength (Src);
+ Size += ALIGN_SIZE (Size);
+
+ if (IsDevicePathEnd (Src))
+ {
+ break;
+ }
+
+ Src = NextDevicePathNode (Src);
+ }
+ //
+ // Allocate space for the unpacked path
+ //
+ NewPath = EfiLibAllocateZeroPool (Size);
+ if (NewPath)
+ {
+
+ ASSERT (((UINTN) NewPath) % MIN_ALIGNMENT_SIZE == 0);
+
+ //
+ // Copy each node
+ //
+ Src = DevPath;
+ Dest = NewPath;
+ for (;;)
+ {
+ Size = DevicePathNodeLength (Src);
+ EfiCopyMem (Dest, Src, Size);
+ Size += ALIGN_SIZE (Size);
+ SetDevicePathNodeLength (Dest, Size);
+ Dest->Type |= EFI_DP_TYPE_UNPACKED;
+ Dest = (EFI_DEVICE_PATH_PROTOCOL *) (((UINT8 *) Dest) + Size);
+
+ if (IsDevicePathEnd (Src))
+ {
+ break;
+ }
+
+ Src = NextDevicePathNode (Src);
+ }
+ }
+
+ return NewPath;
+}
+
+VOID
+DevPathPci (
+ IN OUT POOL_PRINT *Str,
+ IN VOID *DevPath
+)
+{
+ PCI_DEVICE_PATH *Pci;
+
+ Pci = DevPath;
+ CatPrint (Str, L"Pci(%x|%x)", Pci->Device, Pci->Function);
+}
+
+VOID
+DevPathPccard (
+ IN OUT POOL_PRINT *Str,
+ IN VOID *DevPath
+)
+{
+ PCCARD_DEVICE_PATH *Pccard;
+
+ Pccard = DevPath;
+ CatPrint (Str, L"Pcmcia(Function%x)", Pccard->FunctionNumber);
+}
+
+VOID
+DevPathMemMap (
+ IN OUT POOL_PRINT *Str,
+ IN VOID *DevPath
+)
+{
+ MEMMAP_DEVICE_PATH *MemMap;
+
+ MemMap = DevPath;
+ CatPrint (
+ Str,
+ L"MemMap(%d:%.lx-%.lx)",
+ MemMap->MemoryType,
+ MemMap->StartingAddress,
+ MemMap->EndingAddress
+ );
+}
+
+VOID
+DevPathController (
+ IN OUT POOL_PRINT *Str,
+ IN VOID *DevPath
+)
+{
+ CONTROLLER_DEVICE_PATH *Controller;
+
+ Controller = DevPath;
+ CatPrint (Str, L"Ctrl(%d)", Controller->Controller);
+}
+
+VOID
+DevPathVendor (
+ IN OUT POOL_PRINT *Str,
+ IN VOID *DevPath
+)
+/*++
+
+Routine Description:
+
+ Convert Vendor device path to device name
+
+Arguments:
+
+ Str - The buffer store device name
+ DevPath - Pointer to vendor device path
+
+Returns:
+
+ When it return, the device name have been stored in *Str.
+
+--*/
+{
+ VENDOR_DEVICE_PATH *Vendor;
+ CHAR16 *Type;
+ INT32 *Temp;
+
+ Vendor = DevPath;
+ Temp = (INT32 *) (&Vendor->Guid);
+
+ switch (DevicePathType (&Vendor->Header))
+ {
+ case HARDWARE_DEVICE_PATH:
+ //
+ // If the device is a winntbus device, we will give it a readable device name.
+ //
+ Type = L"Hw";
+ break;
+
+ case MESSAGING_DEVICE_PATH:
+ //
+ // If the device is a winntbus device, we will give it a readable device name.
+ //
+ if (EfiCompareGuid (&Vendor->Guid, &mEfiMsgPcAnsiGuid))
+ {
+ CatPrint (Str, L"%s", L"PC-ANSI");
+ return ;
+ }
+ else if (EfiCompareGuid (&Vendor->Guid, &mEfiMsgVt100Guid))
+ {
+ CatPrint (Str, L"%s", L"VT100");
+ return ;
+ }
+ else if (EfiCompareGuid (&Vendor->Guid, &mEfiMsgVt100PlusGuid))
+ {
+ CatPrint (Str, L"%s", L"VT100+");
+ return ;
+ }
+ else if (EfiCompareGuid (&Vendor->Guid, &mEfiMsgVt100Utf8Guid))
+ {
+ CatPrint (Str, L"%s", L"VT100-UTF8");
+ return ;
+ }
+ else
+ {
+ Type = L"Msg";
+ break;
+ }
+
+ case MEDIA_DEVICE_PATH:
+ Type = L"Media";
+ break;
+
+ default:
+ Type = L"?";
+ break;
+ }
+
+ CatPrint (Str, L"Ven%s(%g)", Type, &Vendor->Guid);
+}
+
+VOID
+DevPathAcpi (
+ IN OUT POOL_PRINT *Str,
+ IN VOID *DevPath
+)
+{
+ ACPI_HID_DEVICE_PATH *Acpi;
+
+ Acpi = DevPath;
+ if ((Acpi->HID & PNP_EISA_ID_MASK) == PNP_EISA_ID_CONST)
+ {
+ CatPrint (Str, L"Acpi(PNP%04x,%x)", EISA_ID_TO_NUM (Acpi->HID), Acpi->UID);
+ }
+ else
+ {
+ CatPrint (Str, L"Acpi(%08x,%x)", Acpi->HID, Acpi->UID);
+ }
+}
+
+VOID
+DevPathAtapi (
+ IN OUT POOL_PRINT *Str,
+ IN VOID *DevPath
+)
+{
+ ATAPI_DEVICE_PATH *Atapi;
+
+ Atapi = DevPath;
+ CatPrint (
+ Str,
+ L"Ata(%s,%s)",
+ Atapi->PrimarySecondary ? L"Secondary" : L"Primary",
+ Atapi->SlaveMaster ? L"Slave" : L"Master"
+ );
+}
+
+VOID
+DevPathScsi (
+ IN OUT POOL_PRINT *Str,
+ IN VOID *DevPath
+)
+{
+ SCSI_DEVICE_PATH *Scsi;
+
+ Scsi = DevPath;
+ CatPrint (Str, L"Scsi(Pun%x,Lun%x)", Scsi->Pun, Scsi->Lun);
+}
+
+VOID
+DevPathFibre (
+ IN OUT POOL_PRINT *Str,
+ IN VOID *DevPath
+)
+{
+ FIBRECHANNEL_DEVICE_PATH *Fibre;
+
+ Fibre = DevPath;
+ CatPrint (Str, L"Fibre(Wwn%lx,Lun%x)", Fibre->WWN, Fibre->Lun);
+}
+
+VOID
+DevPath1394 (
+ IN OUT POOL_PRINT *Str,
+ IN VOID *DevPath
+)
+{
+ F1394_DEVICE_PATH *F1394;
+
+ F1394 = DevPath;
+ CatPrint (Str, L"1394(%g)", &F1394->Guid);
+}
+
+VOID
+DevPathUsb (
+ IN OUT POOL_PRINT *Str,
+ IN VOID *DevPath
+)
+{
+ USB_DEVICE_PATH *Usb;
+
+ Usb = DevPath;
+ CatPrint (Str, L"Usb(%x, %x)", Usb->ParentPortNumber, Usb->InterfaceNumber);
+}
+
+VOID
+DevPathUsbClass (
+ IN OUT POOL_PRINT *Str,
+ IN VOID *DevPath
+)
+{
+ USB_CLASS_DEVICE_PATH *UsbClass;
+
+ UsbClass = DevPath;
+ CatPrint (
+ Str,
+ L"Usb Class(%x, %x, %x, %x, %x)",
+ UsbClass->VendorId,
+ UsbClass->ProductId,
+ UsbClass->DeviceClass,
+ UsbClass->DeviceSubClass,
+ UsbClass->DeviceProtocol
+ );
+}
+
+VOID
+DevPathI2O (
+ IN OUT POOL_PRINT *Str,
+ IN VOID *DevPath
+)
+{
+ I2O_DEVICE_PATH *I2O;
+
+ I2O = DevPath;
+ CatPrint (Str, L"I2O(%x)", I2O->Tid);
+}
+
+VOID
+DevPathMacAddr (
+ IN OUT POOL_PRINT *Str,
+ IN VOID *DevPath
+)
+{
+ MAC_ADDR_DEVICE_PATH *MAC;
+ UINTN HwAddressSize;
+ UINTN Index;
+
+ MAC = DevPath;
+
+ HwAddressSize = sizeof (EFI_MAC_ADDRESS);
+ if (MAC->IfType == 0x01 || MAC->IfType == 0x00)
+ {
+ HwAddressSize = 6;
+ }
+
+ CatPrint (Str, L"Mac(");
+
+ for (Index = 0; Index < HwAddressSize; Index++)
+ {
+ CatPrint (Str, L"%02x", MAC->MacAddress.Addr[Index]);
+ }
+
+ CatPrint (Str, L")");
+}
+
+VOID
+DevPathIPv4 (
+ IN OUT POOL_PRINT *Str,
+ IN VOID *DevPath
+)
+{
+ IPv4_DEVICE_PATH *IP;
+
+ IP = DevPath;
+ CatPrint (
+ Str,
+ L"IPv4(%d.%d.%d.%d:%d)",
+ IP->RemoteIpAddress.Addr[0],
+ IP->RemoteIpAddress.Addr[1],
+ IP->RemoteIpAddress.Addr[2],
+ IP->RemoteIpAddress.Addr[3],
+ IP->RemotePort
+ );
+}
+
+VOID
+DevPathIPv6 (
+ IN OUT POOL_PRINT *Str,
+ IN VOID *DevPath
+)
+{
+ IPv6_DEVICE_PATH *IP;
+
+ IP = DevPath;
+ CatPrint (Str, L"IP-v6(not-done)");
+}
+
+VOID
+DevPathInfiniBand (
+ IN OUT POOL_PRINT *Str,
+ IN VOID *DevPath
+)
+{
+ INFINIBAND_DEVICE_PATH *InfiniBand;
+
+ InfiniBand = DevPath;
+ CatPrint (Str, L"InfiniBand(not-done)");
+}
+
+VOID
+DevPathUart (
+ IN OUT POOL_PRINT *Str,
+ IN VOID *DevPath
+)
+{
+ UART_DEVICE_PATH *Uart;
+ CHAR8 Parity;
+
+ Uart = DevPath;
+ switch (Uart->Parity)
+ {
+ case 0:
+ Parity = 'D';
+ break;
+
+ case 1:
+ Parity = 'N';
+ break;
+
+ case 2:
+ Parity = 'E';
+ break;
+
+ case 3:
+ Parity = 'O';
+ break;
+
+ case 4:
+ Parity = 'M';
+ break;
+
+ case 5:
+ Parity = 'S';
+ break;
+
+ default:
+ Parity = 'x';
+ break;
+ }
+
+ if (Uart->BaudRate == 0)
+ {
+ CatPrint (Str, L"Uart(DEFAULT %c", Parity);
+ }
+ else
+ {
+ CatPrint (Str, L"Uart(%d %c", Uart->BaudRate, Parity);
+ }
+
+ if (Uart->DataBits == 0)
+ {
+ CatPrint (Str, L"D");
+ }
+ else
+ {
+ CatPrint (Str, L"%d", Uart->DataBits);
+ }
+
+ switch (Uart->StopBits)
+ {
+ case 0:
+ CatPrint (Str, L"D)");
+ break;
+
+ case 1:
+ CatPrint (Str, L"1)");
+ break;
+
+ case 2:
+ CatPrint (Str, L"1.5)");
+ break;
+
+ case 3:
+ CatPrint (Str, L"2)");
+ break;
+
+ default:
+ CatPrint (Str, L"x)");
+ break;
+ }
+}
+
+VOID
+DevPathHardDrive (
+ IN OUT POOL_PRINT *Str,
+ IN VOID *DevPath
+)
+{
+ HARDDRIVE_DEVICE_PATH *Hd;
+
+ Hd = DevPath;
+ switch (Hd->SignatureType)
+ {
+ case SIGNATURE_TYPE_MBR:
+ CatPrint (
+ Str,
+ L"HD(Part%d,Sig%08x)",
+ Hd->PartitionNumber,
+ *((UINT32 *) (&(Hd->Signature[0])))
+ );
+ break;
+
+ case SIGNATURE_TYPE_GUID:
+ CatPrint (
+ Str,
+ L"HD(Part%d,Sig%g)",
+ Hd->PartitionNumber,
+ (EFI_GUID *) &(Hd->Signature[0])
+ );
+ break;
+
+ default:
+ CatPrint (
+ Str,
+ L"HD(Part%d,MBRType=%02x,SigType=%02x)",
+ Hd->PartitionNumber,
+ Hd->MBRType,
+ Hd->SignatureType
+ );
+ break;
+ }
+}
+
+VOID
+DevPathCDROM (
+ IN OUT POOL_PRINT *Str,
+ IN VOID *DevPath
+)
+{
+ CDROM_DEVICE_PATH *Cd;
+
+ Cd = DevPath;
+ CatPrint (Str, L"CDROM(Entry%x)", Cd->BootEntry);
+}
+
+VOID
+DevPathFilePath (
+ IN OUT POOL_PRINT *Str,
+ IN VOID *DevPath
+)
+{
+ FILEPATH_DEVICE_PATH *Fp;
+
+ Fp = DevPath;
+ CatPrint (Str, L"%s", Fp->PathName);
+}
+
+VOID
+DevPathMediaProtocol (
+ IN OUT POOL_PRINT *Str,
+ IN VOID *DevPath
+)
+{
+ MEDIA_PROTOCOL_DEVICE_PATH *MediaProt;
+
+ MediaProt = DevPath;
+ CatPrint (Str, L"%g", &MediaProt->Protocol);
+}
+
+VOID
+DevPathFvFilePath (
+ IN OUT POOL_PRINT *Str,
+ IN VOID *DevPath
+)
+{
+ MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvFilePath;
+
+ FvFilePath = DevPath;
+ CatPrint (Str, L"%g", &FvFilePath->NameGuid);
+}
+
+VOID
+DevPathBssBss (
+ IN OUT POOL_PRINT *Str,
+ IN VOID *DevPath
+)
+{
+ BBS_BBS_DEVICE_PATH *Bbs;
+ CHAR16 *Type;
+
+ Bbs = DevPath;
+ switch (Bbs->DeviceType)
+ {
+ case BBS_TYPE_FLOPPY:
+ Type = L"Floppy";
+ break;
+
+ case BBS_TYPE_HARDDRIVE:
+ Type = L"Harddrive";
+ break;
+
+ case BBS_TYPE_CDROM:
+ Type = L"CDROM";
+ break;
+
+ case BBS_TYPE_PCMCIA:
+ Type = L"PCMCIA";
+ break;
+
+ case BBS_TYPE_USB:
+ Type = L"Usb";
+ break;
+
+ case BBS_TYPE_EMBEDDED_NETWORK:
+ Type = L"Net";
+ break;
+
+ default:
+ Type = L"?";
+ break;
+ }
+ //
+ // Since current Print function hasn't implemented %a (for ansi string)
+ // we will only print Unicode strings.
+ //
+ CatPrint (Str, L"Legacy-%s", Type);
+}
+
+VOID
+DevPathEndInstance (
+ IN OUT POOL_PRINT *Str,
+ IN VOID *DevPath
+)
+{
+ CatPrint (Str, L",");
+}
+
+VOID
+DevPathNodeUnknown (
+ IN OUT POOL_PRINT *Str,
+ IN VOID *DevPath
+)
+{
+ CatPrint (Str, L"?");
+}
+
+DEVICE_PATH_STRING_TABLE DevPathTable[] = {
+ HARDWARE_DEVICE_PATH,
+ HW_PCI_DP,
+ DevPathPci,
+ HARDWARE_DEVICE_PATH,
+ HW_PCCARD_DP,
+ DevPathPccard,
+ HARDWARE_DEVICE_PATH,
+ HW_MEMMAP_DP,
+ DevPathMemMap,
+ HARDWARE_DEVICE_PATH,
+ HW_VENDOR_DP,
+ DevPathVendor,
+ HARDWARE_DEVICE_PATH,
+ HW_CONTROLLER_DP,
+ DevPathController,
+ ACPI_DEVICE_PATH,
+ ACPI_DP,
+ DevPathAcpi,
+ MESSAGING_DEVICE_PATH,
+ MSG_ATAPI_DP,
+ DevPathAtapi,
+ MESSAGING_DEVICE_PATH,
+ MSG_SCSI_DP,
+ DevPathScsi,
+ MESSAGING_DEVICE_PATH,
+ MSG_FIBRECHANNEL_DP,
+ DevPathFibre,
+ MESSAGING_DEVICE_PATH,
+ MSG_1394_DP,
+ DevPath1394,
+ MESSAGING_DEVICE_PATH,
+ MSG_USB_DP,
+ DevPathUsb,
+ MESSAGING_DEVICE_PATH,
+ MSG_USB_CLASS_DP,
+ DevPathUsbClass,
+ MESSAGING_DEVICE_PATH,
+ MSG_I2O_DP,
+ DevPathI2O,
+ MESSAGING_DEVICE_PATH,
+ MSG_MAC_ADDR_DP,
+ DevPathMacAddr,
+ MESSAGING_DEVICE_PATH,
+ MSG_IPv4_DP,
+ DevPathIPv4,
+ MESSAGING_DEVICE_PATH,
+ MSG_IPv6_DP,
+ DevPathIPv6,
+ MESSAGING_DEVICE_PATH,
+ MSG_INFINIBAND_DP,
+ DevPathInfiniBand,
+ MESSAGING_DEVICE_PATH,
+ MSG_UART_DP,
+ DevPathUart,
+ MESSAGING_DEVICE_PATH,
+ MSG_VENDOR_DP,
+ DevPathVendor,
+ MEDIA_DEVICE_PATH,
+ MEDIA_HARDDRIVE_DP,
+ DevPathHardDrive,
+ MEDIA_DEVICE_PATH,
+ MEDIA_CDROM_DP,
+ DevPathCDROM,
+ MEDIA_DEVICE_PATH,
+ MEDIA_VENDOR_DP,
+ DevPathVendor,
+ MEDIA_DEVICE_PATH,
+ MEDIA_FILEPATH_DP,
+ DevPathFilePath,
+ MEDIA_DEVICE_PATH,
+ MEDIA_PROTOCOL_DP,
+ DevPathMediaProtocol,
+ MEDIA_DEVICE_PATH,
+ MEDIA_FV_FILEPATH_DP,
+ DevPathFvFilePath,
+ BBS_DEVICE_PATH,
+ BBS_BBS_DP,
+ DevPathBssBss,
+ END_DEVICE_PATH_TYPE,
+ END_INSTANCE_DEVICE_PATH_SUBTYPE,
+ DevPathEndInstance,
+ 0,
+ 0,
+ NULL
+ };
+
+CHAR16 *
+DevicePathToStr (
+ IN EFI_DEVICE_PATH_PROTOCOL *DevPath
+)
+/*++
+
+ Turns the Device Path into a printable string. Allcoates
+ the string from pool. The caller must SafeFreePool the returned
+ string.
+
+--*/
+{
+ POOL_PRINT Str;
+ EFI_DEVICE_PATH_PROTOCOL *DevPathNode;
+ VOID (*DumpNode) (POOL_PRINT *, VOID *);
+
+ UINTN Index;
+ UINTN NewSize;
+
+ EfiZeroMem (&Str, sizeof (Str));
+
+ if (DevPath == NULL)
+ {
+ goto Done;
+ }
+ //
+ // Unpacked the device path
+ //
+ DevPath = BdsLibUnpackDevicePath (DevPath);
+ ASSERT (DevPath);
+
+ //
+ // Process each device path node
+ //
+ DevPathNode = DevPath;
+ while (!IsDevicePathEnd (DevPathNode))
+ {
+ //
+ // Find the handler to dump this device path node
+ //
+ DumpNode = NULL;
+ for (Index = 0; DevPathTable[Index].Function; Index += 1)
+ {
+
+ if (DevicePathType (DevPathNode) == DevPathTable[Index].Type &&
+ DevicePathSubType (DevPathNode) == DevPathTable[Index].SubType
+ )
+ {
+ DumpNode = DevPathTable[Index].Function;
+ break;
+ }
+ }
+ //
+ // If not found, use a generic function
+ //
+ if (!DumpNode)
+ {
+ DumpNode = DevPathNodeUnknown;
+ }
+ //
+ // Put a path seperator in if needed
+ //
+ if (Str.len && DumpNode != DevPathEndInstance)
+ {
+ CatPrint (&Str, L"/");
+ }
+ //
+ // Print this node of the device path
+ //
+ DumpNode (&Str, DevPathNode);
+
+ //
+ // Next device path node
+ //
+ DevPathNode = NextDevicePathNode (DevPathNode);
+ }
+ //
+ // Shrink pool used for string allocation
+ //
+ gBS->FreePool (DevPath);
+
+Done:
+ NewSize = (Str.len + 1) * sizeof (CHAR16);
+ Str.str = ReallocatePool (Str.str, NewSize, NewSize);
+ ASSERT (Str.str != NULL);
+ Str.str[Str.len] = 0;
+ return Str.str;
+}
+
+EFI_DEVICE_PATH_PROTOCOL *
+LibDuplicateDevicePathInstance (
+ IN EFI_DEVICE_PATH_PROTOCOL *DevPath
+)
+/*++
+
+Routine Description:
+
+ Function creates a device path data structure that identically matches the
+ device path passed in.
+
+Arguments:
+
+ DevPath - A pointer to a device path data structure.
+
+Returns:
+
+ The new copy of DevPath is created to identically match the input.
+ Otherwise, NULL is returned.
+
+--*/
+{
+ EFI_DEVICE_PATH_PROTOCOL *NewDevPath;
+ EFI_DEVICE_PATH_PROTOCOL *DevicePathInst;
+ EFI_DEVICE_PATH_PROTOCOL *Temp;
+ UINTN Size;
+
+ //
+ // get the size of an instance from the input
+ //
+ Temp = DevPath;
+ DevicePathInst = EfiDevicePathInstance (&Temp, &Size);
+
+ //
+ // Make a copy
+ //
+ NewDevPath = NULL;
+ if (Size)
+ {
+ NewDevPath = EfiLibAllocateZeroPool (Size);
+ ASSERT (NewDevPath != NULL);
+ }
+
+ if (NewDevPath)
+ {
+ EfiCopyMem (NewDevPath, DevicePathInst, Size);
+ }
+
+ return NewDevPath;
+}
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/AmtWrapper/AmtPetAlert/DevicePath.h b/Board/EM/MeWrapper/AmtWrapper/AmtPetAlert/DevicePath.h
new file mode 100644
index 0000000..1f73827
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/AmtPetAlert/DevicePath.h
@@ -0,0 +1,93 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/AmtWrapper/AmtPetAlert/DevicePath.h 1 2/08/12 1:10a Klzhan $
+//
+// $Revision: 1 $
+//
+// $Date: 2/08/12 1:10a $
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/AmtWrapper/AmtPetAlert/DevicePath.h $
+//
+// 1 2/08/12 1:10a Klzhan
+// Initial Check in
+//
+// 1 2/25/11 1:45a Klzhan
+// Initial Check-in
+//
+// 1 12/03/10 5:11a Klzhan
+// Initial Check-in.
+//
+//**********************************************************************
+//
+//<AMI_FHDR_START>
+//---------------------------------------------------------------------------
+// Name: DevicePath.c
+//
+// Description: DevicePath functions for AMT Pet Alert.
+//
+//---------------------------------------------------------------------------
+//<AMI_FHDR_END>
+#include "Tiano.h"
+#include "EfiPrintLib.h"
+#include "EfiDriverLib.h"
+
+//
+// Internal definitions
+//
+typedef struct {
+ CHAR16 *str;
+ UINTN len;
+ UINTN maxlen;
+} POOL_PRINT;
+
+typedef struct {
+ UINT8 Type;
+ UINT8 SubType;
+ VOID (*Function) (POOL_PRINT *, VOID *);
+} DEVICE_PATH_STRING_TABLE;
+
+//
+// Define Maxmim characters that will be accepted
+//
+#define MAX_CHAR 480
+#define MAX_CHAR_SIZE (MAX_CHAR * 2)
+
+#define MIN_ALIGNMENT_SIZE 4
+#define ALIGN_SIZE(a) ((a % MIN_ALIGNMENT_SIZE) ? MIN_ALIGNMENT_SIZE - (a % MIN_ALIGNMENT_SIZE) : 0)
+
+CHAR16 *
+DevicePathToStr (
+ EFI_DEVICE_PATH_PROTOCOL *DevPath
+);
+
+EFI_DEVICE_PATH_PROTOCOL *
+BdsLibUnpackDevicePath (
+ IN EFI_DEVICE_PATH_PROTOCOL *DevPath
+);
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/AmtWrapper/AmtPlatformPolicy/AmtPlatformPolicy.c b/Board/EM/MeWrapper/AmtWrapper/AmtPlatformPolicy/AmtPlatformPolicy.c
new file mode 100644
index 0000000..bdc8193
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/AmtPlatformPolicy/AmtPlatformPolicy.c
@@ -0,0 +1,558 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/AmtWrapper/AmtPlatformPolicy/AmtPlatformPolicy.c 11 9/21/15 10:12p Tristinchou $
+//
+// $Revision: 11 $
+//
+// $Date: 9/21/15 10:12p $
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/AmtWrapper/AmtPlatformPolicy/AmtPlatformPolicy.c $
+//
+// 11 9/21/15 10:12p Tristinchou
+// [TAG] EIP238392
+// [Category] Improvement
+// [Description] Disable USB provision while Intel AMT is disabled in
+// setup
+//
+// 10 5/14/14 9:45p Tristinchou
+// [TAG] EIP160730
+// [Category] Improvement
+// [Description] Remove the variable runtime attribute and keep original
+// attributes.
+//
+// 9 12/16/13 9:55p Tristinchou
+// [TAG] EIPNone
+// [Category] Improvement
+// [Description] Free memory while error occur in InstallDiskInfo()
+//
+// 8 8/27/13 4:21a Tristinchou
+// [TAG] EIPNone
+// [Category] Improvement
+// [Description] Fix system hangs while boot with ME 1.5MB firmware.
+// [Files] AmtPlatformPolicy.c
+//
+// 7 8/22/13 8:51a Tristinchou
+// [TAG] EIP131034
+// [Category] Improvement
+// [Description] The system will hang after create/ reset/delete raid
+// mode
+// [Files] AmtPlatformPolicy.c
+//
+// 6 11/07/12 8:47a Klzhan
+// Clear Cira request item after loaded.
+//
+// 5 9/19/12 6:56a Klzhan
+// Fix Windows capsule update fail.
+//
+// 4 7/02/12 11:39p Klzhan
+// [TAG] EIP94113
+// [Category] Spec Update
+// [Severity] Important
+// [Description] Update ME RC0.6
+//
+// 3 5/14/12 4:50a Klzhan
+// [TAG] EIP89952
+// [Category] Spec Update
+// [Severity] Important
+// [Description] Update ME RC 0.56
+// [Files] AmtPlatformPolicy.c
+// AmtPlatformPolicy.h
+// AmtPlatformPolicy.sdl
+// AmtPlatformPolicy.mak
+// AmtPlatformPolicy.dxs
+// AmtPlatformPolicy.cif
+//
+// 2 4/24/12 12:41a Klzhan
+//
+// 1 2/08/12 1:08a Klzhan
+// Initial Check in
+//
+// 8 9/29/11 11:47p Klzhan
+// Fill Amt Wrapper protocol with setup data.
+//
+// 7 9/26/11 6:19a Klzhan
+// [TAG] EIP70516
+// [Category] Spec Update
+// [Severity] Important
+// [Description] Update ME 8.0 RC 0.8
+// [Files] AmtPlatformPolicy.c
+// AmtPlatformPolicy.h
+// AmtPlatformPolicy.sdl
+// AmtPlatformPolicy.mak
+// AmtPlatformPolicy.dxs
+// AmtPlatformPolicy.cif
+//
+// 6 7/08/11 4:23a Klzhan
+// [TAG] EIP64189
+// [Category] Spec Update
+// [Severity] Important
+// [Description] Update ME RC to 0.7
+//
+// 5 5/24/11 5:01a Klzhan
+// Add support ME RC 0.60
+//
+// 4 4/18/11 9:45a Klzhan
+// [TAG] EIP58005
+// [Category] Spec Update
+// [Severity] Important
+// [Description] Move ME FW downgrade related code to ME platform
+// policy.
+//
+// 3 4/18/11 9:17a Klzhan
+// Improvement : Update DXE_PLATFORM_AMT_POLICY_PROTOCOL_REVISION from 7
+// to A.
+//
+// 2 3/29/11 3:48a Klzhan
+// A token to keep ME always in Disable Mode.
+//
+// 1 2/25/11 1:44a Klzhan
+// Initial Check-in
+//
+// 1 12/03/10 5:11a Klzhan
+// Initial Check-in.
+//
+//**********************************************************************
+//
+//<AMI_FHDR_START>
+//---------------------------------------------------------------------------
+// Name: AmtPlatformPolicy.c
+//
+// Description:
+//
+//---------------------------------------------------------------------------
+//<AMI_FHDR_END>
+
+#include "AmtPlatformPolicy.h"
+#include "token.h"
+#include <SetupDataDefinition.h>
+DXE_AMT_POLICY_PROTOCOL mDxePlatformAmtPolicy = { 0 };
+INSTALL_DISK_INFO_PROTOCOL mInstallDiskInfo = { InstallDiskInfo };
+UINT64 mPciDeviceFilterOutTable[] = { EFI_MAX_ADDRESS, };
+#define SETUP_GUID { 0xEC87D643, 0xEBA4, 0x4BB5, 0xA1, 0xE5, 0x3F, 0x3E, 0x36, 0xB2, 0x0D, 0xA9 }
+
+#define AMT_READY_TO_BOOT_PROTOCOL_GUID \
+ { \
+ 0x40b09b5a, 0xf0ef, 0x4627, 0x93, 0xd5, 0x27, 0xf0, 0x4b, 0x75, 0x4d, 0x5 \
+ }
+
+#define END_DEVICE_PATH 0x7F
+#define END_DEVICE_PATH1 0xFF
+#define NODE_LENGTH(pPath) (*(UINT16*)&(pPath)->Length[0])
+#define NEXT_NODE(pPath) ((EFI_DEVICE_PATH_PROTOCOL*)((UINT8*)(pPath)+NODE_LENGTH(pPath)))
+#define isEndNode(pDp) ((pDp)->Type==END_DEVICE_PATH||(pDp)->Type==END_DEVICE_PATH1)
+EFI_GUID gAmtReadyToBootProtocolGuid = AMT_READY_TO_BOOT_PROTOCOL_GUID;
+EFI_GUID gEfiDiskInfoProtocolGuid = EFI_DISK_INFO_PROTOCOL_GUID;
+EFI_GUID gDevicePathProtocolGuid = EFI_DEVICE_PATH_PROTOCOL_GUID;
+UINT8 GetDevicePathSubtype(EFI_DEVICE_PATH_PROTOCOL *Dp, UINT8 Type);
+
+//
+// Driver entry point
+//
+EFI_DRIVER_ENTRY_POINT (AmtPlatformPolicyEntryPoint)
+EFI_STATUS
+EFIAPI
+InstallDiskInfo (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ UINTN BlockIoHandleCount = 0;
+ UINTN DiskInfoHandleCount = 0;
+ EFI_HANDLE *BlockIoHandleBuffer = NULL;
+ EFI_HANDLE *DiskInfoHandleBuffer = NULL;
+ UINTN UsedBlockIoHandle = 0;
+ UINTN UsedDiskInfoHandle = 0;
+ EFI_DISK_INFO_PROTOCOL *DiskInfoProtocol;
+ EFI_DISK_INFO_PROTOCOL *DiskInfoProtocolBuffer;
+ EFI_BLOCK_IO_PROTOCOL *BlockIoProtocol;
+ EFI_DEVICE_PATH_PROTOCOL *DevicePathProtocol;
+ UINT8 DevicePathSubtype = 0;
+ IDENTIFY_DATA *IdentifyData = NULL;
+ UINT32 BufferSize = sizeof (IDENTIFY_DATA);
+ UINT8 ThisDiskInfoHandleIsHdd = 0; // 1 is HDD, 0 is ODD
+ UINT8 ThisBlockIoHandleIsHdd = 0; // 1 is HDD, 0 is ODD
+
+ //Locate all handle which have BlockIo
+ Status = gBS->LocateHandleBuffer(
+ ByProtocol,
+ &gEfiBlockIoProtocolGuid,
+ NULL,
+ &BlockIoHandleCount,
+ &BlockIoHandleBuffer );
+ if(EFI_ERROR(Status))
+ goto ErrorExit;
+
+ //Locate all handle which have DiskInfo
+ Status = gBS->LocateHandleBuffer(
+ ByProtocol,
+ &gEfiDiskInfoProtocolGuid,
+ NULL,
+ &DiskInfoHandleCount,
+ &DiskInfoHandleBuffer );
+ if(EFI_ERROR(Status))
+ goto ErrorExit;
+
+ if( DiskInfoHandleCount != 0 )
+ {
+ for( UsedBlockIoHandle = 0 ; UsedBlockIoHandle < BlockIoHandleCount ; UsedBlockIoHandle++ )
+ {
+ ThisBlockIoHandleIsHdd = 0;
+ //Block to install DiskInfoProtocol to USB
+ Status = gBS->HandleProtocol(
+ BlockIoHandleBuffer[UsedBlockIoHandle],
+ &gDevicePathProtocolGuid,
+ &DevicePathProtocol);
+ if( !EFI_ERROR(Status) )
+ {
+ DevicePathSubtype = GetDevicePathSubtype( DevicePathProtocol, MESSAGING_DEVICE_PATH );
+ }
+ if( DevicePathSubtype == MSG_USB_DP ||
+ DevicePathSubtype == MSG_USB_CLASS_DP )
+ {
+ continue;
+ }
+ //Block to install DiskInfoProtocol to Partition
+ Status = gBS->HandleProtocol(
+ BlockIoHandleBuffer[UsedBlockIoHandle],
+ &gEfiBlockIoProtocolGuid,
+ &BlockIoProtocol);
+ if(EFI_ERROR(Status))
+ goto ErrorExit;
+
+ if( BlockIoProtocol->Media->LogicalPartition )
+ {
+ continue;
+ }
+
+ //Handle is HDD or ODD
+ if( BlockIoProtocol->Media->RemovableMedia == 0 )
+ {
+ ThisBlockIoHandleIsHdd = 1;
+ }
+
+ for( UsedDiskInfoHandle = 0 ; UsedDiskInfoHandle < DiskInfoHandleCount ; UsedDiskInfoHandle++ )
+ {
+ ThisDiskInfoHandleIsHdd = 0;
+ if( DiskInfoHandleBuffer[UsedDiskInfoHandle] == NULL )
+ {
+ continue;
+ }
+
+ //Handle is HDD or ODD
+ Status = gBS->HandleProtocol(
+ DiskInfoHandleBuffer[UsedDiskInfoHandle],
+ &gEfiDiskInfoProtocolGuid,
+ &DiskInfoProtocol);
+ if(EFI_ERROR(Status))
+ goto ErrorExit;
+
+ IdentifyData = AllocatePool(BufferSize);
+ if( IdentifyData == NULL )
+ goto ErrorExit;
+
+ Status = DiskInfoProtocol->Identify( DiskInfoProtocol, IdentifyData, &BufferSize );
+ if(EFI_ERROR(Status))
+ goto ErrorExit;
+
+ if( IdentifyData->LBA_48 !=0 )
+ {
+ ThisDiskInfoHandleIsHdd = 1;
+ }
+
+ //If handles the same type( HDD or ODD)
+ if( ThisDiskInfoHandleIsHdd == ThisBlockIoHandleIsHdd )
+ {
+ Status = gBS->HandleProtocol(
+ BlockIoHandleBuffer[UsedBlockIoHandle],
+ &gEfiDiskInfoProtocolGuid,
+ &DiskInfoProtocolBuffer );
+ //If this BlockIoHandle isn't installed DiskInfoProtocol
+ if(EFI_ERROR(Status))
+ {
+ Status = gBS->InstallMultipleProtocolInterfaces(
+ &BlockIoHandleBuffer[UsedBlockIoHandle],
+ &gEfiDiskInfoProtocolGuid,
+ DiskInfoProtocol,
+ NULL );
+ if( !EFI_ERROR(Status) )
+ {
+ FreePool(IdentifyData);
+ //Release used handle pointer
+ DiskInfoHandleBuffer[UsedDiskInfoHandle] = NULL;
+ break;
+ }
+ }
+ }
+ FreePool(IdentifyData);
+ }
+ }
+ }
+ FreePool(BlockIoHandleBuffer);
+ FreePool(DiskInfoHandleBuffer);
+
+ return EFI_SUCCESS;
+
+ErrorExit:
+ if( BlockIoHandleBuffer != NULL )
+ FreePool(BlockIoHandleBuffer);
+ if( DiskInfoHandleBuffer != NULL )
+ FreePool(DiskInfoHandleBuffer);
+ if( IdentifyData != NULL )
+ FreePool(IdentifyData);
+
+ return EFI_NOT_FOUND;
+}
+
+UINT8 GetDevicePathSubtype(EFI_DEVICE_PATH_PROTOCOL *Dp, UINT8 Type)
+{
+ UINT8 SubType;
+
+ if (Dp == NULL) return 0;
+ SubType = 0;
+
+ for( ; !(isEndNode(Dp)); Dp=NEXT_NODE(Dp))
+ if (Dp->Type == Type) SubType = Dp->SubType;
+ return SubType;
+}
+
+//
+// Function implementations
+//
+EFI_STATUS
+EFIAPI
+AmtPlatformPolicyEntryPoint (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+)
+/*++
+
+Routine Description:
+
+ Initilize Intel AMT DXE Platform Policy
+
+Arguments:
+
+ ImageHandle Image handle of this driver.
+ SystemTable Global system service table.
+
+Returns:
+
+ EFI_SUCCESS Initialization complete.
+ EFI_UNSUPPORTED The chipset is unsupported by this driver.
+ EFI_OUT_OF_RESOURCES Do not have enough resources to initialize the driver.
+ EFI_DEVICE_ERROR Device error, driver exits abnormally.
+
+--*/
+{
+ EFI_STATUS Status;
+ UINT32 SetupVarAttr;
+ UINTN VariableSize;
+ UINT32 MebxVarAttr;
+ ME_BIOS_EXTENSION_SETUP MeBiosExtensionSetupData;
+ SETUP_DATA SetupData;
+ EFI_GUID gSetupGuid = SETUP_GUID;
+ DXE_MBP_DATA_PROTOCOL *mBIOSPayLoad;
+ EFI_HANDLE Handle;
+
+ EfiInitializeDriverLib (ImageHandle, SystemTable);
+
+ Handle = NULL;
+
+ Status = gBS->LocateProtocol (
+ &gMeBiosPayloadDataProtocolGuid,
+ NULL,
+ &mBIOSPayLoad
+ );
+ if( EFI_ERROR(Status) ) {
+ // Install Dummy MeBios Payload Data Protocol for avoiding relating driver
+ // not run. (For EIP#96807 - EFI Capsule Update)
+ SetupVarAttr = 0;
+ VariableSize = sizeof(SETUP_DATA);
+ Status = gRT->GetVariable( L"Setup", &gSetupGuid, \
+ &SetupVarAttr, &VariableSize, &SetupData );
+ if( EFI_ERROR(Status) ) return Status;
+ {
+ DXE_MBP_DATA_PROTOCOL mMbpData;
+ ZeroMem (&mMbpData, sizeof (DXE_MBP_DATA_PROTOCOL));
+ mMbpData.Revision = DXE_MBP_DATA_PROTOCOL_REVISION_2;
+ mMbpData.MeBiosPayload.FwPlatType.RuleData.Fields.IntelMeFwImageType = SetupData.MeImageType;
+ mMbpData.Handle = NULL;
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &mMbpData.Handle,
+ &gMeBiosPayloadDataProtocolGuid,
+ &mMbpData,
+ NULL
+ );
+ if (!EFI_ERROR(Status)) mBIOSPayLoad = &mMbpData;
+ }
+ }
+ if (mBIOSPayLoad->MeBiosPayload.FwPlatType.RuleData.Fields.IntelMeFwImageType != INTEL_ME_5MB_FW) {
+ return EFI_UNSUPPORTED;
+ }
+
+ Status = gBS->InstallProtocolInterface (
+ &Handle,
+ &gAmtReadyToBootProtocolGuid,
+ EFI_NATIVE_INTERFACE,
+ &mInstallDiskInfo
+ );
+
+ SetupVarAttr = 0;
+ VariableSize = sizeof(SETUP_DATA);
+ //
+ // Get iAMT configuration from Setup Data
+ //
+ Status = gRT->GetVariable(
+ L"Setup",
+ &gSetupGuid,
+ &SetupVarAttr,
+ &VariableSize,
+ &SetupData );
+
+ //
+ // AMT DXE Policy Init
+ //
+ mDxePlatformAmtPolicy.Revision = DXE_PLATFORM_AMT_POLICY_PROTOCOL_REVISION_1;
+///////////////////////////////////////////////////////////////////////////
+ if (EFI_ERROR(Status)) // Default Setting for AMT
+ {
+ //
+ // Initialzie the Me Configuration
+ //
+ mDxePlatformAmtPolicy.AmtConfig.AsfEnabled = 1;
+ mDxePlatformAmtPolicy.AmtConfig.iAmtEnabled = 1;
+ mDxePlatformAmtPolicy.AmtConfig.WatchDog = 0;
+ mDxePlatformAmtPolicy.AmtConfig.WatchDogTimerOs = 0;
+ mDxePlatformAmtPolicy.AmtConfig.WatchDogTimerBios = 0;
+ mDxePlatformAmtPolicy.AmtConfig.CiraRequest = 0;
+ mDxePlatformAmtPolicy.AmtConfig.CiraTimeout = 0;
+ mDxePlatformAmtPolicy.AmtConfig.UnConfigureMe = 0;
+ mDxePlatformAmtPolicy.AmtConfig.HideUnConfigureMeConfirm = 0;
+ mDxePlatformAmtPolicy.AmtConfig.MebxDebugMsg = 0;
+ mDxePlatformAmtPolicy.AmtConfig.USBProvision = 0;
+ mDxePlatformAmtPolicy.AmtConfig.FWProgress = 1;
+ mDxePlatformAmtPolicy.AmtConfig.iAmtbxSelectionScreen = 0;
+ mDxePlatformAmtPolicy.AmtConfig.iAmtbxHotkeyPressed = 0;
+ mDxePlatformAmtPolicy.AmtConfig.AtEnabled = 1;
+ mDxePlatformAmtPolicy.AmtConfig.ManageabilityMode = 1;
+ //
+ // Oem Resolution Settings
+ //
+ mDxePlatformAmtPolicy.AmtConfig.MebxNonUiTextMode = 0; // MEBX_TEXT_AUTO
+ mDxePlatformAmtPolicy.AmtConfig.MebxUiTextMode = 0; // MEBX_TEXT_AUTO
+ mDxePlatformAmtPolicy.AmtConfig.MebxGraphicsMode = 0; // MEBX_GRAPHICS_AUTO
+
+ } else {
+ mDxePlatformAmtPolicy.AmtConfig.AsfEnabled = SetupData.Asf;
+ mDxePlatformAmtPolicy.AmtConfig.iAmtEnabled = SetupData.Amt;
+ mDxePlatformAmtPolicy.AmtConfig.WatchDog = SetupData.WatchDog;
+ mDxePlatformAmtPolicy.AmtConfig.WatchDogTimerOs = SetupData.WatchDogTimerOs;
+ mDxePlatformAmtPolicy.AmtConfig.WatchDogTimerBios = SetupData.WatchDogTimerBios;
+ mDxePlatformAmtPolicy.AmtConfig.CiraRequest = SetupData.AmtCiraRequest;
+ mDxePlatformAmtPolicy.AmtConfig.CiraTimeout = SetupData.AmtCiraTimeout;
+ mDxePlatformAmtPolicy.AmtConfig.UnConfigureMe = SetupData.UnConfigureMe;
+ mDxePlatformAmtPolicy.AmtConfig.HideUnConfigureMeConfirm = SetupData.HideUnConfigureMeConfirm;
+ mDxePlatformAmtPolicy.AmtConfig.MebxDebugMsg = SetupData.MebxDebugMsg;
+ mDxePlatformAmtPolicy.AmtConfig.USBProvision = SetupData.USBProvision;
+ mDxePlatformAmtPolicy.AmtConfig.FWProgress = SetupData.FWProgress;
+ mDxePlatformAmtPolicy.AmtConfig.iAmtbxSelectionScreen = SetupData.AmtbxSelectionScreen;
+ mDxePlatformAmtPolicy.AmtConfig.iAmtbxHotkeyPressed = SetupData.AmtbxHotKeyPressed;
+ mDxePlatformAmtPolicy.AmtConfig.AtEnabled = 1;
+ mDxePlatformAmtPolicy.AmtConfig.ManageabilityMode = 1;
+ //
+ // Oem Resolution Settings
+ //
+ mDxePlatformAmtPolicy.AmtConfig.MebxNonUiTextMode = 0; // MEBX_TEXT_AUTO
+ mDxePlatformAmtPolicy.AmtConfig.MebxUiTextMode = 0; // MEBX_TEXT_AUTO
+ mDxePlatformAmtPolicy.AmtConfig.MebxGraphicsMode = 0; // MEBX_GRAPHICS_AUTO
+
+ if(SetupData.AmtbxHotKeyPressed == 1)
+ SetupData.AmtbxHotKeyPressed = 0;
+
+ if(SetupData.AmtCiraRequest == 1)
+ SetupData.AmtCiraRequest = 0;
+
+ if(SetupData.UnConfigureMe == 1)
+ SetupData.UnConfigureMe = 0;
+
+ if(SetupData.Amt == 0)
+ mDxePlatformAmtPolicy.AmtConfig.USBProvision = USB_PROVISION_DEFAULT_WITHOUT_AMT;
+ }
+
+///////////////////////////////////////////////////////////////////////////
+ mDxePlatformAmtPolicy.AmtConfig.PciDeviceFilterOutTable = (UINT32) (UINTN) mPciDeviceFilterOutTable;
+ //
+ // Please don't change the default value of ForcMebxSyncUp and
+ // This let customer to force MEBX execution if they need and
+ //
+ mDxePlatformAmtPolicy.AmtConfig.ForcMebxSyncUp = 0;
+
+ //
+ // Get BIOS Sync-up data from MEBx to AMT platform policy
+ //
+ MebxVarAttr = 0;
+ VariableSize = sizeof (MeBiosExtensionSetupData);
+ Status = gRT->GetVariable (
+ gEfiMeBiosExtensionSetupName,
+ &gEfiMeBiosExtensionSetupGuid,
+ &MebxVarAttr,
+ &VariableSize,
+ &MeBiosExtensionSetupData
+ );
+ if (EFI_ERROR (Status)) {
+ mDxePlatformAmtPolicy.AmtConfig.ManageabilityMode = 0;
+ } else {
+ mDxePlatformAmtPolicy.AmtConfig.ManageabilityMode = MeBiosExtensionSetupData.PlatformMngSel;
+ }
+ //
+ // Install protocol to to allow access to this Policy.
+ //
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &ImageHandle,
+ &gDxePlatformAmtPolicyGuid,
+ &mDxePlatformAmtPolicy,
+ NULL
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ //
+ // Get iAMT configuration from Setup Data
+ //
+ VariableSize = sizeof(SETUP_DATA);
+ Status = gRT->SetVariable (
+ L"Setup",
+ &gSetupGuid,
+ SetupVarAttr,
+ VariableSize,
+ &SetupData );
+
+ return Status;
+}
+
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/AmtWrapper/AmtPlatformPolicy/AmtPlatformPolicy.cif b/Board/EM/MeWrapper/AmtWrapper/AmtPlatformPolicy/AmtPlatformPolicy.cif
new file mode 100644
index 0000000..7cffe71
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/AmtPlatformPolicy/AmtPlatformPolicy.cif
@@ -0,0 +1,14 @@
+<component>
+ name = "AmtPlatformPolicy"
+ category = ModulePart
+ LocalRoot = "Board\EM\MeWrapper\AmtWrapper\AmtPlatformPolicy"
+ RefName = "AmtPlatformPolicy"
+[files]
+"AmtPlatformPolicy.c"
+"AmtPlatformPolicy.h"
+"AmtPlatformPolicy.sdl"
+"AmtPlatformPolicy.mak"
+"AmtPlatformPolicy.dxs"
+[parts]
+"AmtPeiPolicyInit"
+<endComponent>
diff --git a/Board/EM/MeWrapper/AmtWrapper/AmtPlatformPolicy/AmtPlatformPolicy.dxs b/Board/EM/MeWrapper/AmtWrapper/AmtPlatformPolicy/AmtPlatformPolicy.dxs
new file mode 100644
index 0000000..fe01967
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/AmtPlatformPolicy/AmtPlatformPolicy.dxs
@@ -0,0 +1,54 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/AmtWrapper/AmtPlatformPolicy/AmtPlatformPolicy.dxs 1 2/08/12 1:09a Klzhan $
+//
+// $Revision: 1 $
+//
+// $Date: 2/08/12 1:09a $
+//
+//**********************************************************************
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: AmtDPlatformPolicy.DXS
+//
+// Description: This file is the dependency file for the NB DXE
+// driver
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+
+#include "EfiDepex.h"
+#include EFI_PROTOCOL_DEFINITION (MePlatformPolicy)
+
+DEPENDENCY_START
+ DXE_PLATFORM_ME_POLICY_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 **
+//** **
+//*************************************************************************
+//*************************************************************************
diff --git a/Board/EM/MeWrapper/AmtWrapper/AmtPlatformPolicy/AmtPlatformPolicy.h b/Board/EM/MeWrapper/AmtWrapper/AmtPlatformPolicy/AmtPlatformPolicy.h
new file mode 100644
index 0000000..ea8f278
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/AmtPlatformPolicy/AmtPlatformPolicy.h
@@ -0,0 +1,209 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/AmtWrapper/AmtPlatformPolicy/AmtPlatformPolicy.h 4 8/22/13 8:52a Tristinchou $
+//
+// $Revision: 4 $
+//
+// $Date: 8/22/13 8:52a $
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/AmtWrapper/AmtPlatformPolicy/AmtPlatformPolicy.h $
+//
+// 4 8/22/13 8:52a Tristinchou
+// [TAG] EIP131034
+// [Category] Improvement
+// [Description] The system will hang after create/ reset/delete raid
+// mode
+// [Files] AmtPlatformPolicy.h
+//
+// 3 5/14/12 4:50a Klzhan
+// [TAG] EIP89952
+// [Category] Spec Update
+// [Severity] Important
+// [Description] Update ME RC 0.56
+// [Files] AmtPlatformPolicy.c
+// AmtPlatformPolicy.h
+// AmtPlatformPolicy.sdl
+// AmtPlatformPolicy.mak
+// AmtPlatformPolicy.dxs
+// AmtPlatformPolicy.cif
+//
+// 2 4/24/12 12:41a Klzhan
+//
+// 1 2/08/12 1:08a Klzhan
+// Initial Check in
+//
+// 2 9/26/11 6:19a Klzhan
+// [TAG] EIP70516
+// [Category] Spec Update
+// [Severity] Important
+// [Description] Update ME 8.0 RC 0.8
+// [Files] AmtPlatformPolicy.c
+// AmtPlatformPolicy.h
+// AmtPlatformPolicy.sdl
+// AmtPlatformPolicy.mak
+// AmtPlatformPolicy.dxs
+// AmtPlatformPolicy.cif
+//
+// 1 2/25/11 1:45a Klzhan
+// Initial Check-in
+//
+// 1 12/03/10 5:11a Klzhan
+// Initial Check-in.
+//
+//**********************************************************************
+#ifndef _DXE_AMT_PLATFORM_POLICY_H_
+#define _DXE_AMT_PLATFORM_POLICY_H_
+
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#endif
+
+#include EFI_PROTOCOL_DEFINITION (MeBiosPayloadData)
+#include EFI_PROTOCOL_PRODUCER (AmtPlatformPolicy)
+#include EFI_GUID_DEFINITION (MeBiosExtensionSetup)
+#include "MeLib.h"
+#include "Include\Protocol\PDiskInfo.h"
+#include "Include\Protocol\PIDEController.h"
+// Debug #include "AmtPlatformPolicyUpdateDxeLib.h"
+
+typedef
+struct _INSTALL_DISK_INFO_PROTOCOL INSTALL_DISK_INFO_PROTOCOL;
+
+// Based on ATA/ATAPI-6
+#pragma pack (1)
+typedef struct _IDENTIFY_DATA{
+
+ UINT16 General_Config_0;
+ UINT16 Reserved_1;
+ UINT16 Special_Config_2;
+ UINT16 Reserved_3;
+ UINT16 Reserved_4;
+ UINT16 Reserved_5;
+ UINT16 Reserved_6;
+ UINT16 Reserved_7;
+ UINT16 Reserved_8;
+ UINT16 Reserved_9;
+ UINT8 Serial_Number_10[20];
+ UINT16 Reserved_20;
+ UINT16 Reserved_21;
+ UINT16 Reserved_22;
+ UINT8 Firmware_Revision_23[8];
+ UINT8 Model_Number_27[40];
+ UINT16 Maximum_Sector_Multiple_Command_47;
+ UINT16 Reserved_48;
+ UINT16 Capabilities_49;
+ UINT16 Capabilities_50;
+ UINT16 PIO_Mode_51;
+ UINT16 Reserved_52;
+ UINT16 Valid_Bits_53;
+ UINT16 Reserved_54_58[5];
+ UINT16 Valid_Bits_59;
+ UINT32 Addressable_Sector_60;
+ UINT16 SingleWord_DMA_62;
+ UINT16 MultiWord_DMA_63;
+ UINT16 PIO_Mode_64;
+ UINT16 Min_Multiword_DMA_timing_65;
+ UINT16 Manuf_Multiword_DMA_timing_66;
+ UINT16 Min_PIO_Mode_timing_67;
+ UINT16 Min_PIO_Mode_timing_68;
+ UINT16 Reserved_69_74[6];
+ UINT16 Queue_Depth_75;
+ UINT16 Reserved_76_79[4];
+ UINT16 Major_Revision_80;
+ UINT16 Minor_Revision_81;
+ UINT16 Command_Set_Supported_82;
+ UINT16 Command_Set_Supported_83;
+ UINT16 Command_Set_Supported_84;
+ UINT16 Command_Set_Enabled_85;
+ UINT16 Command_Set_Enabled_86;
+ UINT16 Command_Set_Enabled_87;
+ UINT16 UDMA_Mode_88;
+ UINT16 Time_security_Earse_89;
+ UINT16 Time_Esecurity_Earse_90;
+ UINT16 Current_Power_Level_91;
+ UINT16 Master_Password_Rev_92;
+ UINT16 Hard_Reset_Value_93;
+ UINT16 Acoustic_Level_94;
+ UINT16 Reserved_95_99[5];
+ UINT64 LBA_48;
+ UINT16 Reserved_104_126[23];
+ UINT16 Status_Notification_127;
+ UINT16 Security_Status_128;
+ UINT16 Reserved_129_159[31];
+ UINT16 CFA_Power_Mode_160;
+ UINT16 Reserved_161_175[15];
+ UINT16 Media_Serial_Number_176_205[30];
+ UINT16 Reserved_206_254[49];
+ UINT16 Checksum_255;
+} IDENTIFY_DATA;
+#pragma pack ()
+
+EFI_STATUS
+AmtDxePolicyInitEntryPoint (
+ IN EFI_HANDLE ImageHandle,
+ IN OUT EFI_SYSTEM_TABLE *SystemTable
+ )
+/*++
+
+Routine Description:
+
+ Initilize Intel AMT DXE Platform Policy
+
+Arguments:
+
+ ImageHandle - Image handle of this driver.
+ SystemTable - Global system service table.
+
+Returns:
+
+ EFI_SUCCESS Initialization complete.
+ EFI_UNSUPPORTED The chipset is unsupported by this driver.
+ EFI_OUT_OF_RESOURCES Do not have enough resources to initialize the driver.
+ EFI_DEVICE_ERROR Device error, driver exits abnormally.
+
+--*/
+;
+EFI_STATUS
+EFIAPI
+InstallDiskInfo (
+ VOID
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI *INSTALL_DISK_INFO) (
+ VOID
+ );
+
+typedef struct _INSTALL_DISK_INFO_PROTOCOL {
+ INSTALL_DISK_INFO Install;
+}INSTALL_DISK_INFO_PROTOCOL;
+
+#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/AmtWrapper/AmtPlatformPolicy/AmtPlatformPolicy.mak b/Board/EM/MeWrapper/AmtWrapper/AmtPlatformPolicy/AmtPlatformPolicy.mak
new file mode 100644
index 0000000..6cd33ff
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/AmtPlatformPolicy/AmtPlatformPolicy.mak
@@ -0,0 +1,116 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/AmtWrapper/AmtPlatformPolicy/AmtPlatformPolicy.mak 3 4/24/12 12:41a Klzhan $
+#
+# $Revision: 3 $
+#
+# $Date: 4/24/12 12:41a $
+#**********************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/AmtWrapper/AmtPlatformPolicy/AmtPlatformPolicy.mak $
+#
+# 3 4/24/12 12:41a Klzhan
+#
+# 2 2/23/12 8:59a Klzhan
+# Support New EDK
+#
+# 1 2/08/12 1:08a Klzhan
+# Initial Check in
+#
+# 2 9/26/11 6:19a Klzhan
+# [TAG] EIP70516
+# [Category] Spec Update
+# [Severity] Important
+# [Description] Update ME 8.0 RC 0.8
+# [Files] AmtPlatformPolicy.c
+# AmtPlatformPolicy.h
+# AmtPlatformPolicy.sdl
+# AmtPlatformPolicy.mak
+# AmtPlatformPolicy.dxs
+# AmtPlatformPolicy.cif
+#
+# 1 2/25/11 1:45a Klzhan
+# Initial Check-in
+#
+# 1 12/03/10 5:11a Klzhan
+# Initial Check-in.
+#
+#
+#**********************************************************************
+#<AMI_FHDR_START>
+#
+# Name: AmtPlatformPolicy.mak
+#
+# Description:
+#
+#<AMI_FHDR_END>
+#**********************************************************************
+All : AmtPlatformPolicy
+
+AmtPlatformPolicy : $(BUILD_DIR)\AmtPlatformPolicy.mak AmtPlatformPolicyBin
+
+$(BUILD_DIR)\AmtPlatformPolicy.mak : $(AmtPlatformPolicy_DIR)\$(@B).cif $(AmtPlatformPolicy_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(AmtPlatformPolicy_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+AmtPlatformPolicy_INCLUDES=\
+ $(EdkIIGlueLib_INCLUDES) \
+ $(ME_INCLUDES) \
+ $(MISCFRAMEWORK_INCLUDES) \
+ $(NB_INCLUDES)\
+ $(SB_INCLUDES)\
+ /I$(PROJECT_DIR)\
+ /IInclude\
+
+AmtPlatformPolicy_LIBS=\
+ $(EFIDRIVERLIB)\
+ $(MeProtocolLib_LIB)\
+ $(MeLibDxe_LIB)\
+ $(MeGuidLib_LIB)\
+!IF "$(x64_BUILD)"=="1"
+ $(EdkIIGlueBaseLibX64_LIB)\
+!ELSE
+ $(EdkIIGlueBaseLibIA32_LIB)\
+!ENDIF
+ $(EdkIIGlueBaseLib_LIB)\
+ $(EdkIIGlueDxeReportStatusCodeLib_LIB)\
+ $(EdkIIGlueDxeDebugLibReportStatusCode_LIB)\
+ $(EdkIIGlueUefiLib_LIB)\
+
+AmtPlatformPolicyBin : $(AmtPlatformPolicy_LIBS)
+ $(MAKE) /$(MAKEFLAGS) $(EDK_DEFAULTS)\
+ /f $(BUILD_DIR)\AmtPlatformPolicy.mak all\
+ GUID=1be65202-9318-492d-a551-08df2bd60aee\
+ "MY_INCLUDES = $(AmtPlatformPolicy_INCLUDES)" \
+ ENTRY_POINT=AmtPlatformPolicyEntryPoint\
+ DEPEX1=$(AmtPlatformPolicy_DIR)\AmtPlatformPolicy.dxs\
+ DEPEX1_TYPE=EFI_SECTION_DXE_DEPEX\
+ TYPE=BS_DRIVER\
+ 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/AmtWrapper/AmtPlatformPolicy/AmtPlatformPolicy.sdl b/Board/EM/MeWrapper/AmtWrapper/AmtPlatformPolicy/AmtPlatformPolicy.sdl
new file mode 100644
index 0000000..bb2e57d
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/AmtPlatformPolicy/AmtPlatformPolicy.sdl
@@ -0,0 +1,42 @@
+TOKEN
+ Name = "AmtPlatformPolicy_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable AmtPlatformPolicy support in Project"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+End
+
+PATH
+ Name = "AmtPlatformPolicy_DIR"
+End
+
+MODULE
+ Help = "Includes AmtPlatformPolicy.mak to Project"
+ File = "AmtPlatformPolicy.mak"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\AmtPlatformPolicy.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End
+
+TOKEN
+ Name = "USB_PROVISION_DEFAULT_WITHOUT_AMT"
+ Value = "0"
+ Help = "If set to 1, usb provision is functional when AMT disable"
+ TokenType = Integer
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "SW_SMI_POST_COMPLETE"
+ Value = "0xBB"
+ Help = "Value to be written into SMI command register \to set POST Complete flag for indicating that the POST is complete"
+ TokenType = Integer
+ TargetH = Yes
+ Range = "0-0xff"
+End
+
diff --git a/Board/EM/MeWrapper/AmtWrapper/AmtPlatformPolicy/Pei/AmtPeiPolicyInit.c b/Board/EM/MeWrapper/AmtWrapper/AmtPlatformPolicy/Pei/AmtPeiPolicyInit.c
new file mode 100644
index 0000000..0a3ecc2
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/AmtPlatformPolicy/Pei/AmtPeiPolicyInit.c
@@ -0,0 +1,233 @@
+/*++
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+--*/
+
+/*++
+
+Copyright (c) 1999 - 2010 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+Module Name:
+
+ AmtPeiPolicyInit.c
+
+Abstract:
+
+ This file is SampleCode for Intel AMT PEI Platform Policy initialzation.
+
+--*/
+#include "AmtPeiPolicyInit.h"
+
+#if EFI_SPECIFICATION_VERSION>0x20000
+#define __UEFI_HII__H__
+#define __HII_CONFIG_ACCESS__H__
+#include EFI_PROTOCOL_DEFINITION (HiiConfigAccess)
+#else
+#ifndef GUID_VARIABLE_DECLARATION
+#define GUID_VARIABLE_DECLARATION(Variable, Guid) extern EFI_GUID Variable
+#endif
+#define __UEFI_HII__H__
+#define __HII_PROTOCOL_H__
+#define _HII_H_
+#endif
+
+#include <Setup.h>
+
+#include EFI_PPI_DEFINITION (Variable)
+#include EFI_GUID_DEFINITION (MeBiosExtensionSetup)
+#include <ActiveManagement\AlertStandardFormat\Heci\Common\AlertStandardFormatCommon.h>
+#include <Guid\AmtForcePushPetPolicy\AmtForcePushPetPolicy.h>
+
+EFI_GUID gSetupGuid = SETUP_GUID;
+EFI_GUID gEfiMeBiosExtensionSetupGuid = EFI_ME_BIOS_EXTENSION_SETUP_GUID;
+CHAR16 gEfiMeBiosExtensionSetupName[] = EFI_ME_BIOS_EXTENSION_SETUP_VARIABLE_NAME;
+EFI_GUID gPeiReadOnlyVariablePpiGuid = PEI_READ_ONLY_VARIABLE_ACCESS_PPI_GUID;
+EFI_GUID gAmtForcePushPetPolicyGuid = AMT_FORCE_PUSH_PET_POLICY_GUID;
+
+EFI_STATUS
+CreateAmtForcePushPetPolicyHob(
+ IN EFI_PEI_SERVICES **PeiServices
+);
+
+//
+// Function implementations
+//
+EFI_STATUS
+AmtPeiPolicyInitEntryPoint (
+ IN EFI_FFS_FILE_HEADER *FfsHeader,
+ IN EFI_PEI_SERVICES **PeiServices
+ )
+/*++
+
+Routine Description:
+
+ Initilize Intel AMT PEI Platform Policy
+
+Arguments:
+
+ FfsHeader Pointer to Firmware File System file header.
+ PeiServices General purpose services available to every PEIM.
+
+Returns:
+
+ EFI_STATUS
+
+--*/
+{
+ EFI_STATUS Status;
+ PEI_AMT_PLATFORM_POLICY_PPI *AmtPlatformPolicyPpi;
+ EFI_PEI_PPI_DESCRIPTOR *AmtPlatformPolicyPpiDesc;
+ EFI_PEI_READ_ONLY_VARIABLE_PPI *VariableServices;
+ UINTN VariableSize;
+ SETUP_DATA SetupData;
+ ME_BIOS_EXTENSION_SETUP MeBiosExtensionSetupData;
+ //
+ // Allocate descriptor and PPI structures
+ //
+ AmtPlatformPolicyPpi = (PEI_AMT_PLATFORM_POLICY_PPI *) AllocateZeroPool (sizeof (PEI_AMT_PLATFORM_POLICY_PPI));
+ ASSERT (AmtPlatformPolicyPpi != NULL);
+ if (AmtPlatformPolicyPpi == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ AmtPlatformPolicyPpiDesc = (EFI_PEI_PPI_DESCRIPTOR *) AllocateZeroPool (sizeof (EFI_PEI_PPI_DESCRIPTOR));
+ ASSERT (AmtPlatformPolicyPpiDesc != NULL);
+ if (AmtPlatformPolicyPpiDesc == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ //
+ // Initialize the PPI
+ //
+ AmtPlatformPolicyPpiDesc->Flags = EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST;
+ AmtPlatformPolicyPpiDesc->Guid = &gPeiAmtPlatformPolicyPpiGuid;
+
+ // Locate Variable Ppi
+ Status = (*PeiServices)->LocatePpi (PeiServices, &gPeiReadOnlyVariablePpiGuid, 0, NULL, &VariableServices);
+
+ //
+ // Make sure we have a PPI, if not, just return.
+ //
+ if (!VariableServices) {
+ return EFI_SUCCESS;
+ }
+ //
+ // Get Setup Variable
+ //
+
+ VariableSize = sizeof (SETUP_DATA);
+ Status = VariableServices->PeiGetVariable (
+ PeiServices,
+ L"Setup",
+ &gSetupGuid,
+ NULL,
+ &VariableSize,
+ &SetupData
+ );
+ //
+ // Update the REVISION number
+ //
+ AmtPlatformPolicyPpi->Revision = PEI_AMT_PLATFORM_POLICY_PPI_REVISION_5;
+
+ //
+ // Initialize the Platform Configuration
+ //
+ if (Status != EFI_SUCCESS) {
+ AmtPlatformPolicyPpi->iAmtEnabled = 0;
+ AmtPlatformPolicyPpi->WatchDog = 0;
+ AmtPlatformPolicyPpi->WatchDogTimerBios = 0;
+ AmtPlatformPolicyPpi->WatchDogTimerOs = 0;
+ AmtPlatformPolicyPpi->AsfEnabled = 1;
+ AmtPlatformPolicyPpi->FWProgress = 1;
+ } else {
+ AmtPlatformPolicyPpi->iAmtEnabled = SetupData.Amt;
+ AmtPlatformPolicyPpi->WatchDog = SetupData.WatchDog;
+ AmtPlatformPolicyPpi->WatchDogTimerBios = SetupData.WatchDogTimerBios;
+ AmtPlatformPolicyPpi->WatchDogTimerOs = SetupData.WatchDogTimerOs;
+ AmtPlatformPolicyPpi->AsfEnabled = SetupData.Asf;
+ AmtPlatformPolicyPpi->FWProgress = SetupData.FWProgress;
+ }
+
+ //
+ // Get BIOS Sync-up data from MEBx to AMT platform policy
+ //
+ VariableSize = sizeof (MeBiosExtensionSetupData);
+ Status = VariableServices->PeiGetVariable(
+ PeiServices,
+ gEfiMeBiosExtensionSetupName,
+ &gEfiMeBiosExtensionSetupGuid,
+ NULL,
+ &VariableSize,
+ &MeBiosExtensionSetupData
+ );
+ if (Status != EFI_SUCCESS) {
+ AmtPlatformPolicyPpi->ManageabilityMode = 0;
+ } else {
+ AmtPlatformPolicyPpi->ManageabilityMode = MeBiosExtensionSetupData.PlatformMngSel;
+ }
+
+// Debug UpdatePeiAmtPlatformPolicy (PeiServices, AmtPlatformPolicyPpi);
+
+ AmtPlatformPolicyPpiDesc->Ppi = AmtPlatformPolicyPpi;
+ //
+ // Install the ME PEI Platform Policy PPI
+ //
+ Status = (**PeiServices).InstallPpi (PeiServices, AmtPlatformPolicyPpiDesc);
+ ASSERT_PEI_ERROR (PeiServices, Status);
+
+ CreateAmtForcePushPetPolicyHob(PeiServices);
+
+ return Status;
+}
+EFI_FRAMEWORK_MESSAGE_TYPE mAmtForcePushPetPolicy[] = {
+ EfiAsfMessageChassisIntrusion,
+ EfiAsfMessageUserAuthenticationInvalid,
+ EfiAsfMessageHddAuthenticationInvalid,
+};
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+//
+// Procedure: CreateAmtForcePushPetPolicyHob
+//
+// Description: Create AMT force push pet policy HOB.
+//
+// Input: IN EFI_PEI_SERVICES **PeiServices,
+//
+// Output: EFI_STATUS
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS
+CreateAmtForcePushPetPolicyHob(
+IN EFI_PEI_SERVICES **PeiServices
+)
+{
+ EFI_STATUS Status;
+ EFI_HOB_GUID_TYPE *Hob;
+
+ // Build the GUID'd HOB for DXE
+ Status = (*PeiServices)->CreateHob (
+ PeiServices,
+ EFI_HOB_TYPE_GUID_EXTENSION,
+ (UINT16) (sizeof (EFI_HOB_GUID_TYPE) + sizeof(mAmtForcePushPetPolicy)),
+ &Hob
+ );
+ if (EFI_ERROR (Status))return Status;
+
+ ((EFI_HOB_GUID_TYPE *)(Hob))->Name = gAmtForcePushPetPolicyGuid;
+
+ Hob++;
+
+ GlueCopyMem (Hob, mAmtForcePushPetPolicy, sizeof(mAmtForcePushPetPolicy));
+
+ return EFI_SUCCESS;
+}
diff --git a/Board/EM/MeWrapper/AmtWrapper/AmtPlatformPolicy/Pei/AmtPeiPolicyInit.cif b/Board/EM/MeWrapper/AmtWrapper/AmtPlatformPolicy/Pei/AmtPeiPolicyInit.cif
new file mode 100644
index 0000000..c6c717e
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/AmtPlatformPolicy/Pei/AmtPeiPolicyInit.cif
@@ -0,0 +1,13 @@
+<component>
+ name = "AmtPeiPolicyInit"
+ category = ModulePart
+ LocalRoot = "Board\EM\MeWrapper\AmtWrapper\AmtPlatformPolicy\Pei"
+ RefName = "AmtPeiPolicyInit"
+[files]
+"AmtPeiPolicyInit.c"
+"AmtPeiPolicyInit.h"
+"AmtPeiPolicyInit.sdl"
+"AmtPeiPolicyInit.mak"
+"AmtPeiPolicyInit.dxs"
+"AmtPeiPolicyInit.inf"
+<endComponent>
diff --git a/Board/EM/MeWrapper/AmtWrapper/AmtPlatformPolicy/Pei/AmtPeiPolicyInit.dxs b/Board/EM/MeWrapper/AmtWrapper/AmtPlatformPolicy/Pei/AmtPeiPolicyInit.dxs
new file mode 100644
index 0000000..abfebdd
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/AmtPlatformPolicy/Pei/AmtPeiPolicyInit.dxs
@@ -0,0 +1,35 @@
+/*++
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+--*/
+
+/*++
+
+Copyright (c) 1999 - 2010 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+Module Name:
+
+ MePeiPolicyInit.dxs
+
+Abstract:
+
+ Dependency expression source file.
+
+--*/
+
+#include "EfiDepex.h"
+
+DEPENDENCY_START
+ TRUE
+DEPENDENCY_END
+
+
diff --git a/Board/EM/MeWrapper/AmtWrapper/AmtPlatformPolicy/Pei/AmtPeiPolicyInit.h b/Board/EM/MeWrapper/AmtWrapper/AmtPlatformPolicy/Pei/AmtPeiPolicyInit.h
new file mode 100644
index 0000000..a4426bf
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/AmtPlatformPolicy/Pei/AmtPeiPolicyInit.h
@@ -0,0 +1,60 @@
+/*++
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+--*/
+
+/*++
+
+Copyright (c) 1999 - 2010 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+Module Name:
+
+ AmtPeiPolicyInit.h
+
+Abstract:
+
+ Header file for the AmtPeiPolicyInit PEIM.
+
+--*/
+#ifndef _AMT_PEI_PLATFORM_POLICY_H_
+#define _AMT_PEI_PLATFORM_POLICY_H_
+
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGluePeim.h"
+#endif
+
+#include EFI_PPI_DEFINITION (AmtPlatformPolicyPei)
+// Debug #include "AmtPlatformPolicyUpdatePeiLib.h"
+
+EFI_STATUS
+AmtPeiPolicyInitEntryPoint (
+ IN EFI_FFS_FILE_HEADER *FfsHeader,
+ IN EFI_PEI_SERVICES **PeiServices
+ )
+/*++
+
+Routine Description:
+
+ Initilize Intel AMT PEI Platform Policy
+
+Arguments:
+
+ FfsHeader Pointer to Firmware File System file header.
+ PeiServices General purpose services available to every PEIM.
+
+Returns:
+
+ EFI_STATUS
+
+--*/
+;
+#endif
diff --git a/Board/EM/MeWrapper/AmtWrapper/AmtPlatformPolicy/Pei/AmtPeiPolicyInit.inf b/Board/EM/MeWrapper/AmtWrapper/AmtPlatformPolicy/Pei/AmtPeiPolicyInit.inf
new file mode 100644
index 0000000..f039471
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/AmtPlatformPolicy/Pei/AmtPeiPolicyInit.inf
@@ -0,0 +1,81 @@
+#
+#/*++
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#--*/
+#
+#/*++
+#
+# Copyright (c) 1999 - 2010 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# Module Name:
+#
+# AmtPeiPolicyInit.inf
+#
+# Abstract:
+#
+# Component description file for the AmtPeiPolicyInit PEIM.
+#
+#--*/
+
+
+[defines]
+BASE_NAME = AmtPeiPolicyInit
+FILE_GUID = A05ECE52-15A8-424e-BFD3-FCF3D566A09C
+COMPONENT_TYPE = PE32_PEIM
+
+[sources.common]
+ AmtPeiPolicyInit.c
+ AmtPeiPolicyInit.h
+#
+# Edk II Glue Driver Entry Point
+#
+ EdkIIGluePeimEntryPoint.c
+
+[includes.common]
+ $(EFI_SOURCE)\$(PROJECT_ME_ROOT)
+
+#
+# EDK II Glue Library utilizes some standard headers from EDK
+#
+ $(EDK_SOURCE)\Foundation
+ $(EDK_SOURCE)\Foundation\Core\Dxe
+ $(EDK_SOURCE)\Foundation\Efi
+ $(EDK_SOURCE)\Foundation\Efi\Include
+ $(EDK_SOURCE)\Foundation\Framework
+ $(EDK_SOURCE)\Foundation\Framework\Include
+ $(EDK_SOURCE)\Foundation\Include
+ $(EDK_SOURCE)\Foundation\Include\IndustryStandard
+ $(EDK_SOURCE)\Foundation\Include\Pei
+ $(EDK_SOURCE)\Foundation\Library\Dxe\Include
+ $(EDK_SOURCE)\Foundation\Library\EdkIIGlueLib\Include
+
+[libraries.common]
+ MeLibPpi
+ PeiLib
+ EdkIIGlueBaseLib
+ EdkIIGlueBaseMemoryLib
+ EdkIIGluePeiDebugLibReportStatusCode
+ EdkIIGluePeiReportStatusCodeLib
+ EdkIIGluePeiServicesLib
+ EdkIIGluePeiMemoryAllocationLib
+
+[nmake.common]
+ IMAGE_ENTRY_POINT= _ModuleEntryPoint
+ DPX_SOURCE=AmtPeiPolicyInit.dxs
+ C_FLAGS = $(C_FLAGS) /D "__EDKII_GLUE_MODULE_ENTRY_POINT__=AmtPeiPolicyInitEntryPoint" \
+ /D __EDKII_GLUE_BASE_LIB__ \
+ /D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ /D __EDKII_GLUE_PEI_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ /D __EDKII_GLUE_PEI_REPORT_STATUS_CODE_LIB__ \
+ /D __EDKII_GLUE_PEI_SERVICES_LIB__ \
+ /D __EDKII_GLUE_PEI_MEMORY_ALLOCATION_LIB__ \
diff --git a/Board/EM/MeWrapper/AmtWrapper/AmtPlatformPolicy/Pei/AmtPeiPolicyInit.mak b/Board/EM/MeWrapper/AmtWrapper/AmtPlatformPolicy/Pei/AmtPeiPolicyInit.mak
new file mode 100644
index 0000000..ee122c7
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/AmtPlatformPolicy/Pei/AmtPeiPolicyInit.mak
@@ -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/AmtWrapper/AmtPlatformPolicy/AmtPeiPolicyInit/AmtPeiPolicyInit.mak 2 2/23/12 8:59a Klzhan $
+#
+# $Revision: 2 $
+#
+# $Date: 2/23/12 8:59a $
+#**********************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/AmtWrapper/AmtPlatformPolicy/AmtPeiPolicyInit/AmtPeiPolicyInit.mak $
+#
+# 2 2/23/12 8:59a Klzhan
+# Support New EDK
+#
+# 1 2/08/12 1:09a Klzhan
+#
+# 1 3/29/11 5:03a Klzhan
+#
+# 1 2/25/11 1:45a Klzhan
+# Initial Check-in
+#
+# 1 12/03/10 5:11a Klzhan
+# Initial Check-in.
+#
+#
+#**********************************************************************
+#<AMI_FHDR_START>
+#
+# Name: AmtPlatformPolicy.mak
+#
+# Description:
+#
+#<AMI_FHDR_END>
+#**********************************************************************
+All : AmtPeiPolicyInit
+
+AmtPeiPolicyInit : $(BUILD_DIR)\AmtPeiPolicyInit.mak AmtPeiPolicyInitBin
+
+$(BUILD_DIR)\AmtPeiPolicyInit.mak : $(AmtPeiPlatformPolicy_DIR)\$(@B).cif $(AmtPeiPlatformPolicy_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(AmtPeiPlatformPolicy_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+AmtPeiPlatformPolicy_INCLUDES=\
+ $(EDK_INCLUDES) \
+ $(ME_INCLUDES) \
+ $(MISCFRAMEWORK_INCLUDES) \
+ $(NB_INCLUDES)\
+ $(SB_INCLUDES)\
+ /I$(PROJECT_DIR)\
+ /IInclude\
+
+
+AmtPeiPlatformPolicy_DEFINES=$(MY_DEFINES)\
+ /D"__EDKII_GLUE_MODULE_ENTRY_POINT__=AmtPeiPolicyInitEntryPoint"\
+ /D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ /D __EDKII_GLUE_PEI_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ /D __EDKII_GLUE_PEI_REPORT_STATUS_CODE_LIB__\
+ /D __EDKII_GLUE_PEI_SERVICES_LIB__ \
+ /D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__ \
+
+AmtPeiPlatformPolicy_LIBS=\
+ $(EDKPROTOCOLLIB)\
+ $(MeLibPpi_LIB)\
+ $(EdkIIGlueBaseLib_LIB)\
+ $(EdkIIGlueBaseLibIA32_LIB)\
+ $(EdkIIGluePeiServicesLib_LIB)\
+ $(EdkIIGluePeiHobLib_LIB)\
+ $(EdkIIGluePeiMemoryAllocationLib_LIB)\
+ $(EdkIIGlueBaseIoLibIntrinsic_LIB)\
+ $(EdkIIGluePeiDebugLibReportStatusCode_LIB)\
+ $(EdkIIGluePeiReportStatusCodeLib_LIB)\
+ $(PEILIB)
+
+
+AmtPeiPolicyInitBin : $(AmtPeiPlatformPolicy_LIBS)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\AmtPeiPolicyInit.mak all\
+ GUID=A05ECE52-15A8-424e-BFD3-FCF3D566A09C\
+ "MY_INCLUDES = $(AmtPeiPlatformPolicy_INCLUDES)" \
+ "MY_DEFINES=$(AmtPeiPlatformPolicy_DEFINES)"\
+ ENTRY_POINT=AmtPeiPolicyInitEntryPoint\
+ TYPE=PEIM\
+ EDKIIModule=PEIM\
+ DEPEX1=$(AmtPeiPlatformPolicy_DIR)\AmtPeiPolicyInit.dxs\
+ DEPEX1_TYPE=EFI_SECTION_PEI_DEPEX\
+ COMPRESS=0
+
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2010, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/Board/EM/MeWrapper/AmtWrapper/AmtPlatformPolicy/Pei/AmtPeiPolicyInit.sdl b/Board/EM/MeWrapper/AmtWrapper/AmtPlatformPolicy/Pei/AmtPeiPolicyInit.sdl
new file mode 100644
index 0000000..15734dd
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/AmtPlatformPolicy/Pei/AmtPeiPolicyInit.sdl
@@ -0,0 +1,25 @@
+TOKEN
+ Name = "AmtPeiPlatformPolicy_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable AmtPlatformPolicy support in Project"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+End
+
+PATH
+ Name = "AmtPeiPlatformPolicy_DIR"
+End
+
+MODULE
+ Help = "Includes AmtPlatformPolicy.mak to Project"
+ File = "AmtPeiPolicyInit.mak"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\AmtPeiPolicyInit.ffs"
+ Parent = "FV_BB"
+ InvokeOrder = AfterParent
+End
+
diff --git a/Board/EM/MeWrapper/AmtWrapper/AmtSetup/AmtSMIFlashElink.c b/Board/EM/MeWrapper/AmtWrapper/AmtSetup/AmtSMIFlashElink.c
new file mode 100644
index 0000000..0716540
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/AmtSetup/AmtSMIFlashElink.c
@@ -0,0 +1,128 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/AmtWrapper/AmtSetup/AmtSMIFlashElink.c 3 5/14/14 9:48p Tristinchou $
+//
+// $Revision: 3 $
+//
+// $Date: 5/14/14 9:48p $
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/AmtWrapper/AmtSetup/AmtSMIFlashElink.c $
+//
+// 3 5/14/14 9:48p Tristinchou
+// [TAG] EIP167030
+// [Category] Improvement
+// [Description] Remove the variable runtime attribute and keep original
+// attributes.
+//
+// 2 9/19/12 6:38a Klzhan
+// Check MebxVariable exist or not before restore.
+//
+// 1 4/24/12 12:38a Klzhan
+// Update modulepart to latest
+//
+// 1 2/16/12 9:01a Klzhan
+// [TAG] EIP83223
+// [Category] Improvement
+// [Description] Restore MEBiosExtensionSetup when NVRam updated by AFU.
+//
+//**********************************************************************
+
+//<AMI_FHDR_START>
+//---------------------------------------------------------------------------
+// Name: AMTSMIFlashElink.c
+//
+// Description: AMT TSE Functions.
+//
+//---------------------------------------------------------------------------
+//<AMI_FHDR_END>
+#include <AmiDxeLib.h>
+#include "MeBiosExtensionSetup\MeBiosExtensionSetup.h"
+
+ME_BIOS_EXTENSION_SETUP BiosExtensionSetup;
+UINT32 mMebxSetupVariableDataAttr;
+UINTN mMebxSetupVariableDataSize;
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------
+// Procedure: PreserveMEBXSyncData
+//
+// Description: Restore the MEBiosExtensionSetup variable
+//
+// Input: NONE
+//
+// Output: NONE
+//
+// Returns: NONE
+//
+//----------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID PreserveMEBXSyncData (VOID)
+{
+
+ EFI_STATUS Status;
+
+ mMebxSetupVariableDataSize = sizeof(ME_BIOS_EXTENSION_SETUP);
+ Status = pRS->GetVariable ( gEfiMeBiosExtensionSetupName,
+ &gEfiMeBiosExtensionSetupGuid,
+ &mMebxSetupVariableDataAttr,
+ &mMebxSetupVariableDataSize,
+ &BiosExtensionSetup);
+
+ if(EFI_ERROR(Status))
+ mMebxSetupVariableDataSize = 0;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------
+// Procedure: RestoreMEBXSyncData
+//
+// Description: Restore the MEBiosExtensionSetup variable
+//
+// Input: NONE
+//
+// Output: NONE
+//
+// Returns: NONE
+//
+//----------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID RestoreMEBXSyncData (VOID)
+{
+ EFI_STATUS Status;
+
+ if(mMebxSetupVariableDataSize == 0)
+ return;
+
+ Status = pRS->SetVariable ( gEfiMeBiosExtensionSetupName,
+ &gEfiMeBiosExtensionSetupGuid,
+ mMebxSetupVariableDataAttr,
+ mMebxSetupVariableDataSize,
+ &BiosExtensionSetup );
+}
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/AmtWrapper/AmtSetup/AmtSetup.c b/Board/EM/MeWrapper/AmtWrapper/AmtSetup/AmtSetup.c
new file mode 100644
index 0000000..a643c62
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/AmtSetup/AmtSetup.c
@@ -0,0 +1,236 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/AmtWrapper/AmtSetup/AmtSetup.c 5 5/14/14 9:48p Tristinchou $
+//
+// $Revision: 5 $
+//
+// $Date: 5/14/14 9:48p $
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/AmtWrapper/AmtSetup/AmtSetup.c $
+//
+// 5 5/14/14 9:48p Tristinchou
+// [TAG] EIP167030
+// [Category] Improvement
+// [Description] Remove the variable runtime attribute and keep original
+// attributes.
+//
+// 4 9/19/12 6:37a Klzhan
+// Fix entry point return type.
+//
+// 3 6/05/12 2:05a Klzhan
+// [TAG] EIP91581
+// [Category] Improvement
+// [Description] Avoid system crash when HECI reset
+//
+// 1 2/08/12 1:08a Klzhan
+// Initial Check in
+//
+// 2 7/14/11 7:45a Klzhan
+// Add "Disable ME" setup item.
+//
+// 1 2/25/11 1:44a Klzhan
+// Initial Check-in
+//
+// 1 12/03/10 5:11a Klzhan
+// Initial Check-in.
+//
+//**********************************************************************
+//
+//<AMI_FHDR_START>
+//---------------------------------------------------------------------------
+// Name: AMTSetup.c
+//
+// Description: AMT TSE Functions.
+//
+//---------------------------------------------------------------------------
+//<AMI_FHDR_END>
+#include "Token.h"
+#include "Efi.h"
+#include "EfiDriverLib.h"
+#include "EfiCommonLib.h"
+#include "Amt.h"
+#include "EfiScriptLib.h"
+#include "AmtLib.h"
+#include "Include\Protocol\LegacySredir.h"
+#include "AmtSetup.h"
+#include <SetupDataDefinition.h>
+#include "MELib.h"
+#include EFI_PROTOCOL_CONSUMER (AmtPlatformPolicy)
+#include EFI_PROTOCOL_CONSUMER (AmtWrapper)
+#include EFI_PROTOCOL_DEFINITION (MeBiosPayloadData)
+#include "Protocol\AmtWrapper\AmtWrapper.h"
+
+EFI_GUID gEfiAmtWrapperProtocolGuid = EFI_AMT_WRAPPER_PROTOCOL_GUID;
+
+#define SETUP_GUID { 0xEC87D643, 0xEBA4, 0x4BB5, 0xA1, 0xE5, 0x3F, 0x3E, 0x36, 0xB2, 0x0D, 0xA9 }
+EFI_GUID gEfiSetupGuid = SETUP_GUID;
+
+VOID
+SetMEDisable (
+ IN UINT8 Grayout
+)
+{
+#if defined(iAMT_SUPPORT) && (iAMT_SUPPORT == 1)
+ SETUP_DATA gSetupData;
+ UINTN SetupDataSize;
+ EFI_STATUS Status;
+ EFI_HECI_PROTOCOL *Heci;
+ UINT32 MeMode;
+ DXE_MBP_DATA_PROTOCOL *mBIOSPayLoad;
+
+ Status = gBS->LocateProtocol (
+ &gEfiHeciProtocolGuid,
+ NULL,
+ &Heci
+ );
+
+ if (EFI_ERROR (Status)) {
+ return;
+ }
+
+ Status = Heci->GetMeMode (&MeMode);
+
+ if (EFI_ERROR (Status)) {
+ return;
+ }
+
+ SetupDataSize = sizeof(SETUP_DATA);
+ Status = gRT->GetVariable ( L"Setup", \
+ &gEfiSetupGuid, \
+ NULL, \
+ &SetupDataSize, \
+ &gSetupData );
+
+ if (EFI_ERROR (Status)) {
+ return;
+ }
+
+ Status = gBS->LocateProtocol(&gMeBiosPayloadDataProtocolGuid,
+ NULL, &mBIOSPayLoad);
+
+ if (EFI_ERROR (Status)) {
+ return;
+ }
+
+ if(gSetupData.MEDisabled)
+ {
+ // AT in Inactive mode, and no SOL or IDER or KVM session
+ // can't set ME to disabled
+ if((MeMode == ME_MODE_NORMAL) &&
+ (mBIOSPayLoad->MeBiosPayload.AtState.State == 0) &&
+ (Grayout == 0))
+ {
+ Status = HeciSetMeDisableMsg();
+ if(!EFI_ERROR(Status))
+ {
+ Status = HeciSendCbmResetRequest (CBM_RR_REQ_ORIGIN_BIOS_POST, CBM_HRR_GLOBAL_RESET);
+ if(!EFI_ERROR(Status))
+ EFI_DEADLOOP();
+ }
+ }
+ }else
+ {
+ if(MeMode == ME_MODE_TEMP_DISABLED)
+ {
+ Status = HeciSetMeEnableMsg();
+ if(!EFI_ERROR(Status))
+ {
+ Status = HeciSendCbmResetRequest (CBM_RR_REQ_ORIGIN_BIOS_POST, CBM_HRR_GLOBAL_RESET);
+ if(!EFI_ERROR(Status))
+ EFI_DEADLOOP();
+ }
+ }
+ }
+#endif
+}
+
+
+EFI_STATUS
+InitializeAmtSetup (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+)
+{
+ SETUP_AMT_FEATURES SetupAmtFeatures;
+ EFI_STATUS Status;
+ UINT32 VarAttr;
+ UINTN VariableSize;
+ UINTN Update = 0;
+ UINT8 GrayOut;
+ AMT_WRAPPER_PROTOCOL *pAmtWrapper = NULL;
+
+
+ EfiInitializeDriverLib (ImageHandle, SystemTable);
+
+ Status = gBS->LocateProtocol(
+ &gEfiAmtWrapperProtocolGuid,
+ NULL,
+ &pAmtWrapper);
+
+ ASSERT_EFI_ERROR(Status);
+
+ VariableSize = sizeof(SETUP_AMT_FEATURES);
+ Status = gRT->GetVariable(
+ L"SetupAmtFeatures",
+ &gEfiSetupGuid,
+ &VarAttr,
+ &VariableSize,
+ &SetupAmtFeatures);
+
+ if ( pAmtWrapper->ActiveManagementEnableIdeR() ||
+ pAmtWrapper->ActiveManagementEnableSol() ||
+ pAmtWrapper->ActiveManagementEnableKvm()) {
+ GrayOut = 1;
+ } else {
+ GrayOut = 0;
+ }
+
+ if (SetupAmtFeatures.GrayOut != GrayOut) {
+ SetupAmtFeatures.GrayOut = GrayOut;
+ Update = 1;
+ }
+
+ if (Update || EFI_ERROR(Status)) {
+ if( Status == EFI_NOT_FOUND )
+ VarAttr = EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS;
+ Status = gRT->SetVariable(
+ L"SetupAmtFeatures",
+ &gEfiSetupGuid,
+ VarAttr,
+ sizeof(SETUP_AMT_FEATURES),
+ &SetupAmtFeatures);
+ ASSERT_EFI_ERROR(Status);
+ }
+ SetMEDisable(GrayOut);
+
+
+ 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/AmtWrapper/AmtSetup/AmtSetup.cif b/Board/EM/MeWrapper/AmtWrapper/AmtSetup/AmtSetup.cif
new file mode 100644
index 0000000..58618a7
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/AmtSetup/AmtSetup.cif
@@ -0,0 +1,16 @@
+<component>
+ name = "AmtSetup"
+ category = ModulePart
+ LocalRoot = "Board\EM\MeWrapper\AmtWrapper\AmtSetup"
+ RefName = "AmtSetup"
+[files]
+"AmtSetup.sdl"
+"AmtSetup.mak"
+"AmtSetup.c"
+"AmtSetup.sd"
+"AmtSetup.uni"
+"AmtSetup.h"
+"AmtSetup.dxs"
+"AmtTseFunc.c"
+"AmtSMIFlashElink.c"
+<endComponent>
diff --git a/Board/EM/MeWrapper/AmtWrapper/AmtSetup/AmtSetup.dxs b/Board/EM/MeWrapper/AmtWrapper/AmtSetup/AmtSetup.dxs
new file mode 100644
index 0000000..057c0e5
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/AmtSetup/AmtSetup.dxs
@@ -0,0 +1,70 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/AmtWrapper/AmtSetup/AmtSetup.dxs 1 2/08/12 1:08a Klzhan $
+//
+// $Revision: 1 $
+//
+// $Date: 2/08/12 1:08a $
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/AmtWrapper/AmtSetup/AmtSetup.dxs $
+//
+// 1 2/08/12 1:08a Klzhan
+// Initial Check in
+//
+// 1 2/25/11 1:44a Klzhan
+// Initial Check-in
+//
+// 1 12/03/10 5:11a Klzhan
+// Initial Check-in.
+//
+//**********************************************************************
+//
+//<AMI_FHDR_START>
+//---------------------------------------------------------------------------
+// Name: AMTSetup.dxs
+//
+// Description: AMT TSE dependency file.
+//
+//---------------------------------------------------------------------------
+//<AMI_FHDR_END>
+
+#include <Protocol\Variable.h>
+#include "Protocol\AmtWrapper\AmtWrapper.h"
+
+#include EFI_PROTOCOL_DEFINITION (ActiveManagement)
+
+DEPENDENCY_START
+ EFI_VARIABLE_ARCH_PROTOCOL_GUID AND
+ EFI_VARIABLE_WRITE_ARCH_PROTOCOL_GUID AND
+ EFI_ACTIVE_MANAGEMENT_PROTOCOL_GUID AND
+ EFI_AMT_WRAPPER_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 **
+//** **
+//*************************************************************************
+//*************************************************************************
+
diff --git a/Board/EM/MeWrapper/AmtWrapper/AmtSetup/AmtSetup.h b/Board/EM/MeWrapper/AmtWrapper/AmtSetup/AmtSetup.h
new file mode 100644
index 0000000..00b842c
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/AmtSetup/AmtSetup.h
@@ -0,0 +1,74 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/AmtWrapper/AmtSetup/AmtSetup.h 1 2/08/12 1:08a Klzhan $
+//
+// $Revision: 1 $
+//
+// $Date: 2/08/12 1:08a $
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/AmtWrapper/AmtSetup/AmtSetup.h $
+//
+// 1 2/08/12 1:08a Klzhan
+// Initial Check in
+//
+// 1 2/25/11 1:44a Klzhan
+// Initial Check-in
+//
+// 1 12/03/10 5:11a Klzhan
+// Initial Check-in.
+//
+//**********************************************************************
+//
+//<AMI_FHDR_START>
+//---------------------------------------------------------------------------
+// Name: AMTSetup.sd
+//
+// Description: AMT TSE makfile.
+//
+//---------------------------------------------------------------------------
+//<AMI_FHDR_END>
+#ifndef __AMT_SETUP_H__
+#define __AMT_SETUP_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+//This structure is used for setup.
+typedef struct {
+ UINT8 GrayOut;
+} SETUP_AMT_FEATURES;
+
+
+/****** 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/AmtWrapper/AmtSetup/AmtSetup.mak b/Board/EM/MeWrapper/AmtWrapper/AmtSetup/AmtSetup.mak
new file mode 100644
index 0000000..e5cedb1
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/AmtSetup/AmtSetup.mak
@@ -0,0 +1,166 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/AmtWrapper/AmtSetup/AmtSetup.mak 3 4/24/12 12:38a Klzhan $
+#
+# $Revision: 3 $
+#
+# $Date: 4/24/12 12:38a $
+#**********************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/AmtWrapper/AmtSetup/AmtSetup.mak $
+#
+# 3 4/24/12 12:38a Klzhan
+# Update modulepart to latest
+#
+# 2 2/23/12 8:58a Klzhan
+# Support New EDK
+#
+# 1 2/08/12 1:08a Klzhan
+# Initial Check in
+#
+# 2 7/14/11 7:45a Klzhan
+# Add "Disable ME" setup item.
+#
+# 1 2/25/11 1:44a Klzhan
+# Initial Check-in
+#
+# 1 12/03/10 5:11a Klzhan
+# Initial Check-in.
+#
+#**********************************************************************
+#
+#<AMI_FHDR_START>
+#---------------------------------------------------------------------------
+# Name: AMTSetup.sd
+#
+# Description: AMT TSE makfile.
+#
+#---------------------------------------------------------------------------
+#<AMI_FHDR_END>
+
+#---------------------------------------------------------------------------
+# Create AMT Setup Screens
+#---------------------------------------------------------------------------
+All : AmtSetup
+
+AmtSetup : $(BUILD_DIR)\AmtSetup.mak AmtSetupBin
+#AmtSetup : $(BUILD_DIR)\AmtSetup.mak AmtSetupBin
+AmtTseFunc_lib : $(BUILD_DIR)\AmtSetup.mak AmtTseSetupBin
+
+
+SetupSdbs : $(BUILD_DIR)\AmtSetup.sdb
+
+$(BUILD_DIR)\AmtSetup.sdb : $(AMT_SETUP_DIR)\$(@B).sd $(AMT_SETUP_DIR)\$(@B).uni
+ $(STRGATHER) -i INCLUDE -parse -newdb -db $(BUILD_DIR)\$(@B).sdb $(AMT_SETUP_DIR)\$(@B).uni
+ $(STRGATHER) -scan -db $(BUILD_DIR)\$(@B).sdb -od $(BUILD_DIR)\$(@B).sdb $(AMT_SETUP_DIR)\$(@B).sd
+
+$(BUILD_DIR)\AmtSetup.mak : $(AMT_SETUP_DIR)\$(@B).cif $(AMT_SETUP_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(AMT_SETUP_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+AmtSetup_INCLUDES= \
+ $(EDK_INCLUDES) \
+ $(MISCFRAMEWORK_INCLUDES) \
+ $(ME_INCLUDES) \
+ $(IndustryStandard_INCLUDES)\
+
+AmtSetup_CFLAGS=$(CFLAGS) \
+ -I $(TSEBIN_DIR)\Inc \
+ -I $(TSEBIN_DIR)\
+ -I ReferenceCode\ME\Protocol\
+ -I Board\EM\MeWrapper\AmtWrapper\Protocol
+
+AmtTseSetup_INCLUDES= \
+ /I$(PROJECT_DIR) \
+ $(EDK_INCLUDES) \
+ $(MISCFRAMEWORK_INCLUDES) \
+ $(ME_INCLUDES) \
+ /IInclude\Protocol\
+ /IInclude\IndustryStandard\
+ /IInclude\
+
+SetupData : $(BUILD_DIR)\AmtTseFunc.obj
+
+$(BUILD_DIR)\AmtTseFunc.obj : $(AMT_SETUP_DIR)\AmtTseFunc.c
+ $(CC) $(AmtSetup_CFLAGS) /Fo$(BUILD_DIR)\ $(AMT_SETUP_DIR)\AmtTseFunc.c
+
+AMT_SETUPLIB_OBJECTS = $(BUILD_DIR)\$(AMT_SETUP_DIR)\AmtTseFunc.obj
+AMT_SETUP_OBJECTS = $(BUILD_DIR)\$(AMT_SETUP_DIR)\AmtSetup.obj
+
+AMT_SETUP_LIBS=\
+ $(EFIDRIVERLIB)\
+ $(MeLibDxe_LIB)\
+ $(EfiScriptLib_LIB)\
+ $(EdkIIGlueBaseLib_LIB)\
+ $(EDKFRAMEWORKPROTOCOLLIB)\
+ $(EFIPROTOCOLLIB)\
+!IF "$(x64_BUILD)"=="1"
+ $(EdkIIGlueBaseLibX64_LIB)\
+!ELSE
+ $(EdkIIGlueBaseLibIA32_LIB)\
+!ENDIF
+ $(EdkIIGlueBaseLib_LIB)\
+ $(EdkIIGlueDxeReportStatusCodeLib_LIB)\
+ $(EdkIIGlueDxeDebugLibReportStatusCode_LIB)\
+ $(EdkIIGlueDxeMemoryAllocationLib_LIB)\
+ $(EFIGUIDLIB)\
+ $(EDKPROTOCOLLIB)\
+ $(EdkIIGlueBaseIoLibIntrinsic_LIB)\
+ $(EdkIIGlueBaseMemoryLib_LIB)\
+ $(EdkIIGlueEdkDxeRuntimeDriverLib_LIB)\
+ $(EdkIIGlueUefiLib_LIB)\
+ $(EdkIIGlueDxeHobLib_LIB)\
+
+AmtSetupBin : $(AMT_SETUP_LIBS)
+ $(MAKE) /$(MAKEFLAGS) $(EDK_DEFAULTS)\
+ /f $(BUILD_DIR)\AmtSetup.mak all \
+ "MY_INCLUDES=$(AmtSetup_INCLUDES)"\
+ GUID=773CB08B-511A-4bd5-85AD-41D4F4B64A52 \
+ TYPE=BS_DRIVER \
+ "OBJECTS=$(AMT_SETUP_OBJECTS)"\
+ ENTRY_POINT=InitializeAmtSetup \
+ DEPEX1=$(AMT_SETUP_DIR)\AmtSetup.dxs \
+ DEPEX1_TYPE=EFI_SECTION_DXE_DEPEX \
+ COMPRESS=1
+
+#---------------------------------------------------------------------------
+# Create Restore BIOSExtesionSetup Restore Component
+#---------------------------------------------------------------------------
+AmtSMIFlashElink : $(BUILD_DIR)\AmtSetup.mak AmtSMIFlashElinkBin
+
+AmtSMIFlashElinkObjs = $(BUILD_DIR)\$(AMT_SETUP_DIR)\AmtSMIFlashElink.obj
+
+AmtSMIFlashElinkBin : $(AMIDXELIB) $(MeGuidLib_LIB)
+ $(MAKE) /$(MAKEFLAGS) $(BUILD_DEFAULTS)\
+ /f $(BUILD_DIR)\AmtSetup.mak all\
+ "CFLAGS=$(CFLAGS:/W4=/W3) /I$(MeGuidLib_DIR)" \
+ OBJECTS="$(AmtSMIFlashElinkObjs)" \
+ NAME=AmtSetup \
+ TYPE=LIBRARY LIBRARY_NAME=$(AMT_SMIFLASH_LIB)
+
+$(AMT_SMIFLASH_LIB) : AmtSMIFlashElink
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/AmtWrapper/AmtSetup/AmtSetup.sd b/Board/EM/MeWrapper/AmtWrapper/AmtSetup/AmtSetup.sd
new file mode 100644
index 0000000..8f9bd1a
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/AmtSetup/AmtSetup.sd
@@ -0,0 +1,382 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/AmtWrapper/AmtSetup/AmtSetup.sd 5 9/24/15 3:04a Tristinchou $
+//
+// $Revision: 5 $
+//
+// $Date: 9/24/15 3:04a $
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/AmtWrapper/AmtSetup/AmtSetup.sd $
+//
+// 5 9/24/15 3:04a Tristinchou
+// [TAG] EIP238392
+// [Category] Improvement
+// [Description] Change USB Provisioning default to disable
+//
+// 4 8/02/13 5:02a Klzhan
+// [TAG] EIP131372
+// [Category] Improvement
+// [Description] Fix build error when disable AT_SUPPORT
+//
+// 3 11/06/12 7:13a Klzhan
+// Pass SharkBay AT test.
+//
+// 2 4/24/12 12:38a Klzhan
+// Update modulepart to latest
+//
+// 1 2/08/12 1:08a Klzhan
+// Initial Check in
+//
+// 3 7/14/11 7:45a Klzhan
+// Add "Disable ME" setup item.
+//
+// 2 5/19/11 5:30a Klzhan
+// Remove un-use AMT setup item.
+//
+// 1 2/25/11 1:44a Klzhan
+// Initial Check-in
+//
+// 1 12/03/10 5:11a Klzhan
+// Initial Check-in.
+//
+//**********************************************************************
+
+//<AMI_FHDR_START>
+//---------------------------------------------------------------------------
+// Name: AMTSetup.sd
+//
+// Description: AMT TSE sd file.
+//
+//---------------------------------------------------------------------------
+//<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.
+/***********************************************************/
+ //
+ // Intel AMT
+ //
+ UINT8 Amt;
+ UINT8 AmtbxPrompt;
+ UINT8 AmtbxHotKeyPressed;
+ UINT8 AmtbxSelectionScreen;
+ UINT8 FWVerbose;
+ UINT8 HideUnConfigureMeConfirm;
+ UINT8 MebxDebugMsg;
+ UINT8 UnConfigureMe;
+ UINT8 AmtSpiLock;
+ UINT16 AmtWaitTimer;
+ UINT8 AmtCiraRequest;
+ UINT8 AmtCiraTimeout;
+ UINT8 USBProvision;
+ UINT8 FWProgress;
+ UINT8 MEDisabled;
+ //
+ // ASF
+ //
+ UINT8 Asf;
+
+ //
+ // WatchDog
+ //
+ UINT8 WatchDog;
+ UINT16 WatchDogTimerOs;
+ UINT16 WatchDogTimerBios;
+
+#endif
+
+//---------------------------------------------------------------------------
+#if defined(VFRCOMPILE) && !defined(CONTROLS_ARE_DEFINED)
+#define CONTROL_DEFINITION
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#ifdef CONTROL_DEFINITION
+
+#define AMT_ONEOF_AMT\
+ oneof varid = SETUP_DATA.Amt,\
+ prompt = STRING_TOKEN(STR_AMT_PROMPT),\
+ help = STRING_TOKEN(STR_AMT_HELP),\
+ option text = STRING_TOKEN(STR_DISABLED), value = 0, flags = RESET_REQUIRED, key = 0;\
+ option text = STRING_TOKEN(STR_ENABLED), value = 1, flags = DEFAULT | MANUFACTURING | RESET_REQUIRED, key = 0;\
+ endoneof;
+
+
+#define AMT_CHECKBOX_AMTBX_HOTKEYPRESSED\
+ checkbox varid = SETUP_DATA.AmtbxHotKeyPressed,\
+ prompt = STRING_TOKEN(STR_AMTBX_HOTKEY_PRESSED_PROMPT),\
+ help = STRING_TOKEN(STR_AMTBX_HOTKEY_PRESSED_HELP),\
+ flags = 0 | RESET_REQUIRED,\
+ key = 0,\
+ endcheckbox;
+
+#define AMT_CHECKBOX_AMTBX_SELECTSECTION\
+ checkbox varid = SETUP_DATA.AmtbxSelectionScreen,\
+ prompt = STRING_TOKEN(STR_AMTBX_SELECTION_SCREEN_PROMPT),\
+ help = STRING_TOKEN(STR_AMTBX_SELECTION_SCREEN_HELP),\
+ flags = 0 | RESET_REQUIRED,\
+ key = 0,\
+ endcheckbox;
+
+
+#define AMT_CHECKBOX_HIDEUNCONFIGUREDMECONFIRM\
+ checkbox varid = SETUP_DATA.HideUnConfigureMeConfirm,\
+ prompt = STRING_TOKEN(STR_AMT_HIDE_CONFIRMATION_UNCONFIGURE_ME_PROMPT),\
+ help = STRING_TOKEN(STR_AMT_HIDE_CONFIRMATION_UNCONFIGURE_ME_HELP),\
+ flags = 0 | RESET_REQUIRED,\
+ key = 0,\
+ endcheckbox;
+
+#define AMT_CHECKBOX_MEBX_DEBUGMSG\
+ checkbox varid = SETUP_DATA.MebxDebugMsg,\
+ prompt = STRING_TOKEN(STR_AMT_MEBX_DEBUG_MSG_PROMPT),\
+ help = STRING_TOKEN(STR_AMT_MEBX_DEBUG_MSG_HELP),\
+ flags = 0 | RESET_REQUIRED,\
+ key = 0,\
+ endcheckbox;
+
+#define AMT_CHECKBOX_UNCONFIGUREME\
+ checkbox varid = SETUP_DATA.UnConfigureMe,\
+ prompt = STRING_TOKEN(STR_AMT_UNCONFIGURE_ME_PROMPT),\
+ help = STRING_TOKEN(STR_AMT_UNCONFIGURE_ME_HELP),\
+ flags = 0 | RESET_REQUIRED,\
+ key = 0,\
+ endcheckbox;
+
+#define AMT_NUMERIC_AMT_WAITTIMER\
+ numeric varid = SETUP_DATA.AmtWaitTimer,\
+ prompt = STRING_TOKEN (STR_AMT_WAIT_TIMER_PROMPT),\
+ help = STRING_TOKEN (STR_AMT_WAIT_TIMER_HELP),\
+ minimum = 0,\
+ maximum = 65535,\
+ step = 1,\
+ default = 0,\
+ endnumeric;
+ // Stepping of 0 equates to a manual entering
+ // of a value, otherwise it will auto-increment
+ // with a left/right arrow
+
+#define AMT_ONEOF_MEDISABLED\
+ oneof varid = SETUP_DATA.MEDisabled,\
+ prompt = STRING_TOKEN(STR_SET_ME_DISABLED_PROMPT),\
+ help = STRING_TOKEN(STR_SET_ME_DISABLED_HELP),\
+ option text = STRING_TOKEN(STR_DISABLED), value = 0, flags = DEFAULT | RESET_REQUIRED, key = 0;\
+ option text = STRING_TOKEN(STR_ENABLED), value = 1, flags = MANUFACTURING | RESET_REQUIRED, key = 0;\
+ endoneof;
+
+#define AMT_ONEOF_ASF\
+ oneof varid = SETUP_DATA.Asf,\
+ prompt = STRING_TOKEN(STR_ASF_PROMPT),\
+ help = STRING_TOKEN(STR_ASF_HELP),\
+ option text = STRING_TOKEN(STR_DISABLED), value = 0, flags = RESET_REQUIRED, key = 0;\
+ option text = STRING_TOKEN(STR_ENABLED), value = 1, flags = DEFAULT | MANUFACTURING | RESET_REQUIRED, key = 0;\
+ endoneof;
+
+#define AMT_CHECKBOX_AMT_CIRAREQUEST\
+ checkbox varid = SETUP_DATA.AmtCiraRequest,\
+ prompt = STRING_TOKEN(STR_AMT_CIRA_REQUEST_PROMPT),\
+ help = STRING_TOKEN(STR_AMT_CIRA_REQUEST_HELP),\
+ flags = 0 | RESET_REQUIRED,\
+ key = 0,\
+ endcheckbox;
+
+#define AMT_ONEOF_USB_PROVISION\
+ oneof varid = SETUP_DATA.USBProvision,\
+ prompt = STRING_TOKEN(STR_AMT_USB_CONFIGURE_PROMPT),\
+ help = STRING_TOKEN(STR_AMT_USB_CONFIGURE_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;
+
+#define AMT_ONEOF_FW_PROGRESS\
+ oneof varid = SETUP_DATA.FWProgress,\
+ prompt = STRING_TOKEN(STR_AMT_PET_PROGRESS_PROMPT),\
+ help = STRING_TOKEN(STR_AMT_PET_PROGRESS_HELP),\
+ option text = STRING_TOKEN(STR_DISABLED), value = 0, flags = RESET_REQUIRED, key = 0;\
+ option text = STRING_TOKEN(STR_ENABLED), value = 1, flags = DEFAULT | MANUFACTURING | RESET_REQUIRED, key = 0;\
+ endoneof;
+
+
+#define AMT_NUMERIC_AMT_CIRATIMEOUT\
+ numeric varid = SETUP_DATA.AmtCiraTimeout, \
+ prompt = STRING_TOKEN (STR_AMT_CIRA_TIMEOUT_PROMPT),\
+ help = STRING_TOKEN (STR_AMT_CIRA_TIMEOUT_HELP),\
+ flags = RESET_REQUIRED,\
+ minimum = 0,\
+ maximum = 255,\
+ step = 1,\
+ default = 0, \
+ endnumeric;
+ // Stepping of 0 equates to a manual entering
+ // of a value, otherwise it will auto-increment
+ // with a left/right arrow
+
+#define AMT_ONEOF_WATCHDOG\
+ oneof varid = SETUP_DATA.WatchDog,\
+ prompt = STRING_TOKEN(STR_WATCHDOG_PROMPT),\
+ help = STRING_TOKEN(STR_WATCHDOG_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;
+
+#define AMT_NUMERIC_WATCHDOG_TIMEROS\
+ numeric varid = SETUP_DATA.WatchDogTimerOs,\
+ prompt = STRING_TOKEN (STR_WATCHDOG_TIMER_OS_PROMPT),\
+ help = STRING_TOKEN (STR_WATCHDOG_TIMER_OS_HELP),\
+ minimum = 0,\
+ maximum = 65535,\
+ step = 1,\
+ default = 0,\
+ endnumeric;
+
+#define AMTSETUP_NUMERIC_WATCHDOG_TIMERBIOS\
+ numeric varid = SETUP_DATA.WatchDogTimerBios,\
+ prompt = STRING_TOKEN (STR_WATCHDOG_TIMER_BIOS_PROMPT),\
+ help = STRING_TOKEN (STR_WATCHDOG_TIMER_BIOS_HELP),\
+ minimum = 0,\
+ maximum = 65535,\
+ step = 1,\
+ default = 0,\
+ endnumeric;
+
+#endif // CONTROL_DEFINITION
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#ifdef CONTROLS_WITH_DEFAULTS
+ AMT_ONEOF_AMT
+ AMT_CHECKBOX_AMTBX_HOTKEYPRESSED
+ AMT_CHECKBOX_AMTBX_SELECTSECTION
+ AMT_CHECKBOX_HIDEUNCONFIGUREDMECONFIRM
+ AMT_CHECKBOX_MEBX_DEBUGMSG
+ AMT_CHECKBOX_UNCONFIGUREME
+ AMT_NUMERIC_AMT_WAITTIMER
+ AMT_ONEOF_MEDISABLED
+ AMT_ONEOF_ASF
+ AMT_CHECKBOX_AMT_CIRAREQUEST
+ AMT_ONEOF_USB_PROVISION
+ AMT_ONEOF_FW_PROGRESS
+ AMT_NUMERIC_AMT_CIRATIMEOUT
+ AMT_ONEOF_WATCHDOG
+ AMT_NUMERIC_WATCHDOG_TIMEROS
+ AMTSETUP_NUMERIC_WATCHDOG_TIMERBIOS
+#endif // CONTROLS_WITH_DEFAULTS
+
+//**********************************************************************
+// Advanced - ASF Configuration Form
+//**********************************************************************
+
+#ifdef ADVANCED_FORM_SET
+
+#ifdef FORM_SET_TYPEDEF
+ #include "AmtSetup.h"
+ #include <MeSetup.h>
+#endif
+
+ #ifdef FORM_SET_ITEM
+ // Define controls to be added to the main page of the formset
+
+ #endif
+
+ #ifdef FORM_SET_VARSTORE
+ varstore SETUP_AMT_FEATURES,
+ key = AUTO_ID(AMT_FEATURES_ID),
+ name = SetupAmtFeatures,
+ guid = SETUP_GUID;
+ #endif
+
+ #ifdef FORM_SET_GOTO
+ // Define goto commands for the forms defined in this file
+ suppressif NOT ideqval SETUP_DATA.MeFirmwareInfo == NORMAL_MODE
+ AND NOT ideqval SETUP_DATA.MeFirmwareInfo == TEMP_DISABLE_MODE;
+ grayoutif ideqval SETUP_AMT_FEATURES.GrayOut == 1;
+ goto AMT_FORM_ID,
+ prompt = STRING_TOKEN(STR_AMT_FORM),
+ help = STRING_TOKEN(STR_AMT_FORM_HELP);
+ SUPPRESS_GRAYOUT_ENDIF
+ #endif
+
+ #ifdef FORM_SET_FORM
+
+ // Define forms
+ #ifndef AMT_FORM_SETUP
+ #define AMT_FORM_SETUP
+
+ form formid = AUTO_ID(AMT_FORM_ID),
+ title = STRING_TOKEN(STR_AMT_FORM);
+
+ grayoutif ideqval SYSTEM_ACCESS.Access == SYSTEM_PASSWORD_USER;
+ AMT_ONEOF_AMT
+ endif;
+
+
+ grayoutif ideqval SETUP_DATA.Amt == 0 OR ideqval SYSTEM_ACCESS.Access == SYSTEM_PASSWORD_USER;
+ AMT_CHECKBOX_AMTBX_HOTKEYPRESSED
+ AMT_CHECKBOX_AMTBX_SELECTSECTION
+ AMT_CHECKBOX_HIDEUNCONFIGUREDMECONFIRM
+ AMT_CHECKBOX_MEBX_DEBUGMSG
+ AMT_CHECKBOX_UNCONFIGUREME
+ AMT_NUMERIC_AMT_WAITTIMER
+
+#if TdtWrapper_SUPPORT
+ grayoutif ideqval TDT_VOLATILE_SETUP_DATA.TdtEnroll == 1;
+ AMT_ONEOF_MEDISABLED
+ endif;
+#else
+ AMT_ONEOF_MEDISABLED
+#endif
+ AMT_ONEOF_ASF
+ AMT_CHECKBOX_AMT_CIRAREQUEST
+ AMT_ONEOF_USB_PROVISION
+ AMT_ONEOF_FW_PROGRESS
+ endif;
+
+ grayoutif ideqval SETUP_DATA.AmtCiraRequest == 0 OR ideqval SETUP_DATA.Amt == 0 OR ideqval SYSTEM_ACCESS.Access == SYSTEM_PASSWORD_USER;
+ AMT_NUMERIC_AMT_CIRATIMEOUT
+ endif;
+
+ grayoutif ideqval SETUP_DATA.Asf == 0 OR ideqval SYSTEM_ACCESS.Access == SYSTEM_PASSWORD_USER;
+ AMT_ONEOF_WATCHDOG
+ endif;
+
+ grayoutif ideqval SETUP_DATA.Asf == 0 OR ideqval SETUP_DATA.WatchDog == 0 OR ideqval SYSTEM_ACCESS.Access == SYSTEM_PASSWORD_USER;
+ AMT_NUMERIC_WATCHDOG_TIMEROS
+ AMTSETUP_NUMERIC_WATCHDOG_TIMERBIOS
+ endif;
+
+ endform;
+ #endif // AMT_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/AmtWrapper/AmtSetup/AmtSetup.sdl b/Board/EM/MeWrapper/AmtWrapper/AmtSetup/AmtSetup.sdl
new file mode 100644
index 0000000..8840618
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/AmtSetup/AmtSetup.sdl
@@ -0,0 +1,107 @@
+TOKEN
+ Name = "iAMT_Setup"
+ Value = "1"
+ Help = "Main switch to enable iAMT Setup support in Project"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+End
+
+PATH
+ Name = "AMT_SETUP_DIR"
+End
+
+MODULE
+ Help = "Includes AmtSetup.mak to Project"
+ File = "AmtSetup.mak"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\AmtSetup.sdb"
+ Parent = "SETUP_SDBS"
+ Priority = 30
+ Help = "Includes generic iAMT setup screens to the project"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "$(AMT_SETUP_DIR)\AmtSetup.sd"
+ Parent = "SETUP_DEFINITIONS"
+ Priority = 30
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "iAMTProcessProceedToBootHook,"
+ Parent = "ProcessProceedToBoot,"
+ Help = "iAMT hook into TSE for TSE specific functions "
+ Token = "iAMT_SUPPORT" "=" "1"
+ InvokeOrder = BeforeParent
+End
+
+ELINK
+ Name = "iAMTProcessEnterSetupHook,"
+ Parent = "PostManagerHandShakeHook,"
+ Help = "iAMT hook into TSE for TSE specific functions "
+ Token = "iAMT_SUPPORT" "=" "1"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\AmtSetup.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\AmtTseFunc.obj"
+ Parent = "AMITSE_Objects"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "AMTSETUP_LIB"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "iAMTProcessConInAvailabilityHook,"
+ Parent = "ProcessConInAvailability,"
+ Help = "iAMT hook into TSE for TSE specific functions "
+ Token = "iAMT_SUPPORT" "=" "1"
+ InvokeOrder = AfterParent
+End
+
+
+ELINK
+ Name = "AMTBypassPasswordCheck,"
+ Parent = "ProcessConInAvailabilityHook,"
+ Priority = 0
+ InvokeOrder = AfterParent
+End
+
+TOKEN
+ Name = "AMT_SMIFLASH_LIB"
+ Value = "$(BUILD_DIR)\AmtSetup.lib"
+ TokenType = Expression
+ TargetMAK = Yes
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\AmtSetup.lib"
+ Parent = "PRESERVE_LIB"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "PreserveMEBXSyncData,"
+ Parent = "SMIFlashPreUpdateList"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "RestoreMEBXSyncData,"
+ Parent = "SMIFlashEndUpdateList"
+ InvokeOrder = AfterParent
+End
diff --git a/Board/EM/MeWrapper/AmtWrapper/AmtSetup/AmtSetup.uni b/Board/EM/MeWrapper/AmtWrapper/AmtSetup/AmtSetup.uni
new file mode 100644
index 0000000..a0e84b7
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/AmtSetup/AmtSetup.uni
Binary files differ
diff --git a/Board/EM/MeWrapper/AmtWrapper/AmtSetup/AmtTseFunc.c b/Board/EM/MeWrapper/AmtWrapper/AmtSetup/AmtTseFunc.c
new file mode 100644
index 0000000..ee41845
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/AmtSetup/AmtTseFunc.c
@@ -0,0 +1,447 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/AmtWrapper/AmtSetup/AmtTseFunc.c 3 5/14/14 9:49p Tristinchou $
+//
+// $Revision: 3 $
+//
+// $Date: 5/14/14 9:49p $
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/AmtWrapper/AmtSetup/AmtTseFunc.c $
+//
+// 3 5/14/14 9:49p Tristinchou
+// [TAG] EIP167030
+// [Category] Improvement
+// [Description] Remove the variable runtime attribute and keep original
+// attributes.
+//
+// 2 4/24/12 12:38a Klzhan
+// Update modulepart to latest
+//
+// 1 2/08/12 1:08a Klzhan
+// Initial Check in
+//
+// 1 2/25/11 1:44a Klzhan
+// Initial Check-in
+//
+// 1 12/03/10 5:11a Klzhan
+// Initial Check-in.
+//
+//**********************************************************************
+
+//<AMI_FHDR_START>
+//---------------------------------------------------------------------------
+// Name: AMTTseFunc.c
+//
+// Description: AMT TSE Functions.
+//
+//---------------------------------------------------------------------------
+//<AMI_FHDR_END>
+/*
+#include <EFI.h>
+#include "EfiDriverLib.h"
+#include "EfiCommonLib.h"
+#include "AmtSetup.h"
+#include "token.h"
+#include "EfiBootScript.h"
+#include <AMIVfr.h>
+#include <Core\EM\AMITSE\Inc\variable.h>
+
+#include EFI_PROTOCOL_CONSUMER (AmtPlatformPolicy)
+#include EFI_PROTOCOL_CONSUMER (AmtWrapper)
+#include EFI_PROTOCOL_CONSUMER (AlertStandardFormat)
+#include EFI_PROTOCOL_DEFINITION (BootScriptSave)
+#include EFI_GUID_DEFINITION (AcpiVariable)
+*/
+#include <Setup.h>
+#include <TseCommon.h>
+//#include <ME.h>
+//#include "Board\EM\AMT\Setup\AMT.h"
+#include "variable.h"
+#include "AmtWrapper\AmtWrapper.h"
+#include "AlertStandardFormat\AlertStandardFormat.h"
+#define SETUP_GUID \
+ { 0xEC87D643, 0xEBA4, 0x4BB5, 0xA1, 0xE5, 0x3F, 0x3E, 0x36, 0xB2, 0x0D, 0xA9 }
+
+#define BOOT_MANAGER_GUID \
+ { 0xB4909CF3, 0x7B93, 0x4751, 0x9B, 0xD8, 0x5B, 0xA8, 0x22, 0x0B, 0x9B, 0xB2 }
+
+#define EFI_BOOT_SCRIPT_SAVE_PROTOCOL_GUID \
+ { \
+ 0x470e1529, 0xb79e, 0x4e32, 0xa0, 0xfe, 0x6a, 0x15, 0x6d, 0x29, 0xf9, 0xb2 \
+ }
+
+#define AMI_EFI_SOL_POST_MESSAGE_GUID \
+ { 0xf42f3752, 0x12e, 0x4812, 0x99, 0xe6, 0x49, 0xf9, 0x43, 0x4, 0x84, 0x54 }
+
+#define EFI_GLOBAL_VARIABLE \
+ {0x8BE4DF61,0x93CA,0x11d2,0xAA,0xD,0x0,0xE0,0x98,0x03,0x2B,0x8C}
+
+//EFI_BOOT_SCRIPT_SAVE_PROTOCOL *gBootScriptSave;
+EFI_GUID gEfiAmtWrapperProtocolGuidTse = EFI_AMT_WRAPPER_PROTOCOL_GUID;
+EFI_GUID gEfiAlertStandardFormatProtocolGuid = EFI_ALERT_STANDARD_FORMAT_PROTOCOL_GUID;
+static UINTN ScriptDone = 0;
+extern BOOLEAN gEnterSetup;
+
+VOID CheckForKey( EFI_EVENT Event, VOID *Context );
+VOID AMTBypassPasswordRestore(VOID);
+
+extern EFI_BOOT_SERVICES *gBS;
+extern EFI_SYSTEM_TABLE *gST;
+extern EFI_RUNTIME_SERVICES *gRT;
+//*******************************************************************************
+//<AMI_PHDR_START>
+// Procedure: iAMTCheckForKey
+//
+// Description:
+//
+// Input: Event: Timer event.
+// Context: Event context; always NULL
+//
+// Output: VOID
+//
+//<AMI_PHDR_END>
+//*******************************************************************************
+VOID iAMTCheckForKey( EFI_EVENT Event, VOID *Context)
+{
+ // Console Lock by uninstall Protocol,
+ // So remove this.
+ //CheckForKey((EFI_EVENT)NULL, NULL );
+
+}
+
+
+//*******************************************************************************
+//<AMI_PHDR_START>
+// Procedure: iAMTProcessProceedToBootHook
+//
+// Description:
+//
+// Input: Event: Timer event.
+// Context: Event context; always NULL
+//
+// Output: VOID
+//
+//<AMI_PHDR_END>
+//*******************************************************************************
+VOID iAMTProcessProceedToBootHook ( EFI_EVENT Event, VOID *Context)
+{
+ AMT_WRAPPER_PROTOCOL *pAmtWrapper = NULL;
+ EFI_STATUS Status;
+ EFI_ALERT_STANDARD_FORMAT_PROTOCOL *AsfCheck;
+ EFI_ASF_BOOT_OPTIONS *mInternalAsfBootOptions;
+
+ if (pAmtWrapper == NULL) {
+ Status = gBS->LocateProtocol(&gEfiAmtWrapperProtocolGuidTse, NULL, &pAmtWrapper);
+ }
+
+ //case IDER
+ if (pAmtWrapper != NULL) {
+ if (pAmtWrapper->ActiveManagementEnableIdeR()||pAmtWrapper->ActiveManagementEnableSol()){
+ Status = pAmtWrapper->BdsBootViaAsf();
+ return;
+ }
+ }
+
+ //case ASF
+ //Get the ASF options
+ //if set then we have to do and Asfboot
+ Status = gBS->LocateProtocol (
+ &gEfiAlertStandardFormatProtocolGuid,
+ NULL,
+ &AsfCheck
+ );
+
+ if (EFI_ERROR (Status)) {
+// DEBUG ((EFI_D_ERROR, "Info : Error gettings ASF protocol -> %r\n", Status));
+ return;
+ }
+
+ Status = AsfCheck->GetBootOptions (AsfCheck, &mInternalAsfBootOptions);
+
+ if (mInternalAsfBootOptions->SubCommand != ASF_BOOT_OPTIONS_PRESENT) {
+ return;
+ }else{
+ Status = pAmtWrapper->BdsBootViaAsf();
+ return;
+ }
+}
+
+
+//*******************************************************************************
+//<AMI_PHDR_START>
+// Procedure: iAMTProcessEnterSetupHook
+//
+// Description:
+//
+// Input: Event: Timer event.
+// Context: Event context; always NULL
+//
+// Output: VOID
+//
+//<AMI_PHDR_END>
+//*******************************************************************************
+VOID iAMTProcessEnterSetupHook ( EFI_EVENT Event, VOID *Context)
+{
+ EFI_STATUS Status;
+ UINT16 count = 0;
+ EFI_GUID BootManGuid = BOOT_MANAGER_GUID;
+ AMT_WRAPPER_PROTOCOL *pAmtWrapper = NULL;
+
+ if (pAmtWrapper == NULL)
+ Status = gBS->LocateProtocol(&gEfiAmtWrapperProtocolGuidTse, NULL, &pAmtWrapper);
+ if (pAmtWrapper != NULL) {
+ if (pAmtWrapper->ActiveManagementEnableIdeR()) {
+ count = 0xFFFF;
+ }
+ }
+ if (count == 0xFFFF){
+ gRT->SetVariable( L"BootManager", &BootManGuid, EFI_VARIABLE_BOOTSERVICE_ACCESS,sizeof(count),&count );}
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: AMTBypassPasswordRestore
+//
+// 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 iAMTProcessConInAvailabilityHook (VOID)
+{
+ AMT_WRAPPER_PROTOCOL *pAmtWrapper = NULL;
+ EFI_HANDLE SolPostMessageHandle = NULL;
+ EFI_STATUS Status;
+ EFI_GUID gAmiEfiSolPostMessageGuid = AMI_EFI_SOL_POST_MESSAGE_GUID;
+
+ // Handle EnterSetup Flag here !!
+ if (pAmtWrapper == NULL){
+ Status = gBS->LocateProtocol(&gEfiAmtWrapperProtocolGuidTse, NULL, &pAmtWrapper);
+ }
+ if(EFI_ERROR(Status))
+ return FALSE;
+ if(pAmtWrapper->ActiveManagementEnterSetup())
+ gEnterSetup = TRUE;
+
+ // Install Protocol here, Trig Callback event to show SOL message.
+ Status = gBS->InstallMultipleProtocolInterfaces(
+ &SolPostMessageHandle,
+ &gAmiEfiSolPostMessageGuid,
+ NULL,
+ NULL);
+
+
+ return FALSE;
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: AMTBypassPasswordRestore
+//
+// 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>
+VOID AMTBypassPasswordRestore(VOID)
+{
+
+ EFI_STATUS Status;
+ UINT32 VarAttr;
+ UINTN VariableSize;
+ EFI_GUID gAmiTseSetupGuid = AMITSESETUP_GUID;
+ AMITSESETUP AmiTseData;
+#if defined(TSE_ADVANCED_BIN_SUPPORT)
+ AMITSESETUP *pSetupVariable;
+#endif
+ VariableSize = sizeof(AMITSESETUP);
+ Status = gRT->GetVariable ( L"AMITSESetupBackup", \
+ &gAmiTseSetupGuid, \
+ &VarAttr, \
+ &VariableSize, \
+ &AmiTseData );
+
+ // If we get this variable, restore it back
+ if (!EFI_ERROR (Status)) {
+
+ VariableSize = sizeof(AMITSESETUP);
+ Status = gRT->SetVariable ( L"AMITSESetup", \
+ &gAmiTseSetupGuid, \
+ VarAttr, \
+ VariableSize, \
+ &AmiTseData );
+
+ VariableSize = 0;
+ Status = gRT->SetVariable ( L"AMITSESetupBackup", \
+ &gAmiTseSetupGuid, \
+ VarAttr, \
+ VariableSize, \
+ &AmiTseData );
+#if defined(TSE_ADVANCED_BIN_SUPPORT)
+ VariableSize = sizeof(AMITSESETUP);
+ pSetupVariable = VarGetVariable( VARIABLE_ID_AMITSESETUP, &VariableSize );
+ if ( ( pSetupVariable == NULL ) || ( VariableSize != sizeof(AMITSESETUP) ) )
+ pSetupVariable = VarGetNvram( VARIABLE_ID_AMITSESETUP, &VariableSize );
+ MemCopy(pSetupVariable->UserPassword, AmiTseData.UserPassword,
+ sizeof(pSetupVariable->UserPassword));
+ MemCopy(pSetupVariable->AdminPassword, AmiTseData.AdminPassword,
+ sizeof(pSetupVariable->AdminPassword));
+ VarSetNvram( VARIABLE_ID_AMITSESETUP, \
+ pSetupVariable, sizeof(AMITSESETUP));
+#endif
+ }
+
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: AMTBypassPasswordCheck
+//
+// Description: ELink to ProcessConInAvailabilityHook.
+// If AMT Bypass user password, Delete AMITSESetup.
+//
+// Input: VOID
+//
+// Output: BOOLEAN. Should return TRUE if the screen was used to
+// ask password; FALSE if the screen was not used to ask
+// password.
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+BOOLEAN AMTBypassPasswordCheck(VOID)
+{
+ EFI_STATUS Status;
+ UINT32 VarAttr;
+ UINTN VariableSize;
+ EFI_GUID gAmiTseSetupGuid = AMITSESETUP_GUID;
+ AMITSESETUP AmiTseData;
+#if defined(TSE_ADVANCED_BIN_SUPPORT)
+ AMITSESETUP *pSetupVariable;
+#endif
+ UINTN VarSize=0;
+ EFI_ALERT_STANDARD_FORMAT_PROTOCOL *Asf;
+ EFI_ASF_BOOT_OPTIONS *mAsfBootOptions;
+ EFI_GUID gSetupGuid = SETUP_GUID;
+ mAsfBootOptions = NULL;
+ //
+ // Get Protocol for ASF
+ //
+ Status = gBS->LocateProtocol (
+ &gEfiAlertStandardFormatProtocolGuid,
+ NULL,
+ &Asf
+ );
+ if (EFI_ERROR (Status)) {
+// DEBUG ((EFI_D_ERROR, "Info : Error gettings ASF protocol -> %r\n", Status));
+ return FALSE;
+ }
+
+ Status = Asf->GetBootOptions (Asf, &mAsfBootOptions);
+ // Configuration data resert.
+ if(mAsfBootOptions->BootOptions & 0x8000)
+ {
+ // Delete Variable.
+ VarAttr = 0;
+ VariableSize = 0;
+ Status = gRT->GetVariable(
+ L"Setup",
+ &gSetupGuid,
+ &VarAttr,
+ &VariableSize,
+ &VarSize );
+ if( EFI_ERROR(Status) && (Status != EFI_BUFFER_TOO_SMALL) )
+ VarAttr = EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS;
+
+ VariableSize = 0;
+ gRT->SetVariable(
+ L"Setup",
+ &gSetupGuid,
+ VarAttr,
+ VariableSize,
+ &VarSize);
+ }
+ // ByPass Password
+ if(mAsfBootOptions->BootOptions & 0x0800)
+ {
+ VarAttr = 0;
+ VariableSize = sizeof(AMITSESETUP);
+ Status = gRT->GetVariable ( L"AMITSESetup", \
+ &gAmiTseSetupGuid, \
+ &VarAttr, \
+ &VariableSize, \
+ &AmiTseData );
+
+ // No Password installed just return
+ if (Status == EFI_NOT_FOUND) {
+ return 0;
+ }
+ // If exist , store a backup then delete AMITSESetup
+
+ VariableSize = sizeof(AMITSESETUP);
+ Status = gRT->SetVariable ( L"AMITSESetupBackup", \
+ &gAmiTseSetupGuid, \
+ VarAttr, \
+ VariableSize, \
+ &AmiTseData );
+ Status = gRT->SetVariable ( L"AMITSESetup", \
+ &gAmiTseSetupGuid, \
+ VarAttr, \
+ 0, \
+ &AmiTseData );
+#if defined(TSE_ADVANCED_BIN_SUPPORT)
+ pSetupVariable = VarGetVariable( VARIABLE_ID_AMITSESETUP, &VarSize );
+ if ( ( pSetupVariable == NULL ) || ( VarSize != sizeof(AMITSESETUP) ) )
+ pSetupVariable = VarGetNvram( VARIABLE_ID_AMITSESETUP, &VarSize );
+ MemSet(pSetupVariable->UserPassword, \
+ sizeof(pSetupVariable->UserPassword), 0);
+ MemSet(pSetupVariable->AdminPassword, \
+ sizeof(pSetupVariable->AdminPassword), 0);
+ VarSetNvram( VARIABLE_ID_AMITSESETUP, \
+ pSetupVariable, sizeof(AMITSESETUP));
+#endif
+ }else
+ {
+ // If not bypass password , check AMITSESetupBackup vairblae
+ AMTBypassPasswordRestore();
+ }
+
+ return 0;
+}
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/AmtWrapper/AmtSmbios/AmtSmbios.c b/Board/EM/MeWrapper/AmtWrapper/AmtSmbios/AmtSmbios.c
new file mode 100644
index 0000000..123be0f
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/AmtSmbios/AmtSmbios.c
@@ -0,0 +1,376 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/AmtWrapper/AmtSmbios/AmtSmbios.c 4 6/21/13 3:39a Klzhan $
+//
+// $Revision: 4 $
+//
+// $Date: 6/21/13 3:39a $
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/AmtWrapper/AmtSmbios/AmtSmbios.c $
+//
+// 4 6/21/13 3:39a Klzhan
+// [TAG] EIPNone
+// [Category] Spec Update
+// [Severity] Minor
+// [Description] ME FW drop support of type 129
+//
+// 3 9/19/12 6:57a Klzhan
+// Update IDER secure boot flag.
+//
+// 2 4/24/12 12:43a Klzhan
+// Update module to latest
+//
+// 1 2/08/12 1:09a Klzhan
+// Initial Check in
+//
+// 3 7/11/11 5:32a Klzhan
+// Close Event after SMBIOS 129 130 created.
+//
+// 2 5/03/11 6:19a Klzhan
+// [TAG] EIP59457
+// [Category] Bug Fix
+// [RootCause] Copy wrong size in SMBios type 129.
+// [Files] AmtSmbios.c
+//
+// 1 2/25/11 1:44a Klzhan
+// Initial Check-in
+//
+// 1 12/03/10 5:11a Klzhan
+// Initial Check-in.
+//
+//**********************************************************************
+//
+//<AMI_FHDR_START>
+//---------------------------------------------------------------------------
+// Name: AMTSmbios.c
+//
+// Description: AMT Smbios Functions.
+//
+//---------------------------------------------------------------------------
+//<AMI_FHDR_END>
+#include "AMTSmbios.h"
+#include "Tiano.h"
+#include "EfiDriverLib.h"
+#include "SaAccess.h"
+#include "PchAccess.h"
+#include "EdkIIGluePcd.h"
+#include "EdkIIGluePcdPciExpressLib.h"
+#include "EdkIIGlueConfig.h"
+#include "EdkIIGlueIoLib.h"
+#include "EdkIIGluePciExpressLib.h"
+#include "EdkIIGlueUefiLib.h"
+#include "SbSetupData.h"
+#include EFI_PROTOCOL_CONSUMER (MeBiosPayloadData)
+EFI_GUID gEfiSmbiosProtocolGuid = EFI_SMBIOS_PROTOCOL_GUID;
+EFI_GUID gEfiEventReadyToBootGuid = EFI_EVENT_GROUP_READY_TO_BOOT;
+EFI_GUID gEfiMeBiosExtensionSetupGuid = EFI_ME_BIOS_EXTENSION_SETUP_GUID;
+CHAR16 gEfiMeBiosExtensionSetupName[] = EFI_ME_BIOS_EXTENSION_SETUP_VARIABLE_NAME;
+EFI_GUID gEfiGlobalVariableGuid = EFI_GLOBAL_VARIABLE_GUID;
+
+EFI_EVENT mLegacyBootEvent;
+
+#if VA_SUPPORT
+EFI_GUID gEfiVaNVMVariableGuid = EFI_VA_NVM_VARIABLE_GUID;
+#endif
+
+EFI_RUNTIME_SERVICES *gRT;
+EFI_BOOT_SERVICES *gBS;
+DXE_MBP_DATA_PROTOCOL MbpData;
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: GetMeFwInfoFromMBP
+//
+// Description: Get ME Fw Info From MBP data
+//
+// Referrals:
+//
+// Notes:
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS
+GetMeFwInfoFromMBP (
+ IN OUT ME_CAP *MECapability
+ )
+{
+ MEFWCAPS_SKU FwCapsSku;
+
+ MECapability->MeEnabled = 1;
+
+ FwCapsSku.Data = MbpData.MeBiosPayload.FwCapsSku.FwCapabilities.Data;
+
+ if (FwCapsSku.Fields.IntelAT) {
+ MECapability->AtSupported = 1;
+ }
+
+ if (FwCapsSku.Fields.KVM) {
+ MECapability->IntelKVM = 1;
+ }
+
+ switch (MbpData.MeBiosPayload.FwPlatType.RuleData.Fields.PlatformBrand) {
+ case INTEL_AMT_BRAND:
+ MECapability->IntelAmtFw = 1;
+ MECapability->LocalWakeupTimer = 1;
+ break;
+
+ case INTEL_STAND_MANAGEABILITY_BRAND:
+ MECapability->IntelAmtFwStandard = 1;
+ break;
+
+ case INTEL_SMALL_BUSINESS_TECHNOLOGY_BRAND:
+ MECapability->IntelSmallBusiness = 1;
+ break;
+ }
+
+ MECapability->MeMajorVer = MbpData.MeBiosPayload.FwVersionName.MajorVersion;
+ MECapability->MeMinorVer = MbpData.MeBiosPayload.FwVersionName.MinorVersion;
+ MECapability->MeBuildNo = MbpData.MeBiosPayload.FwVersionName.BuildVersion;
+ MECapability->MeHotFixNo = MbpData.MeBiosPayload.FwVersionName.HotfixVersion;
+
+ return EFI_SUCCESS;
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: UpdateAmtSmbiosTable
+//
+// Description: SMBIOS tables 81, 82 and 83 are filled here
+//
+// Input: EFI_EVENT Event,
+// VOID *ParentImageHandle
+//
+// Output: EFI_STATUS
+//
+// Modified:
+//
+// Referrals:
+//
+// Notes:
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS
+UpdateAmtSmbiosTable(
+ EFI_EVENT Event,
+ VOID *ParentImageHandle
+)
+{
+ EFI_STATUS Status;
+ EFI_MISC_OEM_TYPE_0x81 Data81;
+ EFI_MISC_OEM_TYPE_0x82 Data82;
+ EFI_SMBIOS_PROTOCOL *mSmbiosProtocol;
+ UINT32 Attributes;
+ UINTN DataSize;
+ ME_BIOS_EXTENSION_SETUP MeBiosExtensionSetup;
+ UINT32 MeEnabled;
+ ME_CAP MeCapabilities;
+#if VA_SUPPORT
+ EFI_VA_NVM_VAR VaNVMVar;
+#endif
+
+
+ Status = MePolicyLibInit();
+ ASSERT_EFI_ERROR(Status);
+
+ Status = AmtPolicyLibInit();
+ ASSERT_EFI_ERROR(Status);
+
+ mSmbiosProtocol = NULL;
+ Status = gBS->LocateProtocol(
+ &gEfiSmbiosProtocolGuid,
+ NULL,
+ &mSmbiosProtocol
+ );
+ ASSERT_EFI_ERROR(Status);
+
+ //Clear all data
+ gBS->SetMem (&Data81, sizeof(EFI_MISC_OEM_TYPE_0x81), 0);
+ gBS->SetMem (&Data82, sizeof(EFI_MISC_OEM_TYPE_0x82), 0);
+ gBS->SetMem (&MeCapabilities, sizeof(ME_CAP), 0);
+
+ //fill
+ Data81.Header.Type = 0x81;
+ Data81.Header.Length = 8;
+ Data81.Header.Handle = 0;
+ Data81.DescString = 1;
+ Data81.StructureVersion = 1;
+ Data81.SystemId = 2;
+ if(AsfSupported())
+ Data81.Attribute = 1;
+ else
+ Data81.Attribute = 0;
+
+ gBS->CopyMem (
+ Data81.DescStringAscii,
+ EFI_OEM_ASF_DESCRIPTIONSTRING,
+ sizeof (EFI_OEM_ASF_DESCRIPTIONSTRING)
+ );
+
+ gBS->CopyMem (
+ Data81.SystemIdAscii,
+ EFI_OEM_ASF_SYSTEMIDSTRING,
+ (sizeof (EFI_OEM_ASF_SYSTEMIDSTRING) - 1)
+ );
+ //
+ Data82.Header.Type = 0x82;
+ Data82.Header.Length = 0x14;
+ Data82.Header.Handle = 0;
+ gBS->CopyMem (
+ Data82.AmtSignature,
+ AMT_Signature,
+ sizeof (UINT32)
+ );
+
+// Data82
+
+ if(AmtSupported()){
+ MeEnabled = *((volatile UINT32 *)(UINTN)((PciMeRegBase) + FW_STATUS_REGISTER));
+ //
+ // Make sure Me is in normal mode & hasn't any error
+ //
+ if ((MeEnabled & 0xFF000) == 0) {
+ Status = GetMeFwInfoFromMBP(&MeCapabilities);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ }
+
+ if( MeCapabilities.IntelAmtFw ==1) {
+ Data82.AmtSupported = 1;
+ }
+
+ Attributes = EFI_VARIABLE_NON_VOLATILE;
+ DataSize = sizeof (ME_BIOS_EXTENSION_SETUP);
+ Status = gRT->GetVariable (
+ gEfiMeBiosExtensionSetupName,
+ &gEfiMeBiosExtensionSetupGuid,
+ &Attributes,
+ &DataSize,
+ &MeBiosExtensionSetup
+ );
+
+ if (!EFI_ERROR(Status)) {
+ if(MeCapabilities.IntelAmtFw == 1) {
+ if(MeBiosExtensionSetup.PlatformMngSel & MNT_ON) {
+ Data82.AmtEnabled = 1;
+ } else {
+ Data82.AmtEnabled = 0;
+ }
+
+ if(MeBiosExtensionSetup.AmtSolIder & IDER_ENABLE) {
+ Data82.IderEnabled = 1;
+ } else {
+ Data82.IderEnabled = 0;
+ }
+
+ if (MeBiosExtensionSetup.AmtSolIder & SOL_ENABLE) {
+ Data82.SolEnabled = 1;
+ } else {
+ Data82.SolEnabled = 0;
+ }
+ Data82.NetworkEnabled = 1; // If AMT enabled, LAN is always enabled
+
+ }
+
+ if(MeCapabilities.IntelKVM) {
+ if (MeBiosExtensionSetup.KvmEnable & KVM_ENABLE) {
+ Data82.KvmEnabled = 1;
+ } else {
+ Data82.KvmEnabled = 0;
+ }
+ }
+ }
+ }
+ else {
+ Data82.AmtEnabled = 0;
+ Data82.IderEnabled = 0;
+ Data82.SolEnabled = 0;
+ Data82.KvmEnabled = 0;
+ Data82.NetworkEnabled = 0;
+ }
+
+ Data82.ExtendedData = 0xA5;
+ Data82.OemCapabilities1 = 0x2F;
+ Data82.OemCapabilities2 = 0x02;
+#if defined(SecureBoot_SUPPORT) && (SecureBoot_SUPPORT == 1)
+ Data82.OemCapabilities3 = 1;
+#else
+ Data82.OemCapabilities3 = 0;
+#endif
+ Data82.OemCapabilities4 = 0;
+
+ Status = mSmbiosProtocol->SmbiosAddStructure((UINT8 *)&Data82, sizeof(EFI_MISC_OEM_TYPE_0x82));
+ gBS->CloseEvent(Event);
+ return Status;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: iAMTSMBiosDriverEntryPoint
+//
+// Description: iAMT SMBIOS driver entry point
+//
+// Input: EFI_HANDLE ImageHandle,
+// EFI_SYSTEM_TABLE *SystemTable
+//
+// Output: EFI_STATUS
+//
+// Modified:
+//
+// Referrals:
+//
+// Notes:
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS
+AmtSmbiosEntryPoint(
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+)
+{
+ EFI_STATUS Status;
+ DXE_MBP_DATA_PROTOCOL *MbpDataBuf;
+ EfiInitializeDriverLib (ImageHandle, SystemTable);
+
+ Status = gBS->LocateProtocol (&gMeBiosPayloadDataProtocolGuid, NULL, &MbpDataBuf);
+
+ gBS->CopyMem (
+ &MbpData,
+ MbpDataBuf,
+ sizeof (DXE_MBP_DATA_PROTOCOL)
+ );
+ Status = EfiCreateEventReadyToBootEx(
+ EFI_TPL_CALLBACK,
+ UpdateAmtSmbiosTable,
+ (VOID *)&ImageHandle,
+ &mLegacyBootEvent
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ return Status;
+}
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/AmtWrapper/AmtSmbios/AmtSmbios.cif b/Board/EM/MeWrapper/AmtWrapper/AmtSmbios/AmtSmbios.cif
new file mode 100644
index 0000000..b84bee9
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/AmtSmbios/AmtSmbios.cif
@@ -0,0 +1,12 @@
+<component>
+ name = "AmtSmbios"
+ category = ModulePart
+ LocalRoot = "Board\EM\MeWrapper\AmtWrapper\AmtSmbios\"
+ RefName = "AmtSmbios"
+[files]
+"AmtSmbios.sdl"
+"AmtSmbios.mak"
+"AmtSmbios.c"
+"AmtSmbios.dxs"
+"AmtSmbios.h"
+<endComponent>
diff --git a/Board/EM/MeWrapper/AmtWrapper/AmtSmbios/AmtSmbios.dxs b/Board/EM/MeWrapper/AmtWrapper/AmtSmbios/AmtSmbios.dxs
new file mode 100644
index 0000000..b95943c
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/AmtSmbios/AmtSmbios.dxs
@@ -0,0 +1,70 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/AmtWrapper/AmtSmbios/AmtSmbios.dxs 1 2/08/12 1:09a Klzhan $
+//
+// $Revision: 1 $
+//
+// $Date: 2/08/12 1:09a $
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/AmtWrapper/AmtSmbios/AmtSmbios.dxs $
+//
+// 1 2/08/12 1:09a Klzhan
+// Initial Check in
+//
+// 1 2/25/11 1:44a Klzhan
+// Initial Check-in
+//
+// 1 12/03/10 5:11a Klzhan
+// Initial Check-in.
+//
+//**********************************************************************
+//
+//<AMI_FHDR_START>
+//---------------------------------------------------------------------------
+// Name: AMTSmbios.dxs
+//
+// Description: AMT Smbios dependency file.
+//
+//---------------------------------------------------------------------------
+//<AMI_FHDR_END>
+#include "EfiDepex.h"
+
+#include "Protocol\SmbiosGetFlashDataProtocol.h"
+#include EFI_PROTOCOL_DEFINITION (AmtPlatformPolicy)
+#include EFI_PROTOCOL_DEFINITION (Heci)
+#include EFI_PROTOCOL_DEFINITION (MePlatformPolicy)
+
+DEPENDENCY_START
+ EFI_SMBIOS_PROTOCOL_GUID AND
+ DXE_PLATFORM_AMT_POLICY_GUID AND
+ EFI_HECI_PROTOCOL_GUID AND
+ DXE_PLATFORM_ME_POLICY_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/AmtWrapper/AmtSmbios/AmtSmbios.h b/Board/EM/MeWrapper/AmtWrapper/AmtSmbios/AmtSmbios.h
new file mode 100644
index 0000000..7a7d30b
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/AmtSmbios/AmtSmbios.h
@@ -0,0 +1,124 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/AmtWrapper/AmtSmbios/AmtSmbios.h 1 2/08/12 1:09a Klzhan $
+//
+// $Revision: 1 $
+//
+// $Date: 2/08/12 1:09a $
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/AmtWrapper/AmtSmbios/AmtSmbios.h $
+//
+// 1 2/08/12 1:09a Klzhan
+// Initial Check in
+//
+// 1 2/25/11 1:44a Klzhan
+// Initial Check-in
+//
+// 2 12/16/10 3:47a Klzhan
+// Remove un-use structure.
+//
+// 1 12/03/10 5:11a Klzhan
+// Initial Check-in.
+//
+//**********************************************************************
+//
+//<AMI_FHDR_START>
+//---------------------------------------------------------------------------
+// Name: AMTSmbios.dxs
+//
+// Description: AMT Smbios include file.
+//
+//---------------------------------------------------------------------------
+//<AMI_FHDR_END>
+#include "Token.h"
+#include <Tiano.h>
+#include <Include\Protocol\SMBios.h>
+#include <Include\Protocol\SmbiosGetFlashDataProtocol.h>
+#include <AmtLib.h>
+#include <MeLib.h>
+#include "CpuFuncs.h"
+
+#include EFI_GUID_DEFINITION (MeBiosExtensionSetup)
+#include EFI_GUID_DEFINITION (GlobalVariable)
+#include EFI_PROTOCOL_DEFINITION (PciIo)
+#include EFI_PROTOCOL_CONSUMER (PciRootBridgeIo)
+#include EFI_PROTOCOL_DEPENDENCY (SaPlatformPolicy)
+#include EFI_PROTOCOL_CONSUMER (Heci)
+#include EFI_PROTOCOL_CONSUMER (TcgService)
+
+#if VA_SUPPORT
+#include EFI_PROTOCOL_DEFINITION(PlatformVaPolicy)
+#endif
+
+#define EFI_OEM_ASF_DESCRIPTIONSTRING "Intel_ASF"
+#define EFI_OEM_ASF_SYSTEMIDSTRING "Intel_ASF_001"
+#define AMT_Signature "$AMT"
+
+#define PciMeRegBase PCIEX_BASE_ADDRESS + (UINT32) (22 << 15)
+#define FW_STATUS_REGISTER 0x40
+
+//
+// This is definition for SMBIOS Oem data type 0x81
+//
+#pragma pack (1)
+typedef struct {
+ SMBIOS_STRUCTURE_HEADER Header;
+ UINT8 DescString;// String number
+ UINT8 StructureVersion;
+ UINT8 SystemId;// String number
+ UINT8 Attribute;
+ UINT8 DescStringAscii[sizeof(EFI_OEM_ASF_DESCRIPTIONSTRING)];
+ UINT8 SystemIdAscii[sizeof(EFI_OEM_ASF_SYSTEMIDSTRING)-1];
+ UINT16 Zero; //terminator
+} EFI_MISC_OEM_TYPE_0x81;
+
+//
+// This is definition for SMBIOS Oem data type 0x82
+//
+typedef struct {
+ SMBIOS_STRUCTURE_HEADER Header;
+ UINT8 AmtSignature[4];
+ UINT8 AmtSupported;
+ UINT8 AmtEnabled;
+ UINT8 IderEnabled;
+ UINT8 SolEnabled;
+ UINT8 NetworkEnabled;
+ UINT8 ExtendedData;
+ UINT8 OemCapabilities1;
+ UINT8 OemCapabilities2;
+ UINT8 OemCapabilities3;
+ UINT8 OemCapabilities4;
+ UINT8 KvmEnabled;
+ UINT8 Reserved;
+ UINT16 Zero; //terminator
+} EFI_MISC_OEM_TYPE_0x82;
+
+#pragma pack ()
+
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/AmtWrapper/AmtSmbios/AmtSmbios.mak b/Board/EM/MeWrapper/AmtWrapper/AmtSmbios/AmtSmbios.mak
new file mode 100644
index 0000000..1a1f3eb
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/AmtSmbios/AmtSmbios.mak
@@ -0,0 +1,108 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/AmtWrapper/AmtSmbios/AmtSmbios.mak 2 2/23/12 8:59a Klzhan $
+#
+# $Revision: 2 $
+#
+# $Date: 2/23/12 8:59a $
+#**********************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/AmtWrapper/AmtSmbios/AmtSmbios.mak $
+#
+# 2 2/23/12 8:59a Klzhan
+# Support New EDK
+#
+# 1 2/08/12 1:09a Klzhan
+# Initial Check in
+#
+# 1 2/25/11 1:44a Klzhan
+# Initial Check-in
+#
+# 1 12/03/10 5:11a Klzhan
+# Initial Check-in.
+#
+#**********************************************************************
+#
+#<AMI_FHDR_START>
+#---------------------------------------------------------------------------
+# Name: AMTSmbios.dxs
+#
+# Description: AMT Smbios Makfile.
+#
+#---------------------------------------------------------------------------
+#<AMI_FHDR_END>
+# MAK file for the ModulePart:AmtSmbios
+all : AmtSmbios
+
+$(BUILD_DIR)\AmtSmbios.mak : $(AmtSmbios_DIR)\$(@B).cif $(AmtSmbios_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(AmtSmbios_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+AmtSmbios : $(BUILD_DIR)\AmtSmbios.mak AmtSmbiosBin
+
+AmtSmbios_INCLUDES=\
+ $(ME_INCLUDES)\
+ $(EDK_INCLUDES)\
+ $(EdkIIGlueLib_INCLUDES)\
+ $(INTEL_PCH_INCLUDES)\
+ $(INTEL_MCH_INCLUDES)\
+ $(NB_INCLUDES)\
+ /I$(BOARD_DIR) \
+ $(MISCFRAMEWORK_INCLUDES)\
+
+
+AmtSmbios_LIBS=\
+ $(AmtLibDxe_LIB)\
+ $(MeLibDxe_LIB)\
+ $(EDKPROTOCOLLIB)\
+ $(EFIDRIVERLIB)\
+ $(CPUIA32LIB)\
+ $(VaProtocolLib_LIB)\
+ $(EdkIIGlueDxeReportStatusCodeLib_LIB)\
+ $(EdkIIGlueDxeDebugLibReportStatusCode_LIB)\
+ $(EdkIIGlueBaseLib_LIB)\
+!IF "$(x64_BUILD)"=="1"
+ $(EdkIIGlueBaseLibX64_LIB)\
+!ELSE
+ $(EdkIIGlueBaseLibIA32_LIB)\
+!ENDIF
+ $(EdkIIGlueUefiLib_LIB)\
+
+AmtSmbiosBin : $(AmtSmbios_LIBS)
+ $(MAKE) /$(MAKEFLAGS) $(EDK_DEFAULTS)\
+ /f $(BUILD_DIR)\AmtSmbios.mak all \
+ NAME=AmtSmbios \
+ MAKEFILE=$(BUILD_DIR)\AmtSmbios.mak \
+ "MY_INCLUDES=$(AmtSmbios_INCLUDES)" \
+ GUID=A8C67255-E029-4b1a-968E-ECA6E9C11C73 \
+ ENTRY_POINT=AmtSmbiosEntryPoint \
+ DEPEX1=$(AmtSmbios_DIR)\AmtSmbios.dxs \
+ DEPEX1_TYPE=EFI_SECTION_DXE_DEPEX \
+ TYPE=BS_DRIVER \
+ COMPRESS=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/AmtWrapper/AmtSmbios/AmtSmbios.sdl b/Board/EM/MeWrapper/AmtWrapper/AmtSmbios/AmtSmbios.sdl
new file mode 100644
index 0000000..d39f449
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/AmtSmbios/AmtSmbios.sdl
@@ -0,0 +1,25 @@
+TOKEN
+ Name = "AmtSmbios_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable iAmtSmbios support in Project"
+ TokenType = Boolean
+ TargetMAK = Yes
+ Master = Yes
+End
+
+PATH
+ Name = "AmtSmbios_DIR"
+ Help = "AMT Smbios file source directory"
+End
+
+MODULE
+ Help = "Includes AmtSmbios.mak to Project"
+ File = "AmtSmbios.mak"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\AmtSmbios.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End
+
diff --git a/Board/EM/MeWrapper/AmtWrapper/AmtStatusCode/AmtStatusCode.cif b/Board/EM/MeWrapper/AmtWrapper/AmtStatusCode/AmtStatusCode.cif
new file mode 100644
index 0000000..dcc3413
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/AmtStatusCode/AmtStatusCode.cif
@@ -0,0 +1,12 @@
+<component>
+ name = "AmtStatusCode"
+ category = ModulePart
+ LocalRoot = "Board\EM\MeWrapper\AmtWrapper\AmtStatusCode"
+ RefName = "AmtStatusCode"
+[files]
+"AmtStatusCode.sdl"
+"AmtStatusCode.mak"
+"AmtStatusCodePei.c"
+"AmtStatusCodeDxe.c"
+"AmtStatusCodeSmm.c"
+<endComponent>
diff --git a/Board/EM/MeWrapper/AmtWrapper/AmtStatusCode/AmtStatusCode.mak b/Board/EM/MeWrapper/AmtWrapper/AmtStatusCode/AmtStatusCode.mak
new file mode 100644
index 0000000..d75f602
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/AmtStatusCode/AmtStatusCode.mak
@@ -0,0 +1,81 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/AmtWrapper/AmtStatusCode/AmtStatusCode.mak 1 2/08/12 1:10a Klzhan $
+#
+# $Revision: 1 $
+#
+# $Date: 2/08/12 1:10a $
+#**********************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/AmtWrapper/AmtStatusCode/AmtStatusCode.mak $
+#
+# 1 2/08/12 1:10a Klzhan
+# Initial Check in
+#
+# 1 2/25/11 1:44a Klzhan
+# Initial Check-in
+#
+# 1 12/03/10 5:10a Klzhan
+# Initial Check-in.
+#
+#**********************************************************************
+#
+#<AMI_FHDR_START>
+#---------------------------------------------------------------------------
+# Name: AMTStatusCode.mak
+#
+# Description: AMT Status Code Makfile.
+#
+#---------------------------------------------------------------------------
+#<AMI_FHDR_END>
+
+#---------------------------------------------------------------------------
+# AMT StatusCode for DXE
+#---------------------------------------------------------------------------
+CORE_DXEBin : $(BUILD_DIR)\$(STATUS_CODE_DIR)\AmtStatusCodeDxe.obj
+
+$(BUILD_DIR)\$(STATUS_CODE_DIR)\AmtStatusCodeDxe.obj : $(AmtStatusCode_DIR)\AmtStatusCodeDxe.c
+ $(CC) $(CFLAGS:/W4=/W3) /DTIANO_RELEASE_VERSION=0x00080006 /DDXE_STATUS_CODE $(AlertStandardFormatDxe_INCLUDES) $(EDK_INCLUDES) $(STATUS_CODE_INCLUDES) /Fo$(BUILD_DIR)\$(STATUS_CODE_DIR)\AmtStatusCodeDxe.obj $(AmtStatusCode_DIR)\AmtStatusCodeDxe.c
+
+#---------------------------------------------------------------------------
+# AMT StatusCode for PEI
+#---------------------------------------------------------------------------
+CORE_PEIBin : $(BUILD_DIR)\$(STATUS_CODE_DIR)\AmtStatusCodePei.obj
+
+$(BUILD_DIR)\$(STATUS_CODE_DIR)\AmtStatusCodePei.obj : $(AmtStatusCode_DIR)\AmtStatusCodePei.c
+ $(CCPEI) $(CFLAGS:/W4=/W3) /DTIANO_RELEASE_VERSION=0x00080006 /DPEI_STATUS_CODE /IEDK\Foundation\Include\IA32 $(AlertStandardFormatPei_INCLUDES) $(EDK_INCLUDES) $(ME_INCLUDES) $(STATUS_CODE_INCLUDES) /Fo$(BUILD_DIR)\$(STATUS_CODE_DIR)\AmtStatusCodePei.obj $(AmtStatusCode_DIR)\AmtStatusCodePei.c
+
+#---------------------------------------------------------------------------
+# AMT StatusCode for SMM
+#---------------------------------------------------------------------------
+SmmStatusCodeBin : $(BUILD_DIR)\$(SmmStatusCode_DIR)\AmtStatusCodeSmm.obj
+
+$(BUILD_DIR)\$(SmmStatusCode_DIR)\AmtStatusCodeSmm.obj : $(AmtStatusCode_DIR)\AmtStatusCodeSmm.c
+ $(CC) $(CFLAGS:/W4=/W3) /DTIANO_RELEASE_VERSION=0x00080006 /DSMM_STATUS_CODE $(AlertStandardFormat_INCLUDES) $(ME_INCLUDES) $(STATUS_CODE_INCLUDES) $(CORE_INCLUDES) /Fo$(BUILD_DIR)\$(SmmStatusCode_DIR)\AmtStatusCodeSmm.obj $(AmtStatusCode_DIR)\AmtStatusCodeSmm.c
+
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/AmtWrapper/AmtStatusCode/AmtStatusCode.sdl b/Board/EM/MeWrapper/AmtWrapper/AmtStatusCode/AmtStatusCode.sdl
new file mode 100644
index 0000000..f83c100
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/AmtStatusCode/AmtStatusCode.sdl
@@ -0,0 +1,42 @@
+TOKEN
+ Name = "AmtStatusCode_SUPPORT"
+ Value = "0"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable AmtStatusCode support in Project"
+End
+
+MODULE
+ Help = "Includes AmtStatusCode.mak to Project"
+ File = "AmtStatusCode.mak"
+End
+
+PATH
+ Name = "AmtStatusCode_DIR"
+End
+
+ELINK
+ Name = "AmtStatusCode,"
+ Parent = "ReportMiscStatus"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "AmtStatusInit,"
+ Parent = "StatusCodeInitialize"
+ InvokeOrder = AfterParent
+End
+
+#ELINK
+# Name = "SmmAmtStatusCode,"
+# Parent = "SmmReportMiscStatus"
+# InvokeOrder = AfterParent
+#End
+
+#ELINK
+# Name = "SmmAmtStatusInit,"
+# Parent = "SmmStatusCodeInitialize"
+# InvokeOrder = AfterParent
+#End
diff --git a/Board/EM/MeWrapper/AmtWrapper/AmtStatusCode/AmtStatusCodeDxe.c b/Board/EM/MeWrapper/AmtWrapper/AmtStatusCode/AmtStatusCodeDxe.c
new file mode 100644
index 0000000..7cae372
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/AmtStatusCode/AmtStatusCodeDxe.c
@@ -0,0 +1,151 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/AmtWrapper/AmtStatusCode/AmtStatusCodeDxe.c 1 2/08/12 1:10a Klzhan $
+//
+// $Revision: 1 $
+//
+// $Date: 2/08/12 1:10a $
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/AmtWrapper/AmtStatusCode/AmtStatusCodeDxe.c $
+//
+// 1 2/08/12 1:10a Klzhan
+// Initial Check in
+//
+// 1 2/25/11 1:44a Klzhan
+// Initial Check-in
+//
+// 1 12/03/10 5:11a Klzhan
+// Initial Check-in.
+//
+//**********************************************************************
+//
+//<AMI_FHDR_START>
+//---------------------------------------------------------------------------
+// Name: AMTStatusDxeCode.c
+//
+// Description: Processes ASF messages for DXE.
+//
+//---------------------------------------------------------------------------
+//<AMI_FHDR_END>
+/*++
+
+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:
+
+ AmtStatusCodeDxe.c
+
+Abstract:
+ Processes ASF messages
+
+--*/
+
+#include "Tiano.h"
+#include "Pei.h"
+#include EFI_PPI_DEFINITION (StatusCode)
+
+VOID AmtStatusCode(
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_STATUS_CODE_TYPE Type,
+ IN EFI_STATUS_CODE_VALUE Value,
+ IN UINT32 Instance,
+ IN EFI_GUID *CallerId OPTIONAL,
+ IN EFI_STATUS_CODE_DATA *Data OPTIONAL
+)
+/*++
+Routine Description:
+
+ Provides an interface that a software module can call to report an ASF DXE status code.
+
+Arguments:
+
+ PeiServices - PeiServices pointer.
+
+ Type - Indicates the type of status code being reported.
+
+ Value - Describes the current status of a hardware or software entity.
+ This included information about the class and subclass that is
+ used to classify the entity as well as an operation.
+
+ Instance - The enumeration of a hardware or software entity within
+ the system. Valid instance numbers start with 1.
+
+ CallerId - This optional parameter may be used to identify the caller.
+ This parameter allows the status code driver to apply different
+ rules to different callers.
+
+ Data - This optional parameter may be used to pass additional data.
+
+Returns:
+
+ None
+
+--*/
+{
+ //
+ // Do nothing, because AMT ASF driver will handle that.
+ //
+ return ;
+}
+
+EFI_STATUS
+AmtStatusInit(
+ IN EFI_FFS_FILE_HEADER *FfsHeader,
+ IN EFI_PEI_SERVICES **PeiServices
+)
+/*++
+Routine Description:
+
+ Init routine for DXE ASF StatusCode.
+
+Arguments:
+
+ FfsHeader - FfsHeader pointer.
+ PeiServices - PeiServices pointer.
+
+Returns:
+
+ EFI_SUCCESS - The function completed successfully
+
+--*/
+{
+ //
+ // Do nothing, because AMT ASF driver will handle that.
+ //
+ 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/AmtWrapper/AmtStatusCode/AmtStatusCodePei.c b/Board/EM/MeWrapper/AmtWrapper/AmtStatusCode/AmtStatusCodePei.c
new file mode 100644
index 0000000..8cf18ba
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/AmtStatusCode/AmtStatusCodePei.c
@@ -0,0 +1,224 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/AmtWrapper/AmtStatusCode/AmtStatusCodePei.c 1 2/08/12 1:10a Klzhan $
+//
+// $Revision: 1 $
+//
+// $Date: 2/08/12 1:10a $
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/AmtWrapper/AmtStatusCode/AmtStatusCodePei.c $
+//
+// 1 2/08/12 1:10a Klzhan
+// Initial Check in
+//
+// 1 2/25/11 1:44a Klzhan
+// Initial Check-in
+//
+// 1 12/03/10 5:11a Klzhan
+// Initial Check-in.
+//
+//**********************************************************************
+//
+//<AMI_FHDR_START>
+//---------------------------------------------------------------------------
+// Name: AMTStatusCodePei.c
+//
+// Description: Processes ASF messages for Pei.
+//
+//---------------------------------------------------------------------------
+//<AMI_FHDR_END>
+/*++
+
+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:
+
+ AmtStatusCodePei.c
+
+Abstract:
+ Processes ASF messages
+
+--*/
+
+#include "Tiano.h"
+#include "Pei.h"
+#include EFI_PPI_DEFINITION (StatusCode)
+
+#include EFI_PPI_DEFINITION (AmtStatusCode)
+
+EFI_GUID mPeiAmtStatusCodePpiGuid = PEI_AMT_STATUS_CODE_PPI_GUID;
+EFI_GUID mAmtPETQueueHobGuid = AMT_PET_QUEUE_HOB_GUID;
+
+EFI_STATUS
+AmtQueuePetMessage (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_STATUS_CODE_TYPE Type,
+ IN EFI_STATUS_CODE_VALUE Value
+ )
+/*++
+Routine Description:
+
+ This routine puts PET message to MessageQueue, which will be sent later.
+
+Arguments:
+
+ PeiServices - PeiServices pointer.
+ Type - StatusCode message type.
+ Value - StatusCode message value.
+
+Returns:
+
+ EFI_SUCCESS - The function completed successfully
+
+--*/
+{
+ AMT_PET_QUEUE_HOB *PETQueueHob;
+ EFI_STATUS Status;
+
+ // Create PET queue hob
+ Status = (**PeiServices).CreateHob ( PeiServices, \
+ EFI_HOB_TYPE_GUID_EXTENSION, \
+ sizeof(AMT_PET_QUEUE_HOB), \
+ &PETQueueHob );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ PETQueueHob->EfiHobGuidType.Name = mAmtPETQueueHobGuid;
+ PETQueueHob->Type = Type;
+ PETQueueHob->Value = Value;
+
+ return EFI_SUCCESS;
+}
+
+VOID AmtStatusCode(
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_STATUS_CODE_TYPE Type,
+ IN EFI_STATUS_CODE_VALUE Value,
+ IN UINT32 Instance,
+ IN EFI_GUID *CallerId OPTIONAL,
+ IN EFI_STATUS_CODE_DATA *Data OPTIONAL
+)
+/*++
+Routine Description:
+
+ Provides an interface that a software module can call to report an ASF PEI status code.
+
+Arguments:
+
+ PeiServices - PeiServices pointer.
+
+ Type - Indicates the type of status code being reported.
+
+ Value - Describes the current status of a hardware or software entity.
+ This included information about the class and subclass that is
+ used to classify the entity as well as an operation.
+
+ Instance - The enumeration of a hardware or software entity within
+ the system. Valid instance numbers start with 1.
+
+ CallerId - This optional parameter may be used to identify the caller.
+ This parameter allows the status code driver to apply different
+ rules to different callers.
+
+ Data - This optional parameter may be used to pass additional data.
+
+Returns:
+
+ None
+
+--*/
+{
+ PEI_AMT_STATUS_CODE_PPI *AmtStatusCode;
+ EFI_STATUS Status;
+
+ Status = (*PeiServices)->LocatePpi( PeiServices, \
+ &mPeiAmtStatusCodePpiGuid, \
+ 0, \
+ NULL, \
+ &AmtStatusCode );
+ if ( EFI_ERROR (Status) ) {
+ if (((Type & EFI_STATUS_CODE_TYPE_MASK) != EFI_PROGRESS_CODE) &&
+ ((Type & EFI_STATUS_CODE_TYPE_MASK) != EFI_ERROR_CODE)) {
+ return ;
+ }
+
+ // Register to Hob
+
+ // Create PET queue hob
+ AmtQueuePetMessage (PeiServices, Type, Value);
+
+ return ;
+ }
+
+ AmtStatusCode->ReportStatusCode (
+ PeiServices,
+ AmtStatusCode,
+ Type,
+ Value,
+ Instance,
+ CallerId,
+ Data
+ );
+
+ return ;
+}
+
+EFI_STATUS
+AmtStatusInit(
+ IN EFI_FFS_FILE_HEADER *FfsHeader,
+ IN EFI_PEI_SERVICES **PeiServices
+)
+/*++
+Routine Description:
+
+ Init routine for PEI ASF StatusCode.
+
+Arguments:
+
+ FfsHeader - FfsHeader pointer.
+ PeiServices - PeiServices pointer.
+
+Returns:
+
+ EFI_SUCCESS - The function completed successfully
+
+--*/
+{
+ 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/AmtWrapper/AmtStatusCode/AmtStatusCodeSmm.c b/Board/EM/MeWrapper/AmtWrapper/AmtStatusCode/AmtStatusCodeSmm.c
new file mode 100644
index 0000000..63b3919
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/AmtStatusCode/AmtStatusCodeSmm.c
@@ -0,0 +1,368 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/AmtWrapper/AmtStatusCode/AmtStatusCodeSmm.c 1 2/08/12 1:10a Klzhan $
+//
+// $Revision: 1 $
+//
+// $Date: 2/08/12 1:10a $
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/AmtWrapper/AmtStatusCode/AmtStatusCodeSmm.c $
+//
+// 1 2/08/12 1:10a Klzhan
+// Initial Check in
+//
+// 1 2/25/11 1:44a Klzhan
+// Initial Check-in
+//
+// 1 12/03/10 5:11a Klzhan
+// Initial Check-in.
+//
+//**********************************************************************
+//
+//<AMI_FHDR_START>
+//---------------------------------------------------------------------------
+// Name: AMTStatusCodePei.c
+//
+// Description: Processes ASF messages for Pei.
+//
+//---------------------------------------------------------------------------
+//<AMI_FHDR_END>
+/*++
+
+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:
+
+ AmtStatusCodeSmm.c
+
+Abstract:
+ Processes ASF messages
+
+--*/
+
+#include "Tiano.h"
+#include "Pei.h"
+#include EFI_PROTOCOL_DEFINITION (SmmBase)
+#include EFI_PROTOCOL_DEFINITION (SmmStatusCode)
+#include "Protocol/AmtStatusCodeSmm/AmtStatusCodeSmm.h"
+//#include EFI_PROTOCOL_DEFINITION (AmtStatusCodeSmm)
+
+EFI_GUID mAmtSmmStatusCodeProtocolGuid = AMT_SMM_STATUS_CODE_PROTOCOL_GUID;
+EFI_GUID gAmtSmmPETQueueProtocolGuid = AMT_SMM_PET_QUEUE_PROTOCOL_GUID;
+
+AMT_SMM_PET_QUEUE_PROTOCOL gAmtSmmPETQueue;
+AMT_SMM_PET_QUEUE_PROTOCOL *gAmtSmmPETQueueProtocol;
+
+AMT_SMM_STATUS_CODE_PROTOCOL *mAmtSmmStatusCode;
+
+EFI_SYSTEM_TABLE *pST;
+EFI_BOOT_SERVICES *pBS;
+EFI_RUNTIME_SERVICES *pRS;
+EFI_SMM_BASE_PROTOCOL *pSmmBase;
+EFI_SMM_SYSTEM_TABLE *pSmst;
+
+VOID
+AmtInitializeListHead (
+ EFI_LIST_ENTRY *List
+ )
+{
+ List->ForwardLink = List;
+ List->BackLink = List;
+}
+
+VOID
+AmtInsertTailList (
+ EFI_LIST_ENTRY *ListHead,
+ EFI_LIST_ENTRY *Entry
+ )
+{
+ EFI_LIST_ENTRY *_ListHead;
+ EFI_LIST_ENTRY *_BackLink;
+
+ _ListHead = ListHead;
+ _BackLink = _ListHead->BackLink;
+ Entry->ForwardLink = _ListHead;
+ Entry->BackLink = _BackLink;
+ _BackLink->ForwardLink = Entry;
+ _ListHead->BackLink = Entry;
+}
+
+EFI_STATUS
+AmtQueuePetMessage (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_STATUS_CODE_TYPE Type,
+ IN EFI_STATUS_CODE_VALUE Value
+ )
+/*++
+Routine Description:
+
+ This routine puts PET message to MessageQueue, which will be sent later.
+
+Arguments:
+
+ PeiServices - PeiServices pointer.
+ Type - StatusCode message type.
+ Value - StatusCode message value.
+
+Returns:
+
+ EFI_SUCCESS - The function completed successfully
+
+--*/
+{
+ AMT_SMM_PET_QUEUE_NODE *NewNode;
+ EFI_STATUS Status;
+
+ Status = pSmmBase->SmmAllocatePool (
+ pSmmBase,
+ EfiRuntimeServicesData,
+ sizeof (AMT_SMM_PET_QUEUE_NODE),
+ &NewNode
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ NewNode->Signature = AMT_SMM_PET_QUEUE_NODE_SIGNATURE;
+ NewNode->Type = Type;
+ NewNode->Value = Value;
+ AmtInsertTailList (&gAmtSmmPETQueueProtocol->MessageList, &NewNode->Link);
+
+ return EFI_SUCCESS;
+}
+
+VOID SmmAmtStatusCode(
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_STATUS_CODE_TYPE Type,
+ IN EFI_STATUS_CODE_VALUE Value,
+ IN UINT32 Instance,
+ IN EFI_GUID *CallerId OPTIONAL,
+ IN EFI_STATUS_CODE_DATA *Data OPTIONAL
+)
+/*++
+Routine Description:
+
+ Provides an interface that a software module can call to report an ASF DXE status code.
+
+Arguments:
+
+ PeiServices - PeiServices pointer.
+
+ Type - Indicates the type of status code being reported.
+
+ Value - Describes the current status of a hardware or software entity.
+ This included information about the class and subclass that is
+ used to classify the entity as well as an operation.
+
+ Instance - The enumeration of a hardware or software entity within
+ the system. Valid instance numbers start with 1.
+
+ CallerId - This optional parameter may be used to identify the caller.
+ This parameter allows the status code driver to apply different
+ rules to different callers.
+
+ Data - This optional parameter may be used to pass additional data.
+
+Returns:
+
+ None
+
+--*/
+{
+ if (mAmtSmmStatusCode == NULL) {
+ if (((Type & EFI_STATUS_CODE_TYPE_MASK) != EFI_PROGRESS_CODE) &&
+ ((Type & EFI_STATUS_CODE_TYPE_MASK) != EFI_ERROR_CODE)) {
+ return ;
+ }
+
+ // Register to Queue
+ AmtQueuePetMessage (PeiServices, Type, Value);
+
+ return ;
+ }
+
+ mAmtSmmStatusCode->ReportStatusCode (
+ mAmtSmmStatusCode,
+ Type,
+ Value,
+ Instance,
+ CallerId,
+ Data
+ );
+
+ return ;
+}
+
+VOID
+EFIAPI
+AmtCallback (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+/*++
+Routine Description:
+
+ ASF SMM StatusCode Callback.
+
+Arguments:
+
+ Event - ASF StatusCode Callback Event.
+
+ Context - ASF StatusCode Callback Context.
+
+Returns:
+
+ None
+
+--*/
+{
+ pBS->LocateProtocol ( &mAmtSmmStatusCodeProtocolGuid, NULL, &mAmtSmmStatusCode );
+
+ return;
+}
+
+EFI_STATUS
+AmtCreateMessageQueue (
+ VOID
+ )
+/*++
+Routine Description:
+
+ This routine creats PET MessageQueue.
+
+Arguments:
+
+ None
+
+Returns:
+
+ EFI_SUCCESS - The function completed successfully
+
+--*/
+{
+ EFI_STATUS Status;
+ EFI_HANDLE Handle;
+
+ Status = pBS->LocateProtocol (
+ &gAmtSmmPETQueueProtocolGuid,
+ NULL,
+ &gAmtSmmPETQueueProtocol
+ );
+ if (!EFI_ERROR (Status)) {
+ return EFI_SUCCESS;
+ }
+
+ //
+ // Create Queue for later usage
+ //
+ gAmtSmmPETQueueProtocol = &gAmtSmmPETQueue;
+
+ AmtInitializeListHead (&gAmtSmmPETQueueProtocol->MessageList);
+ Handle = NULL;
+ Status = pBS->InstallProtocolInterface (
+ &Handle,
+ &gAmtSmmPETQueueProtocolGuid,
+ EFI_NATIVE_INTERFACE,
+ &gAmtSmmPETQueue
+ );
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+SmmAmtStatusInit(
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+)
+/*++
+Routine Description:
+
+ Init routine for SMM ASF StatusCode.
+
+Arguments:
+
+ FfsHeader - FfsHeader pointer.
+ PeiServices - PeiServices pointer.
+
+Returns:
+
+ EFI_SUCCESS - The function completed successfully
+
+--*/
+{
+ EFI_STATUS Status;
+ VOID *AmtRegistration;
+ EFI_EVENT Event;
+
+ pST=SystemTable;
+ pBS=SystemTable->BootServices;
+ pRS=SystemTable->RuntimeServices;
+ Status = pBS->LocateProtocol(&gEfiSmmBaseProtocolGuid, NULL, &pSmmBase);
+ Status = pSmmBase->GetSmstLocation(pSmmBase,&pSmst);
+
+ AmtCreateMessageQueue ();
+
+ Status = pBS->LocateProtocol ( &mAmtSmmStatusCodeProtocolGuid, NULL, &mAmtSmmStatusCode );
+ if ( !EFI_ERROR (Status) ) return EFI_SUCCESS;
+
+ //
+ // Create the event
+ //
+ Status = pBS->CreateEvent (
+ EFI_EVENT_NOTIFY_SIGNAL,
+ EFI_TPL_CALLBACK,
+ AmtCallback,
+ NULL,
+ &Event
+ );
+ if (EFI_ERROR (Status)) return Status;
+
+ //
+ // Register for protocol notifactions on this event
+ // NOTE: Because this protocol will be installed in SMM, it is safety to
+ // register ProtocolNotify here. This event will be triggered in SMM later.
+ //
+ Status = pBS->RegisterProtocolNotify (
+ &mAmtSmmStatusCodeProtocolGuid,
+ Event,
+ &AmtRegistration
+ );
+ if (EFI_ERROR (Status)) return Status;
+
+ 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/AmtWrapper/AmtWrapper.cif b/Board/EM/MeWrapper/AmtWrapper/AmtWrapper.cif
new file mode 100644
index 0000000..7d6a54b
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/AmtWrapper.cif
@@ -0,0 +1,19 @@
+<component>
+ name = "AmtWrapper"
+ category = ModulePart
+ LocalRoot = "Board\EM\MeWrapper\AmtWrapper\"
+ RefName = "AmtWrapper"
+[files]
+"AmtWrapper.sdl"
+[parts]
+"AmtWrapperDxe"
+"AmtSetup"
+"AmtPlatformPolicy"
+"AsfTable"
+"AmtWrapperProtocolLib"
+"AmtSmbios"
+"AmtPetAlert"
+"AmtStatusCode"
+"AmtLockKBD"
+"ASFVerbosity"
+<endComponent>
diff --git a/Board/EM/MeWrapper/AmtWrapper/AmtWrapper.sdl b/Board/EM/MeWrapper/AmtWrapper/AmtWrapper.sdl
new file mode 100644
index 0000000..1ccfb2b
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/AmtWrapper.sdl
@@ -0,0 +1,20 @@
+TOKEN
+ Name = "AmtWrapper_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable AMT Wrapper support in Project"
+ Token = "iAMT_SUPPORT" "=" "1"
+End
+
+PATH
+ Name = "AmtWrapper_DIR"
+End
+
+ELINK
+ Name = "/I$(AmtWrapper_DIR)"
+ Parent = "ME_INCLUDES"
+ InvokeOrder = AfterParent
+End
diff --git a/Board/EM/MeWrapper/AmtWrapper/AsfTable/AsfTable.c b/Board/EM/MeWrapper/AmtWrapper/AsfTable/AsfTable.c
new file mode 100644
index 0000000..4deedd4
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/AsfTable/AsfTable.c
@@ -0,0 +1,300 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/AmtWrapper/AsfTable/AsfTable.c 3 6/18/14 3:14a Larryliu $
+//
+// $Revision: 3 $
+//
+// $Date: 6/18/14 3:14a $
+//
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/AmtWrapper/AsfTable/AsfTable.c $
+//
+// 3 6/18/14 3:14a Larryliu
+// [TAG] EIP173999
+// [Category] Improvement
+// [Description] [HWR]Remove useless comments from Intel ME
+// component.(except RC)
+// [Files] AsfTable.c
+//
+// 1 2/08/12 1:09a Klzhan
+//
+// 1 2/25/11 1:44a Klzhan
+// Initial Check-in
+//
+// 1 12/03/10 5:10a Klzhan
+// Initial Check-in.
+//
+//
+//**********************************************************************
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: AsfTable.c
+//
+// Description: Create ASF Acpi table
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+#include "AsfTable.h"
+
+EFI_GUID gAcpiSupportGuid = EFI_ACPI_SUPPORT_GUID;
+
+EFI_STATUS
+AsfBuildTbl(
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ );
+
+//----------------------------------------------------------------------------
+// Variable declaration
+//----------------------------------------------------------------------------
+VOID *mAsfRegistration;
+
+//
+// Driver entry point
+//
+EFI_DRIVER_ENTRY_POINT (AsfTableEntryPoint);
+
+//
+// Function implementations
+//
+EFI_STATUS
+EFIAPI
+AsfTableEntryPoint (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+)
+{
+ EFI_EVENT FilterEvent;
+ EFI_STATUS Status;
+
+ //
+ // Initialize the EFI Driver Library
+ //
+ EfiInitializeDriverLib (ImageHandle, SystemTable);
+
+ Status = gBS->CreateEvent ( EFI_EVENT_NOTIFY_SIGNAL,
+ EFI_TPL_CALLBACK,
+ AsfBuildTbl,
+ NULL,
+ &FilterEvent);
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+
+ // Register for protocol notifactions on this event
+ Status = gBS->RegisterProtocolNotify ( &gAcpiSupportGuid,
+ FilterEvent,
+ &mAsfRegistration);
+
+ ASSERT_EFI_ERROR (Status);
+
+ gBS->SignalEvent (FilterEvent);
+
+ return Status;
+}
+
+//-----------------------------------------------------------------------------
+// ASF Table
+//-----------------------------------------------------------------------------
+//The table shound be runtime build like as ASFBSP
+//
+// ASF Definitions
+//
+#define EFI_ACPI_1_0_ASF_DESCRIPTION_TABLE_REVISION 0x20
+
+// need to update to asl asf 2.0 table....
+EFI_ACPI_1_0_ASF_DESCRIPTION_TABLE ASF_TABLE = {
+ EFI_ACPI_1_0_ASF_DESCRIPTION_TABLE_SIGNATURE,
+ sizeof (EFI_ACPI_1_0_ASF_DESCRIPTION_TABLE),
+ EFI_ACPI_1_0_ASF_DESCRIPTION_TABLE_REVISION,
+ 0, // to make sum of entire table == 0
+
+ // OEM identification
+ 'I', 'N', 'T', 'E', 'L', ' ',
+
+ // OEM table identification
+ ((((((((((((('D' << 8) + '8') << 8) + '6') << 8) + '5') << 8) + 'G') << 8) + 'C') << 8) + 'H') << 8) + ' ', // OEM table identification
+
+ 1, // OEM revision number
+ ((((('M' << 8) + 'S') << 8) + 'F') << 8) + 'T', // ASL compiler vendor ID
+ 1000000, // ASL compiler revision number
+
+ //
+ // ASF_INFO
+ //
+ 0x00, // Type "ASF_INFO"
+ 0x00, // Reserved
+ sizeof (EFI_ACPI_ASF_INFO), // Length
+ 0xFF, // Min Watchdog Reset Value
+ 0xFF, // Min ASF Sensor Inter-poll Wait Time
+ 0x0001, // System ID
+ 0x57010000, // IANA Manufacture ID for Intel
+ 0x00, // Feature Flag
+ 0x00, 0x00, 0x00, // Reserved
+
+ //
+ // ASF_ALRT
+ //
+
+ 0x01, // Type "ASF_ALRT"
+ 0x00, // Reserved
+ sizeof (EFI_ACPI_ASF_ALRT), // Length
+ 0x00, // Assertion Event Bit Mask
+ 0x00, // Deassertion Event Bit Mask
+ 0x03, // Number Of Alerts
+ 0x0C, // Array Element Length
+ //
+ // ICH Slave SMBUS Read devices
+ //
+ 0x89, 0x04, 0x01, 0x01, 0x05, 0x6F, 0x00, 0x68, 0x08, 0x88, 0x17, 0x00, // Device 0
+ 0x89, 0x04, 0x04, 0x04, 0x07, 0x6F, 0x00, 0x68, 0x20, 0x88, 0x03, 0x00, // Device 1
+ 0x89, 0x05, 0x01, 0x01, 0x19, 0x6F, 0x00, 0x68, 0x20, 0x88, 0x22, 0x00, // Device 2
+
+ //
+ // ASF_RCTL
+ //
+ 0x02, // Type "ASF_RCTL"
+ 0x00, // Reserved
+ sizeof (EFI_ACPI_ASF_RCTL), // Length
+ 0x04, // Number of Controls
+ 0x04, // Array Element Length
+ 0x0000, // Reserved
+ //
+ // ICH Slave SMBUS Write cmds
+ //
+ 0x00, 0x88, 0x00, 0x03, // Control 0 --> Reset system
+ 0x01, 0x88, 0x00, 0x02, // Control 1 --> Power Off system
+ 0x02, 0x88, 0x00, 0x01, // Control 2 --> Power On system
+ 0x03, 0x88, 0x00, 0x04, // Control 3 --> Power Cycle Reset (off then on)
+
+ //
+ // ASF_RCMP
+ //
+ 0x03, // Type "ASF_RCMP"
+ 0x00, // Reserved
+ sizeof (EFI_ACPI_ASF_RMCP), // Length
+
+ // Remote Control Capabilities supported Bit Masks
+ // =============================================
+ // System Firmware Capabilities Bit Mask Started
+ // =============================================
+ 0x21, // System Firmware Capabilities Bit Mask
+ // (two MSBytes are Rsvd,
+
+ // Bit7 RSVD
+ // Bit6 Support Sleep Button LOCK
+ // Bit5 Support KBD LOCK
+ // Bit4-3 RSVD
+ // Bit2 Support Reset Button LOCK
+ // Bit1 Support Power Button LOCK
+ // Bit0 Support Verbosity/ Blank Screen
+ 0xF8,
+ // Bit7 Support Configration Data Reset
+ // Bit6 Support Verbosity/ Quiet
+ // Bit5 Support Verbosity/ Verbose
+ // Bit4 Support Force Progress Event
+ // Bit3 Support User Password Bypass
+ // Bit2:0 RSVD
+ 0x00,
+ 0x00,
+ // =============================================
+ // Special Commands Bit Mask Started
+ // =============================================
+ 0x00, // RSVD
+ 0x13,
+ // Bit7:5 RSVD
+ // Bit4 Support Force CD/DVD Boot Command
+ // Bit3 Support Force Diagnostic Boot Command
+ // Bit2 Support Force Hard Drive Safe-mode Boot Command
+ // Bit1 Support Force Hard Drive Boot Command
+ // Bit0 Support Force PXE Boot Command
+ // =============================================
+ // System Capabilities Bit Mask Started
+ // =============================================
+ 0xF0, // System Capabilities Bit Mask (Supports Reset,
+ // Power-Up,Power-Down, Power-Cycle Reset
+ // for compat and secure port.
+ 0x00, // Boot Option Complete Code
+ 0x57010000, // IANA ID for Intel Manufacturer
+ 0x00, // Special Command
+ 0x00, 0x00, // Special Command Parameter
+ 0x00, 0x01, // Boot Options
+ 0x00, 0x00, // OEM Parameters
+
+ //
+ // ASF_ADDR
+ //
+ 0x84, // Type "ASF_ADDR", last record
+ 0x00, // Reserved
+ sizeof (EFI_ACPI_ASF_ADDR), // Length
+ 0x00, // SEEPROM Address
+ ASF_ADDR_DEVICE_ARRAY_LENGTH, // Number Of Devices
+ 0x5C, 0x68, 0x88, 0xC2, 0xD2, // Fixed SMBus Address (Heceta 6, 82573E device - static def (also an ARP addr),
+ 0xDC, 0xA0, 0xA2, 0xA4, 0xA6, // ICH Slave Device, SMB ARP, CK410, DB400/800, SDRAM SPD devices
+ 0xC8 // TEKOA Slave Device
+};
+
+EFI_STATUS
+AsfBuildTbl(
+ IN EFI_EVENT Event,
+ IN VOID *Context
+)
+{
+ EFI_STATUS Status;
+ UINTN AsfTableHandle=0;
+ EFI_ACPI_SUPPORT_PROTOCOL *AcpiSupport;
+ VOID *AsfStruc;
+
+ AsfStruc = (VOID *)&ASF_TABLE;
+
+ Status = gBS->LocateProtocol(&gAcpiSupportGuid,
+ NULL,
+ &AcpiSupport);
+ if (EFI_ERROR (Status))
+ {
+ return EFI_ABORTED;
+ }
+
+ Status = AcpiSupport->SetAcpiTable (AcpiSupport,
+ AsfStruc,
+ TRUE,
+ (EFI_ACPI_TABLE_VERSION_2_0|EFI_ACPI_TABLE_VERSION_1_0B),
+ &AsfTableHandle);
+ if (EFI_ERROR(Status))
+ {
+ // Handle the error appropriately
+ return EFI_ABORTED;
+ }
+
+ return Status;
+}
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/AmtWrapper/AsfTable/AsfTable.cif b/Board/EM/MeWrapper/AmtWrapper/AsfTable/AsfTable.cif
new file mode 100644
index 0000000..bf83bbb
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/AsfTable/AsfTable.cif
@@ -0,0 +1,12 @@
+<component>
+ name = "AsfTable"
+ category = ModulePart
+ LocalRoot = "Board\EM\MeWrapper\AmtWrapper\AsfTable"
+ RefName = "AsfTable"
+[files]
+"AsfTable.c"
+"AsfTable.h"
+"AsfTable.sdl"
+"AsfTable.mak"
+"AsfTable.dxs"
+<endComponent>
diff --git a/Board/EM/MeWrapper/AmtWrapper/AsfTable/AsfTable.dxs b/Board/EM/MeWrapper/AmtWrapper/AsfTable/AsfTable.dxs
new file mode 100644
index 0000000..1d031bb
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/AsfTable/AsfTable.dxs
@@ -0,0 +1,66 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/AmtWrapper/AsfTable/AsfTable.dxs 1 2/08/12 1:09a Klzhan $
+//
+// $Revision: 1 $
+//
+// $Date: 2/08/12 1:09a $
+//
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/AmtWrapper/AsfTable/AsfTable.dxs $
+//
+// 1 2/08/12 1:09a Klzhan
+//
+// 1 2/25/11 1:44a Klzhan
+// Initial Check-in
+//
+// 1 12/03/10 5:10a Klzhan
+// Initial Check-in.
+//
+//
+//**********************************************************************
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: AsfTable.DXS
+//
+// Description: This file is the dependency file for the AsfTable driver
+//
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+
+DEPENDENCY_START
+ TRUE
+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/AmtWrapper/AsfTable/AsfTable.h b/Board/EM/MeWrapper/AmtWrapper/AsfTable/AsfTable.h
new file mode 100644
index 0000000..09cfc72
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/AsfTable/AsfTable.h
@@ -0,0 +1,70 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/AmtWrapper/AsfTable/AsfTable.h 1 2/08/12 1:09a Klzhan $
+//
+// $Revision: 1 $
+//
+// $Date: 2/08/12 1:09a $
+//
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/AmtWrapper/AsfTable/AsfTable.h $
+//
+// 1 2/08/12 1:09a Klzhan
+//
+// 1 2/25/11 1:44a Klzhan
+// Initial Check-in
+//
+// 1 12/03/10 5:10a Klzhan
+// Initial Check-in.
+//
+//
+//**********************************************************************
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: AsfTable.h
+//
+// Description: Header file for ASF Acpi table
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+#ifndef _ASF_TABLE_H_
+#define _ASF_TABLE_H_
+
+#include "Efi.h"
+#include "EfiDriverLib.h"
+#include "EfiCommonLib.h"
+#include "AlertStandardFormatTable.h"
+
+#include EFI_PROTOCOL_DEFINITION (AcpiSupport)
+
+#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/AmtWrapper/AsfTable/AsfTable.mak b/Board/EM/MeWrapper/AmtWrapper/AsfTable/AsfTable.mak
new file mode 100644
index 0000000..65f6576
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/AsfTable/AsfTable.mak
@@ -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/AmtWrapper/AsfTable/AsfTable.mak 1 2/08/12 1:09a Klzhan $
+#
+# $Revision: 1 $
+#
+# $Date: 2/08/12 1:09a $
+#**********************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/AmtWrapper/AsfTable/AsfTable.mak $
+#
+# 1 2/08/12 1:09a Klzhan
+#
+# 1 2/25/11 1:44a Klzhan
+# Initial Check-in
+#
+# 1 12/03/10 5:10a Klzhan
+# Initial Check-in.
+#
+#
+#**********************************************************************
+#<AMI_FHDR_START>
+#
+# Name: AsfTable.mak
+#
+# Description:
+#
+#<AMI_FHDR_END>
+#**********************************************************************
+EDK : AsfTable
+
+AsfTable : $(BUILD_DIR)\AsfTable.mak AsfTableBin
+
+$(BUILD_DIR)\AsfTable.mak : $(AsfTable_DIR)\$(@B).cif $(AsfTable_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(AsfTable_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+ASF_TABLE_INCLUDES=\
+ $(EDK_INCLUDES)\
+ $(MISCFRAMEWORK_INCLUDES)\
+ $(ME_INCLUDES)\
+ $(IndustryStandard_INCLUDES)\
+
+AsfTableBin : $(EFIDRIVERLIB) $(EFICOMMONLIB) $(PRINTLIB)
+ $(MAKE) /$(MAKEFLAGS) $(EDK_DEFAULTS)\
+ /f $(BUILD_DIR)\AsfTable.mak all\
+ GUID=E72527CF-505B-4b50-99CD-A32467FA4AA4\
+ "MY_INCLUDES=$(ASF_TABLE_INCLUDES)" \
+ ENTRY_POINT=AsfTableEntryPoint \
+ TYPE=BS_DRIVER LIBRARIES= \
+ DEPEX1=$(AsfTable_DIR)\AsfTable.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 **
+#** **
+#*************************************************************************
+#************************************************************************* \ No newline at end of file
diff --git a/Board/EM/MeWrapper/AmtWrapper/AsfTable/AsfTable.sdl b/Board/EM/MeWrapper/AmtWrapper/AsfTable/AsfTable.sdl
new file mode 100644
index 0000000..b370431
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/AsfTable/AsfTable.sdl
@@ -0,0 +1,24 @@
+TOKEN
+ Name = "AsfTable_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable AsfTable support in Project"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+End
+
+PATH
+ Name = "AsfTable_DIR"
+End
+
+MODULE
+ Help = "Includes AsfTable.mak to Project"
+ File = "AsfTable.mak"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\AsfTable.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End \ No newline at end of file
diff --git a/Board/EM/MeWrapper/AmtWrapper/Dxe/AmtWrapperDxe.c b/Board/EM/MeWrapper/AmtWrapper/Dxe/AmtWrapperDxe.c
new file mode 100644
index 0000000..b5d4c0a
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/Dxe/AmtWrapperDxe.c
@@ -0,0 +1,883 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/AmtWrapper/AmtWrapperDxe/AmtWrapperDxe.c 10 6/18/14 3:08a Larryliu $
+//
+// $Revision: 10 $
+//
+// $Date: 6/18/14 3:08a $
+//
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/AmtWrapper/AmtWrapperDxe/AmtWrapperDxe.c $
+//
+// 10 6/18/14 3:08a Larryliu
+// [TAG] EIP173999
+// [Category] Improvement
+// [Description] [HWR]Remove useless comments from Intel ME
+// component.(except RC)
+// [Files] AmtWrapperDxe.c
+//
+// 8 5/14/14 9:52p Tristinchou
+// [TAG] EIP167030
+// [Category] Improvement
+// [Description] Remove the variable runtime attribute and keep original
+// attributes.
+//
+// 7 9/12/13 5:26a Klzhan
+// [TAG] EIPNone
+// [Category] Improvement
+// [Description] Correct gSerialOverLanDevicePath
+//
+// 6 4/18/13 1:55a Klzhan
+// [TAG] EIP119190
+// [Category] Bug Fix
+// [Severity] Important
+// [Symptom] BIOS doesn't wait for KVM pass code input.
+// [RootCause] The Con Out Start protocol GUID is different in AMI and
+// ME RC.
+// [Solution] Install ME RC ConOut Protocol when AMI ConOut Protocol
+// installed.
+// [Files] AmtWrapperDxe.c
+// AmtWrapperDxe.h
+//
+// 5 4/08/13 3:06a Klzhan
+// [TAG] EIPNone
+// [Category] Improvement
+// [Description] Support New Security protocol.
+//
+// 4 10/30/12 8:33a Klzhan
+// Correct Secure IDER boot
+//
+// 3 8/14/12 7:24a Klzhan
+// Support UEFI IDER boot.
+//
+// 2 4/24/12 12:36a Klzhan
+// Update modulepart to latest
+//
+// 1 2/08/12 1:08a Klzhan
+// Initial Check in
+//
+// 3 6/21/11 3:42a Klzhan
+// Fix comnpiler error if PCI COM is 0.
+//
+// 2 3/29/11 3:18a Klzhan
+// Remove un-used code.
+//
+// 1 2/25/11 1:43a Klzhan
+// Initial Check-in
+//
+// 2 12/28/10 2:00a Klzhan
+// Improvement : Enable/Disable Terminal item for SOL redirection.
+//
+// 1 12/03/10 5:10a Klzhan
+// Initial Check-in.
+//
+//
+//**********************************************************************
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: AmtWrapperDxe.c
+//
+// Description: Amt Wrapper Functions
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+/*++
+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.
+--*/
+#if EFI_SPECIFICATION_VERSION>0x20000
+#include "token.h"
+#define _HII_H_
+#define _FORM_CALLBACK_H_
+#define _GLOBAL_VARIABLE_GUID_H_
+#ifndef GUID_VARIABLE_DECLARATION
+#define GUID_VARIABLE_DECLARATION(Variable, Guid) extern EFI_GUID Variable
+#endif
+#include "AmtWrapperDxe.h"
+#else
+#include "AmtWrapperDxe.h"
+#include "token.h"
+#define __UEFI_HII__H__
+#define __HII_PROTOCOL_H__
+#define _HII_H_
+#endif
+#if defined(Terminal_SUPPORT) && (Terminal_SUPPORT == 1)
+#include "Core\Em\Terminal\TerminalSetupVar.h"
+#endif
+#include <SetupDataDefinition.h>
+#if defined(CORE_COMBINED_VERSION) && CORE_COMBINED_VERSION >=0x4028e
+#include <Protocol\Security2.h>
+#else
+#include <Protocol\Security.h>
+#endif
+
+#include <Amt.h>
+#include EFI_GUID_DEFINITION(ConsoleOutDevice)
+
+#define SETUP_GUID { 0xEC87D643, 0xEBA4, 0x4BB5, 0xA1, 0xE5, 0x3F, 0x3E, 0x36, 0xB2, 0x0D, 0xA9 }
+
+AMT_WRAPPER_PROTOCOL AmtWrapperInstance = {
+ AmtWrapperInit,
+ AmtWrapperGet,
+ AmtWrapperSet,
+ AmtWrapperEnableSol,
+ AmtWrapperEnableIdeR,
+ AmtWrapperPauseBoot,
+ AmtWrapperEnterSetup,
+ //AsfSupportInit,
+ AmtWrapperBdsBootViaAsf,
+ BdsLibUpdateConsoleVariable,
+ ActiveManagementConsoleLocked,
+ AmtWrapperEnableKvm,
+ AmtWrapperInitializationKvm
+ };
+
+extern EFI_ACTIVE_MANAGEMENT_PROTOCOL *mActiveManagement;
+extern EFI_ASF_BOOT_OPTIONS *mAsfBootOptions;
+#if defined(LEGACYSREDIR_SUPPORT) && (LEGACYSREDIR_SUPPORT == 1)
+EFI_GUID gEfiLegacySredirProtocolGuid = EFI_LEGACY_SREDIR_PROTOCOL_GUID;
+#endif
+EFI_GUID gSetupGuid = SETUP_GUID;
+EFI_GUID gEfiAmtWrapperProtocolGuid = EFI_AMT_WRAPPER_PROTOCOL_GUID;
+EFI_GUID gEfiMeBiosExtensionSetupGuid = EFI_ME_BIOS_EXTENSION_SETUP_GUID;
+CHAR16 gEfiMeBiosExtensionSetupName[] = EFI_ME_BIOS_EXTENSION_SETUP_VARIABLE_NAME;
+
+PLATFORM_PCI_SERIAL_OVER_LAN_DEVICE_PATH gSerialOverLanDevicePath = {
+ gPciRootBridge,
+ {
+ HARDWARE_DEVICE_PATH,
+ HW_PCI_DP,
+ (UINT8)(sizeof(PCI_DEVICE_PATH)),
+ (UINT8)((sizeof(PCI_DEVICE_PATH)) >> 8),
+ SOL_FUNCTION_NUMBER,
+ ME_DEVICE_NUMBER
+ },
+ {
+ MESSAGING_DEVICE_PATH,
+ MSG_UART_DP,
+ (UINT8)(sizeof(UART_DEVICE_PATH)),
+ (UINT8)((sizeof(UART_DEVICE_PATH)) >> 8),
+ 0,
+ 115200,
+ 8,
+ 1,
+ 1
+ },
+ {
+ MESSAGING_DEVICE_PATH,
+ MSG_VENDOR_DP,
+ (UINT8)(sizeof(VENDOR_DEVICE_PATH)),
+ (UINT8)((sizeof(VENDOR_DEVICE_PATH)) >> 8),
+ DEVICE_PATH_MESSAGING_PC_ANSI
+ },
+ gEndEntire
+ };
+
+
+EFI_HANDLE mBdsImageHandle;
+UINT16 gPlatformBootTimeOutDefault = 1;
+
+
+//
+// Driver entry point
+//
+EFI_DRIVER_ENTRY_POINT (AmtWrapperDxeEntryPoint);
+
+//
+// Function implementations
+//
+#if defined(CORE_COMBINED_VERSION) && CORE_COMBINED_VERSION >=0x4028e
+EFI_STATUS EmptyFileAuthentication
+(
+ IN CONST EFI_SECURITY2_ARCH_PROTOCOL *This,
+ IN CONST EFI_DEVICE_PATH_PROTOCOL *File,
+ IN VOID *FileBuffer,
+ IN UINTN FileSize,
+ IN BOOLEAN BootPolicy
+)
+#else
+EFI_STATUS EmptyFileAuthentication
+(
+ IN EFI_SECURITY_ARCH_PROTOCOL *This,
+ IN UINT32 AuthenticationStatus,
+ IN EFI_DEVICE_PATH_PROTOCOL *File
+)
+#endif
+{
+ if (File==NULL) return EFI_INVALID_PARAMETER;
+ return EFI_SUCCESS;
+}
+
+VOID
+EFIAPI
+InstallEDKConOutStartProtocol (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+{
+
+ gBS->InstallProtocolInterface(
+ &mBdsImageHandle, &gEfiConsoleOutDeviceGuid, EFI_NATIVE_INTERFACE, NULL);
+
+ gBS->CloseEvent (Event);
+}
+
+EFI_STATUS
+EFIAPI
+AmtWrapperDxeEntryPoint (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+)
+/*++
+
+Routine Description:
+
+ Entry point for the Active Management Driver.
+
+Arguments:
+
+ ImageHandle Image handle of this driver.
+ SystemTable Global system service table.
+
+Returns:
+
+ EFI_SUCCESS Initialization complete.
+ EFI_UNSUPPORTED The chipset is unsupported by this driver.
+ EFI_OUT_OF_RESOURCES Do not have enough resources to initialize the driver.
+ EFI_DEVICE_ERROR Device error, driver exits abnormally.
+
+--*/
+{
+ EFI_STATUS Status;
+ EFI_EVENT ReadyToBootEvent;
+ EFI_GUID gSetupGuid = SETUP_GUID;
+ UINTN VariableSize = sizeof(SETUP_DATA);
+ SETUP_DATA SetupDataBuffer;
+ SETUP_DATA *SetupData = &SetupDataBuffer;
+ VOID *AfterConsolOutNotifyReg;
+ EFI_EVENT AfterConsolOutInstalledEvent;
+ EFI_GUID AmiConOutStartProtocolGuid = AMI_CONSOLE_OUT_DEVICES_STARTED_PROTOCOL_GUID;
+
+ mBdsImageHandle = ImageHandle;
+ //
+ // Initialize the EFI Driver Library
+ //
+ EfiInitializeDriverLib (ImageHandle, SystemTable);
+ INITIALIZE_SCRIPT (ImageHandle, SystemTable);
+
+ mAsfBootOptions = NULL;
+ mActiveManagement = NULL;
+
+ InitAmtWrapperLib();
+ //
+ // Install the EFI_ACTIVE_MANAGEMENT_PROTOCOL interface
+ //
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &ImageHandle,
+ &gEfiAmtWrapperProtocolGuid, &AmtWrapperInstance,
+ NULL
+ );
+
+ // This event is for KVM function, because ConOut Start GUID is different from AMI to ME RC.
+ Status = gBS->CreateEvent (
+ EFI_EVENT_NOTIFY_SIGNAL,
+ EFI_TPL_NOTIFY,
+ InstallEDKConOutStartProtocol,
+ NULL,
+ &AfterConsolOutInstalledEvent
+ );
+
+ Status = gBS->RegisterProtocolNotify (
+ &AmiConOutStartProtocolGuid,
+ AfterConsolOutInstalledEvent,
+ &AfterConsolOutNotifyReg
+ );
+
+#if defined(Terminal_SUPPORT) && (Terminal_SUPPORT == 1)
+ // Enable/Disable Sol redirection
+ SetSOLCOMEnable(AmtWrapperEnableSol());
+#endif
+ //
+ // Register Ready to Boot Event for AMT Wrapper
+ //
+#if defined(EFI_EVENT_SIGNAL_READY_TO_BOOT) && EFI_SPECIFICATION_VERSION<0x20000
+ Status = gBS->CreateEvent(
+ EFI_EVENT_SIGNAL_READY_TO_BOOT | EFI_EVENT_NOTIFY_SIGNAL_ALL,
+ EFI_TPL_CALLBACK,
+ AmtWrapperReadyToBoot,
+ (VOID *)&ImageHandle,
+ &ReadyToBootEvent
+ );
+#else
+ Status = EfiCreateEventReadyToBoot(
+ EFI_TPL_CALLBACK,
+ AmtWrapperReadyToBoot,
+ (VOID *)&ImageHandle,
+ &ReadyToBootEvent
+ );
+#endif
+
+ return Status;
+}
+
+#if defined(Terminal_SUPPORT) && (Terminal_SUPPORT == 1)
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: SetSOLCOMEnable
+//
+// Description: Enable/Disable SOL COM.
+//
+// Input:
+//
+// Output:
+//
+// Notes:
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID
+SetSOLCOMEnable(
+ IN BOOLEAN Enabled
+)
+{
+ UINT32 ComPort;
+ UINT32 SetupVarAttr;
+ UINTN SetupDataSize;
+ SETUP_DATA gSetupData;
+ EFI_STATUS Status;
+#if (TOTAL_PCI_SERIAL_PORTS > 0)
+ UINT32 i = 0;
+ EFI_GUID gTerminalVarGuid = TERMINAL_VAR_GUID;
+ UINTN PciSerialPortsLocationVarSize =
+ sizeof(PCI_SERIAL_PORTS_LOCATION_VAR);
+ UINT32 PciSerialPortsLocationVarAttributes=0;
+ PCI_SERIAL_PORTS_LOCATION_VAR PciSerialPortsLocationVar;
+ UINT32 gTotalSioSerialPorts = TOTAL_SIO_SERIAL_PORTS;
+ Status = gRT->GetVariable(L"PciSerialPortsLocationVar",
+ &gTerminalVarGuid,
+ &PciSerialPortsLocationVarAttributes,
+ &PciSerialPortsLocationVarSize,
+ &PciSerialPortsLocationVar);
+
+ if(EFI_ERROR(Status)) {
+ ComPort = gTotalSioSerialPorts;
+ }
+
+ ComPort = gTotalSioSerialPorts;
+
+ for (i = 0; i < TOTAL_PCI_SERIAL_PORTS; i++) {
+ if ((PciSerialPortsLocationVar.Device[i] == SOL_DEVICE_NUMBER) &&
+ (PciSerialPortsLocationVar.Function[i] == SOL_FUNCTION_NUMBER)) {
+ ComPort = gTotalSioSerialPorts+i;
+ break;
+ }
+ }
+#else
+ return;
+#endif
+
+ SetupVarAttr = 0;
+ SetupDataSize = sizeof(SETUP_DATA);
+ Status = gRT->GetVariable( \
+ L"Setup", \
+ &gSetupGuid, \
+ &SetupVarAttr, \
+ &SetupDataSize, \
+ &gSetupData );
+
+ if(Enabled)
+ gSetupData.ConsoleRedirectionEnable[ComPort] = 1;
+ else
+ gSetupData.ConsoleRedirectionEnable[ComPort] = 0;
+
+ Status = gRT->SetVariable( \
+ L"Setup", \
+ &gSetupGuid, \
+ SetupVarAttr, \
+ SetupDataSize, \
+ &gSetupData );
+}
+#endif
+
+EFI_STATUS
+BdsRefreshBbsTableForBoot (
+ IN BDS_COMMON_OPTION *Entry
+)
+{
+ return EFI_NOT_FOUND;
+}
+
+VOID
+PrintBbsTable (
+ IN BBS_TABLE *LocalBbsTable
+)
+{
+ UINT16 Idx;
+
+ DEBUG ((EFI_D_ERROR, "\n"));
+ DEBUG ((EFI_D_ERROR, " NO Prio bb/dd/ff cl/sc Type Stat segm:offs\n"));
+ DEBUG ((EFI_D_ERROR, "=============================================\n"));
+ for (Idx = 0; Idx < MAX_BBS_ENTRIES; Idx++)
+ {
+ if (LocalBbsTable[Idx].BootPriority == BBS_IGNORE_ENTRY)
+ {
+ continue;
+ }
+
+ DEBUG (
+ (EFI_D_ERROR,
+ " %02x: %04x %02x/%02x/%02x %02x/02%x %04x %04x %04x:%04x\n",
+ (UINTN) Idx,
+ (UINTN) LocalBbsTable[Idx].BootPriority,
+ (UINTN) LocalBbsTable[Idx].Bus,
+ (UINTN) LocalBbsTable[Idx].Device,
+ (UINTN) LocalBbsTable[Idx].Function,
+ (UINTN) LocalBbsTable[Idx].Class,
+ (UINTN) LocalBbsTable[Idx].SubClass,
+ (UINTN) LocalBbsTable[Idx].DeviceType,
+ (UINTN) * (UINT16 *) &LocalBbsTable[Idx].StatusFlags,
+ (UINTN) LocalBbsTable[Idx].BootHandlerSegment,
+ (UINTN) LocalBbsTable[Idx].BootHandlerOffset,
+ (UINTN) ((LocalBbsTable[Idx].MfgStringSegment << 4) + LocalBbsTable[Idx].MfgStringOffset),
+ (UINTN) ((LocalBbsTable[Idx].DescStringSegment << 4) + LocalBbsTable[Idx].DescStringOffset))
+ );
+ }
+
+ DEBUG ((EFI_D_ERROR, "\n"));
+}
+
+BOOLEAN
+AmtWrapperGet(
+ IN UINTN Index,
+ IN OUT VOID *pVar
+)
+{
+ BOOLEAN st = FALSE;
+
+ InitAmtWrapperLib();
+
+ if (Index == GET_SOL_DP) {
+ *((PLATFORM_PCI_SERIAL_OVER_LAN_DEVICE_PATH **)pVar) = &gSerialOverLanDevicePath;
+ st = TRUE;
+ } else if (Index == GET_TIME_OUT) {
+ *((UINT16 *)pVar) = BdsLibGetTimeout();
+ st = TRUE;
+ } else if (Index == GET_BOOT_OPTION) {
+ *((UINT16 *)pVar) = mAsfBootOptions->BootOptions;
+ st = TRUE;
+ } else if (Index == GET_IS_SOL) {
+ *((UINTN *)pVar) = IsSOL(*((EFI_HANDLE *)pVar));
+ st = TRUE;
+ } else if (Index == GET_IS_IDER) {
+ *((UINTN *)pVar) = IsIDER(*((EFI_HANDLE *)pVar));
+ st = TRUE;
+ }
+
+ return st;
+}
+
+UINTN IsSOL(
+ IN EFI_HANDLE Controller
+)
+{
+ EFI_STATUS Status;
+ EFI_PCI_IO_PROTOCOL *PciIo;
+ UINTN Segment=0;
+ UINTN Bus=0;
+ UINTN Device=0;
+ UINTN Function=0;
+ UINTN flag = FALSE;
+
+ Status = gBS->HandleProtocol(Controller,
+ &gEfiPciIoProtocolGuid,
+ &PciIo);
+ if (!EFI_ERROR(Status)) {
+ Status = PciIo->GetLocation(PciIo,
+ &Segment,
+ &Bus,
+ &Device,
+ &Function);
+ if (!EFI_ERROR(Status)) {
+ if (Device == SOL_DEVICE_NUMBER && Function == SOL_FUNCTION_NUMBER) {
+ flag = TRUE;
+ }
+ }
+ }
+
+ return flag;
+}
+
+UINTN IsIDER(
+ IN EFI_HANDLE Controller
+)
+{
+ EFI_STATUS Status;
+ EFI_PCI_IO_PROTOCOL *PciIo;
+ UINTN Segment=0;
+ UINTN Bus=0;
+ UINTN Device=0;
+ UINTN Function=0;
+ UINTN flag = FALSE;
+
+ Status = gBS->HandleProtocol(Controller,
+ &gEfiPciIoProtocolGuid,
+ &PciIo);
+ if (!EFI_ERROR(Status)) {
+ Status = PciIo->GetLocation(PciIo,
+ &Segment,
+ &Bus,
+ &Device,
+ &Function);
+ if (!EFI_ERROR(Status)) {
+ if (Device == IDER_DEVICE_NUMBER && Function == IDER_FUNCTION_NUMBER) {
+ flag = TRUE;
+ }
+ }
+ }
+
+ return flag;
+}
+
+UINT16 ConvertSetupDataToUART(
+ UINT8 Parity,
+ UINT8 DataBits,
+ UINT8 StopBits
+)
+{
+ UINT16 DataParityStopBit = 0;
+
+ switch (Parity) {
+ case NoParity:
+ DataParityStopBit &= ~(PAREN | EVENPAR | STICPAR);
+ break;
+ case EvenParity:
+ DataParityStopBit |= (PAREN | EVENPAR);
+ DataParityStopBit &= ~STICPAR;
+ break;
+ case OddParity:
+ DataParityStopBit |= PAREN;
+ DataParityStopBit &= ~(EVENPAR | STICPAR);
+ break;
+ case SpaceParity:
+ DataParityStopBit |= (PAREN | EVENPAR | STICPAR);
+ break;
+ case MarkParity:
+ DataParityStopBit |= (PAREN | STICPAR);
+ DataParityStopBit &= ~EVENPAR;
+ break;
+ }
+
+ // Set stop bits.
+ switch (StopBits) {
+ case OneStopBit :
+ DataParityStopBit &= ~STOPB;
+ break;
+ case OneFiveStopBits :
+ case TwoStopBits :
+ DataParityStopBit |= STOPB;
+ break;
+ }
+
+ // Set data bits.
+ DataParityStopBit &= ~SERIALDB;
+ DataParityStopBit |= (UINT8)((DataBits - 5) & 0x03);
+
+ return DataParityStopBit;
+}
+
+BOOLEAN
+AmtWrapperSet(
+ IN UINTN Index,
+ IN OUT VOID *pVar
+)
+{
+#if defined(LEGACYSREDIR_SUPPORT) && (LEGACYSREDIR_SUPPORT == 1)
+ EFI_LEGACY_SREDIR_PROTOCOL *pLegacySredir;
+ UINT64 PciAddress;
+ UINT32 SerialAddress;
+ UINT8 SerialIRQ;
+ EFI_STATUS Status;
+ EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;
+ BOOLEAN st = FALSE;
+
+ InitAmtWrapperLib();
+
+ if (Index == SET_BIOS_WDT_START) {
+ AsfStartWatchDog(ASF_START_BIOS_WDT);
+ st = TRUE;
+ }
+ else if (Index == SET_OS_WDT_START) {
+ AsfStartWatchDog(ASF_START_OS_WDT);
+ st = TRUE;
+ }
+ else if (Index == SET_WDT_STOP) {
+ AsfStopWatchDog();
+ st = TRUE;
+ }
+ else if (Index == SET_OS_SOL) {
+ Status = gBS->LocateProtocol(&gEfiLegacySredirProtocolGuid, NULL, &pLegacySredir);
+ ASSERT_EFI_ERROR(Status);
+
+ Status = gBS->LocateProtocol(&gEfiPciRootBridgeIoProtocolGuid, NULL, &PciRootBridgeIo);
+ ASSERT_EFI_ERROR(Status);
+
+ PciAddress = EFI_PCI_ADDRESS (SOL_BUS_NUMBER, SOL_DEVICE_NUMBER, SOL_FUNCTION_NUMBER, 0x10);
+ PciRootBridgeIo->Pci.Read (
+ PciRootBridgeIo,
+ EfiPciWidthUint32,
+ PciAddress,
+ 1,
+ &SerialAddress
+ );
+ SerialAddress &= ~1; // mask IO/MEM bit
+
+ PciAddress = EFI_PCI_ADDRESS (SOL_BUS_NUMBER, SOL_DEVICE_NUMBER, SOL_FUNCTION_NUMBER, 0x3C);
+ PciRootBridgeIo->Pci.Read (
+ PciRootBridgeIo,
+ EfiPciWidthUint8,
+ PciAddress,
+ 1,
+ &SerialIRQ
+ );
+/*
+ UID = TOTAL_SIO_SERIAL_PORTS;
+ gEfiComParameters.BaseAddress = (UINT16)SerialAddress;
+ gEfiComParameters.SerialIRQ = (UINT8)SerialIRQ;
+
+ VariableSize = sizeof(SETUP_DATA);
+ Status = gRT->GetVariable(
+ L"Setup",
+ &gSetupGuid,
+ NULL,
+ &VariableSize,
+ &SetupData);
+ ASSERT(!EFI_ERROR(Status));
+
+ gEfiComParameters.Baudrate = BaudRates[SetupData.BaudRate[UID]];
+ gEfiComParameters.TerminalType = TerminalTypes[SetupData.TerminalType[UID]];
+ gEfiComParameters.FlowControl = SetupData.FlowControl[UID];
+
+ gEfiComParameters.DataParityStop = ConvertSetupDataToUART(
+ SetupData.Parity[UID],
+ SetupData.DataBits[UID],
+ SetupData.StopBits[UID]);
+
+ if (SREDIR_DISPLAY_MODE == DISPLAY_BY_80x24)
+ gEfiComParameters.LegacyOsResolution = 0;
+ else if (SREDIR_DISPLAY_MODE == DISPLAY_BY_80x25)
+ gEfiComParameters.LegacyOsResolution = 1;
+ else
+ gEfiComParameters.LegacyOsResolution = SetupData.LegacyOsResolution[UID];
+*/
+ Status = pLegacySredir->EnableLegacySredir(pLegacySredir);
+
+ ASSERT_EFI_ERROR (Status);
+ st = TRUE;
+ }
+
+ return st;
+#else
+ return FALSE;
+#endif
+}
+
+EFI_STATUS
+AmtWrapperInit(
+ IN EFI_HANDLE ImageHandle,
+ IN OUT EFI_SYSTEM_TABLE *SystemTable
+)
+{
+ mBdsImageHandle = ImageHandle;
+ InitAmtWrapperLib();
+
+ return EFI_SUCCESS;
+}
+
+
+VOID
+InitAmtWrapperLib(VOID)
+{
+ if (mActiveManagement == NULL)
+ AmtLibInit();
+
+ if (mAsfBootOptions == NULL) {
+ BdsAsfInitialization();
+ }
+}
+
+BOOLEAN
+AmtWrapperEnableSol(
+ IN VOID
+)
+{
+ BOOLEAN st;
+
+ InitAmtWrapperLib();
+ st = ActiveManagementEnableSol();
+ if(((mAsfBootOptions->OemParameters) & 0x01) && (mAsfBootOptions != NULL))
+ st = TRUE;
+ else
+ st = FALSE;
+ return st;
+}
+
+BOOLEAN
+AmtWrapperEnableIdeR(
+ IN VOID
+)
+{
+ BOOLEAN st;
+ EFI_STATUS Status;
+#if defined(CORE_COMBINED_VERSION) && CORE_COMBINED_VERSION >=0x4028e
+ EFI_SECURITY2_ARCH_PROTOCOL *mSecurity;
+#else
+ EFI_SECURITY_ARCH_PROTOCOL *mSecurity;
+#endif
+
+ InitAmtWrapperLib();
+ st = ActiveManagementEnableIdeR();
+ if(!st)
+ return st;
+ // IDER enabled and Enforce Secure Boot enabled
+ if((mAsfBootOptions->SpecialCommandParam & ENFORCE_SECURE_BOOT)
+ != ENFORCE_SECURE_BOOT)
+ {
+#if defined(CORE_COMBINED_VERSION) && CORE_COMBINED_VERSION >=0x4028e
+ EFI_GUID gEfiSecurity2ArchProtocolGuid = EFI_SECURITY2_ARCH_PROTOCOL_GUID;
+ Status = gBS->LocateProtocol(&gEfiSecurity2ArchProtocolGuid,
+
+#else
+ Status = gBS->LocateProtocol(&gEfiSecurityArchProtocolGuid,
+#endif
+ NULL, &mSecurity);
+
+ if(EFI_ERROR(Status))
+ return st;
+ // Set a empty File Authentication to skip Secure check.
+ // This will not been restore, because IDER boot fail system HALT
+
+#if defined(CORE_COMBINED_VERSION) && CORE_COMBINED_VERSION >=0x4028e
+ mSecurity->FileAuthentication = EmptyFileAuthentication;
+#else
+ mSecurity->FileAuthenticationState = EmptyFileAuthentication;
+#endif
+ }
+
+ return st;
+}
+
+BOOLEAN
+AmtWrapperPauseBoot(
+ IN VOID
+)
+{
+ BOOLEAN st;
+
+ InitAmtWrapperLib();
+ st = ActiveManagementPauseBoot();
+
+ return st;
+}
+
+BOOLEAN
+AmtWrapperEnterSetup(
+ IN VOID
+)
+{
+ BOOLEAN st;
+
+ InitAmtWrapperLib();
+ st = ActiveManagementEnterSetup();
+
+ return st;
+}
+
+EFI_STATUS
+AmtWrapperBdsBootViaAsf(
+ IN VOID
+)
+{
+ EFI_STATUS Status = EFI_NOT_FOUND;
+
+ InitAmtWrapperLib();
+
+ if (mActiveManagement != NULL && mAsfBootOptions != NULL) {
+ Status = BdsBootViaAsf();
+ }
+
+ return Status;
+}
+
+
+
+EFI_STATUS
+AmtWrapperReadyToBoot(
+ EFI_EVENT Event,
+ VOID *ParentImageHandle
+)
+{
+ EFI_STATUS Status = EFI_SUCCESS;
+
+
+ return Status;
+}
+
+BOOLEAN
+AmtWrapperEnableKvm(
+ IN VOID
+)
+{
+ BOOLEAN Status;
+
+ Status = ActiveManagementEnableKvm();
+
+ return Status;
+}
+
+BOOLEAN
+AmtWrapperInitializationKvm(
+ IN VOID
+)
+{
+ BOOLEAN Status;
+
+ Status = BdsKvmInitialization();
+
+ return Status;
+}
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/AmtWrapper/Dxe/AmtWrapperDxe.cif b/Board/EM/MeWrapper/AmtWrapper/Dxe/AmtWrapperDxe.cif
new file mode 100644
index 0000000..91f7c3b
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/Dxe/AmtWrapperDxe.cif
@@ -0,0 +1,25 @@
+<component>
+ name = "AmtWrapperDxe"
+ category = ModulePart
+ LocalRoot = "Board\EM\MeWrapper\AmtWrapper\Dxe"
+ RefName = "AmtWrapperDxe"
+[files]
+"AmtWrapperDxe.sdl"
+"AmtWrapperDxe.c"
+"AmtWrapperDxe.h"
+"AmtWrapperDxe.mak"
+"AmtWrapperDxe.dxs"
+"AsfSupport.c"
+"AsfSupport.h"
+"DevicePath.c"
+"Performance.c"
+"Performance.h"
+"BdsBoot.c"
+"BdsConnect.c"
+"BdsConsole.c"
+"BdsLib.h"
+"BdsMisc.c"
+"BmMachine.h"
+"KvmSupport.c"
+"KvmSupport.h"
+<endComponent>
diff --git a/Board/EM/MeWrapper/AmtWrapper/Dxe/AmtWrapperDxe.dxs b/Board/EM/MeWrapper/AmtWrapper/Dxe/AmtWrapperDxe.dxs
new file mode 100644
index 0000000..4e8ab21
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/Dxe/AmtWrapperDxe.dxs
@@ -0,0 +1,75 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/AmtWrapper/AmtWrapperDxe/AmtWrapperDxe.dxs 1 2/08/12 1:08a Klzhan $
+//
+// $Revision: 1 $
+//
+// $Date: 2/08/12 1:08a $
+//
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/AmtWrapper/AmtWrapperDxe/AmtWrapperDxe.dxs $
+//
+// 1 2/08/12 1:08a Klzhan
+// Initial Check in
+//
+// 1 2/25/11 1:43a Klzhan
+// Initial Check-in
+//
+// 1 12/03/10 5:10a Klzhan
+// Initial Check-in.
+//
+//
+//**********************************************************************
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: AmtWrapperDxe.dxs
+//
+// Description: Dependency file for AMTWrapperDxe module.
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+
+#include "EfiDepex.h"
+
+#include EFI_PROTOCOL_DEFINITION (BootScriptSave)
+#include EFI_PROTOCOL_DEPENDENCY (PciRootBridgeIo)
+#include EFI_PROTOCOL_DEFINITION (AlertStandardFormat)
+#include EFI_PROTOCOL_DEFINITION (ActiveManagement)
+
+DEPENDENCY_START
+ EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_GUID AND
+ EFI_ACTIVE_MANAGEMENT_PROTOCOL_GUID AND
+ EFI_ALERT_STANDARD_FORMAT_PROTOCOL_GUID AND
+ EFI_BOOT_SCRIPT_SAVE_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/AmtWrapper/Dxe/AmtWrapperDxe.h b/Board/EM/MeWrapper/AmtWrapper/Dxe/AmtWrapperDxe.h
new file mode 100644
index 0000000..2bc4540
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/Dxe/AmtWrapperDxe.h
@@ -0,0 +1,268 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/AmtWrapper/AmtWrapperDxe/AmtWrapperDxe.h 3 4/18/13 1:55a Klzhan $
+//
+// $Revision: 3 $
+//
+// $Date: 4/18/13 1:55a $
+//
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/AmtWrapper/AmtWrapperDxe/AmtWrapperDxe.h $
+//
+// 3 4/18/13 1:55a Klzhan
+// [TAG] EIP119190
+// [Category] Bug Fix
+// [Severity] Important
+// [Symptom] BIOS doesn't wait for KVM pass code input.
+// [RootCause] The Con Out Start protocol GUID is different in AMI and
+// ME RC.
+// [Solution] Install ME RC ConOut Protocol when AMI ConOut Protocol
+// installed.
+// [Files] AmtWrapperDxe.c
+// AmtWrapperDxe.h
+//
+// 2 4/24/12 12:36a Klzhan
+// Update modulepart to latest
+//
+// 1 2/08/12 1:08a Klzhan
+// Initial Check in
+//
+// 1 2/25/11 1:43a Klzhan
+// Initial Check-in
+//
+// 2 12/28/10 2:00a Klzhan
+// Improvement : Enable/Disable Terminal item for SOL redirection.
+//
+// 1 12/03/10 5:10a Klzhan
+// Initial Check-in.
+//
+//
+//**********************************************************************
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: AmtWrapperDxe.h
+//
+// Description: Header file for Amt Wrapper Dxe module
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+#ifndef _AMT_WRAPPER_DXE_H_
+#define _AMT_WRAPPER_DXE_H_
+
+#include "Efi.h"
+#include "EfiDriverLib.h"
+#include "EfiCommonLib.h"
+#include "BdsLib.h"
+#include "EfiScriptLib.h"
+#if defined(LEGACYSREDIR_SUPPORT) && (LEGACYSREDIR_SUPPORT == 1)
+#include "Protocol\LegacySredir.h"
+#endif
+#include "AmtLib.h"
+#include "MeAccess.h"
+
+#include EFI_PROTOCOL_CONSUMER (AmtPlatformPolicy)
+#include EFI_PROTOCOL_CONSUMER (AmtWrapper)
+#include EFI_PROTOCOL_CONSUMER (BootScriptSave)
+#include EFI_PROTOCOL_CONSUMER (PciRootBridgeIo)
+#include EFI_PROTOCOL_CONSUMER (ActiveManagement)
+#include EFI_PROTOCOL_CONSUMER (PciIo)
+#include EFI_PROTOCOL_CONSUMER (SerialIo)
+
+#include EFI_GUID_DEFINITION (MeBiosExtensionSetup)
+
+#define R_PCI_SVID 0x2C
+
+#define DISPLAY_SCREEN 0x01 // for LegacySredr CSM16
+#define SUPPORT8025 0x02 // for LegacySredr CSM16
+
+// define for SREDIR_DISPLAY_MODE
+#define DISPLAY_BY_SETUP 0x00
+#define DISPLAY_BY_80x24 0x01
+#define DISPLAY_BY_80x25 0x02
+
+#define STOPB 0x4 // Bit2: Number of Stop Bits
+#define PAREN 0x8 // Bit3: Parity Enable
+#define EVENPAR 0x10 // Bit4: Even Parity Select
+#define STICPAR 0x20 // Bit5: Sticky Parity
+#define SERIALDB 0x3 // Bit0-1: Number of Serial
+ //
+
+#define EFI_WIN_NT_THUNK_PROTOCOL_GUID \
+ { 0x58c518b1, 0x76f3, 0x11d4, 0xbc, 0xea, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 }
+
+#define EFI_WIN_NT_BUS_DRIVER_IO_PROTOCOL_GUID \
+ { 0x96eb4ad6, 0xa32a, 0x11d4, 0xbc, 0xfd, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 }
+
+#define EFI_WIN_NT_SERIAL_PORT_GUID \
+ { 0xc95a93d, 0xa006, 0x11d4, 0xbc, 0xfa, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 }
+
+#define AMI_CONSOLE_OUT_DEVICES_STARTED_PROTOCOL_GUID \
+ { 0xef9a3971, 0xc1a0, 0x4a93, 0xbd, 0x40, 0x5a, 0xa1, 0x65, 0xf2, 0xdc, 0x3a }
+
+typedef struct {
+ ACPI_HID_DEVICE_PATH PciRootBridge;
+ PCI_DEVICE_PATH SerialOverLAN;
+ UART_DEVICE_PATH Uart;
+ VENDOR_DEVICE_PATH TerminalType;
+ EFI_DEVICE_PATH_PROTOCOL End;
+} PLATFORM_PCI_SERIAL_OVER_LAN_DEVICE_PATH;
+
+#define gPciRootBridge \
+ { \
+ ACPI_DEVICE_PATH, \
+ ACPI_DP, \
+ (UINT8) (sizeof (ACPI_HID_DEVICE_PATH)), \
+ (UINT8) ((sizeof (ACPI_HID_DEVICE_PATH)) >> 8), \
+ EISA_PNP_ID (0x0A03), 0 \
+ }
+
+#define gEndEntire \
+ { \
+ END_DEVICE_PATH_TYPE,\
+ END_ENTIRE_DEVICE_PATH_SUBTYPE,\
+ END_DEVICE_PATH_LENGTH,\
+ 0\
+ }
+
+VOID
+SetSOLCOMEnable(
+ IN BOOLEAN Enabled
+);
+
+EFI_STATUS
+AmtWrapperInit(
+ IN EFI_HANDLE ImageHandle,
+ IN OUT EFI_SYSTEM_TABLE *SystemTable
+);
+
+BOOLEAN
+AmtWrapperGet(
+ UINTN Index,
+ VOID *pVar
+);
+
+BOOLEAN
+AmtWrapperSet(
+ UINTN Index,
+ VOID *pVar
+);
+
+BOOLEAN
+ActiveManagementPauseBoot (
+ IN VOID
+);
+
+BOOLEAN
+ActiveManagementEnterSetup (
+ IN VOID
+);
+
+BOOLEAN
+ActiveManagementEnableSol (
+ IN VOID
+);
+
+BOOLEAN
+ActiveManagementEnableIdeR (
+ IN VOID
+);
+
+EFI_STATUS
+BdsAsfInitialization (
+ IN VOID
+);
+
+EFI_STATUS
+BdsBootViaAsf (
+ IN VOID
+);
+
+VOID
+InitAmtWrapperLib(
+ IN VOID
+);
+
+BOOLEAN
+AmtWrapperEnableKvm(
+ IN VOID
+);
+
+BOOLEAN
+AmtWrapperInitializationKvm(
+ IN VOID
+);
+
+BOOLEAN
+AmtWrapperEnableSol(
+ IN VOID
+);
+
+BOOLEAN
+AmtWrapperEnableIdeR(
+ IN VOID
+);
+
+BOOLEAN
+AmtWrapperPauseBoot(
+ IN VOID
+);
+
+BOOLEAN
+AmtWrapperEnterSetup(
+ IN VOID
+);
+
+EFI_STATUS
+AmtWrapperBdsBootViaAsf(
+ IN VOID
+);
+
+EFI_STATUS
+AmtWrapperReadyToBoot(
+ EFI_EVENT Event,
+ VOID *ParentImageHandle
+);
+
+BOOLEAN
+BdsKvmInitialization (
+ IN VOID
+);
+
+UINTN IsSOL(
+ IN EFI_HANDLE Controller
+);
+
+UINTN IsIDER(
+ IN EFI_HANDLE Controller
+);
+#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/AmtWrapper/Dxe/AmtWrapperDxe.mak b/Board/EM/MeWrapper/AmtWrapper/Dxe/AmtWrapperDxe.mak
new file mode 100644
index 0000000..21f25ce
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/Dxe/AmtWrapperDxe.mak
@@ -0,0 +1,117 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/AmtWrapper/AmtWrapperDxe/AmtWrapperDxe.mak 2 2/23/12 8:58a Klzhan $
+#
+# $Revision: 2 $
+#
+# $Date: 2/23/12 8:58a $
+#
+#**********************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/AmtWrapper/AmtWrapperDxe/AmtWrapperDxe.mak $
+#
+# 2 2/23/12 8:58a Klzhan
+# Support New EDK
+#
+# 1 2/08/12 1:08a Klzhan
+# Initial Check in
+#
+# 2 9/15/11 2:12a Klzhan
+# Remove AMI Lib.
+#
+# 1 2/25/11 1:43a Klzhan
+# Initial Check-in
+#
+# 1 12/03/10 5:10a Klzhan
+# Initial Check-in.
+#
+#
+#**********************************************************************
+#
+#<AMI_FHDR_START>
+#----------------------------------------------------------------------------
+#
+# Name: AmtWrapperDxe.mak
+#
+# Description: Makfile for Amt Wrapper Dxe module
+#
+#----------------------------------------------------------------------------
+#<AMI_FHDR_END>
+EDK : AmtWrapperDxe
+
+AmtWrapperDxe : $(BUILD_DIR)\AmtWrapperDxe.mak AmtWrapperDxeBin
+
+$(BUILD_DIR)\AmtWrapperDxe.mak : $(AmtWrapperDxe_DIR)\$(@B).cif $(AmtWrapperDxe_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(AmtWrapperDxe_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+AmtWrapperDxe_INCLUDES=\
+ $(EDK_INCLUDES)\
+ $(MISCFRAMEWORK_INCLUDES)\
+ $(ME_INCLUDES)\
+ $(INTEL_MCH_INCLUDES)\
+ $(INTEL_PCH_INCLUDES)\
+ $(IndustryStandard_INCLUDES)\
+ $(EdkIIGlueLib_INCLUDES)\
+ /IInclude\
+ $(NB_INCLUDES)
+
+
+AmtWrapperDxe_LIBS=\
+ $(EFISCRIPTLIB)\
+ $(EFIDRIVERLIB)\
+ $(EFICOMMONLIB)\
+ $(PRINTLIB)\
+ $(EDKFRAMEWORKPROTOCOLLIB)\
+ $(EFIGUIDLIB)\
+ $(AmtProtocolLib_LIB)\
+ $(AmtLibDxe_LIB)\
+ $(MeLibDxe_LIB)\
+ $(AmtGuidLib_LIB)\
+ $(EdkIIGlueDxeReportStatusCodeLib_LIB)\
+ $(EdkIIGlueDxeDebugLibReportStatusCode_LIB)\
+ $(EdkIIGlueBaseLib_LIB)\
+!IF "$(x64_BUILD)"=="1"
+ $(EdkIIGlueBaseLibX64_LIB)\
+!ELSE
+ $(EdkIIGlueBaseLibIA32_LIB)\
+!ENDIF
+ $(EdkIIGlueDxeServicesTableLib_LIB)\
+
+AmtWrapperDxeBin : $(AmtWrapperDxe_LIBS)
+ $(MAKE) /$(MAKEFLAGS) $(EDK_DEFAULTS)\
+ /f $(BUILD_DIR)\AmtWrapperDxe.mak all\
+ GUID=D77C900D-A1C7-41c5-B989-0C3D37FCA432\
+ "MY_INCLUDES=$(AmtWrapperDxe_INCLUDES)" \
+ ENTRY_POINT=AmtWrapperDxeEntryPoint\
+ DEPEX1=$(AmtWrapperDxe_DIR)\AmtWrapperDxe.dxs\
+ DEPEX1_TYPE=EFI_SECTION_DXE_DEPEX\
+ TYPE=BS_DRIVER\
+ 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/AmtWrapper/Dxe/AmtWrapperDxe.sdl b/Board/EM/MeWrapper/AmtWrapper/Dxe/AmtWrapperDxe.sdl
new file mode 100644
index 0000000..cf027e3
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/Dxe/AmtWrapperDxe.sdl
@@ -0,0 +1,57 @@
+TOKEN
+ Name = "AmtWrapperDxe_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable AMT Wrapper DXE support in Project"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+End
+
+PATH
+ Name = "AmtWrapperDxe_DIR"
+End
+
+MODULE
+ Help = "Includes AmtWrapperDxe.mak to Project"
+ File = "AmtWrapperDxe.mak"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\AmtWrapperDxe.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End
+
+TOKEN
+ Name = "SREDIR_DISPLAY_MODE"
+ Value = "0"
+ Help = "0:Legacy Redirection by Setup Setting\1:Force Legacy Redirection to 80x24\2:Force Legacy Redirection to 80x25"
+ TokenType = Integer
+ TargetH = Yes
+ Range = "0 - 2"
+End
+
+ELINK
+ Name = "{0x8086,0x1C3A},"
+ Parent = "InvalidPciComDeviceList"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "{0x8086,0x1C3B},"
+ Parent = "InvalidPciComDeviceList"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "{0x8086,0x1E3A},"
+ Parent = "InvalidPciComDeviceList"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "{0x8086,0x1E3B},"
+ Parent = "InvalidPciComDeviceList"
+ InvokeOrder = AfterParent
+End \ No newline at end of file
diff --git a/Board/EM/MeWrapper/AmtWrapper/Dxe/AsfSupport.c b/Board/EM/MeWrapper/AmtWrapper/Dxe/AsfSupport.c
new file mode 100644
index 0000000..425a608
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/Dxe/AsfSupport.c
@@ -0,0 +1,1919 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/AmtWrapper/AmtWrapperDxe/AsfSupport.c 10 5/14/14 9:52p Tristinchou $
+//
+// $Revision: 10 $
+//
+// $Date: 5/14/14 9:52p $
+//
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/AmtWrapper/AmtWrapperDxe/AsfSupport.c $
+//
+// 10 5/14/14 9:52p Tristinchou
+// [TAG] EIP167030
+// [Category] Improvement
+// [Description] Remove the variable runtime attribute and keep original
+// attributes.
+//
+// 9 1/08/14 10:23p Tristinchou
+// [TAG] EIP144445
+// [Category] Bug Fix
+// [Severity] Normal
+// [Symptom] AMT IDER Floppy failed on HSW ULT
+// [RootCause] IDER Device ID is different on HSW ULT
+// [Solution] Determine the bus, device and function number directly
+//
+// 8 9/24/13 4:22a Klzhan
+// [TAG] EIPNone
+// [Category] Improvement
+// [Description] Raise TPL is not needed
+//
+// 7 4/08/13 3:10a Klzhan
+// [TAG] EIPNone
+// [Category] Bug Fix
+// [Severity] Important
+// [Symptom] TC015 fail
+//
+// 6 3/01/13 4:38a Klzhan
+// [TAG] EIPNone
+// [Category] Improvement
+// [Description] Boot to legacy when UEFI boot fail.
+// Correct secure boot fail behavior
+//
+// 5 2/25/13 7:05a Klzhan
+// [TAG] EIP113605
+// [Category] Improvement
+// [Description] Support IDER Floppy BOOT.
+//
+// 4 10/30/12 8:30a Klzhan
+// Improvement : Boot to Legacy when EFI boot fail.
+// Improvement : Correct Secure IDER Boot.
+//
+// 3 8/14/12 7:26a Klzhan
+// Support UEFI IDER boot.
+//
+// 2 4/24/12 12:36a Klzhan
+// Update modulepart to latest
+//
+// 1 2/08/12 1:08a Klzhan
+// Initial Check in
+//
+// 3 7/08/11 4:20a Klzhan
+//
+// 2 6/16/11 4:56a Klzhan
+// Update IDER related code.
+//
+// 1 2/25/11 1:43a Klzhan
+// Initial Check-in
+//
+// 1 12/03/10 5:10a Klzhan
+// Initial Check-in.
+//
+//
+//**********************************************************************
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: AsfSupport.c
+//
+// Description:
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+/*++
+ This file contains an 'Intel Peripheral Driver' and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+/*++
+
+Copyright (c) 2005-2008 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:
+
+ AsfSupport.c
+
+Abstract:
+
+ Support routines for ASF boot options in the BDS
+
+--*/
+
+#include "AsfSupport.h"
+
+#pragma pack(push,1)
+
+typedef struct {
+ UINT32 Attributes;
+ UINT16 FilePathListLength;
+} EFI_LOAD_OPTION;
+#pragma pack(pop)
+
+//
+// Global variables
+//
+EFI_ASF_BOOT_OPTIONS *mAsfBootOptions;
+
+static EFI_DEVICE_PATH_PROTOCOL EndDevicePath[] = {
+ END_DEVICE_PATH_TYPE,
+ END_ENTIRE_DEVICE_PATH_SUBTYPE,
+ END_DEVICE_PATH_LENGTH,
+ 0
+};
+
+//
+// Legacy Device Order
+//
+typedef struct {
+ UINT32 Type;
+ UINT16 Length;
+ UINT16 Device[1];
+} LEGACY_DEVICE_ORDER;
+
+#define LEGACY_DEV_ORDER_GUID \
+ { \
+ 0xA56074DB, 0x65FE, 0x45F7, 0xBD, 0x21, 0x2D, 0x2B, 0xDD, 0x8E, 0x96, 0x52 \
+ }
+
+EFI_GUID gLegacyDeviceOrderGuid = LEGACY_DEV_ORDER_GUID;
+
+EFI_STATUS
+BdsAsfInitialization (
+ IN VOID
+ )
+/*++
+
+Routine Description:
+
+ Retrieve the ASF boot options previously recorded by the ASF driver.
+
+Arguments:
+
+ None.
+
+Returns:
+
+ Initialize Boot Options global variable and AMT protocol
+
+--*/
+{
+ EFI_STATUS Status;
+ EFI_ALERT_STANDARD_FORMAT_PROTOCOL *Asf;
+
+ mAsfBootOptions = NULL;
+
+ //
+ // Amt Library Init
+ //
+ Status = AmtLibInit ();
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "Info : Error init AmtLibInit -> %r\n", Status));
+ return Status;
+ }
+ //
+ // Get Protocol for ASF
+ //
+ Status = gBS->LocateProtocol (
+ &gEfiAlertStandardFormatProtocolGuid,
+ NULL,
+ &Asf
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "Info : Error gettings ASF protocol -> %r\n", Status));
+ return Status;
+ }
+
+ Status = Asf->GetBootOptions (Asf, &mAsfBootOptions);
+
+ return Status;
+}
+
+BDS_COMMON_OPTION *
+BdsCreateBootOption (
+ IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
+ IN CHAR16 *Description
+ )
+/*++
+
+Routine Description:
+
+ This function will create a BootOption from the give device path and
+ description string.
+
+Arguments:
+
+ DevicePath - The device path which the option represent
+ Description - The description of the boot option
+
+Returns:
+
+ BDS_COMMON_OPTION - A BDS_COMMON_OPTION pointer
+
+--*/
+{
+ BDS_COMMON_OPTION *Option;
+
+ Option = EfiLibAllocateZeroPool (sizeof (BDS_COMMON_OPTION));
+ if (Option == NULL) {
+ return NULL;
+ }
+
+ Option->Signature = BDS_LOAD_OPTION_SIGNATURE;
+ Option->DevicePath = EfiLibAllocateZeroPool (EfiDevicePathSize (DevicePath));
+ EfiCopyMem (Option->DevicePath, DevicePath, EfiDevicePathSize (DevicePath));
+
+ Option->Attribute = LOAD_OPTION_ACTIVE;
+ Option->Description = EfiLibAllocateZeroPool (EfiStrSize (Description));
+ EfiCopyMem (Option->Description, Description, EfiStrSize (Description));
+
+ return Option;
+}
+
+EFI_DEVICE_PATH_PROTOCOL *
+BdsCreateShellDevicePath (
+ VOID
+ )
+/*++
+
+Routine Description:
+
+ This function will create a SHELL BootOption to boot.
+
+Arguments:
+
+ None.
+
+Returns:
+
+ Shell Device path for booting.
+
+--*/
+{
+ UINTN FvHandleCount;
+ EFI_HANDLE *FvHandleBuffer;
+ UINTN Index;
+ EFI_STATUS Status;
+#if (PI_SPECIFICATION_VERSION < 0x00010000)
+ EFI_FIRMWARE_VOLUME_PROTOCOL *Fv;
+#else
+ EFI_FIRMWARE_VOLUME2_PROTOCOL *Fv;
+#endif
+ EFI_FV_FILETYPE Type;
+ UINTN Size;
+ EFI_FV_FILE_ATTRIBUTES Attributes;
+ UINT32 AuthenticationStatus;
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;
+ MEDIA_FW_VOL_FILEPATH_DEVICE_PATH ShellNode;
+
+ DevicePath = NULL;
+ Status = EFI_SUCCESS;
+
+ gBS->LocateHandleBuffer (
+ ByProtocol,
+ #if (PI_SPECIFICATION_VERSION < 0x00010000)
+ &gEfiFirmwareVolumeProtocolGuid,
+ #else
+ &gEfiFirmwareVolume2ProtocolGuid,
+ #endif
+ NULL,
+ &FvHandleCount,
+ &FvHandleBuffer
+ );
+
+ for (Index = 0; Index < FvHandleCount; Index++) {
+ gBS->HandleProtocol (
+ FvHandleBuffer[Index],
+ #if (PI_SPECIFICATION_VERSION < 0x00010000)
+ &gEfiFirmwareVolumeProtocolGuid,
+ #else
+ &gEfiFirmwareVolume2ProtocolGuid,
+ #endif
+ (VOID **) &Fv
+ );
+
+ Status = Fv->ReadFile (
+ Fv,
+ &gEfiShellFileGuid,
+ NULL,
+ &Size,
+ &Type,
+ &Attributes,
+ &AuthenticationStatus
+ );
+ if (EFI_ERROR (Status)) {
+ //
+ // Skip if no shell file in the FV
+ //
+ continue;
+ } else {
+ //
+ // Found the shell
+ //
+ break;
+ }
+ }
+
+ if (EFI_ERROR (Status)) {
+ //
+ // No shell present
+ //
+ if (FvHandleCount) {
+ gBS->FreePool (FvHandleBuffer);
+ }
+
+ return NULL;
+ }
+ //
+ // Build the shell boot option
+ //
+ DevicePath = EfiDevicePathFromHandle (FvHandleBuffer[Index]);
+
+ //
+ // Build the shell device path
+ //
+ ShellNode.Header.Type = MEDIA_DEVICE_PATH;
+ ShellNode.Header.SubType = MEDIA_FV_FILEPATH_DP;
+ SetDevicePathNodeLength (&ShellNode.Header, sizeof (MEDIA_FW_VOL_FILEPATH_DEVICE_PATH));
+ EfiCopyMem (&ShellNode.NameGuid, &gEfiShellFileGuid, sizeof (EFI_GUID));
+ DevicePath = EfiAppendDevicePathNode (DevicePath, (EFI_DEVICE_PATH_PROTOCOL *) &ShellNode);
+
+ if (FvHandleCount) {
+ gBS->FreePool (FvHandleBuffer);
+ }
+
+ return DevicePath;
+}
+
+static
+EFI_DEVICE_PATH_PROTOCOL *
+BdsCreatePxeDevicePath (
+ IN UINT16 DeviceIndex
+ )
+/*++
+
+Routine Description:
+
+ This function will create a PXE BootOption to boot.
+
+Arguments:
+
+ DeviceIndex - PXE handle index
+
+Returns:
+
+ PXE Device path for booting.
+
+--*/
+{
+ UINTN Index;
+ EFI_STATUS Status;
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;
+ UINTN NumberLoadFileHandles;
+ EFI_HANDLE *LoadFileHandles;
+ VOID *ProtocolInstance;
+
+ DevicePath = NULL;
+ Status = EFI_SUCCESS;
+
+ //
+ // We want everything connected up for PXE
+ //
+ BdsLibConnectAllDriversToAllControllers ();
+
+ //
+ // Parse Network Boot Device
+ //
+ gBS->LocateHandleBuffer (
+ ByProtocol,
+ &gEfiSimpleNetworkProtocolGuid,
+ NULL,
+ &NumberLoadFileHandles,
+ &LoadFileHandles
+ );
+ for (Index = 0; Index < NumberLoadFileHandles; Index++) {
+ Status = gBS->HandleProtocol (
+ LoadFileHandles[Index],
+ &gEfiLoadFileProtocolGuid,
+ (VOID **) &ProtocolInstance
+ );
+ if (EFI_ERROR (Status)) {
+ //
+ // try next handle
+ //
+ continue;
+ } else {
+ if (Index == DeviceIndex) {
+ //
+ // Found a PXE handle
+ //
+ break;
+ } else {
+ Status = EFI_UNSUPPORTED;
+ }
+ }
+ }
+
+ if (EFI_ERROR (Status)) {
+ //
+ // No PXE present
+ //
+ if (NumberLoadFileHandles) {
+ gBS->FreePool (LoadFileHandles);
+ }
+
+ return NULL;
+ }
+ //
+ // Build the PXE device path
+ //
+ DevicePath = EfiDevicePathFromHandle (LoadFileHandles[Index]);
+
+ if (NumberLoadFileHandles) {
+ gBS->FreePool (LoadFileHandles);
+ }
+
+ return DevicePath;
+}
+
+static
+VOID
+GetAmtBusDevFcnVal (
+ OUT UINT32 *Bus,
+ OUT UINT32 *Device,
+ OUT UINT32 *Function
+ )
+/*++
+
+Routine Description:
+
+ This function will get Bus, Device and Function.
+
+Arguments:
+
+ Bus - AMT Bus
+ Device - AMT Device
+ Function - AMT Function
+
+Returns:
+
+ None.
+
+--*/
+{
+ UINT32 Index;
+ EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;
+ UINT64 Address;
+ DATA32_UNION Data32Union;
+ EFI_STATUS Status;
+
+ *Bus = 0;
+ *Device = 0;
+ *Function = 0;
+
+ //
+ // Locate root bridge IO protocol
+ //
+ Status = gBS->LocateProtocol (&gEfiPciRootBridgeIoProtocolGuid, NULL, &PciRootBridgeIo);
+ ASSERT_EFI_ERROR (Status);
+
+ //
+ // Need to fill in IDER bus dev function so find this for Tekoa i82573E here.
+ //
+ for (Index = 0; Index < 0x255; Index++) {
+ Address = EFI_PCI_ADDRESS (
+ Index,
+ ME_DEVICE_NUMBER, //
+ IDER_FUNCTION_NUMBER, // fun 2 IDER capability
+ PCI_VENDOR_ID_OFFSET
+ );
+ Status = PciRootBridgeIo->Pci.Read (
+ PciRootBridgeIo,
+ EfiPciWidthUint32,
+ Address,
+ 1,
+ &Data32Union
+ );
+ if ((Data32Union.Data16[0] == V_ME_IDER_VENDOR_ID) &&
+ (Data32Union.Data16[1] == V_ME_IDER_DEVICE_ID)) {
+ //
+ // LOM i82573E is always Device 0 and function 2 so or this 8 bit value of 0x02
+ // into bus number discovered. Bus # upper byte and Dev-Fcn lower byte.
+ //
+ *Bus = Index;
+ *Device = ME_DEVICE_NUMBER;
+ *Function = IDER_FUNCTION_NUMBER;
+ break;
+ }
+ }
+}
+
+UINTN
+GetFirstIndexByType (
+ UINT16 DevType
+ )
+/*++
+
+Routine Description:
+
+ Boot HDD by BIOS Default Priority
+
+Arguments:
+
+ DevType - Boot device whose device type
+
+Returns:
+
+ None
+
+--*/
+{
+ EFI_STATUS Status;
+ UINTN LegacyDevOrderSize;
+ LEGACY_DEVICE_ORDER *LegacyDevOrder;
+ UINTN Index;
+ UINT8 *p;
+ UINTN o;
+
+ Index = 0;
+ o = 0;
+
+ LegacyDevOrderSize = 0;
+ LegacyDevOrder = NULL;
+
+ Status = gRT->GetVariable (
+ L"LegacyDevOrder",
+ &gLegacyDeviceOrderGuid,
+ NULL,
+ &LegacyDevOrderSize,
+ NULL
+ );
+
+ if (Status == EFI_BUFFER_TOO_SMALL) {
+ LegacyDevOrder = EfiLibAllocateZeroPool (LegacyDevOrderSize);
+ if (LegacyDevOrder != NULL) {
+ Status = gRT->GetVariable (
+ L"LegacyDevOrder",
+ &gLegacyDeviceOrderGuid,
+ NULL,
+ &LegacyDevOrderSize,
+ LegacyDevOrder
+ );
+ if (!EFI_ERROR (Status)) {
+ p = (UINT8 *) LegacyDevOrder;
+ o = 0;
+ for (o = 0; o < LegacyDevOrderSize; o += sizeof (LegacyDevOrder->Type) + LegacyDevOrder->Length) {
+ LegacyDevOrder = (LEGACY_DEVICE_ORDER *) (p + o);
+ if (LegacyDevOrder->Type == DevType) {
+ Index = LegacyDevOrder->Device[0];
+ }
+ }
+ }
+ }
+ }
+
+ return Index;
+}
+
+static
+EFI_STATUS
+RefreshBbsTableForBoot (
+ IN UINT16 DeviceIndex,
+ IN UINT16 DevType,
+ IN UINT16 BbsCount,
+ IN OUT BBS_TABLE *BbsTable
+ )
+/*++
+
+Routine Description:
+
+ Update the table with our required boot device
+
+Arguments:
+
+ DeviceIndex - Boot device whose device index
+ DevType - Boot device whose device type
+ BbsCount - Number of BBS_TABLE structures
+ BbsTable - BBS entry
+
+Returns:
+
+ EFI_STATUS
+
+--*/
+{
+ EFI_STATUS Status;
+ UINTN Index;
+ UINT16 BootDeviceIndex;
+ UINT16 TempIndex;
+
+ Status = EFI_NOT_FOUND;
+ TempIndex = 1;
+
+ BootDeviceIndex = DeviceIndex;
+
+ //
+ // Find the first present boot device whose device type
+ // matches the DevType, we use it to boot first. This is different
+ // from the other Bbs table refresh since we are looking for the device type
+ // index instead of the first device to match the device type.
+ //
+ // And set other present boot devices' priority to BBS_UNPRIORITIZED_ENTRY
+ // their priority will be set by LegacyBiosPlatform protocol by default
+ //
+ if (DeviceIndex > 0) {
+ for (Index = 0; Index < BbsCount; Index++) {
+ if (BbsTable[Index].BootPriority == BBS_IGNORE_ENTRY) {
+ continue;
+ }
+
+ BbsTable[Index].BootPriority = BBS_DO_NOT_BOOT_FROM;
+
+ if (BbsTable[Index].DeviceType == DevType) {
+ if (TempIndex++ == DeviceIndex) {
+ BbsTable[Index].BootPriority = 0;
+ Status = EFI_SUCCESS;
+ continue;
+ }
+ }
+ }
+ } else {
+ //
+ // Boot HDD by BIOS Default Priority
+ //
+ Index = GetFirstIndexByType (DevType);
+ BbsTable[Index].BootPriority = 0;
+ Status = EFI_SUCCESS;
+ }
+
+ return Status;
+}
+
+static
+EFI_STATUS
+RefreshBbsTableForIdeRBoot (
+ IN UINT16 DeviceIndex,
+ IN UINT16 DevType,
+ IN UINT16 BbsCount,
+ IN OUT BBS_TABLE *BbsTable
+ )
+/*++
+
+Routine Description:
+
+ Update the table with IdeR boot device
+
+Arguments:
+
+ DeviceIndex - Boot device whose device index
+ DevType - Boot device whose device type
+ BbsCount - Number of BBS_TABLE structures
+ BbsTable - BBS entry
+
+Returns:
+
+ EFI_STATUS
+
+--*/
+{
+ EFI_STATUS Status;
+ UINTN Index;
+ BOOLEAN IderDeviceFound;
+
+ Status = EFI_NOT_FOUND;
+
+ IderDeviceFound = FALSE;
+
+ //
+ // Find the first present boot device whose device type
+ // matches the DevType, we use it to boot first.
+ //
+ // And set other present boot devices' priority to BBS_DO_NOT_BOOT_FROM
+ // their priority will be set by LegacyBiosPlatform protocol by default
+ //
+ for (Index = 0; Index < BbsCount; Index++) {
+ if (BBS_IGNORE_ENTRY == BbsTable[Index].BootPriority) {
+ continue;
+ }
+
+ BbsTable[Index].BootPriority = BBS_DO_NOT_BOOT_FROM;
+
+ if ( (BbsTable[Index].Bus == ME_BUS) &&
+ (BbsTable[Index].Device == ME_DEVICE_NUMBER) &&
+ (BbsTable[Index].Function == IDER_FUNCTION_NUMBER) ) {
+ if (DeviceIndex == 0 && IderDeviceFound != TRUE) {
+ BbsTable[Index].BootPriority = 0;
+ IderDeviceFound = TRUE;
+ Status = EFI_SUCCESS;
+ } else {
+ DeviceIndex--;
+ }
+
+ continue;
+ }
+ }
+
+ return Status;
+}
+static
+EFI_DEVICE_PATH_PROTOCOL *
+BuildDevicePathFromBootOrder
+(
+ VOID
+)
+{
+ UINT8 BootMediaType = 0;
+ UINT8 BootMediaSubType = 0;
+ BOOLEAN IDERBoot = FALSE, IDERFloppy = FALSE;
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath = NULL;
+ UINT16 *BootOrder;
+ EFI_LOAD_OPTION *BootOption;
+ UINTN BootOrderSize;
+ UINTN BootOptionSize;
+ CHAR16 BootVarName[9];
+ UINTN i;
+ EFI_STATUS Status;
+ EFI_DEVICE_PATH_PROTOCOL *Dp, *DevicePathNode;
+ EFI_DEVICE_PATH_PROTOCOL *DummyDp;
+ UINTN BufferSize = 0;
+ if (ActiveManagementEnableIdeR ()) {
+ //
+ // Check if any media exist in Ider device
+ //
+ if (BdsCheckIderMedia ()) {
+
+ // IDER Floppy
+ if(mAsfBootOptions->SpecialCommandParam == 1)
+ {
+ IDERFloppy = TRUE;
+ }
+
+ // IDER CD
+ if((mAsfBootOptions->SpecialCommandParam == 0x101) ||
+ (mAsfBootOptions->SpecialCommandParam == 0x103))
+ {
+ BootMediaType = MEDIA_DEVICE_PATH;
+ BootMediaSubType = MEDIA_CDROM_DP;
+ }
+ IDERBoot = TRUE;
+ }
+ }else
+ {
+ switch (mAsfBootOptions->SpecialCommand) {
+ case FORCE_PXE:
+ if (mAsfBootOptions->SpecialCommandParam != 0) {
+ //
+ // ASF spec says 0 currently only option
+ //
+ return NULL;
+ }
+ BootMediaType = MESSAGING_DEVICE_PATH;
+ BootMediaSubType = MSG_MAC_ADDR_DP;
+ break;
+
+ case FORCE_HARDDRIVE:
+ case FORCE_SAFEMODE:
+ BootMediaType = MEDIA_DEVICE_PATH;
+ BootMediaSubType = MEDIA_HARDDRIVE_DP;
+ break;
+
+ case FORCE_DIAGNOSTICS:
+ if (mAsfBootOptions->SpecialCommandParam != 0) {
+ //
+ // ASF spec says 0 currently only option
+ //
+ return NULL;
+ }
+
+ DevicePath = BdsCreateShellDevicePath ();
+
+ //
+ // We want everything connected up for shell
+ //
+ BdsLibConnectAllDriversToAllControllers ();
+ break;
+
+ case FORCE_CDDVD:
+ BootMediaType = MEDIA_DEVICE_PATH;
+ BootMediaSubType = MEDIA_CDROM_DP;
+ break;
+
+ default:
+ return NULL;
+ break;
+ }
+ }//else IDER check
+ // Get Device Path from BootXXXX
+ BootOrder = NULL;
+ BootOption = NULL;
+ BootOrderSize = 0;
+
+ Status = gRT->GetVariable(
+ L"BootOrder",
+ &gEfiGlobalVariableGuid,
+ NULL,
+ &BootOrderSize,
+ NULL
+ );
+
+ if (Status == EFI_BUFFER_TOO_SMALL)
+ {
+ BootOrder = EfiLibAllocateZeroPool(BootOrderSize);
+ if (BootOrder != NULL)
+ {
+ Status = gRT->GetVariable(
+ L"BootOrder",
+ &gEfiGlobalVariableGuid,
+ NULL,
+ &BootOrderSize,
+ BootOrder
+ );
+ if (!EFI_ERROR(Status))
+ {
+ for (i=0; i<BootOrderSize/sizeof(UINT16); i++)
+ {
+ SPrint(BootVarName, sizeof(BootVarName), L"Boot%04x", BootOrder[i] );
+ BootOptionSize = 0;
+ Status = gRT->GetVariable(
+ BootVarName,
+ &gEfiGlobalVariableGuid,
+ NULL,
+ &BootOptionSize,
+ NULL
+ );
+ if (Status == EFI_BUFFER_TOO_SMALL)
+ {
+ BootOption = EfiLibAllocateZeroPool(BootOptionSize);
+ if (BootOption != NULL)
+ {
+ Status = gRT->GetVariable(
+ BootVarName,
+ &gEfiGlobalVariableGuid,
+ NULL,
+ &BootOptionSize,
+ BootOption);
+ if (!EFI_ERROR(Status))
+ {
+ Dp = (EFI_DEVICE_PATH_PROTOCOL *) (
+ //
+ // skip the header
+ //
+ (UINT8 *) (BootOption + 1)
+ //
+ // skip the string
+ //
+ + (EfiStrLen ((CHAR16 *) (BootOption + 1)) + 1) * sizeof (CHAR16));
+ DevicePathNode = Dp;
+ while (!EfiIsDevicePathEnd (DevicePathNode))
+ {
+ // Skip USB device
+ /*
+ if((DevicePathNode->Type == MESSAGING_DEVICE_PATH) &&
+ (DevicePathNode->SubType == MSG_USB_DP))
+ break;
+ */
+
+ if( IDERBoot &&
+ (DevicePathNode->Type == MESSAGING_DEVICE_PATH) &&
+ (DevicePathNode->SubType == MSG_SATA_DP))
+ break;
+
+ // Do something special for IDER Floppy,
+ // In AMT commander tool, If redirect to Floppy and CD image
+ // The device path are almost the same
+ if(IDERFloppy &&
+ (DevicePathNode->Type == MESSAGING_DEVICE_PATH) &&
+ (DevicePathNode->SubType == MSG_ATAPI_DP))
+ {
+ EFI_DEVICE_PATH_PROTOCOL *tDP =
+ EfiNextDevicePathNode (DevicePathNode);
+ // IDER CD image has Next Device Path Node, but Floppy doesn't
+ if(EfiIsDevicePathEnd (tDP))
+ {
+ // Correct Pointer of DP, Fix freepool hang issue
+ BufferSize =
+ (UINTN)((UINTN *)BootOptionSize -
+ ((UINTN *)Dp -
+ (UINTN *)BootOption))/sizeof(UINT8);
+
+ Status = gBS->AllocatePool(
+ EfiBootServicesData, BufferSize, &DummyDp );
+
+ if(!EFI_ERROR(Status))
+ {
+ gBS->CopyMem(
+ (VOID*)DummyDp, (VOID*)Dp, BufferSize );
+ }
+ else
+ {
+ Status = gBS->FreePool(BootOption);
+ Status = gBS->FreePool(BootOrder);
+ return NULL;
+ }
+ Status = gBS->FreePool(BootOption);
+ Status = gBS->FreePool(BootOrder);
+ return DummyDp;
+ }
+ break;
+ }
+ if((DevicePathNode->Type == BootMediaType) &&
+ (DevicePathNode->SubType == BootMediaSubType))
+ {
+ // Correct Pointer of DP, Fix freepool hang issue
+ BufferSize =
+ (UINTN)((UINTN *)BootOptionSize -
+ ((UINTN *)Dp -
+ (UINTN *)BootOption))/sizeof(UINT8);
+
+ Status = gBS->AllocatePool(
+ EfiBootServicesData, BufferSize, &DummyDp );
+
+ if(!EFI_ERROR(Status))
+ {
+ gBS->CopyMem(
+ (VOID*)DummyDp, (VOID*)Dp, BufferSize );
+ }
+ else
+ {
+ Status = gBS->FreePool(BootOption);
+ Status = gBS->FreePool(BootOrder);
+ return NULL;
+
+ }
+ Status = gBS->FreePool(BootOption);
+ Status = gBS->FreePool(BootOrder);
+ return DummyDp;
+ }
+
+ DevicePathNode = EfiNextDevicePathNode (DevicePathNode);
+ }
+ }
+ gBS->FreePool (BootOption);
+ }
+ }
+ }
+ }
+ gBS->FreePool (BootOrder);
+ }
+ }
+
+ return DevicePath;
+}
+static
+EFI_DEVICE_PATH_PROTOCOL *
+BdsCreateLegacyBootDevicePath (
+ IN UINT16 DeviceType,
+ IN UINT16 DeviceIndex,
+ IN BOOLEAN IdeRBoot
+ )
+/*++
+
+Routine Description:
+
+ Build the BBS Device Path for this boot selection
+
+Arguments:
+
+ DeviceType - Boot device whose device type
+ DeviceIndex - Boot device whose device index
+ IdeRBoot - If IdeRBoot is TRUE then check Ider device
+
+Returns:
+
+ EFI_STATUS
+
+--*/
+{
+ EFI_LEGACY_BIOS_PROTOCOL *LegacyBios;
+ BBS_BBS_DEVICE_PATH BbsDevicePathNode;
+ BBS_TABLE *BbsTable;
+ UINT16 HddCount;
+ UINT16 BbsCount;
+ HDD_INFO *LocalHddInfo;
+ UINT16 Index;
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;
+ EFI_STATUS Status;
+
+ HddCount = 0;
+ BbsCount = 0;
+ LocalHddInfo = NULL;
+
+ Index = DeviceIndex;
+
+ //
+ // Make sure the Legacy Boot Protocol is available
+ //
+ Status = gBS->LocateProtocol (&gEfiLegacyBiosProtocolGuid, NULL, &LegacyBios);
+ if (EFI_ERROR (Status)) {
+ return NULL;
+ }
+ //
+ // Get BBS table instance
+ //
+ Status = LegacyBios->GetBbsInfo (
+ LegacyBios,
+ &HddCount,
+ &LocalHddInfo,
+ &BbsCount,
+ &BbsTable
+ );
+ if (EFI_ERROR (Status)) {
+ return NULL;
+ }
+ //
+ // For debug
+ //
+ PrintBbsTable (BbsTable);
+
+ //
+ // Update the table with our required boot device
+ //
+ if (IdeRBoot) {
+ Status = RefreshBbsTableForIdeRBoot (
+ Index,
+ DeviceType,
+ BbsCount,
+ BbsTable
+ );
+ } else {
+ Status = RefreshBbsTableForBoot (
+ Index,
+ DeviceType,
+ BbsCount,
+ BbsTable
+ );
+ }
+ //
+ // For debug
+ //
+ PrintBbsTable (BbsTable);
+
+ if (EFI_ERROR (Status)) {
+ //
+ // Device not found - do normal boot
+ //
+ gST->ConOut->OutputString (
+ gST->ConOut,
+ L"Can't Find Boot Device by Boot Option !!\r\n"
+ );
+ while(1);
+ return NULL;
+ }
+ //
+ // Build the BBS Device Path for this boot selection
+ //
+ DevicePath = EfiLibAllocateZeroPool (sizeof (EFI_DEVICE_PATH_PROTOCOL));
+ if (DevicePath == NULL) {
+ return NULL;
+ }
+
+ BbsDevicePathNode.Header.Type = BBS_DEVICE_PATH;
+ BbsDevicePathNode.Header.SubType = BBS_BBS_DP;
+ SetDevicePathNodeLength (&BbsDevicePathNode.Header, sizeof (BBS_BBS_DEVICE_PATH));
+ BbsDevicePathNode.DeviceType = DeviceType;
+ BbsDevicePathNode.StatusFlag = 0;
+ BbsDevicePathNode.String[0] = 0;
+
+ DevicePath = EfiAppendDevicePathNode (
+ EndDevicePath,
+ (EFI_DEVICE_PATH_PROTOCOL *) &BbsDevicePathNode
+ );
+ if (NULL == DevicePath) {
+ return NULL;
+ }
+
+ return DevicePath;
+}
+
+EFI_STATUS
+AsfDoLegacyBoot (
+ IN BDS_COMMON_OPTION *Option
+ )
+/*++
+
+Routine Description:
+
+ Boot the legacy system with the boot option
+
+Arguments:
+
+ Option - The legacy boot option which have BBS device path
+
+Returns:
+
+ EFI_UNSUPPORTED - There is no legacybios protocol, do not support
+ legacy boot.
+
+ EFI_STATUS - Return the status of LegacyBios->LegacyBoot ().
+
+--*/
+{
+ EFI_STATUS Status;
+ EFI_LEGACY_BIOS_PROTOCOL *LegacyBios;
+
+ Status = gBS->LocateProtocol (&gEfiLegacyBiosProtocolGuid, NULL, &LegacyBios);
+ if (EFI_ERROR (Status)) {
+ //
+ // If no LegacyBios protocol we do not support legacy boot
+ //
+ return EFI_UNSUPPORTED;
+ }
+ //
+ // Write boot to OS performance data to a file
+ //
+ WRITE_BOOT_TO_OS_PERFORMANCE_DATA;
+
+ DEBUG ((EFI_D_INFO | EFI_D_LOAD, "Legacy Boot: %S\n", Option->Description));
+ return LegacyBios->LegacyBoot (
+ LegacyBios,
+ (BBS_BBS_DEVICE_PATH *) Option->DevicePath,
+ Option->LoadOptionsSize,
+ Option->LoadOptions
+ );
+}
+
+BOOLEAN CompareDP(
+ EFI_DEVICE_PATH_PROTOCOL *dp1,
+ EFI_DEVICE_PATH_PROTOCOL *dp2
+ )
+{
+ UINTN s1,s2;
+ BOOLEAN st = FALSE;
+
+ s1 = EfiDevicePathSize(dp1);
+
+ s2 = EfiDevicePathSize(dp2);
+
+ if (s1 == s2) {
+ if (EfiCompareMem(dp1, dp2, s1) == 0)
+ st = TRUE;
+ }
+
+ return st;
+}
+
+
+UINT16 GetBootCurrent(
+ IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
+)
+{
+ UINT16 *BootOrder;
+ EFI_LOAD_OPTION *BootOption;
+ UINTN BootOrderSize; //size of BootOrder Variable
+ UINTN BootOptionSize;
+ CHAR16 BootVarName[9];
+ UINTN i;
+ EFI_STATUS Status;
+ BOOLEAN st;
+ UINT16 BootCurrent;
+ EFI_DEVICE_PATH_PROTOCOL *Dp;
+
+ BootOrder = NULL;
+ BootOption = NULL;
+ BootCurrent = 0;
+ BootOrderSize = 0;
+
+ Status = gRT->GetVariable(
+ L"BootOrder",
+ &gEfiGlobalVariableGuid,
+ NULL,
+ &BootOrderSize,
+ NULL
+ );
+
+ if (Status == EFI_BUFFER_TOO_SMALL) {
+ BootOrder = EfiLibAllocateZeroPool(BootOrderSize);
+ if (BootOrder != NULL){
+ Status = gRT->GetVariable(
+ L"BootOrder",
+ &gEfiGlobalVariableGuid,
+ NULL,
+ &BootOrderSize,
+ BootOrder
+ );
+ if (!EFI_ERROR(Status)) {
+ for (i=0; i<BootOrderSize/sizeof(UINT16); i++){
+ SPrint(BootVarName, sizeof(BootVarName), L"Boot%04x", BootOrder[i] );
+ BootOptionSize = 0;
+ Status = gRT->GetVariable(
+ BootVarName,
+ &gEfiGlobalVariableGuid,
+ NULL,
+ &BootOptionSize,
+ NULL
+ );
+ if (Status == EFI_BUFFER_TOO_SMALL) {
+ BootOption = EfiLibAllocateZeroPool(BootOptionSize);
+ if (BootOption != NULL){
+ Status = gRT->GetVariable(
+ BootVarName,
+ &gEfiGlobalVariableGuid,
+ NULL,
+ &BootOptionSize,
+ BootOption
+ );
+ if (!EFI_ERROR(Status)) {
+ Dp = (EFI_DEVICE_PATH_PROTOCOL*)
+ ( //skip the header
+ (UINT8*)(BootOption+1)
+ //skip the string
+ +(EfiStrLen((CHAR16*)(BootOption+1))+1)*sizeof(CHAR16)
+ );
+ st = CompareDP(Dp, DevicePath);
+ if (st == TRUE) {
+ BootCurrent = BootOrder[i];
+ }
+ }
+ gBS->FreePool(BootOption);
+ }
+ }
+ }
+ }
+ gBS->FreePool(BootOrder);
+ }
+ }
+ return BootCurrent;
+}
+
+EFI_STATUS
+AsfBootViaBootOption (
+ IN BDS_COMMON_OPTION * Option,
+ IN EFI_DEVICE_PATH_PROTOCOL * DevicePath,
+ OUT UINTN *ExitDataSize,
+ OUT CHAR16 **ExitData OPTIONAL
+ )
+/*++
+
+Routine Description:
+
+ Process the boot option follow the EFI 1.1 specification and
+ special treat the legacy boot option with BBS_DEVICE_PATH.
+
+Arguments:
+
+ Option - The boot option need to be processed
+ DevicePath - The device path which describe where to load
+ the boot image or the legcy BBS device path
+ to boot the legacy OS
+ ExitDataSize - Returned directly from gBS->StartImage ()
+ ExitData - Returned directly from gBS->StartImage ()
+
+Returns:
+
+ EFI_SUCCESS - Status from gBS->StartImage (),
+ or BdsBootByDiskSignatureAndPartition ()
+ EFI_NOT_FOUND - If the Device Path is not found in the system
+
+--*/
+{
+ EFI_STATUS Status;
+ EFI_HANDLE Handle;
+ EFI_HANDLE ImageHandle;
+ EFI_DEVICE_PATH_PROTOCOL *TempDevicePath;
+ EFI_DEVICE_PATH_PROTOCOL *FilePath;
+ EFI_LOADED_IMAGE_PROTOCOL *ImageInfo;
+ EFI_EVENT ReadyToBootEvent;
+ EFI_ACPI_S3_SAVE_PROTOCOL *AcpiS3Save;
+ UINT32 VarAttr;
+ UINTN VarSize;
+
+ *ExitDataSize = 0;
+ *ExitData = NULL;
+
+ //
+ // Notes: put EFI64 ROM Shadow Solution
+ //
+ EFI64_SHADOW_ALL_LEGACY_ROM ();
+
+ //
+ // Notes: this code can be remove after the s3 script table
+ // hook on the event EFI_EVENT_SIGNAL_READY_TO_BOOT or
+ // EFI_EVENT_SIGNAL_LEGACY_BOOT
+ //
+ Status = gBS->LocateProtocol (&gEfiAcpiS3SaveGuid, NULL, &AcpiS3Save);
+ if (!EFI_ERROR (Status)) {
+ AcpiS3Save->S3Save (AcpiS3Save, NULL);
+ }
+ //
+ // If it's Device Path that starts with a hard drive path,
+ // this routine will do the booting.
+ //
+ Status = BdsBootByDiskSignatureAndPartition (
+ Option,
+ (HARDDRIVE_DEVICE_PATH *) DevicePath,
+ Option->LoadOptionsSize,
+ Option->LoadOptions,
+ ExitDataSize,
+ ExitData
+ );
+ if (!EFI_ERROR (Status)) {
+ //
+ // If we found a disk signature and partition device path return success
+ //
+ return EFI_SUCCESS;
+ }
+ //
+ // Signal the EFI_EVENT_SIGNAL_READY_TO_BOOT event
+ //
+
+
+ Option->BootCurrent = GetBootCurrent(DevicePath);
+
+ //
+ // Get Variable Attribute
+ //
+ VarAttr = 0;
+ VarSize = 0;
+ Status = gRT->GetVariable(
+ L"BootCurrent",
+ &gEfiGlobalVariableGuid,
+ &VarAttr,
+ &VarSize,
+ NULL );
+ if( Status != EFI_BUFFER_TOO_SMALL )
+ {
+ VarAttr = EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS;
+ VarSize = sizeof(UINT16);
+ }
+
+ //
+ // Set Boot Current
+ //
+ gRT->SetVariable(
+ L"BootCurrent",
+ &gEfiGlobalVariableGuid,
+ VarAttr,
+ VarSize,
+ &Option->BootCurrent );
+
+ //
+ // Abstract: Modified for EFI 2.0 required
+ //
+#if defined(EFI_EVENT_SIGNAL_READY_TO_BOOT) && EFI_SPECIFICATION_VERSION < 0x20000
+ Status = gBS->CreateEvent (
+ EFI_EVENT_SIGNAL_READY_TO_BOOT | EFI_EVENT_NOTIFY_SIGNAL_ALL,
+ EFI_TPL_CALLBACK,
+ NULL,
+ NULL,
+ &ReadyToBootEvent
+ );
+#else
+ Status = EfiCreateEventReadyToBoot (
+ EFI_TPL_CALLBACK,
+ NULL,
+ NULL,
+ &ReadyToBootEvent
+ );
+#endif
+ if (!EFI_ERROR (Status)) {
+ gBS->SignalEvent (ReadyToBootEvent);
+ gBS->CloseEvent (ReadyToBootEvent);
+ }
+
+ if ((DevicePathType (Option->DevicePath) == BBS_DEVICE_PATH) &&
+ (DevicePathSubType (Option->DevicePath) == BBS_BBS_DP)
+ ) {
+ //
+ // Check to see if we should legacy BOOT. If yes then do the legacy boot
+ //
+ return AsfDoLegacyBoot (Option);
+ }
+
+ DEBUG ((EFI_D_INFO | EFI_D_LOAD, "Booting EFI 1.1 way %S\n", Option->Description));
+
+ Status = gBS->LoadImage (
+ TRUE,
+ mBdsImageHandle,
+ DevicePath,
+ NULL,
+ 0,
+ &ImageHandle
+ );
+
+ //
+ // If we didn't find an image, we may need to load the default
+ // boot behavior for the device.
+ //
+ if (EFI_ERROR (Status)) {
+ //
+ // Find a Simple File System protocol on the device path. If the remaining
+ // device path is set to end then no Files are being specified, so try
+ // the removable media file name.
+ //
+ TempDevicePath = DevicePath;
+ Status = gBS->LocateDevicePath (
+ &gEfiSimpleFileSystemProtocolGuid,
+ &TempDevicePath,
+ &Handle
+ );
+ if (!EFI_ERROR (Status) && IsDevicePathEnd (TempDevicePath)) {
+ FilePath = EfiFileDevicePath (Handle, DEFAULT_REMOVABLE_FILE_NAME);
+ if (FilePath) {
+ Status = gBS->LoadImage (
+ TRUE,
+ mBdsImageHandle,
+ FilePath,
+ NULL,
+ 0,
+ &ImageHandle
+ );
+ if (EFI_ERROR (Status)) {
+ // System Halt when IDER boot fail !!
+ if(ActiveManagementEnableIdeR () && ((Status == EFI_SECURITY_VIOLATION) || (Status == EFI_ACCESS_DENIED)))
+ {
+ gST->ConOut->OutputString (
+ gST->ConOut,
+ L"IDER Boot Fail, system halt !! \r\n");
+
+ while(1);
+ }
+ //
+ // The DevicePath failed, and it's not a valid
+ // removable media device.
+ //
+ goto Done;
+ }
+ }
+ } else {
+ Status = EFI_NOT_FOUND;
+ }
+ }
+
+ if (EFI_ERROR (Status)) {
+ //
+ // It there is any error from the Boot attempt exit now.
+ //
+ goto Done;
+ }
+ //
+ // Provide the image with it's load options
+ //
+ Status = gBS->HandleProtocol (ImageHandle, &gEfiLoadedImageProtocolGuid, &ImageInfo);
+ ASSERT_EFI_ERROR (Status);
+
+ if (Option->LoadOptionsSize != 0) {
+ ImageInfo->LoadOptionsSize = Option->LoadOptionsSize;
+ ImageInfo->LoadOptions = Option->LoadOptions;
+ }
+ //
+ // Before calling the image, enable the Watchdog Timer for
+ // the 5 Minute period
+ //
+ gBS->SetWatchdogTimer (5 * 60, 0x0000, 0x00, NULL);
+
+ Status = gBS->StartImage (ImageHandle, ExitDataSize, ExitData);
+ DEBUG ((EFI_D_INFO | EFI_D_LOAD, "Image Return Status = %r\n", Status));
+ // System Halt when IDER boot fail !!
+ if(ActiveManagementEnableIdeR ())
+ {
+ gST->ConOut->OutputString (
+ gST->ConOut,
+ L"IDER Boot Fail, system halt !! \r\n");
+
+ while(1);
+ }
+
+ //
+ // Clear the Watchdog Timer after the image returns
+ //
+ gBS->SetWatchdogTimer (0x0000, 0x0000, 0x0000, NULL);
+
+Done:
+ //
+ // Clear Boot Current
+ //
+ gRT->SetVariable(
+ L"BootCurrent",
+ &gEfiGlobalVariableGuid,
+ VarAttr,
+ 0,
+ &Option->BootCurrent );
+
+ return Status;
+}
+
+EFI_STATUS
+BdsAsfBoot (
+ OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath
+ )
+/*++
+
+Routine Description:
+
+ Found out ASF boot options.
+
+Arguments:
+
+ DevicePath - The device path which describe where to load
+ the boot image or the legcy BBS device path
+ to boot the legacy OS
+
+Returns:
+
+ EFI_STATUS
+
+--*/
+{
+ BOOLEAN EfiBoot;
+
+ EfiBoot = FALSE;
+
+ //
+ // First we check ASF boot options Special Command
+ //
+ switch (mAsfBootOptions->SpecialCommand) {
+ //
+ // No additional special command is included; the Special Command Parameter has no
+ // meaning.
+ //
+ case NOP:
+ break;
+
+ //
+ // The Special Command Parameter can be used to specify a PXE
+ // parameter. When the parameter value is 0, the system default PXE device is booted. All
+ // other values for the PXE parameter are reserved for future definition by this specification.
+ //
+ case FORCE_PXE:
+ if (mAsfBootOptions->SpecialCommandParam != 0) {
+ //
+ // ASF spec says 0 currently only option
+ //
+ return EFI_UNSUPPORTED;
+ }
+
+ if (EfiBoot == TRUE) {
+ *DevicePath = BdsCreatePxeDevicePath (mAsfBootOptions->SpecialCommandParam);
+ } else {
+ *DevicePath = BdsCreateLegacyBootDevicePath (BBS_EMBED_NETWORK, mAsfBootOptions->SpecialCommandParam, FALSE);
+ }
+ break;
+
+ //
+ // The Special Command Parameter identifies the boot-media index for
+ // the managed client. When the parameter value is 0, the default hard-drive is booted, when the
+ // parameter value is 1, the primary hard-drive is booted; when the value is 2, the secondary
+ // hard-drive is booted ¡V and so on.
+ //
+ case FORCE_HARDDRIVE:
+ //
+ // The Special Command Parameter identifies the boot-media
+ // index for the managed client. When the parameter value is 0, the default hard-drive is
+ // booted, when the parameter value is 1, the primary hard-drive is booted; when the value is 2,
+ // the secondary hard-drive is booted ¡V and so on.
+ //
+ case FORCE_SAFEMODE:
+ *DevicePath = BdsCreateLegacyBootDevicePath (BBS_TYPE_HARDDRIVE, mAsfBootOptions->SpecialCommandParam, FALSE);
+ break;
+
+ //
+ // The Special Command Parameter can be used to specify a
+ // diagnostic parameter. When the parameter value is 0, the default diagnostic media is booted.
+ // All other values for the diagnostic parameter are reserved for future definition by this
+ // specification.
+ //
+ case FORCE_DIAGNOSTICS:
+ if (mAsfBootOptions->SpecialCommandParam != 0) {
+ //
+ // ASF spec says 0 currently only option
+ //
+ return EFI_UNSUPPORTED;
+ }
+
+ *DevicePath = BdsCreateShellDevicePath ();
+
+ //
+ // We want everything connected up for shell
+ //
+ BdsLibConnectAllDriversToAllControllers ();
+ break;
+
+ //
+ // The Special Command Parameter identifies the boot-media index for
+ // the managed client. When the parameter value is 0, the default CD/DVD is booted, when the
+ // parameter value is 1, the primary CD/DVD is booted; when the value is 2, the secondary
+ // CD/DVD is booted ¡V and so on.
+ //
+ case FORCE_CDDVD:
+ *DevicePath = BdsCreateLegacyBootDevicePath (BBS_TYPE_CDROM, mAsfBootOptions->SpecialCommandParam, FALSE);
+ break;
+
+ default:
+ return EFI_UNSUPPORTED;
+ break;
+ }
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+BdsAmtBoot (
+ OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath
+ )
+/*++
+
+Routine Description:
+
+ Check IdeR boot device and Asf boot device
+
+Arguments:
+
+ DevicePath - The device path which describe where to load
+ the boot image or the legcy BBS device path
+ to boot the legacy OS
+
+Returns:
+
+ EFI_STATUS
+
+--*/
+{
+ EFI_STATUS Status;
+
+ //
+ // OEM command values; the interpretation of the Special Command and associated Special
+ // Command Parameters is defined by the entity associated with the Enterprise ID.
+ //
+ if (ActiveManagementEnableIdeR ()) {
+ //
+ // Check if any media exist in Ider device
+ //
+ if (BdsCheckIderMedia ()) {
+ *DevicePath = BdsCreateLegacyBootDevicePath (
+ BBS_TYPE_CDROM,
+ (mAsfBootOptions->SpecialCommandParam & IDER_BOOT_DEVICE_MASK) >> IDER_BOOT_DEVICE_SHIFT,
+ TRUE
+ );
+ }
+
+ Status = EFI_SUCCESS;
+ } else {
+ Status = BdsAsfBoot (DevicePath);
+ }
+
+ return Status;
+}
+
+EFI_STATUS
+BdsBootViaAsf (
+ IN VOID
+ )
+/*++
+
+Routine Description:
+
+ Process ASF boot options and if available, attempt the boot
+
+Arguments:
+
+ None.
+
+Returns:
+
+ EFI_SUCCESS - The command completed successfully
+ Other - Error!!
+
+--*/
+{
+ EFI_STATUS Status;
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;
+ BDS_COMMON_OPTION *BootOption;
+ UINTN ExitDataSize;
+ CHAR16 *ExitData;
+
+ Status = EFI_SUCCESS;
+ DevicePath = NULL;
+
+ //
+ // Check if ASF Boot Options is present.
+ //
+ if (mAsfBootOptions->SubCommand != ASF_BOOT_OPTIONS_PRESENT) {
+ return EFI_NOT_FOUND;
+ }
+
+ DevicePath = BuildDevicePathFromBootOrder();
+
+ if(DevicePath != NULL)
+ {
+
+ BootOption = BdsCreateBootOption (DevicePath, L"ASF Boot");
+ if (BootOption != NULL) {
+ Status = AsfBootViaBootOption (BootOption, BootOption->DevicePath, &ExitDataSize, &ExitData);
+ if (EFI_ERROR (Status)) {
+ gBS->FreePool (BootOption);
+ }
+
+ gBS->FreePool (DevicePath);
+ }
+ }
+ // UEFI BOOT fail, try Legacy Boot
+ switch (mAsfBootOptions->IanaId)
+ {
+ case ASF_INTEL_CONVERTED_IANA:
+ Status = BdsAmtBoot (&DevicePath);
+ break;
+
+ case ASF_INDUSTRY_CONVERTED_IANA:
+ Status = BdsAsfBoot (&DevicePath);
+ break;
+ }
+ //
+ // If device path was set, the we have a boot option to use
+ //
+ if (DevicePath == NULL) {
+ return EFI_UNSUPPORTED;
+ }
+
+ BootOption = BdsCreateBootOption (DevicePath, L"ASF Boot");
+ if (BootOption == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ Status = AsfBootViaBootOption (BootOption, BootOption->DevicePath, &ExitDataSize, &ExitData);
+ if (EFI_ERROR (Status)) {
+ gBS->FreePool (BootOption);
+ }
+
+ gBS->FreePool (DevicePath);
+
+ return Status;
+}
+
+BOOLEAN
+BdsCheckIderMedia (
+ IN VOID
+ )
+/*++
+
+Routine Description:
+ This will return if Media in IDE-R is present.
+
+Arguments:
+ None.
+
+Returns:
+ True Media is present.
+ False Media is not present.
+
+--*/
+{
+ UINTN HandleNum;
+ EFI_HANDLE *HandleBuf;
+ EFI_HANDLE Handle;
+ EFI_STATUS Status;
+ EFI_DEVICE_PATH_PROTOCOL *DPath;
+ UINTN Index;
+ UINTN EventIndex;
+ EFI_INPUT_KEY Key;
+ EFI_BLOCK_IO_PROTOCOL *BlkIo;
+ EFI_DISK_INFO_PROTOCOL *DiskInfo;
+ EFI_BLOCK_IO_MEDIA *BlkMedia;
+ VOID *Buffer;
+ UINT8 IdeBootDevice;
+ UINT32 IdeChannel;
+ UINT32 IdeDevice;
+
+ IdeBootDevice = ActiveManagementIderBootDeviceGet ();
+
+ DEBUG ((EFI_D_INFO | EFI_D_LOAD, "Ide Channel Device Index = %d\n", IdeBootDevice));
+
+ //
+ // Make sure the Legacy Boot Protocol is available
+ //
+ Status = gBS->LocateHandleBuffer (
+ ByProtocol,
+ &gEfiBlockIoProtocolGuid,
+ NULL,
+ &HandleNum,
+ &HandleBuf
+ );
+ if (EFI_ERROR (Status)) {
+ return FALSE;
+ }
+
+ for (Index = 0; Index < HandleNum; Index++) {
+ Status = gBS->HandleProtocol (
+ HandleBuf[Index],
+ &gEfiDevicePathProtocolGuid,
+ &DPath
+ );
+ if (!EFI_ERROR (Status)) {
+ Status = gBS->LocateDevicePath (
+ &gEfiIderControllerDriverProtocolGuid,
+ &DPath,
+ &Handle
+ );
+ if (!EFI_ERROR (Status)) {
+ Status = gBS->HandleProtocol (
+ HandleBuf[Index],
+ &gEfiBlockIoProtocolGuid,
+ &BlkIo
+ );
+
+ Status = gBS->HandleProtocol (
+ HandleBuf[Index],
+ &gEfiDiskInfoProtocolGuid,
+ &DiskInfo
+ );
+
+ DiskInfo->WhichIde (DiskInfo, &IdeChannel, &IdeDevice);
+
+ if (IdeBootDevice != (UINT8) (IdeChannel * 2 + IdeDevice)) {
+ continue;
+ }
+
+ if (BlkIo->Media->MediaPresent) {
+ if (HandleBuf != NULL) {
+ gBS->FreePool (HandleBuf);
+ }
+ return TRUE;
+ } else {
+ while (TRUE) {
+ BlkMedia = BlkIo->Media;
+ Buffer = EfiLibAllocatePool (BlkMedia->BlockSize);
+ if (Buffer) {
+ BlkIo->ReadBlocks (
+ BlkIo,
+ BlkMedia->MediaId,
+ 0,
+ BlkMedia->BlockSize,
+ Buffer
+ );
+ gBS->FreePool (Buffer);
+ }
+
+ if (BlkMedia->MediaPresent) {
+ if (HandleBuf != NULL) {
+ gBS->FreePool (HandleBuf);
+ }
+ return TRUE;
+ }
+
+ gST->ConOut->OutputString (
+ gST->ConOut,
+ L"Boot disk missing, please insert boot disk and press ENTER\r\n"
+ );
+ Key.ScanCode = 0;
+ Key.UnicodeChar = 0;
+ gBS->RestoreTPL (EFI_TPL_APPLICATION);
+ while (!(Key.ScanCode == 0 && Key.UnicodeChar == L'\r')) {
+ Status = gBS->WaitForEvent (1, &(gST->ConIn->WaitForKey), &EventIndex);
+ gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
+ }
+
+ gBS->RaiseTPL (EFI_TPL_DRIVER);
+ }
+
+ if (HandleBuf != NULL) {
+ gBS->FreePool (HandleBuf);
+ }
+ return FALSE;
+ }
+ }
+ }
+ }
+
+ if (HandleBuf != NULL) {
+ gBS->FreePool (HandleBuf);
+ }
+ return FALSE;
+}
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/AmtWrapper/Dxe/AsfSupport.h b/Board/EM/MeWrapper/AmtWrapper/Dxe/AsfSupport.h
new file mode 100644
index 0000000..050724f
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/Dxe/AsfSupport.h
@@ -0,0 +1,270 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/AmtWrapper/AmtWrapperDxe/AsfSupport.h 1 2/08/12 1:08a Klzhan $
+//
+// $Revision: 1 $
+//
+// $Date: 2/08/12 1:08a $
+//
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/AmtWrapper/AmtWrapperDxe/AsfSupport.h $
+//
+// 1 2/08/12 1:08a Klzhan
+// Initial Check in
+//
+// 1 2/25/11 1:43a Klzhan
+// Initial Check-in
+//
+// 1 12/03/10 5:10a Klzhan
+// Initial Check-in.
+//
+//
+//**********************************************************************
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: AsfSupport.h
+//
+// Description: ASF BDS Support include file
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+/*++
+ This file contains an 'Intel Peripheral Driver' and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+/*++
+
+Copyright (c) 2005-2008 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:
+
+ AsfSupport.h
+
+Abstract:
+
+ ASF BDS Support include file
+
+--*/
+
+#ifndef _ASF_SUPPORT_H_
+#define _ASF_SUPPORT_H_
+
+#include "Tiano.h"
+#include "EfiDriverLib.h"
+#include "BdsLib.h"
+#include "Pci22.h"
+#include "Amt.h"
+#include "AmtLib.h"
+#include "MeAccess.h"
+
+#include EFI_PROTOCOL_DEFINITION (LegacyBios)
+#include EFI_PROTOCOL_DEFINITION (SimpleNetwork)
+#include EFI_PROTOCOL_DEFINITION (FirmwareVolume)
+#include EFI_PROTOCOL_DEFINITION (PciRootBridgeIo)
+#include EFI_PROTOCOL_DEFINITION (FormBrowser)
+
+#include EFI_PROTOCOL_CONSUMER (AlertStandardformat)
+#include EFI_PROTOCOL_CONSUMER (DiskInfo)
+
+#include EFI_PROTOCOL_DEFINITION (IderControllerDriver)
+
+typedef union {
+ UINT32 Data32;
+ UINT16 Data16[2];
+} DATA32_UNION;
+
+EFI_STATUS
+BdsAsfInitialization (
+ IN VOID
+ )
+/*++
+
+Routine Description:
+
+ Retrieve the ASF boot options previously recorded by the ASF driver.
+
+Arguments:
+
+ None.
+
+Returns:
+
+ Initialize Boot Options global variable and AMT protocol
+
+--*/
+;
+
+EFI_STATUS
+BdsBootViaAsf (
+ IN VOID
+ )
+/*++
+
+Routine Description:
+
+ Process ASF boot options and if available, attempt the boot
+
+Arguments:
+
+ None.
+
+Returns:
+
+ EFI_SUCCESS - The command completed successfully
+ Other - Error!!
+
+--*/
+;
+
+VOID
+PrintBbsTable (
+ IN BBS_TABLE *LocalBbsTable
+ )
+/*++
+
+Routine Description:
+
+ Dump all devices of BBS.
+
+Arguments:
+
+ LocalBbsTable - BBS table entry.
+
+Returns:
+
+ None.
+
+--*/
+;
+
+EFI_STATUS
+BdsLibDoLegacyBoot (
+ IN BDS_COMMON_OPTION *Option
+ )
+/*++
+
+Routine Description:
+
+ Boot the legacy system with the boot option
+
+Arguments:
+
+ Option - The legacy boot option which have BBS device path
+
+Returns:
+
+ EFI_UNSUPPORTED - There is no legacybios protocol, do not support
+ legacy boot.
+
+ EFI_STATUS - Return the status of LegacyBios->LegacyBoot ().
+
+--*/
+;
+
+BOOLEAN
+BdsCheckIderMedia (
+ IN VOID
+ )
+/*++
+
+Routine Description:
+ This will return if Media in IDE-R is present.
+
+Arguments:
+ None.
+
+Returns:
+ True Media is present.
+ False Media is not present.
+
+--*/
+;
+
+EFI_DEVICE_PATH_PROTOCOL *
+BdsCreateShellDevicePath (
+ IN VOID
+ )
+/*++
+
+Routine Description:
+
+ This function will create a SHELL BootOption to boot.
+
+Arguments:
+
+ None.
+
+Returns:
+
+ Shell Device path for booting.
+
+--*/
+;
+
+BDS_COMMON_OPTION *
+BdsCreateBootOption (
+ IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
+ IN CHAR16 *Description
+ )
+/*++
+
+Routine Description:
+
+ This function will create a BootOption from the give device path and
+ description string.
+
+Arguments:
+
+ DevicePath - The device path which the option represent
+ Description - The description of the boot option
+
+Returns:
+
+ BDS_COMMON_OPTION - A BDS_COMMON_OPTION pointer
+
+--*/
+;
+
+#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/AmtWrapper/Dxe/BdsBoot.c b/Board/EM/MeWrapper/AmtWrapper/Dxe/BdsBoot.c
new file mode 100644
index 0000000..15a57b1
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/Dxe/BdsBoot.c
@@ -0,0 +1,809 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/AmtWrapper/AmtWrapperDxe/BdsBoot.c 2 5/14/14 9:52p Tristinchou $
+//
+// $Revision: 2 $
+//
+// $Date: 5/14/14 9:52p $
+//
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/AmtWrapper/AmtWrapperDxe/BdsBoot.c $
+//
+// 2 5/14/14 9:52p Tristinchou
+// [TAG] EIP167030
+// [Category] Improvement
+// [Description] Remove the variable runtime attribute and keep original
+// attributes.
+//
+// 1 2/08/12 1:08a Klzhan
+// Initial Check in
+//
+// 1 2/25/11 1:43a Klzhan
+// Initial Check-in
+//
+// 1 12/03/10 5:10a Klzhan
+// Initial Check-in.
+//
+//
+//**********************************************************************
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: BdsBoot.c
+//
+// Description: Create or Process Boot option by AMT.
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+/*++
+
+Copyright (c) 2004, Intel Corporation
+All rights reserved. This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution. The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+Module Name:
+
+ BdsBoot.c
+
+Abstract:
+
+ BDS Lib functions which relate with create or process the boot
+ option.
+
+--*/
+
+#include "BdsLib.h"
+
+BOOLEAN mEnumBootDevice = FALSE;
+
+EFI_STATUS
+BdsLibDoLegacyBoot (
+ IN BDS_COMMON_OPTION *Option
+ )
+/*++
+
+Routine Description:
+
+ Boot the legacy system with the boot option
+
+Arguments:
+
+ Option - The legacy boot option which have BBS device path
+
+Returns:
+
+ EFI_UNSUPPORTED - There is no legacybios protocol, do not support
+ legacy boot.
+
+ EFI_STATUS - Return the status of LegacyBios->LegacyBoot ().
+
+--*/
+{
+ EFI_STATUS Status;
+ EFI_LEGACY_BIOS_PROTOCOL *LegacyBios;
+
+ Status = gBS->LocateProtocol (&gEfiLegacyBiosProtocolGuid, NULL, &LegacyBios);
+ if (EFI_ERROR (Status)) {
+ //
+ // If no LegacyBios protocol we do not support legacy boot
+ //
+ return EFI_UNSUPPORTED;
+ }
+ //
+ // Notes: if we seperate the int 19, then we don't need to refresh BBS
+ //
+ BdsRefreshBbsTableForBoot (Option);
+
+ //
+ // Write boot to OS performance data to a file
+ //
+ WRITE_BOOT_TO_OS_PERFORMANCE_DATA;
+
+ DEBUG ((EFI_D_INFO | EFI_D_LOAD, "Legacy Boot: %S\n", Option->Description));
+ return LegacyBios->LegacyBoot (
+ LegacyBios,
+ (BBS_BBS_DEVICE_PATH *) Option->DevicePath,
+ Option->LoadOptionsSize,
+ Option->LoadOptions
+ );
+}
+
+EFI_STATUS
+BdsLibBootViaBootOption (
+ IN BDS_COMMON_OPTION * Option,
+ IN EFI_DEVICE_PATH_PROTOCOL * DevicePath,
+ OUT UINTN *ExitDataSize,
+ OUT CHAR16 **ExitData OPTIONAL
+ )
+/*++
+
+Routine Description:
+
+ Process the boot option follow the EFI 1.1 specification and
+ special treat the legacy boot option with BBS_DEVICE_PATH.
+
+Arguments:
+
+ Option - The boot option need to be processed
+
+ DevicePath - The device path which describe where to load
+ the boot image or the legcy BBS device path
+ to boot the legacy OS
+
+ ExitDataSize - Returned directly from gBS->StartImage ()
+
+ ExitData - Returned directly from gBS->StartImage ()
+
+Returns:
+
+ EFI_SUCCESS - Status from gBS->StartImage (),
+ or BdsBootByDiskSignatureAndPartition ()
+
+ EFI_NOT_FOUND - If the Device Path is not found in the system
+
+--*/
+{
+ EFI_STATUS Status;
+ EFI_HANDLE Handle;
+ EFI_HANDLE ImageHandle;
+ EFI_DEVICE_PATH_PROTOCOL *TempDevicePath;
+ EFI_DEVICE_PATH_PROTOCOL *FilePath;
+ EFI_LOADED_IMAGE_PROTOCOL *ImageInfo;
+ EFI_EVENT ReadyToBootEvent;
+ EFI_ACPI_S3_SAVE_PROTOCOL *AcpiS3Save;
+ EFI_LIST_ENTRY TempBootLists;
+ UINT32 VarAttr;
+ UINTN VarSize;
+//;;## EFI_TCG_PLATFORM_PROTOCOL *TcgPlatformProtocol;
+
+ *ExitDataSize = 0;
+ *ExitData = NULL;
+
+ //
+ // Notes: put EFI64 ROM Shadow Solution
+ //
+ EFI64_SHADOW_ALL_LEGACY_ROM ();
+
+ //
+ // Notes: this code can be remove after the s3 script table
+ // hook on the event EFI_EVENT_SIGNAL_READY_TO_BOOT or
+ // EFI_EVENT_SIGNAL_LEGACY_BOOT
+ //
+ Status = gBS->LocateProtocol (&gEfiAcpiS3SaveGuid, NULL, &AcpiS3Save);
+ if (!EFI_ERROR (Status)) {
+ AcpiS3Save->S3Save (AcpiS3Save, NULL);
+ }
+ //
+ // If it's Device Path that starts with a hard drive path,
+ // this routine will do the booting.
+ //
+ Status = BdsBootByDiskSignatureAndPartition (
+ Option,
+ (HARDDRIVE_DEVICE_PATH *) DevicePath,
+ Option->LoadOptionsSize,
+ Option->LoadOptions,
+ ExitDataSize,
+ ExitData
+ );
+ if (!EFI_ERROR (Status)) {
+ //
+ // If we found a disk signature and partition device path return success
+ //
+ return EFI_SUCCESS;
+ }
+ //
+ // Signal the EFI_EVENT_SIGNAL_READY_TO_BOOT event
+ //
+
+// AMI Override: Replace
+// Abstract: Modified for EFI 2.0 required
+#if defined(EFI_EVENT_SIGNAL_READY_TO_BOOT) && EFI_SPECIFICATION_VERSION<0x20000
+ Status = gBS->CreateEvent(
+ EFI_EVENT_SIGNAL_READY_TO_BOOT | EFI_EVENT_NOTIFY_SIGNAL_ALL,
+ EFI_TPL_CALLBACK,
+ NULL,
+ NULL,
+ &ReadyToBootEvent
+ );
+#else
+ Status = EfiCreateEventReadyToBoot(
+ EFI_TPL_CALLBACK,
+ NULL,
+ NULL,
+ &ReadyToBootEvent
+ );
+#endif
+// AMI Override End
+ if (!EFI_ERROR (Status)) {
+ gBS->SignalEvent (ReadyToBootEvent);
+ gBS->CloseEvent (ReadyToBootEvent);
+ }
+ //
+ // Set Boot Current
+ //
+ VarAttr = 0;
+ VarSize = 0;
+
+ Status = gRT->GetVariable(
+ L"BootCurrent",
+ &gEfiGlobalVariableGuid,
+ &VarAttr,
+ &VarSize,
+ NULL );
+ if( EFI_ERROR(Status) && (Status != EFI_BUFFER_TOO_SMALL) )
+ {
+ VarAttr = EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS;
+ VarSize = sizeof(UINT16);
+ }
+
+ gRT->SetVariable(
+ L"BootCurrent",
+ &gEfiGlobalVariableGuid,
+ VarAttr,
+ VarSize,
+ &Option->BootCurrent );
+
+ if ((DevicePathType (Option->DevicePath) == BBS_DEVICE_PATH) &&
+ (DevicePathSubType (Option->DevicePath) == BBS_BBS_DP)
+ ) {
+ //
+ // Check to see if we should legacy BOOT. If yes then do the legacy boot
+ //
+ return BdsLibDoLegacyBoot (Option);
+ }
+
+ //
+ // If the boot option point to Internal FV shell, make sure it is valid
+ //
+ Status = BdsLibUpdateFvFileDevicePath (&DevicePath, &gEfiShellFileGuid);
+ if (!EFI_ERROR(Status)) {
+ if (Option->DevicePath != NULL) {
+ gBS->FreePool(Option->DevicePath);
+ }
+ Option->DevicePath = EfiLibAllocateZeroPool (EfiDevicePathSize (DevicePath));
+ EfiCopyMem (Option->DevicePath, DevicePath, EfiDevicePathSize (DevicePath));
+ //
+ // Update the shell boot option
+ //
+ InitializeListHead (&TempBootLists);
+ BdsLibRegisterNewOption (&TempBootLists, DevicePath, L"EFI Internal Shell", L"BootOrder");
+ //
+ // free the temporary device path created by BdsLibUpdateFvFileDevicePath()
+ //
+ gBS->FreePool (DevicePath);
+ DevicePath = Option->DevicePath;
+ }
+/* //;;##
+ //
+ // Measure GPT Table
+ //
+ Status = gBS->LocateProtocol (
+ &gEfiTcgPlatformProtocolGuid,
+ NULL,
+ &TcgPlatformProtocol
+ );
+ if (!EFI_ERROR (Status)) {
+ Status = TcgPlatformProtocol->MeasureGptTable (DevicePath);
+ }
+*/ //;;##
+
+ //
+ // Drop the TPL level from EFI_TPL_DRIVER to EFI_TPL_APPLICATION
+ //
+ gBS->RestoreTPL (EFI_TPL_APPLICATION);
+
+ DEBUG ((EFI_D_INFO | EFI_D_LOAD, "Booting EFI 1.1 way %S\n", Option->Description));
+
+ Status = gBS->LoadImage (
+ TRUE,
+ mBdsImageHandle,
+ DevicePath,
+ NULL,
+ 0,
+ &ImageHandle
+ );
+
+ //
+ // If we didn't find an image, we may need to load the default
+ // boot behavior for the device.
+ //
+ if (EFI_ERROR (Status)) {
+ //
+ // Find a Simple File System protocol on the device path. If the remaining
+ // device path is set to end then no Files are being specified, so try
+ // the removable media file name.
+ //
+ TempDevicePath = DevicePath;
+ Status = gBS->LocateDevicePath (
+ &gEfiSimpleFileSystemProtocolGuid,
+ &TempDevicePath,
+ &Handle
+ );
+ if (!EFI_ERROR (Status) && IsDevicePathEnd (TempDevicePath)) {
+ FilePath = EfiFileDevicePath (Handle, DEFAULT_REMOVABLE_FILE_NAME);
+ if (FilePath) {
+ Status = gBS->LoadImage (
+ TRUE,
+ mBdsImageHandle,
+ FilePath,
+ NULL,
+ 0,
+ &ImageHandle
+ );
+ if (EFI_ERROR (Status)) {
+ //
+ // The DevicePath failed, and it's not a valid
+ // removable media device.
+ //
+ goto Done;
+ }
+ }
+ } else {
+ Status = EFI_NOT_FOUND;
+ }
+ }
+
+ if (EFI_ERROR (Status)) {
+ //
+ // It there is any error from the Boot attempt exit now.
+ //
+ goto Done;
+ }
+ //
+ // Provide the image with it's load options
+ //
+ Status = gBS->HandleProtocol (ImageHandle, &gEfiLoadedImageProtocolGuid, &ImageInfo);
+ ASSERT_EFI_ERROR (Status);
+
+ if (Option->LoadOptionsSize != 0) {
+ ImageInfo->LoadOptionsSize = Option->LoadOptionsSize;
+ ImageInfo->LoadOptions = Option->LoadOptions;
+ }
+ //
+ // Before calling the image, enable the Watchdog Timer for
+ // the 5 Minute period
+ //
+ gBS->SetWatchdogTimer (5 * 60, 0x0000, 0x00, NULL);
+
+ Status = gBS->StartImage (ImageHandle, ExitDataSize, ExitData);
+ DEBUG ((EFI_D_INFO | EFI_D_LOAD, "Image Return Status = %r\n", Status));
+
+ //
+ // Clear the Watchdog Timer after the image returns
+ //
+ gBS->SetWatchdogTimer (0x0000, 0x0000, 0x0000, NULL);
+
+Done:
+ //
+ // Clear Boot Current
+ //
+ gRT->SetVariable(
+ L"BootCurrent",
+ &gEfiGlobalVariableGuid,
+ VarAttr,
+ 0,
+ &Option->BootCurrent );
+
+ //
+ // Raise the TPL level back to EFI_TPL_DRIVER
+ //
+ gBS->RaiseTPL (EFI_TPL_DRIVER);
+
+ return Status;
+}
+
+EFI_STATUS
+BdsBootByDiskSignatureAndPartition (
+ IN BDS_COMMON_OPTION * Option,
+ IN HARDDRIVE_DEVICE_PATH * HardDriveDevicePath,
+ IN UINT32 LoadOptionsSize,
+ IN VOID *LoadOptions,
+ OUT UINTN *ExitDataSize,
+ OUT CHAR16 **ExitData OPTIONAL
+ )
+/*++
+
+Routine Description:
+
+ Check to see if a hard ware device path was passed in. If it was then search
+ all the block IO devices for the passed in hard drive device path.
+
+Arguments:
+
+ Option - The current processing boot option.
+
+ HardDriveDevicePath - EFI Device Path to boot, if it starts with a hard
+ drive device path.
+
+ LoadOptionsSize - Passed into gBS->StartImage ()
+ via the loaded image protocol.
+
+ LoadOptions - Passed into gBS->StartImage ()
+ via the loaded image protocol.
+
+ ExitDataSize - returned directly from gBS->StartImage ()
+
+ ExitData - returned directly from gBS->StartImage ()
+
+Returns:
+
+ EFI_SUCCESS - Status from gBS->StartImage (),
+ or BootByDiskSignatureAndPartition ()
+
+ EFI_NOT_FOUND - If the Device Path is not found in the system
+
+--*/
+{
+ EFI_STATUS Status;
+ UINTN BlockIoHandleCount;
+ EFI_HANDLE *BlockIoBuffer;
+ EFI_DEVICE_PATH_PROTOCOL *BlockIoDevicePath;
+ EFI_DEVICE_PATH_PROTOCOL *BlockIoHdDevicePath;
+ HARDDRIVE_DEVICE_PATH *TmpHdPath;
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;
+ EFI_DEVICE_PATH_PROTOCOL *NewDevicePath;
+ UINTN Index;
+ BOOLEAN DevicePathMatch;
+ HARDDRIVE_DEVICE_PATH *TempPath;
+
+ *ExitDataSize = 0;
+ *ExitData = NULL;
+
+ if ( !((DevicePathType (&HardDriveDevicePath->Header) == MEDIA_DEVICE_PATH) &&
+ (DevicePathSubType (&HardDriveDevicePath->Header) == MEDIA_HARDDRIVE_DP))
+ ) {
+ //
+ // If the HardDriveDevicePath does not start with a Hard Drive Device Path
+ // exit.
+ //
+ return EFI_NOT_FOUND;
+ }
+ //
+ // The boot device have already been connected
+ //
+ Status = gBS->LocateHandleBuffer (ByProtocol, &gEfiBlockIoProtocolGuid, NULL, &BlockIoHandleCount, &BlockIoBuffer);
+ if (EFI_ERROR (Status) || BlockIoHandleCount == 0) {
+ //
+ // If there was an error or there are no device handles that support
+ // the BLOCK_IO Protocol, then return.
+ //
+ return EFI_NOT_FOUND;
+ }
+ //
+ // Loop through all the device handles that support the BLOCK_IO Protocol
+ //
+ for (Index = 0; Index < BlockIoHandleCount; Index++) {
+
+ Status = gBS->HandleProtocol (BlockIoBuffer[Index], &gEfiDevicePathProtocolGuid, (VOID *) &BlockIoDevicePath);
+ if (EFI_ERROR (Status) || BlockIoDevicePath == NULL) {
+ continue;
+ }
+ //
+ // Make PreviousDevicePath == the device path node before the end node
+ //
+ DevicePath = BlockIoDevicePath;
+ BlockIoHdDevicePath = NULL;
+
+ //
+ // find HardDriver device path node
+ //
+ while (!IsDevicePathEnd (DevicePath)) {
+ if ((DevicePathType (DevicePath) == MEDIA_DEVICE_PATH) &&
+ (DevicePathSubType (DevicePath) == MEDIA_HARDDRIVE_DP)
+ ) {
+ BlockIoHdDevicePath = DevicePath;
+ break;
+ }
+
+ DevicePath = NextDevicePathNode (DevicePath);
+ }
+
+ if (BlockIoHdDevicePath == NULL) {
+ continue;
+ }
+ //
+ // See if the harddrive device path in blockio matches the orig Hard Drive Node
+ //
+ DevicePathMatch = FALSE;
+
+ TmpHdPath = (HARDDRIVE_DEVICE_PATH *) BlockIoHdDevicePath;
+ TempPath = (HARDDRIVE_DEVICE_PATH *) BdsLibUnpackDevicePath ((EFI_DEVICE_PATH_PROTOCOL *) HardDriveDevicePath);
+
+ //
+ // Only several fields will be checked. NOT whole NODE
+ //
+ if ( TmpHdPath->PartitionNumber == TempPath->PartitionNumber &&
+ TmpHdPath->MBRType == TempPath->MBRType &&
+ TmpHdPath->SignatureType == TempPath->SignatureType &&
+ EfiCompareGuid ((EFI_GUID *) TmpHdPath->Signature, (EFI_GUID *) TempPath->Signature)) {
+ //
+ // Get the matched device path
+ //
+ DevicePathMatch = TRUE;
+ }
+ //
+ // Only do the boot, when devicepath match
+ //
+ if (DevicePathMatch) {
+ //
+ // Combine the Block IO and Hard Drive Device path together and try
+ // to boot from it.
+ //
+ DevicePath = NextDevicePathNode ((EFI_DEVICE_PATH_PROTOCOL *) HardDriveDevicePath);
+ NewDevicePath = EfiAppendDevicePath (BlockIoDevicePath, DevicePath);
+
+ //
+ // Recursive boot with new device path
+ //
+ Status = BdsLibBootViaBootOption (Option, NewDevicePath, ExitDataSize, ExitData);
+ if (!EFI_ERROR (Status)) {
+ break;
+ }
+ }
+ }
+
+ gBS->FreePool (BlockIoBuffer);
+ return Status;
+}
+
+
+EFI_STATUS
+EFIAPI
+BdsLibUpdateFvFileDevicePath (
+ IN OUT EFI_DEVICE_PATH_PROTOCOL ** DevicePath,
+ IN EFI_GUID *FileGuid
+ )
+/*++
+
+Routine Description:
+ According to a file guild, check a Fv file device path is valid. If it is invalid,
+ try to return the valid device path.
+ FV address maybe changes for memory layout adjust from time to time, use this funciton
+ could promise the Fv file device path is right.
+
+Arguments:
+ DevicePath - on input, the Fv file device path need to check
+ on output, the updated valid Fv file device path
+
+ FileGuid - the Fv file guild
+
+Returns:
+ EFI_INVALID_PARAMETER - the input DevicePath or FileGuid is invalid parameter
+ EFI_UNSUPPORTED - the input DevicePath does not contain Fv file guild at all
+ EFI_ALREADY_STARTED - the input DevicePath has pointed to Fv file, it is valid
+ EFI_SUCCESS - has successfully updated the invalid DevicePath, and return the updated
+ device path in DevicePath
+
+--*/
+{
+ EFI_DEVICE_PATH_PROTOCOL *TempDevicePath;
+ EFI_DEVICE_PATH_PROTOCOL *LastDeviceNode;
+ EFI_STATUS Status;
+ EFI_GUID *GuidPoint;
+ UINTN Index;
+ UINTN FvHandleCount;
+ EFI_HANDLE *FvHandleBuffer;
+ EFI_FV_FILETYPE Type;
+ UINTN Size;
+ EFI_FV_FILE_ATTRIBUTES Attributes;
+ UINT32 AuthenticationStatus;
+ BOOLEAN FindFvFile;
+ EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;
+#if (PI_SPECIFICATION_VERSION < 0x00010000)
+ EFI_FIRMWARE_VOLUME_PROTOCOL *Fv;
+#else
+ EFI_FIRMWARE_VOLUME2_PROTOCOL *Fv;
+#endif
+ MEDIA_FW_VOL_FILEPATH_DEVICE_PATH FvFileNode;
+ EFI_HANDLE FoundFvHandle;
+ EFI_DEVICE_PATH_PROTOCOL *NewDevicePath;
+
+ if ((DevicePath == NULL) || (*DevicePath == NULL)) {
+ return EFI_INVALID_PARAMETER;
+ }
+ if (FileGuid == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+ //
+ // Check whether the device path point to the default the input Fv file
+ //
+ TempDevicePath = *DevicePath;
+ LastDeviceNode = TempDevicePath;
+ while (!EfiIsDevicePathEnd (TempDevicePath)) {
+ LastDeviceNode = TempDevicePath;
+ TempDevicePath = EfiNextDevicePathNode (TempDevicePath);
+ }
+ GuidPoint = EfiGetNameGuidFromFwVolDevicePathNode (
+ (MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *) LastDeviceNode
+ );
+ if (GuidPoint == NULL) {
+ //
+ // if this option does not points to a Fv file, just return EFI_UNSUPPORTED
+ //
+ return EFI_UNSUPPORTED;
+ }
+ if (!EfiCompareGuid (GuidPoint, FileGuid)) {
+ //
+ // If the Fv file is not the input file guid, just return EFI_UNSUPPORTED
+ //
+ return EFI_UNSUPPORTED;
+ }
+
+ //
+ // Check whether the input Fv file device path is valid
+ //
+ TempDevicePath = *DevicePath;
+ FoundFvHandle = NULL;
+ Status = gBS->LocateDevicePath (
+ #if (PI_SPECIFICATION_VERSION < 0x00010000)
+ &gEfiFirmwareVolumeProtocolGuid,
+ #else
+ &gEfiFirmwareVolume2ProtocolGuid,
+ #endif
+ &TempDevicePath,
+ &FoundFvHandle
+ );
+ if (!EFI_ERROR (Status)) {
+ Status = gBS->HandleProtocol (
+ FoundFvHandle,
+ #if (PI_SPECIFICATION_VERSION < 0x00010000)
+ &gEfiFirmwareVolumeProtocolGuid,
+ #else
+ &gEfiFirmwareVolume2ProtocolGuid,
+ #endif
+ (VOID **) &Fv
+ );
+ if (!EFI_ERROR (Status)) {
+ //
+ // Set FV ReadFile Buffer as NULL, only need to check whether input Fv file exist there
+ //
+ Status = Fv->ReadFile (
+ Fv,
+ FileGuid,
+ NULL,
+ &Size,
+ &Type,
+ &Attributes,
+ &AuthenticationStatus
+ );
+ if (!EFI_ERROR (Status)) {
+ return EFI_ALREADY_STARTED;
+ }
+ }
+ }
+
+ //
+ // Look for the input wanted FV file in current FV
+ // First, try to look for in Bds own FV. Bds and input wanted FV file usually are in the same FV
+ //
+ FindFvFile = FALSE;
+ FoundFvHandle = NULL;
+ Status = gBS->HandleProtocol (
+ mBdsImageHandle,
+ &gEfiLoadedImageProtocolGuid,
+ &LoadedImage
+ );
+ if (!EFI_ERROR (Status)) {
+ Status = gBS->HandleProtocol (
+ LoadedImage->DeviceHandle,
+ #if (PI_SPECIFICATION_VERSION < 0x00010000)
+ &gEfiFirmwareVolumeProtocolGuid,
+ #else
+ &gEfiFirmwareVolume2ProtocolGuid,
+ #endif
+ (VOID **) &Fv
+ );
+ if (!EFI_ERROR (Status)) {
+ Status = Fv->ReadFile (
+ Fv,
+ FileGuid,
+ NULL,
+ &Size,
+ &Type,
+ &Attributes,
+ &AuthenticationStatus
+ );
+ if (!EFI_ERROR (Status)) {
+ FindFvFile = TRUE;
+ FoundFvHandle = LoadedImage->DeviceHandle;
+ }
+ }
+ }
+ //
+ // Second, if fail to find, try to enumerate all FV
+ //
+ if (!FindFvFile) {
+ FvHandleBuffer = NULL;
+ gBS->LocateHandleBuffer (
+ ByProtocol,
+ #if (PI_SPECIFICATION_VERSION < 0x00010000)
+ &gEfiFirmwareVolumeProtocolGuid,
+ #else
+ &gEfiFirmwareVolume2ProtocolGuid,
+ #endif
+ NULL,
+ &FvHandleCount,
+ &FvHandleBuffer
+ );
+ for (Index = 0; Index < FvHandleCount; Index++) {
+ gBS->HandleProtocol (
+ FvHandleBuffer[Index],
+ #if (PI_SPECIFICATION_VERSION < 0x00010000)
+ &gEfiFirmwareVolumeProtocolGuid,
+ #else
+ &gEfiFirmwareVolume2ProtocolGuid,
+ #endif
+ (VOID **) &Fv
+ );
+
+ Status = Fv->ReadFile (
+ Fv,
+ FileGuid,
+ NULL,
+ &Size,
+ &Type,
+ &Attributes,
+ &AuthenticationStatus
+ );
+ if (EFI_ERROR (Status)) {
+ //
+ // Skip if input Fv file not in the FV
+ //
+ continue;
+ }
+ FindFvFile = TRUE;
+ FoundFvHandle = FvHandleBuffer[Index];
+ break;
+ }
+
+ if (FvHandleBuffer !=NULL ) {
+ gBS->FreePool (FvHandleBuffer);
+ }
+ }
+
+ if (FindFvFile) {
+ //
+ // Build the shell device path
+ //
+ NewDevicePath = EfiDevicePathFromHandle (FoundFvHandle);
+ EfiInitializeFwVolDevicepathNode (&FvFileNode, FileGuid);
+ NewDevicePath = EfiAppendDevicePathNode (NewDevicePath, (EFI_DEVICE_PATH_PROTOCOL *) &FvFileNode);
+ *DevicePath = NewDevicePath;
+ return EFI_SUCCESS;
+ }
+ return EFI_NOT_FOUND;
+}
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/AmtWrapper/Dxe/BdsConnect.c b/Board/EM/MeWrapper/AmtWrapper/Dxe/BdsConnect.c
new file mode 100644
index 0000000..597727f
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/Dxe/BdsConnect.c
@@ -0,0 +1,175 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/AmtWrapper/AmtWrapperDxe/BdsConnect.c 1 2/08/12 1:08a Klzhan $
+//
+// $Revision: 1 $
+//
+// $Date: 2/08/12 1:08a $
+//
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/AmtWrapper/AmtWrapperDxe/BdsConnect.c $
+//
+// 1 2/08/12 1:08a Klzhan
+// Initial Check in
+//
+// 1 2/25/11 1:43a Klzhan
+// Initial Check-in
+//
+// 1 12/03/10 5:10a Klzhan
+// Initial Check-in.
+//
+//
+//**********************************************************************
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: BdsConnect.c
+//
+// Description: Connect the device for AMT Boot.
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+/*++
+
+Copyright (c) 2004, Intel Corporation
+All rights reserved. This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution. The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+Module Name:
+
+ BdsConnect.c
+
+Abstract:
+
+ BDS Lib functions which relate with connect the device
+
+--*/
+#include "BdsLib.h"
+#include "EdkIIGlueUefiLib.h"
+
+EFI_STATUS
+BdsLibConnectAllEfi (
+ VOID
+ )
+/*++
+
+Routine Description:
+
+ This function will connect all current system handles recursively. The
+ connection will finish until every handle's child handle created if it have.
+
+Arguments:
+
+ None
+
+Returns:
+
+ EFI_SUCCESS - All handles and it's child handle have been connected
+
+ EFI_STATUS - Return the status of gBS->LocateHandleBuffer().
+
+--*/
+{
+ EFI_STATUS Status;
+ UINTN HandleCount;
+ EFI_HANDLE *HandleBuffer;
+ UINTN Index;
+
+ Status = gBS->LocateHandleBuffer (
+ AllHandles,
+ NULL,
+ NULL,
+ &HandleCount,
+ &HandleBuffer
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ for (Index = 0; Index < HandleCount; Index++) {
+ Status = gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE);
+ }
+
+ gBS->FreePool (HandleBuffer);
+
+ return EFI_SUCCESS;
+}
+
+VOID
+BdsLibConnectAllDriversToAllControllers (
+ VOID
+ )
+/*++
+
+Routine Description:
+
+ Connects all drivers to all controllers.
+ This function make sure all the current system driver will manage
+ the correspoinding controllers if have. And at the same time, make
+ sure all the system controllers have driver to manage it if have.
+
+Arguments:
+
+ None
+
+Returns:
+
+ None
+
+--*/
+{
+ EFI_STATUS Status;
+
+ Status = EfiGetSystemConfigurationTable (&gEfiDxeServicesTableGuid, (VOID**) &gDS);
+
+ do {
+ //
+ // Connect All EFI 1.10 drivers following EFI 1.10 algorithm
+ //
+ BdsLibConnectAllEfi ();
+
+ //
+ // Check to see if it's possible to dispatch an more DXE drivers.
+ // The BdsLibConnectAllEfi () may have made new DXE drivers show up.
+ // If anything is Dispatched Status == EFI_SUCCESS and we will try
+ // the connect again.
+ //
+ Status = gDS->Dispatch ();
+
+ } while (!EFI_ERROR (Status));
+
+}
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/AmtWrapper/Dxe/BdsConsole.c b/Board/EM/MeWrapper/AmtWrapper/Dxe/BdsConsole.c
new file mode 100644
index 0000000..b55a0a1
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/Dxe/BdsConsole.c
@@ -0,0 +1,251 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/AmtWrapper/AmtWrapperDxe/BdsConsole.c 2 5/14/14 9:53p Tristinchou $
+//
+// $Revision: 2 $
+//
+// $Date: 5/14/14 9:53p $
+//
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/AmtWrapper/AmtWrapperDxe/BdsConsole.c $
+//
+// 2 5/14/14 9:53p Tristinchou
+// [TAG] EIP167030
+// [Category] Improvement
+// [Description] Remove the variable runtime attribute and keep original
+// attributes.
+//
+// 1 2/08/12 1:08a Klzhan
+// Initial Check in
+//
+// 1 2/25/11 1:43a Klzhan
+// Initial Check-in
+//
+// 1 12/03/10 5:10a Klzhan
+// Initial Check-in.
+//
+//
+//**********************************************************************
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: BdsConsole.c
+//
+// Description: Connect the Console device for AMT.
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+/*++
+
+Copyright (c) 2004, Intel Corporation
+All rights reserved. This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution. The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+Module Name:
+
+ BdsConsole.c
+
+Abstract:
+
+ BDS Lib functions which contain all the code to connect console device
+
+--*/
+
+#include "BdsLib.h"
+#include "EfiPrintLib.h"
+
+EFI_STATUS
+BdsLibUpdateConsoleVariable (
+ IN CHAR16 *ConVarName,
+ IN EFI_DEVICE_PATH_PROTOCOL *CustomizedConDevicePath,
+ IN EFI_DEVICE_PATH_PROTOCOL *ExclusiveDevicePath
+ )
+/*++
+
+Routine Description:
+
+ This function update console variable based on ConVarName, it can
+ add or remove one specific console device path from the variable
+
+Arguments:
+
+ ConVarName - Console related variable name, ConIn, ConOut, ErrOut.
+
+ CustomizedConDevicePath - The console device path which will be added to
+ the console variable ConVarName, this parameter
+ can not be multi-instance.
+
+ ExclusiveDevicePath - The console device path which will be removed
+ from the console variable ConVarName, this
+ parameter can not be multi-instance.
+
+Returns:
+
+ EFI_UNSUPPORTED - Add or remove the same device path.
+
+ EFI_SUCCESS - Success add or remove the device path from
+ the console variable.
+
+--*/
+{
+ EFI_STATUS Status;
+ EFI_DEVICE_PATH_PROTOCOL *VarConsole;
+ UINTN DevicePathSize;
+ EFI_DEVICE_PATH_PROTOCOL *Instance;
+ EFI_DEVICE_PATH_PROTOCOL *NewDevicePath;
+ UINT32 VarAttr;
+ UINTN VarSize;
+
+
+ VarConsole = NULL;
+ DevicePathSize = 0;
+ NewDevicePath = NULL;
+ Status = EFI_UNSUPPORTED;
+
+ //
+ // Notes: check the device path point, here should check
+ // with compare memory
+ //
+ if (CustomizedConDevicePath == ExclusiveDevicePath) {
+ return EFI_UNSUPPORTED;
+ }
+ //
+ // Delete the ExclusiveDevicePath from current default console
+ //
+ VarConsole = BdsLibGetVariableAndSize (
+ ConVarName,
+ &gEfiGlobalVariableGuid,
+ &DevicePathSize
+ );
+
+ if (ExclusiveDevicePath != NULL && VarConsole != NULL) {
+ if (BdsLibMatchDevicePaths (VarConsole, ExclusiveDevicePath)) {
+
+ Instance = EfiDevicePathInstance (&VarConsole, &DevicePathSize);
+
+ while (VarConsole != NULL) {
+ if (EfiCompareMem (
+ Instance,
+ ExclusiveDevicePath,
+ DevicePathSize - sizeof (EFI_DEVICE_PATH_PROTOCOL)
+ ) == 0) {
+ //
+ // Remove the match part
+ //
+ NewDevicePath = EfiAppendDevicePathInstance (NewDevicePath, VarConsole);
+ break;
+ } else {
+ //
+ // Continue the next instance
+ //
+ NewDevicePath = EfiAppendDevicePathInstance (NewDevicePath, Instance);
+ }
+
+ Instance = EfiDevicePathInstance (&VarConsole, &DevicePathSize);
+ }
+ //
+ // Reset the console variable with new device path
+ //
+ VarAttr = 0;
+ VarSize = 0;
+
+ Status = gRT->GetVariable(
+ ConVarName,
+ &gEfiGlobalVariableGuid,
+ &VarAttr,
+ &VarSize,
+ NULL );
+ if( EFI_ERROR(Status) && Status != EFI_BUFFER_TOO_SMALL )
+ {
+ VarAttr = EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE;
+ VarSize = EfiDevicePathSize( NewDevicePath );
+ }
+
+ gRT->SetVariable(
+ ConVarName,
+ &gEfiGlobalVariableGuid,
+ VarAttr,
+ VarSize,
+ NewDevicePath );
+ }
+ }
+ //
+ // Try to append customized device path
+ //
+ VarConsole = BdsLibGetVariableAndSize (
+ ConVarName,
+ &gEfiGlobalVariableGuid,
+ &DevicePathSize
+ );
+
+ if (CustomizedConDevicePath != NULL) {
+ if (!BdsLibMatchDevicePaths (VarConsole, CustomizedConDevicePath)) {
+ //
+ // In the first check, the default console variable will be null,
+ // just append current customized device path
+ //
+ VarConsole = EfiAppendDevicePathInstance (VarConsole, CustomizedConDevicePath);
+
+ //
+ // Update the variable of the default console
+ //
+ VarAttr = 0;
+ VarSize = 0;
+
+ Status = gRT->GetVariable(
+ ConVarName,
+ &gEfiGlobalVariableGuid,
+ &VarAttr,
+ &VarSize,
+ NULL );
+ if( EFI_ERROR(Status) && Status != EFI_BUFFER_TOO_SMALL )
+ {
+ VarAttr = EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE;
+ VarSize = EfiDevicePathSize( NewDevicePath );
+ }
+
+ gRT->SetVariable(
+ ConVarName,
+ &gEfiGlobalVariableGuid,
+ VarAttr,
+ VarSize,
+ VarConsole );
+ }
+ }
+
+ 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/AmtWrapper/Dxe/BdsLib.h b/Board/EM/MeWrapper/AmtWrapper/Dxe/BdsLib.h
new file mode 100644
index 0000000..5a4e10a
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/Dxe/BdsLib.h
@@ -0,0 +1,459 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/AmtWrapper/AmtWrapperDxe/BdsLib.h 1 2/08/12 1:08a Klzhan $
+//
+// $Revision: 1 $
+//
+// $Date: 2/08/12 1:08a $
+//
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/AmtWrapper/AmtWrapperDxe/BdsLib.h $
+//
+// 1 2/08/12 1:08a Klzhan
+// Initial Check in
+//
+// 3 9/21/11 8:52a Klzhan
+// [TAG] EIP69500
+// [Category] Bug Fix
+// [Severity] Minor
+// [Symptom] Compiler error when DXE_PERFORMANCE is on
+// [RootCause] EDK Library doesn't support this function.
+// [Files] BdsLib.h
+// Performance.c
+//
+// 1 2/25/11 1:43a Klzhan
+// Initial Check-in
+//
+// 1 12/03/10 5:10a Klzhan
+// Initial Check-in.
+//
+//
+//**********************************************************************
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: BdsConsole.h
+//
+// Description: BDS library definition, include the file and data structure
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+/*++
+
+Copyright (c) 2004, Intel Corporation
+All rights reserved. This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution. The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+Module Name:
+
+ BdsLib.h
+
+Abstract:
+
+ BDS library definition, include the file and data structure
+
+--*/
+
+#ifndef _BDS_LIB_H_
+#define _BDS_LIB_H_
+
+#include "Tiano.h"
+#include "EfiDriverLib.h"
+#include "EfiPrintLib.h"
+#include "BmMachine.h"
+#include "EfiHobLib.h"
+
+#include EFI_PROTOCOL_DEFINITION (SerialIo)
+#include EFI_PROTOCOL_DEFINITION (BlockIo)
+#include EFI_PROTOCOL_DEFINITION (LegacyBios)
+#include EFI_PROTOCOL_DEFINITION (AcpiS3Save)
+#include EFI_PROTOCOL_DEFINITION (LoadedImage)
+#include EFI_PROTOCOL_DEFINITION (SimpleFileSystem)
+#include EFI_PROTOCOL_DEFINITION (SimpleNetwork)
+#include EFI_PROTOCOL_DEFINITION (LoadFile)
+#include EFI_PROTOCOL_DEFINITION (PlatformDriverOverride)
+#include EFI_PROTOCOL_DEFINITION (ConsoleControl)
+#include EFI_PROTOCOL_DEFINITION (UgaDraw)
+#include EFI_PROTOCOL_DEFINITION (Hii)
+#include EFI_PROTOCOL_DEFINITION (FirmwareVolume)
+
+#include EFI_PROTOCOL_DEFINITION (TcgService)
+#include EFI_GUID_DEFINITION (PcAnsi)
+#include EFI_GUID_DEFINITION (Hob)
+#include EFI_GUID_DEFINITION (HotPlugDevice)
+#include EFI_GUID_DEFINITION (GlobalVariable)
+#include EFI_GUID_DEFINITION (EfiShell)
+#include EFI_GUID_DEFINITION (ConsoleInDevice)
+#include EFI_GUID_DEFINITION (ConsoleOutDevice)
+#include EFI_GUID_DEFINITION (StandardErrorDevice)
+
+//
+// Include the performance head file and defind macro to add perf data
+//
+#ifdef EFI_DXE_PERFORMANCE
+#include "Performance.h"
+#define WRITE_BOOT_TO_OS_PERFORMANCE_DATA WriteBootToOsPerformanceData ()
+#else
+#define WRITE_BOOT_TO_OS_PERFORMANCE_DATA
+#endif
+
+extern EFI_HANDLE mBdsImageHandle;
+
+//
+// Constants which are variable names used to access variables
+//
+#define VarLegacyDevOrder L"LegacyDevOrder"
+
+//
+// Data structures and defines
+//
+#define FRONT_PAGE_QUESTION_ID 0x0000
+#define FRONT_PAGE_DATA_WIDTH 0x01
+
+//
+// ConnectType
+//
+#define CONSOLE_OUT 0x00000001
+#define STD_ERROR 0x00000002
+#define CONSOLE_IN 0x00000004
+#define CONSOLE_ALL (CONSOLE_OUT | CONSOLE_IN | STD_ERROR)
+
+//
+// Load Option Attributes defined in EFI Specification
+//
+#define LOAD_OPTION_ACTIVE 0x00000001
+#define LOAD_OPTION_FORCE_RECONNECT 0x00000002
+#define IS_LOAD_OPTION_TYPE(_c, _Mask) (BOOLEAN) (((_c) & (_Mask)) != 0)
+
+//
+// Define Maxmim characters that will be accepted
+//
+#define MAX_CHAR 480
+#define MAX_CHAR_SIZE (MAX_CHAR * 2)
+
+#define MIN_ALIGNMENT_SIZE 4
+#define ALIGN_SIZE(a) ((a % MIN_ALIGNMENT_SIZE) ? MIN_ALIGNMENT_SIZE - (a % MIN_ALIGNMENT_SIZE) : 0)
+
+//
+// This data structure is the part of BDS_CONNECT_ENTRY that we can hard code.
+//
+#define BDS_LOAD_OPTION_SIGNATURE EFI_SIGNATURE_32 ('B', 'd', 'C', 'O')
+
+typedef struct {
+
+ UINTN Signature;
+ EFI_LIST_ENTRY Link;
+
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;
+
+ CHAR16 *OptionName;
+ UINTN OptionNumber;
+ UINT16 BootCurrent;
+ UINT32 Attribute;
+ CHAR16 *Description;
+ VOID *LoadOptions;
+ UINT32 LoadOptionsSize;
+
+} BDS_COMMON_OPTION;
+
+typedef struct {
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;
+ UINTN ConnectType;
+} BDS_CONSOLE_CONNECT_ENTRY;
+
+//
+// Lib Functions
+//
+
+//
+// Bds boot relate lib functions
+//
+EFI_STATUS
+BdsLibUpdateBootOrderList (
+ IN EFI_LIST_ENTRY *BdsOptionList,
+ IN CHAR16 *VariableName
+ );
+
+VOID
+BdsLibBootNext (
+ VOID
+ );
+
+EFI_STATUS
+BdsLibBootViaBootOption (
+ IN BDS_COMMON_OPTION * Option,
+ IN EFI_DEVICE_PATH_PROTOCOL * DevicePath,
+ OUT UINTN *ExitDataSize,
+ OUT CHAR16 **ExitData OPTIONAL
+ );
+
+EFI_STATUS
+BdsLibEnumerateAllBootOption (
+ IN OUT EFI_LIST_ENTRY *BdsBootOptionList
+ );
+
+VOID
+BdsLibBuildOptionFromHandle (
+ IN EFI_HANDLE Handle,
+ IN EFI_LIST_ENTRY *BdsBootOptionList
+ );
+
+VOID
+BdsLibBuildOptionFromShell (
+ IN EFI_HANDLE Handle,
+ IN EFI_LIST_ENTRY *BdsBootOptionList
+ );
+
+//
+// Bds misc lib functions
+//
+UINT16
+BdsLibGetTimeout (
+ VOID
+ );
+
+EFI_STATUS
+BdsLibGetBootMode (
+ OUT EFI_BOOT_MODE *BootMode
+ );
+
+VOID
+BdsLibLoadDrivers (
+ IN EFI_LIST_ENTRY *BdsDriverLists
+ );
+
+EFI_STATUS
+BdsLibBuildOptionFromVar (
+ IN EFI_LIST_ENTRY *BdsCommonOptionList,
+ IN CHAR16 *VariableName
+ );
+
+VOID *
+BdsLibGetVariableAndSize (
+ IN CHAR16 *Name,
+ IN EFI_GUID *VendorGuid,
+ OUT UINTN *VariableSize
+ );
+
+EFI_STATUS
+BdsLibOutputStrings (
+ IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *ConOut,
+ ...
+ );
+
+BDS_COMMON_OPTION *
+BdsLibVariableToOption (
+ IN OUT EFI_LIST_ENTRY *BdsCommonOptionList,
+ IN CHAR16 *VariableName
+ );
+
+EFI_STATUS
+BdsLibRegisterNewOption (
+ IN EFI_LIST_ENTRY *BdsOptionList,
+ IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
+ IN CHAR16 *String,
+ IN CHAR16 *VariableName
+ );
+
+//
+// Bds connect or disconnect driver lib funcion
+//
+VOID
+BdsLibConnectAllDriversToAllControllers (
+ VOID
+ );
+
+VOID
+BdsLibConnectAll (
+ VOID
+ );
+
+EFI_STATUS
+BdsLibConnectDevicePath (
+ IN EFI_DEVICE_PATH_PROTOCOL *DevicePathToConnect
+ );
+
+EFI_STATUS
+BdsLibConnectAllEfi (
+ VOID
+ );
+
+EFI_STATUS
+BdsLibDisconnectAllEfi (
+ VOID
+ );
+
+//
+// Bds console relate lib functions
+//
+VOID
+BdsLibConnectAllConsoles (
+ VOID
+ );
+
+EFI_STATUS
+BdsLibConnectAllDefaultConsoles (
+ VOID
+ );
+
+EFI_STATUS
+BdsLibUpdateConsoleVariable (
+ IN CHAR16 *ConVarName,
+ IN EFI_DEVICE_PATH_PROTOCOL *CustomizedConDevicePath,
+ IN EFI_DEVICE_PATH_PROTOCOL *ExclusiveDevicePath
+ );
+
+EFI_STATUS
+BdsLibConnectConsoleVariable (
+ IN CHAR16 *ConVarName
+ );
+
+//
+// Bds device path relate lib functions
+//
+EFI_DEVICE_PATH_PROTOCOL *
+BdsLibUnpackDevicePath (
+ IN EFI_DEVICE_PATH_PROTOCOL *DevPath
+ );
+
+BOOLEAN
+BdsLibMatchDevicePaths (
+ IN EFI_DEVICE_PATH_PROTOCOL *Multi,
+ IN EFI_DEVICE_PATH_PROTOCOL *Single
+ );
+
+CHAR16 *
+DevicePathToStr (
+ EFI_DEVICE_PATH_PROTOCOL *DevPath
+ );
+
+VOID *
+EfiLibGetVariable (
+ IN CHAR16 *Name,
+ IN EFI_GUID *VendorGuid
+ );
+
+//
+// Internal definitions
+//
+typedef struct {
+ CHAR16 *str;
+ UINTN len;
+ UINTN maxlen;
+} POOL_PRINT;
+
+typedef struct {
+ UINT8 Type;
+ UINT8 SubType;
+ VOID (*Function) (POOL_PRINT *, VOID *);
+} DEVICE_PATH_STRING_TABLE;
+
+//
+// Internal functions
+//
+EFI_STATUS
+BdsBootByDiskSignatureAndPartition (
+ IN BDS_COMMON_OPTION * Option,
+ IN HARDDRIVE_DEVICE_PATH * HardDriveDevicePath,
+ IN UINT32 LoadOptionsSize,
+ IN VOID *LoadOptions,
+ OUT UINTN *ExitDataSize,
+ OUT CHAR16 **ExitData OPTIONAL
+ );
+
+//
+// Notes: EFI 64 shadow all option rom
+//
+#ifdef EFI64
+#define EFI64_SHADOW_ALL_LEGACY_ROM() ShadowAllOptionRom ();
+VOID
+ShadowAllOptionRom();
+#else
+#define EFI64_SHADOW_ALL_LEGACY_ROM()
+#endif
+
+//
+// BBS support macros and functions
+//
+
+#if defined(EFI32) || defined(EFIX64)
+#define REFRESH_LEGACY_BOOT_OPTIONS \
+ BdsDeleteAllInvalidLegacyBootOptions ();\
+ BdsAddNonExistingLegacyBootOptions (); \
+ BdsUpdateLegacyDevOrder ()
+#else
+#define REFRESH_LEGACY_BOOT_OPTIONS
+#endif
+
+EFI_STATUS
+BdsDeleteAllInvalidLegacyBootOptions (
+ VOID
+ );
+
+EFI_STATUS
+BdsAddNonExistingLegacyBootOptions (
+ VOID
+ );
+
+EFI_STATUS
+BdsUpdateLegacyDevOrder (
+ VOID
+ );
+
+EFI_STATUS
+BdsRefreshBbsTableForBoot (
+ IN BDS_COMMON_OPTION *Entry
+ );
+
+extern VOID
+WriteBootToOsPerformanceData (
+ VOID
+ );
+
+BOOLEAN
+BdsLibIsValidEFIBootOptDevicePath (
+ IN EFI_DEVICE_PATH_PROTOCOL *DevPath,
+ IN BOOLEAN CheckMedia
+ );
+
+EFI_STATUS
+EFIAPI
+BdsLibUpdateFvFileDevicePath (
+ IN OUT EFI_DEVICE_PATH_PROTOCOL ** DevicePath,
+ IN EFI_GUID *FileGuid
+ );
+
+#endif // _BDS_LIB_H_
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/AmtWrapper/Dxe/BdsMisc.c b/Board/EM/MeWrapper/AmtWrapper/Dxe/BdsMisc.c
new file mode 100644
index 0000000..2b23d21
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/Dxe/BdsMisc.c
@@ -0,0 +1,594 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/AmtWrapper/AmtWrapperDxe/BdsMisc.c 2 5/14/14 9:53p Tristinchou $
+//
+// $Revision: 2 $
+//
+// $Date: 5/14/14 9:53p $
+//
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/AmtWrapper/AmtWrapperDxe/BdsMisc.c $
+//
+// 2 5/14/14 9:53p Tristinchou
+// [TAG] EIP167030
+// [Category] Improvement
+// [Description] Remove the variable runtime attribute and keep original
+// attributes.
+//
+// 1 2/08/12 1:08a Klzhan
+// Initial Check in
+//
+// 1 2/25/11 1:43a Klzhan
+// Initial Check-in
+//
+// 1 12/03/10 5:10a Klzhan
+// Initial Check-in.
+//
+//
+//**********************************************************************
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: BdsMisc.h
+//
+// Description: Misc BDS library function
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+/*++
+
+Copyright (c) 2004 - 2005, Intel Corporation
+All rights reserved. This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution. The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+Module Name:
+
+ BdsMisc.c
+
+Abstract:
+
+ Misc BDS library function
+
+--*/
+
+#include "BdsLib.h"
+
+extern UINT16 gPlatformBootTimeOutDefault;
+
+UINT16
+BdsLibGetTimeout (
+ VOID
+ )
+/*++
+
+Routine Description:
+
+ Return the default value for system Timeout variable.
+
+Arguments:
+
+ None
+
+Returns:
+
+ Timeout value.
+
+--*/
+{
+ UINT16 Timeout;
+ UINT32 VarAttr;
+ UINTN Size;
+ EFI_STATUS Status;
+
+ //
+ // Return Timeout variable or 0xffff if no valid
+ // Timeout variable exists.
+ //
+ VarAttr = 0;
+ Size = sizeof(UINT16);
+ Status = gRT->GetVariable(
+ L"Timeout",
+ &gEfiGlobalVariableGuid,
+ &VarAttr,
+ &Size,
+ &Timeout );
+ if (!EFI_ERROR (Status)) {
+ return Timeout;
+ }
+
+ if( EFI_ERROR (Status) && (Status != EFI_BUFFER_TOO_SMALL) )
+ {
+ VarAttr = EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE;
+ Size = sizeof(UINT16);
+ }
+ //
+ // To make the current EFI Automatic-Test activity possible, just add
+ // following code to make AutoBoot enabled when this variable is not
+ // present.
+ // This code should be removed later.
+ //
+ Timeout = gPlatformBootTimeOutDefault;
+
+ //
+ // Notes: Platform should set default variable if non exists on all error cases!!!
+ //
+ Status = gRT->SetVariable(
+ L"Timeout",
+ &gEfiGlobalVariableGuid,
+ VarAttr,
+ Size,
+ &Timeout );
+
+ return Timeout;
+}
+UINT16
+BdsLibGetFreeOptionNumber (
+ IN CHAR16 *VariableName
+ )
+/*++
+
+Routine Description:
+ Get the Option Number that does not used
+ Try to locate the specific option variable one by one untile find a free number
+
+Arguments:
+ VariableName - Indicate if the boot#### or driver#### option
+
+Returns:
+ The Minimal Free Option Number
+
+--*/
+{
+ UINT16 Number;
+ UINTN Index;
+ CHAR16 StrTemp[10];
+ UINT16 *OptionBuffer;
+ UINTN OptionSize;
+
+ //
+ // Try to find the minimum free number from 0, 1, 2, 3....
+ //
+ Index = 0;
+ do {
+ if (*VariableName == 'B') {
+ SPrint (StrTemp, sizeof (StrTemp), L"Boot%04x", Index);
+ } else {
+ SPrint (StrTemp, sizeof (StrTemp), L"Driver%04x", Index);
+ }
+ //
+ // try if the option number is used
+ //
+ OptionBuffer = BdsLibGetVariableAndSize (
+ StrTemp,
+ &gEfiGlobalVariableGuid,
+ &OptionSize
+ );
+ if (OptionBuffer == NULL) {
+ break;
+ }
+ Index++;
+ } while (1);
+
+ Number = (UINT16) Index;
+ return Number;
+}
+
+EFI_STATUS
+BdsLibRegisterNewOption (
+ IN EFI_LIST_ENTRY *BdsOptionList,
+ IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
+ IN CHAR16 *String,
+ IN CHAR16 *VariableName
+ )
+/*++
+
+Routine Description:
+
+ This function will register the new boot#### or driver#### option base on
+ the VariableName. The new registered boot#### or driver#### will be linked
+ to BdsOptionList and also update to the VariableName. After the boot#### or
+ driver#### updated, the BootOrder or DriverOrder will also be updated.
+
+Arguments:
+
+ BdsOptionList - The header of the boot#### or driver#### link list
+
+ DevicePath - The device path which the boot####
+ or driver#### option present
+
+ String - The description of the boot#### or driver####
+
+ VariableName - Indicate if the boot#### or driver#### option
+
+Returns:
+
+ EFI_SUCCESS - The boot#### or driver#### have been success registered
+
+ EFI_STATUS - Return the status of gRT->SetVariable ().
+
+--*/
+{
+ EFI_STATUS Status;
+ UINTN Index;
+ UINT16 MaxOptionNumber;
+ UINT16 RegisterOptionNumber;
+ UINT16 *TempOptionPtr;
+ UINTN TempOptionSize;
+ UINT16 *OptionOrderPtr;
+ VOID *OptionPtr;
+ UINTN OptionSize;
+ UINT8 *TempPtr;
+ EFI_DEVICE_PATH_PROTOCOL *OptionDevicePath;
+ CHAR16 *Description;
+ CHAR16 OptionName[10];
+ BOOLEAN UpdateDescription;
+ UINT16 BootOrderEntry;
+ UINTN OrderItemNum;
+ UINT32 VarAttr;
+ UINTN VarSize;
+
+
+ OptionPtr = NULL;
+ OptionSize = 0;
+ TempPtr = NULL;
+ OptionDevicePath = NULL;
+ Description = NULL;
+ MaxOptionNumber = 0;
+ OptionOrderPtr = NULL;
+ UpdateDescription = FALSE;
+ EfiZeroMem (OptionName, sizeof (OptionName));
+
+ TempOptionSize = 0;
+ TempOptionPtr = BdsLibGetVariableAndSize (
+ VariableName,
+ &gEfiGlobalVariableGuid,
+ &TempOptionSize
+ );
+
+ //
+ // Compare with current option variable
+ //
+ for (Index = 0; Index < TempOptionSize / sizeof (UINT16); Index++) {
+
+ if (*VariableName == 'B') {
+ SPrint (OptionName, sizeof (OptionName), L"Boot%04x", TempOptionPtr[Index]);
+ } else {
+ SPrint (OptionName, sizeof (OptionName), L"Driver%04x", TempOptionPtr[Index]);
+ }
+
+ OptionPtr = BdsLibGetVariableAndSize (
+ OptionName,
+ &gEfiGlobalVariableGuid,
+ &OptionSize
+ );
+ if (OptionPtr == NULL) {
+ continue;
+ }
+ TempPtr = OptionPtr;
+ TempPtr += sizeof (UINT32) + sizeof (UINT16);
+ Description = (CHAR16 *) TempPtr;
+ TempPtr += EfiStrSize ((CHAR16 *) TempPtr);
+ OptionDevicePath = (EFI_DEVICE_PATH_PROTOCOL *) TempPtr;
+
+ //
+ // Notes: the description may will change base on the GetStringToken
+ //
+ if (EfiCompareMem (OptionDevicePath, DevicePath, EfiDevicePathSize (OptionDevicePath)) == 0) {
+ if (EfiCompareMem (Description, String, EfiStrSize (Description)) == 0) {
+ //
+ // Got the option, so just return
+ //
+ gBS->FreePool (OptionPtr);
+ gBS->FreePool (TempOptionPtr);
+ return EFI_SUCCESS;
+ } else {
+ //
+ // Option description changed, need update.
+ //
+ UpdateDescription = TRUE;
+ gBS->FreePool (OptionPtr);
+ break;
+ }
+ }
+
+ gBS->FreePool (OptionPtr);
+ }
+
+ OptionSize = sizeof (UINT32) + sizeof (UINT16) + EfiStrSize (String) + EfiDevicePathSize (DevicePath);
+ OptionPtr = EfiLibAllocateZeroPool (OptionSize);
+ TempPtr = OptionPtr;
+ *(UINT32 *) TempPtr = LOAD_OPTION_ACTIVE;
+ TempPtr += sizeof (UINT32);
+ *(UINT16 *) TempPtr = (UINT16) EfiDevicePathSize (DevicePath);
+ TempPtr += sizeof (UINT16);
+ EfiCopyMem (TempPtr, String, EfiStrSize (String));
+ TempPtr += EfiStrSize (String);
+ EfiCopyMem (TempPtr, DevicePath, EfiDevicePathSize (DevicePath));
+
+ if (UpdateDescription) {
+ //
+ // The number in option#### to be updated
+ //
+ RegisterOptionNumber = TempOptionPtr[Index];
+ } else {
+ //
+ // The new option#### number
+ //
+ RegisterOptionNumber = BdsLibGetFreeOptionNumber(VariableName);
+ }
+
+ if (*VariableName == 'B') {
+ SPrint (OptionName, sizeof (OptionName), L"Boot%04x", RegisterOptionNumber);
+ } else {
+ SPrint (OptionName, sizeof (OptionName), L"Driver%04x", RegisterOptionNumber);
+ }
+
+ VarAttr = 0;
+ VarSize = 0;
+
+ Status = gRT->GetVariable(
+ OptionName,
+ &gEfiGlobalVariableGuid,
+ &VarAttr,
+ &VarSize,
+ NULL );
+ if( EFI_ERROR (Status) && (Status != EFI_BUFFER_TOO_SMALL) )
+ {
+ VarAttr = EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE;
+ VarSize = OptionSize;
+ }
+
+ Status = gRT->SetVariable (
+ OptionName,
+ &gEfiGlobalVariableGuid,
+ VarAttr,
+ VarSize,
+ OptionPtr );
+ //
+ // Return if only need to update a changed description or fail to set option.
+ //
+ if (EFI_ERROR (Status) || UpdateDescription) {
+ gBS->FreePool (OptionPtr);
+ gBS->FreePool (TempOptionPtr);
+ return Status;
+ }
+
+ gBS->FreePool (OptionPtr);
+
+ //
+ // Update the option order variable
+ //
+
+ //
+ // If no option order
+ //
+ if (TempOptionSize == 0) {
+ VarAttr = 0;
+ VarSize = 0;
+
+ Status = gRT->GetVariable(
+ VariableName,
+ &gEfiGlobalVariableGuid,
+ &VarAttr,
+ &VarSize,
+ NULL );
+ if( EFI_ERROR (Status) && (Status != EFI_BUFFER_TOO_SMALL) )
+ {
+ VarAttr = EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE;
+ VarSize = sizeof(UINT16);
+ }
+
+ BootOrderEntry = 0;
+
+ Status = gRT->SetVariable(
+ VariableName,
+ &gEfiGlobalVariableGuid,
+ VarAttr,
+ VarSize,
+ &BootOrderEntry );
+ if (EFI_ERROR (Status)) {
+ gBS->FreePool (TempOptionPtr);
+ return Status;
+ }
+ return EFI_SUCCESS;
+ }
+ //
+ // Append the new option number to the original option order
+ //
+ OrderItemNum = (TempOptionSize / sizeof (UINT16)) + 1 ;
+ OptionOrderPtr = EfiLibAllocateZeroPool ( OrderItemNum * sizeof (UINT16));
+ EfiCopyMem (OptionOrderPtr, TempOptionPtr, (OrderItemNum - 1) * sizeof (UINT16));
+
+ OptionOrderPtr[Index] = RegisterOptionNumber;
+
+ VarAttr = 0;
+ VarSize = 0;
+
+ Status = gRT->GetVariable(
+ VariableName,
+ &gEfiGlobalVariableGuid,
+ &VarAttr,
+ &VarSize,
+ NULL );
+ if( EFI_ERROR (Status) && (Status != EFI_BUFFER_TOO_SMALL) )
+ {
+ VarAttr = EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE;
+ VarSize = OrderItemNum * sizeof(UINT16);
+ }
+
+ Status = gRT->SetVariable(
+ VariableName,
+ &gEfiGlobalVariableGuid,
+ VarAttr,
+ VarSize,
+ OptionOrderPtr );
+ if (EFI_ERROR (Status)) {
+ gBS->FreePool (TempOptionPtr);
+ gBS->FreePool (OptionOrderPtr);
+ return Status;
+ }
+
+ gBS->FreePool (TempOptionPtr);
+ gBS->FreePool (OptionOrderPtr);
+
+ return EFI_SUCCESS;
+}
+
+
+VOID *
+BdsLibGetVariableAndSize (
+ IN CHAR16 *Name,
+ IN EFI_GUID *VendorGuid,
+ OUT UINTN *VariableSize
+ )
+/*++
+
+Routine Description:
+
+ Read the EFI variable (VendorGuid/Name) and return a dynamically allocated
+ buffer, and the size of the buffer. If failure return NULL.
+
+Arguments:
+
+ Name - String part of EFI variable name
+
+ VendorGuid - GUID part of EFI variable name
+
+ VariableSize - Returns the size of the EFI variable that was read
+
+Returns:
+
+ Dynamically allocated memory that contains a copy of the EFI variable.
+ Caller is responsible freeing the buffer.
+
+ NULL - Variable was not read
+
+--*/
+{
+ EFI_STATUS Status;
+ UINTN BufferSize;
+ VOID *Buffer;
+
+ Buffer = NULL;
+
+ //
+ // Pass in a zero size buffer to find the required buffer size.
+ //
+ BufferSize = 0;
+ Status = gRT->GetVariable (Name, VendorGuid, NULL, &BufferSize, Buffer);
+ if (Status == EFI_BUFFER_TOO_SMALL) {
+ //
+ // Allocate the buffer to return
+ //
+ Buffer = EfiLibAllocateZeroPool (BufferSize);
+ if (Buffer == NULL) {
+ return NULL;
+ }
+ //
+ // Read variable into the allocated buffer.
+ //
+ Status = gRT->GetVariable (Name, VendorGuid, NULL, &BufferSize, Buffer);
+ if (EFI_ERROR (Status)) {
+ BufferSize = 0;
+ }
+ }
+
+ *VariableSize = BufferSize;
+ return Buffer;
+}
+
+BOOLEAN
+BdsLibMatchDevicePaths (
+ IN EFI_DEVICE_PATH_PROTOCOL *Multi,
+ IN EFI_DEVICE_PATH_PROTOCOL *Single
+ )
+/*++
+
+Routine Description:
+
+ Function compares a device path data structure to that of all the nodes of a
+ second device path instance.
+
+Arguments:
+
+ Multi - A pointer to a multi-instance device path data structure.
+
+ Single - A pointer to a single-instance device path data structure.
+
+Returns:
+
+ TRUE - If the Single is contained within Multi
+
+ FALSE - The Single is not match within Multi
+
+
+--*/
+{
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;
+ EFI_DEVICE_PATH_PROTOCOL *DevicePathInst;
+ UINTN Size;
+
+ if (!Multi || !Single) {
+ return FALSE;
+ }
+
+ DevicePath = Multi;
+ DevicePathInst = EfiDevicePathInstance (&DevicePath, &Size);
+ Size -= sizeof (EFI_DEVICE_PATH_PROTOCOL);
+
+ //
+ // Search for the match of 'Single' in 'Multi'
+ //
+ while (DevicePathInst != NULL) {
+ //
+ // If the single device path is found in multiple device paths,
+ // return success
+ //
+ if (Size == 0) {
+ return FALSE;
+ }
+
+ if (EfiCompareMem (Single, DevicePathInst, Size) == 0) {
+ return TRUE;
+ }
+
+ gBS->FreePool (DevicePathInst);
+ DevicePathInst = EfiDevicePathInstance (&DevicePath, &Size);
+ Size -= sizeof (EFI_DEVICE_PATH_PROTOCOL);
+ }
+
+ return FALSE;
+}
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/AmtWrapper/Dxe/BmMachine.h b/Board/EM/MeWrapper/AmtWrapper/Dxe/BmMachine.h
new file mode 100644
index 0000000..4ba1760
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/Dxe/BmMachine.h
@@ -0,0 +1,102 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/AmtWrapper/AmtWrapperDxe/BmMachine.h 2 10/30/12 8:23a Klzhan $
+//
+// $Revision: 2 $
+//
+// $Date: 10/30/12 8:23a $
+//
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/AmtWrapper/AmtWrapperDxe/BmMachine.h $
+//
+// 2 10/30/12 8:23a Klzhan
+// [TAG] EIP92074
+// [Category] Bug Fix
+// [Severity] Important
+// [Symptom] AMT EFI Boot fail
+// [RootCause] File path incorrect.
+//
+// 1 2/08/12 1:08a Klzhan
+// Initial Check in
+//
+// 1 2/25/11 1:43a Klzhan
+// Initial Check-in
+//
+// 1 12/03/10 5:10a Klzhan
+// Initial Check-in.
+//
+//
+//**********************************************************************
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: BmMachine.h
+//
+// Description: Boot Manager Machine type
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+/*++
+
+Copyright (c) 2004, Intel Corporation
+All rights reserved. This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution. The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+Module Name:
+
+ BmMachine.h
+
+Abstract:
+
+ Boot Manager Machine type
+
+
+
+Revision History
+
+--*/
+
+#ifndef _BM_MACHINE_H
+#define _BM_MACHINE_H
+#include "Token.h"
+
+#if x64_BUILD
+#define DEFAULT_REMOVABLE_FILE_NAME L"\\EFI\\BOOT\\BOOTX64.EFI"
+#else
+#define DEFAULT_REMOVABLE_FILE_NAME L"\\EFI\\BOOT\\BOOTIA32.EFI"
+#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/AmtWrapper/Dxe/DevicePath.c b/Board/EM/MeWrapper/AmtWrapper/Dxe/DevicePath.c
new file mode 100644
index 0000000..7fa871e
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/Dxe/DevicePath.c
@@ -0,0 +1,1078 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/AmtWrapper/AmtWrapperDxe/DevicePath.c 1 2/08/12 1:08a Klzhan $
+//
+// $Revision: 1 $
+//
+// $Date: 2/08/12 1:08a $
+//
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/AmtWrapper/AmtWrapperDxe/DevicePath.c $
+//
+// 1 2/08/12 1:08a Klzhan
+// Initial Check in
+//
+// 1 2/25/11 1:43a Klzhan
+// Initial Check-in
+//
+// 1 12/03/10 5:10a Klzhan
+// Initial Check-in.
+//
+//
+//**********************************************************************
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: DevicePath.h
+//
+// Description:
+// BDS internal function define the default device path string, it can be
+// replaced by platform device path.
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+/*++
+
+Copyright (c) 2004, Intel Corporation
+All rights reserved. This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution. The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+Module Name:
+
+ DevicePath.c
+
+Abstract:
+
+ BDS internal function define the default device path string, it can be
+ replaced by platform device path.
+
+--*/
+
+#include "Tiano.h"
+#include "EfiPrintLib.h"
+#include "bdslib.h"
+
+EFI_GUID UnknownDeviceGuid = UNKNOWN_DEVICE_GUID;
+
+EFI_GUID mEfiMsgPcAnsiGuid = DEVICE_PATH_MESSAGING_PC_ANSI;
+EFI_GUID mEfiMsgVt100Guid = DEVICE_PATH_MESSAGING_VT_100;
+EFI_GUID mEfiMsgVt100PlusGuid = DEVICE_PATH_MESSAGING_VT_100_PLUS;
+EFI_GUID mEfiMsgVt100Utf8Guid = DEVICE_PATH_MESSAGING_VT_UTF8;
+
+VOID *
+ReallocatePool (
+ IN VOID *OldPool,
+ IN UINTN OldSize,
+ IN UINTN NewSize
+)
+/*++
+
+Routine Description:
+
+ Adjusts the size of a previously allocated buffer.
+
+Arguments:
+
+ OldPool - A pointer to the buffer whose size is being adjusted.
+
+ OldSize - The size of the current buffer.
+
+ NewSize - The size of the new buffer.
+
+Returns:
+
+ EFI_SUCEESS - The requested number of bytes were allocated.
+
+ EFI_OUT_OF_RESOURCES - The pool requested could not be allocated.
+
+ EFI_INVALID_PARAMETER - The buffer was invalid.
+
+--*/
+{
+ VOID *NewPool;
+
+ NewPool = NULL;
+ if (NewSize)
+ {
+ NewPool = EfiLibAllocateZeroPool (NewSize);
+ }
+
+ if (OldPool)
+ {
+ if (NewPool)
+ {
+ EfiCopyMem (NewPool, OldPool, OldSize < NewSize ? OldSize : NewSize);
+ }
+
+ gBS->FreePool (OldPool);
+ }
+
+ return NewPool;
+}
+
+CHAR16 *
+CatPrint (
+ IN OUT POOL_PRINT *Str,
+ IN CHAR16 *fmt,
+ ...
+)
+/*++
+
+Routine Description:
+
+ Concatenates a formatted unicode string to allocated pool.
+ The caller must free the resulting buffer.
+
+Arguments:
+
+ Str - Tracks the allocated pool, size in use, and
+ amount of pool allocated.
+
+ fmt - The format string
+
+Returns:
+
+ Allocated buffer with the formatted string printed in it.
+ The caller must free the allocated buffer. The buffer
+ allocation is not packed.
+
+--*/
+{
+ UINT16 *AppendStr;
+ VA_LIST args;
+ UINTN strsize;
+
+ AppendStr = EfiLibAllocateZeroPool (0x1000);
+ if (AppendStr == NULL)
+ {
+ return Str->str;
+ }
+
+ VA_START (args, fmt);
+ VSPrint (AppendStr, 0x1000, fmt, args);
+ VA_END (args);
+ if (NULL == Str->str)
+ {
+ strsize = EfiStrSize (AppendStr);
+ Str->str = EfiLibAllocateZeroPool (strsize);
+ ASSERT (Str->str != NULL);
+ }
+ else
+ {
+ strsize = EfiStrSize (AppendStr) + EfiStrSize (Str->str) - sizeof (UINT16);
+ Str->str = ReallocatePool (
+ Str->str,
+ EfiStrSize (Str->str),
+ strsize
+ );
+ ASSERT (Str->str != NULL);
+ }
+
+ Str->maxlen = MAX_CHAR * sizeof (UINT16);
+ if (strsize < Str->maxlen)
+ {
+ EfiStrCat (Str->str, AppendStr);
+ Str->len = strsize - sizeof (UINT16);
+ }
+
+ gBS->FreePool (AppendStr);
+ return Str->str;
+}
+
+EFI_DEVICE_PATH_PROTOCOL *
+BdsLibUnpackDevicePath (
+ IN EFI_DEVICE_PATH_PROTOCOL *DevPath
+)
+/*++
+
+Routine Description:
+
+ Function unpacks a device path data structure so that all the nodes
+ of a device path are naturally aligned.
+
+Arguments:
+
+ DevPath - A pointer to a device path data structure
+
+Returns:
+
+ If the memory for the device path is successfully allocated, then a
+ pointer to the new device path is returned. Otherwise, NULL is returned.
+
+--*/
+{
+ EFI_DEVICE_PATH_PROTOCOL *Src;
+ EFI_DEVICE_PATH_PROTOCOL *Dest;
+ EFI_DEVICE_PATH_PROTOCOL *NewPath;
+ UINTN Size;
+
+ //
+ // Walk device path and round sizes to valid boundries
+ //
+ Src = DevPath;
+ Size = 0;
+ for (;;)
+ {
+ Size += DevicePathNodeLength (Src);
+ Size += ALIGN_SIZE (Size);
+
+ if (IsDevicePathEnd (Src))
+ {
+ break;
+ }
+
+ Src = NextDevicePathNode (Src);
+ }
+ //
+ // Allocate space for the unpacked path
+ //
+ NewPath = EfiLibAllocateZeroPool (Size);
+ if (NewPath)
+ {
+
+ ASSERT (((UINTN) NewPath) % MIN_ALIGNMENT_SIZE == 0);
+
+ //
+ // Copy each node
+ //
+ Src = DevPath;
+ Dest = NewPath;
+ for (;;)
+ {
+ Size = DevicePathNodeLength (Src);
+ EfiCopyMem (Dest, Src, Size);
+ Size += ALIGN_SIZE (Size);
+ SetDevicePathNodeLength (Dest, Size);
+ Dest->Type |= EFI_DP_TYPE_UNPACKED;
+ Dest = (EFI_DEVICE_PATH_PROTOCOL *) (((UINT8 *) Dest) + Size);
+
+ if (IsDevicePathEnd (Src))
+ {
+ break;
+ }
+
+ Src = NextDevicePathNode (Src);
+ }
+ }
+
+ return NewPath;
+}
+
+VOID
+DevPathPci (
+ IN OUT POOL_PRINT *Str,
+ IN VOID *DevPath
+)
+{
+ PCI_DEVICE_PATH *Pci;
+
+ Pci = DevPath;
+ CatPrint (Str, L"Pci(%x|%x)", Pci->Device, Pci->Function);
+}
+
+VOID
+DevPathPccard (
+ IN OUT POOL_PRINT *Str,
+ IN VOID *DevPath
+)
+{
+ PCCARD_DEVICE_PATH *Pccard;
+
+ Pccard = DevPath;
+ CatPrint (Str, L"Pcmcia(Function%x)", Pccard->FunctionNumber);
+}
+
+VOID
+DevPathMemMap (
+ IN OUT POOL_PRINT *Str,
+ IN VOID *DevPath
+)
+{
+ MEMMAP_DEVICE_PATH *MemMap;
+
+ MemMap = DevPath;
+ CatPrint (
+ Str,
+ L"MemMap(%d:%.lx-%.lx)",
+ MemMap->MemoryType,
+ MemMap->StartingAddress,
+ MemMap->EndingAddress
+ );
+}
+
+VOID
+DevPathController (
+ IN OUT POOL_PRINT *Str,
+ IN VOID *DevPath
+)
+{
+ CONTROLLER_DEVICE_PATH *Controller;
+
+ Controller = DevPath;
+ CatPrint (Str, L"Ctrl(%d)", Controller->Controller);
+}
+
+VOID
+DevPathVendor (
+ IN OUT POOL_PRINT *Str,
+ IN VOID *DevPath
+)
+/*++
+
+Routine Description:
+
+ Convert Vendor device path to device name
+
+Arguments:
+
+ Str - The buffer store device name
+ DevPath - Pointer to vendor device path
+
+Returns:
+
+ When it return, the device name have been stored in *Str.
+
+--*/
+{
+ VENDOR_DEVICE_PATH *Vendor;
+ CHAR16 *Type;
+ INT32 *Temp;
+
+ Vendor = DevPath;
+ Temp = (INT32 *) (&Vendor->Guid);
+
+ switch (DevicePathType (&Vendor->Header))
+ {
+ case HARDWARE_DEVICE_PATH:
+ //
+ // If the device is a winntbus device, we will give it a readable device name.
+ //
+ Type = L"Hw";
+ break;
+
+ case MESSAGING_DEVICE_PATH:
+ //
+ // If the device is a winntbus device, we will give it a readable device name.
+ //
+ if (EfiCompareGuid (&Vendor->Guid, &mEfiMsgPcAnsiGuid))
+ {
+ CatPrint (Str, L"%s", L"PC-ANSI");
+ return ;
+ }
+ else if (EfiCompareGuid (&Vendor->Guid, &mEfiMsgVt100Guid))
+ {
+ CatPrint (Str, L"%s", L"VT100");
+ return ;
+ }
+ else if (EfiCompareGuid (&Vendor->Guid, &mEfiMsgVt100PlusGuid))
+ {
+ CatPrint (Str, L"%s", L"VT100+");
+ return ;
+ }
+ else if (EfiCompareGuid (&Vendor->Guid, &mEfiMsgVt100Utf8Guid))
+ {
+ CatPrint (Str, L"%s", L"VT100-UTF8");
+ return ;
+ }
+ else
+ {
+ Type = L"Msg";
+ break;
+ }
+
+ case MEDIA_DEVICE_PATH:
+ Type = L"Media";
+ break;
+
+ default:
+ Type = L"?";
+ break;
+ }
+
+ CatPrint (Str, L"Ven%s(%g)", Type, &Vendor->Guid);
+}
+
+VOID
+DevPathAcpi (
+ IN OUT POOL_PRINT *Str,
+ IN VOID *DevPath
+)
+{
+ ACPI_HID_DEVICE_PATH *Acpi;
+
+ Acpi = DevPath;
+ if ((Acpi->HID & PNP_EISA_ID_MASK) == PNP_EISA_ID_CONST)
+ {
+ CatPrint (Str, L"Acpi(PNP%04x,%x)", EISA_ID_TO_NUM (Acpi->HID), Acpi->UID);
+ }
+ else
+ {
+ CatPrint (Str, L"Acpi(%08x,%x)", Acpi->HID, Acpi->UID);
+ }
+}
+
+VOID
+DevPathAtapi (
+ IN OUT POOL_PRINT *Str,
+ IN VOID *DevPath
+)
+{
+ ATAPI_DEVICE_PATH *Atapi;
+
+ Atapi = DevPath;
+ CatPrint (
+ Str,
+ L"Ata(%s,%s)",
+ Atapi->PrimarySecondary ? L"Secondary" : L"Primary",
+ Atapi->SlaveMaster ? L"Slave" : L"Master"
+ );
+}
+
+VOID
+DevPathScsi (
+ IN OUT POOL_PRINT *Str,
+ IN VOID *DevPath
+)
+{
+ SCSI_DEVICE_PATH *Scsi;
+
+ Scsi = DevPath;
+ CatPrint (Str, L"Scsi(Pun%x,Lun%x)", Scsi->Pun, Scsi->Lun);
+}
+
+VOID
+DevPathFibre (
+ IN OUT POOL_PRINT *Str,
+ IN VOID *DevPath
+)
+{
+ FIBRECHANNEL_DEVICE_PATH *Fibre;
+
+ Fibre = DevPath;
+ CatPrint (Str, L"Fibre(Wwn%lx,Lun%x)", Fibre->WWN, Fibre->Lun);
+}
+
+VOID
+DevPath1394 (
+ IN OUT POOL_PRINT *Str,
+ IN VOID *DevPath
+)
+{
+ F1394_DEVICE_PATH *F1394;
+
+ F1394 = DevPath;
+ CatPrint (Str, L"1394(%g)", &F1394->Guid);
+}
+
+VOID
+DevPathUsb (
+ IN OUT POOL_PRINT *Str,
+ IN VOID *DevPath
+)
+{
+ USB_DEVICE_PATH *Usb;
+
+ Usb = DevPath;
+ CatPrint (Str, L"Usb(%x, %x)", Usb->ParentPortNumber, Usb->InterfaceNumber);
+}
+
+VOID
+DevPathUsbClass (
+ IN OUT POOL_PRINT *Str,
+ IN VOID *DevPath
+)
+{
+ USB_CLASS_DEVICE_PATH *UsbClass;
+
+ UsbClass = DevPath;
+ CatPrint (
+ Str,
+ L"Usb Class(%x, %x, %x, %x, %x)",
+ UsbClass->VendorId,
+ UsbClass->ProductId,
+ UsbClass->DeviceClass,
+ UsbClass->DeviceSubClass,
+ UsbClass->DeviceProtocol
+ );
+}
+
+VOID
+DevPathI2O (
+ IN OUT POOL_PRINT *Str,
+ IN VOID *DevPath
+)
+{
+ I2O_DEVICE_PATH *I2O;
+
+ I2O = DevPath;
+ CatPrint (Str, L"I2O(%x)", I2O->Tid);
+}
+
+VOID
+DevPathMacAddr (
+ IN OUT POOL_PRINT *Str,
+ IN VOID *DevPath
+)
+{
+ MAC_ADDR_DEVICE_PATH *MAC;
+ UINTN HwAddressSize;
+ UINTN Index;
+
+ MAC = DevPath;
+
+ HwAddressSize = sizeof (EFI_MAC_ADDRESS);
+ if (MAC->IfType == 0x01 || MAC->IfType == 0x00)
+ {
+ HwAddressSize = 6;
+ }
+
+ CatPrint (Str, L"Mac(");
+
+ for (Index = 0; Index < HwAddressSize; Index++)
+ {
+ CatPrint (Str, L"%02x", MAC->MacAddress.Addr[Index]);
+ }
+
+ CatPrint (Str, L")");
+}
+
+VOID
+DevPathIPv4 (
+ IN OUT POOL_PRINT *Str,
+ IN VOID *DevPath
+)
+{
+ IPv4_DEVICE_PATH *IP;
+
+ IP = DevPath;
+ CatPrint (
+ Str,
+ L"IPv4(%d.%d.%d.%d:%d)",
+ IP->RemoteIpAddress.Addr[0],
+ IP->RemoteIpAddress.Addr[1],
+ IP->RemoteIpAddress.Addr[2],
+ IP->RemoteIpAddress.Addr[3],
+ IP->RemotePort
+ );
+}
+
+VOID
+DevPathIPv6 (
+ IN OUT POOL_PRINT *Str,
+ IN VOID *DevPath
+)
+{
+ IPv6_DEVICE_PATH *IP;
+
+ IP = DevPath;
+ CatPrint (Str, L"IP-v6(not-done)");
+}
+
+VOID
+DevPathInfiniBand (
+ IN OUT POOL_PRINT *Str,
+ IN VOID *DevPath
+)
+{
+ INFINIBAND_DEVICE_PATH *InfiniBand;
+
+ InfiniBand = DevPath;
+ CatPrint (Str, L"InfiniBand(not-done)");
+}
+
+VOID
+DevPathUart (
+ IN OUT POOL_PRINT *Str,
+ IN VOID *DevPath
+)
+{
+ UART_DEVICE_PATH *Uart;
+ CHAR8 Parity;
+
+ Uart = DevPath;
+ switch (Uart->Parity)
+ {
+ case 0:
+ Parity = 'D';
+ break;
+
+ case 1:
+ Parity = 'N';
+ break;
+
+ case 2:
+ Parity = 'E';
+ break;
+
+ case 3:
+ Parity = 'O';
+ break;
+
+ case 4:
+ Parity = 'M';
+ break;
+
+ case 5:
+ Parity = 'S';
+ break;
+
+ default:
+ Parity = 'x';
+ break;
+ }
+
+ if (Uart->BaudRate == 0)
+ {
+ CatPrint (Str, L"Uart(DEFAULT %c", Parity);
+ }
+ else
+ {
+ CatPrint (Str, L"Uart(%d %c", Uart->BaudRate, Parity);
+ }
+
+ if (Uart->DataBits == 0)
+ {
+ CatPrint (Str, L"D");
+ }
+ else
+ {
+ CatPrint (Str, L"%d", Uart->DataBits);
+ }
+
+ switch (Uart->StopBits)
+ {
+ case 0:
+ CatPrint (Str, L"D)");
+ break;
+
+ case 1:
+ CatPrint (Str, L"1)");
+ break;
+
+ case 2:
+ CatPrint (Str, L"1.5)");
+ break;
+
+ case 3:
+ CatPrint (Str, L"2)");
+ break;
+
+ default:
+ CatPrint (Str, L"x)");
+ break;
+ }
+}
+
+VOID
+DevPathHardDrive (
+ IN OUT POOL_PRINT *Str,
+ IN VOID *DevPath
+)
+{
+ HARDDRIVE_DEVICE_PATH *Hd;
+
+ Hd = DevPath;
+ switch (Hd->SignatureType)
+ {
+ case SIGNATURE_TYPE_MBR:
+ CatPrint (
+ Str,
+ L"HD(Part%d,Sig%08x)",
+ Hd->PartitionNumber,
+ *((UINT32 *) (&(Hd->Signature[0])))
+ );
+ break;
+
+ case SIGNATURE_TYPE_GUID:
+ CatPrint (
+ Str,
+ L"HD(Part%d,Sig%g)",
+ Hd->PartitionNumber,
+ (EFI_GUID *) &(Hd->Signature[0])
+ );
+ break;
+
+ default:
+ CatPrint (
+ Str,
+ L"HD(Part%d,MBRType=%02x,SigType=%02x)",
+ Hd->PartitionNumber,
+ Hd->MBRType,
+ Hd->SignatureType
+ );
+ break;
+ }
+}
+
+VOID
+DevPathCDROM (
+ IN OUT POOL_PRINT *Str,
+ IN VOID *DevPath
+)
+{
+ CDROM_DEVICE_PATH *Cd;
+
+ Cd = DevPath;
+ CatPrint (Str, L"CDROM(Entry%x)", Cd->BootEntry);
+}
+
+VOID
+DevPathFilePath (
+ IN OUT POOL_PRINT *Str,
+ IN VOID *DevPath
+)
+{
+ FILEPATH_DEVICE_PATH *Fp;
+
+ Fp = DevPath;
+ CatPrint (Str, L"%s", Fp->PathName);
+}
+
+VOID
+DevPathMediaProtocol (
+ IN OUT POOL_PRINT *Str,
+ IN VOID *DevPath
+)
+{
+ MEDIA_PROTOCOL_DEVICE_PATH *MediaProt;
+
+ MediaProt = DevPath;
+ CatPrint (Str, L"%g", &MediaProt->Protocol);
+}
+
+VOID
+DevPathFvFilePath (
+ IN OUT POOL_PRINT *Str,
+ IN VOID *DevPath
+)
+{
+ MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvFilePath;
+
+ FvFilePath = DevPath;
+ CatPrint (Str, L"%g", &FvFilePath->NameGuid);
+}
+
+VOID
+DevPathBssBss (
+ IN OUT POOL_PRINT *Str,
+ IN VOID *DevPath
+)
+{
+ BBS_BBS_DEVICE_PATH *Bbs;
+ CHAR16 *Type;
+
+ Bbs = DevPath;
+ switch (Bbs->DeviceType)
+ {
+ case BBS_TYPE_FLOPPY:
+ Type = L"Floppy";
+ break;
+
+ case BBS_TYPE_HARDDRIVE:
+ Type = L"Harddrive";
+ break;
+
+ case BBS_TYPE_CDROM:
+ Type = L"CDROM";
+ break;
+
+ case BBS_TYPE_PCMCIA:
+ Type = L"PCMCIA";
+ break;
+
+ case BBS_TYPE_USB:
+ Type = L"Usb";
+ break;
+
+ case BBS_TYPE_EMBEDDED_NETWORK:
+ Type = L"Net";
+ break;
+
+ default:
+ Type = L"?";
+ break;
+ }
+ //
+ // Since current Print function hasn't implemented %a (for ansi string)
+ // we will only print Unicode strings.
+ //
+ CatPrint (Str, L"Legacy-%s", Type);
+}
+
+VOID
+DevPathEndInstance (
+ IN OUT POOL_PRINT *Str,
+ IN VOID *DevPath
+)
+{
+ CatPrint (Str, L",");
+}
+
+VOID
+DevPathNodeUnknown (
+ IN OUT POOL_PRINT *Str,
+ IN VOID *DevPath
+)
+{
+ CatPrint (Str, L"?");
+}
+
+DEVICE_PATH_STRING_TABLE DevPathTable[] = {
+ HARDWARE_DEVICE_PATH,
+ HW_PCI_DP,
+ DevPathPci,
+ HARDWARE_DEVICE_PATH,
+ HW_PCCARD_DP,
+ DevPathPccard,
+ HARDWARE_DEVICE_PATH,
+ HW_MEMMAP_DP,
+ DevPathMemMap,
+ HARDWARE_DEVICE_PATH,
+ HW_VENDOR_DP,
+ DevPathVendor,
+ HARDWARE_DEVICE_PATH,
+ HW_CONTROLLER_DP,
+ DevPathController,
+ ACPI_DEVICE_PATH,
+ ACPI_DP,
+ DevPathAcpi,
+ MESSAGING_DEVICE_PATH,
+ MSG_ATAPI_DP,
+ DevPathAtapi,
+ MESSAGING_DEVICE_PATH,
+ MSG_SCSI_DP,
+ DevPathScsi,
+ MESSAGING_DEVICE_PATH,
+ MSG_FIBRECHANNEL_DP,
+ DevPathFibre,
+ MESSAGING_DEVICE_PATH,
+ MSG_1394_DP,
+ DevPath1394,
+ MESSAGING_DEVICE_PATH,
+ MSG_USB_DP,
+ DevPathUsb,
+ MESSAGING_DEVICE_PATH,
+ MSG_USB_CLASS_DP,
+ DevPathUsbClass,
+ MESSAGING_DEVICE_PATH,
+ MSG_I2O_DP,
+ DevPathI2O,
+ MESSAGING_DEVICE_PATH,
+ MSG_MAC_ADDR_DP,
+ DevPathMacAddr,
+ MESSAGING_DEVICE_PATH,
+ MSG_IPv4_DP,
+ DevPathIPv4,
+ MESSAGING_DEVICE_PATH,
+ MSG_IPv6_DP,
+ DevPathIPv6,
+ MESSAGING_DEVICE_PATH,
+ MSG_INFINIBAND_DP,
+ DevPathInfiniBand,
+ MESSAGING_DEVICE_PATH,
+ MSG_UART_DP,
+ DevPathUart,
+ MESSAGING_DEVICE_PATH,
+ MSG_VENDOR_DP,
+ DevPathVendor,
+ MEDIA_DEVICE_PATH,
+ MEDIA_HARDDRIVE_DP,
+ DevPathHardDrive,
+ MEDIA_DEVICE_PATH,
+ MEDIA_CDROM_DP,
+ DevPathCDROM,
+ MEDIA_DEVICE_PATH,
+ MEDIA_VENDOR_DP,
+ DevPathVendor,
+ MEDIA_DEVICE_PATH,
+ MEDIA_FILEPATH_DP,
+ DevPathFilePath,
+ MEDIA_DEVICE_PATH,
+ MEDIA_PROTOCOL_DP,
+ DevPathMediaProtocol,
+ MEDIA_DEVICE_PATH,
+ MEDIA_FV_FILEPATH_DP,
+ DevPathFvFilePath,
+ BBS_DEVICE_PATH,
+ BBS_BBS_DP,
+ DevPathBssBss,
+ END_DEVICE_PATH_TYPE,
+ END_INSTANCE_DEVICE_PATH_SUBTYPE,
+ DevPathEndInstance,
+ 0,
+ 0,
+ NULL
+ };
+
+CHAR16 *
+DevicePathToStr (
+ IN EFI_DEVICE_PATH_PROTOCOL *DevPath
+)
+/*++
+
+ Turns the Device Path into a printable string. Allcoates
+ the string from pool. The caller must SafeFreePool the returned
+ string.
+
+--*/
+{
+ POOL_PRINT Str;
+ EFI_DEVICE_PATH_PROTOCOL *DevPathNode;
+ VOID (*DumpNode) (POOL_PRINT *, VOID *);
+
+ UINTN Index;
+ UINTN NewSize;
+
+ EfiZeroMem (&Str, sizeof (Str));
+
+ if (DevPath == NULL)
+ {
+ goto Done;
+ }
+ //
+ // Unpacked the device path
+ //
+ DevPath = BdsLibUnpackDevicePath (DevPath);
+ ASSERT (DevPath);
+
+ //
+ // Process each device path node
+ //
+ DevPathNode = DevPath;
+ while (!IsDevicePathEnd (DevPathNode))
+ {
+ //
+ // Find the handler to dump this device path node
+ //
+ DumpNode = NULL;
+ for (Index = 0; DevPathTable[Index].Function; Index += 1)
+ {
+
+ if (DevicePathType (DevPathNode) == DevPathTable[Index].Type &&
+ DevicePathSubType (DevPathNode) == DevPathTable[Index].SubType
+ )
+ {
+ DumpNode = DevPathTable[Index].Function;
+ break;
+ }
+ }
+ //
+ // If not found, use a generic function
+ //
+ if (!DumpNode)
+ {
+ DumpNode = DevPathNodeUnknown;
+ }
+ //
+ // Put a path seperator in if needed
+ //
+ if (Str.len && DumpNode != DevPathEndInstance)
+ {
+ CatPrint (&Str, L"/");
+ }
+ //
+ // Print this node of the device path
+ //
+ DumpNode (&Str, DevPathNode);
+
+ //
+ // Next device path node
+ //
+ DevPathNode = NextDevicePathNode (DevPathNode);
+ }
+ //
+ // Shrink pool used for string allocation
+ //
+ gBS->FreePool (DevPath);
+
+Done:
+ NewSize = (Str.len + 1) * sizeof (CHAR16);
+ Str.str = ReallocatePool (Str.str, NewSize, NewSize);
+ ASSERT (Str.str != NULL);
+ Str.str[Str.len] = 0;
+ return Str.str;
+}
+
+EFI_DEVICE_PATH_PROTOCOL *
+LibDuplicateDevicePathInstance (
+ IN EFI_DEVICE_PATH_PROTOCOL *DevPath
+)
+/*++
+
+Routine Description:
+
+ Function creates a device path data structure that identically matches the
+ device path passed in.
+
+Arguments:
+
+ DevPath - A pointer to a device path data structure.
+
+Returns:
+
+ The new copy of DevPath is created to identically match the input.
+ Otherwise, NULL is returned.
+
+--*/
+{
+ EFI_DEVICE_PATH_PROTOCOL *NewDevPath;
+ EFI_DEVICE_PATH_PROTOCOL *DevicePathInst;
+ EFI_DEVICE_PATH_PROTOCOL *Temp;
+ UINTN Size;
+
+ //
+ // get the size of an instance from the input
+ //
+ Temp = DevPath;
+ DevicePathInst = EfiDevicePathInstance (&Temp, &Size);
+
+ //
+ // Make a copy
+ //
+ NewDevPath = NULL;
+ if (Size)
+ {
+ NewDevPath = EfiLibAllocateZeroPool (Size);
+ ASSERT (NewDevPath != NULL);
+ }
+
+ if (NewDevPath)
+ {
+ EfiCopyMem (NewDevPath, DevicePathInst, Size);
+ }
+
+ return NewDevPath;
+}
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/AmtWrapper/Dxe/KvmSupport.c b/Board/EM/MeWrapper/AmtWrapper/Dxe/KvmSupport.c
new file mode 100644
index 0000000..dab3fe4
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/Dxe/KvmSupport.c
@@ -0,0 +1,135 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/AmtWrapper/AmtWrapperDxe/KvmSupport.c 1 2/08/12 1:08a Klzhan $
+//
+// $Revision: 1 $
+//
+// $Date: 2/08/12 1:08a $
+//
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/AmtWrapper/AmtWrapperDxe/KvmSupport.c $
+//
+// 1 2/08/12 1:08a Klzhan
+// Initial Check in
+//
+// 1 2/25/11 1:44a Klzhan
+// Initial Check-in
+//
+// 1 12/03/10 5:10a Klzhan
+// Initial Check-in.
+//
+//
+//**********************************************************************
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: KvmSupport.c
+//
+// Description: Support routines for KVM init in the BDS
+//
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+/*++
+ This file contains an 'Intel Peripheral Driver' and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to 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:
+
+ KvmSupport.c
+
+Abstract:
+
+ Support routines for KVM init in the BDS
+
+--*/
+// Remove for RC 0.8
+/*
+#include "KvmSupport.h"
+
+BOOLEAN
+BdsKvmInitialization (
+ IN VOID
+ )
+*/
+/*++
+
+Routine Description:
+
+ Request KVM message.
+
+Arguments:
+
+ None.
+
+Returns:
+
+ True KVM Boot Option is an active.
+
+--*/
+/*
+{
+ EFI_STATUS Status;
+ UINT32 ResponseCode;
+
+ if(ActiveManagementEnableKvm() == TRUE) {
+ Status = HeciQueryKvmRequest(QUERY_REQUEST, &ResponseCode);
+ if (EFI_ERROR (Status)) {
+ gST->ConOut->ClearScreen (gST->ConOut);
+ gST->ConOut->OutputString (gST->ConOut, L"Error!! Times up and the KVM session was cancelled!!");
+ Status = HeciQueryKvmRequest(CANCEL_REQUEST, &ResponseCode);
+ } else if (ResponseCode == KVM_SESSION_CANCELLED) {
+ gST->ConOut->ClearScreen (gST->ConOut);
+ gST->ConOut->OutputString (gST->ConOut, L"Error!! The request has rejected and the KVM session was cancelled!!");
+ } else {
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+*/
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/AmtWrapper/Dxe/KvmSupport.h b/Board/EM/MeWrapper/AmtWrapper/Dxe/KvmSupport.h
new file mode 100644
index 0000000..2058d6b
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/Dxe/KvmSupport.h
@@ -0,0 +1,119 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/AmtWrapper/AmtWrapperDxe/KvmSupport.h 1 2/08/12 1:08a Klzhan $
+//
+// $Revision: 1 $
+//
+// $Date: 2/08/12 1:08a $
+//
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/AmtWrapper/AmtWrapperDxe/KvmSupport.h $
+//
+// 1 2/08/12 1:08a Klzhan
+// Initial Check in
+//
+// 1 2/25/11 1:44a Klzhan
+// Initial Check-in
+//
+// 1 12/03/10 5:10a Klzhan
+// Initial Check-in.
+//
+//
+//**********************************************************************
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: KvmSupport.h
+//
+// Description: KVM BDS Support include file
+//
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+/*++
+ This file contains an 'Intel Peripheral Driver' and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to 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:
+
+ KvmSupport.h
+
+Abstract:
+
+ KVM BDS Support include file
+
+--*/
+#ifndef _KVM_SUPPORT_H_
+#define _KVM_SUPPORT_H_
+
+#include "Tiano.h"
+#include "EfiDriverLib.h"
+#include "BdsLib.h"
+#include "AmtLib.h"
+#include "MeLib.h"
+
+BOOLEAN
+BdsKvmInitialization (
+ IN VOID
+ )
+/*++
+
+Routine Description:
+
+ Request KVM message.
+
+Arguments:
+
+ None.
+
+Returns:
+
+ True KVM Boot Option is an active.
+
+--*/
+;
+#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/AmtWrapper/Dxe/Performance.c b/Board/EM/MeWrapper/AmtWrapper/Dxe/Performance.c
new file mode 100644
index 0000000..deb51a4
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/Dxe/Performance.c
@@ -0,0 +1,431 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/AmtWrapper/AmtWrapperDxe/Performance.c 3 5/14/14 9:53p Tristinchou $
+//
+// $Revision: 3 $
+//
+// $Date: 5/14/14 9:53p $
+//
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/AmtWrapper/AmtWrapperDxe/Performance.c $
+//
+// 3 5/14/14 9:53p Tristinchou
+// [TAG] EIP167030
+// [Category] Improvement
+// [Description] Remove the variable runtime attribute and keep original
+// attributes.
+//
+// 2 9/19/12 6:35a Klzhan
+// Fix Build error when Performance is enabled.
+//
+// 1 2/08/12 1:08a Klzhan
+// Initial Check in
+//
+// 2 9/21/11 9:00a Klzhan
+// [TAG] EIP69500
+// [Category] Bug Fix
+// [Severity] Minor
+// [Symptom] Compiler Error when DXE_PERFORMANCE is on
+// [RootCause] EDK Library doesn't support this function.
+//
+// 1 2/25/11 1:44a Klzhan
+// Initial Check-in
+//
+// 1 12/03/10 5:10a Klzhan
+// Initial Check-in.
+//
+//
+//**********************************************************************
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: Performance.c
+//
+// Description: help to get the system performance
+//
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+/*++
+
+Copyright (c) 2004 - 2005, Intel Corporation
+All rights reserved. This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution. The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+Module Name:
+
+ Performance.c
+
+Abstract:
+
+ This file include the file which can help to get the system
+ performance, all the function will only include if the performance
+ switch is set.
+
+--*/
+
+#include "Tiano.h"
+#include "EfiDriverLib.h"
+#include "EfiPrintLib.h"
+
+#ifndef GUID_VARIABLE_DECLARATION
+#define GUID_VARIABLE_DECLARATION(Variable, Guid) extern EFI_GUID Variable
+#endif
+
+//#define EFI_DXE_PERFORMANCE
+
+#ifdef EFI_DXE_PERFORMANCE
+#include "EfiImage.h"
+#include "Include\Protocol\Performance.h"
+
+VOID
+ConvertChar16ToChar8 (
+ IN CHAR8 *Dest,
+ IN CHAR16 *Src
+ )
+{
+ while (*Src) {
+ *Dest++ = (UINT8) (*Src++);
+ }
+
+ *Dest = 0;
+}
+#include <token.h>
+#include EFI_ARCH_PROTOCOL_CONSUMER (Cpu)
+#include EFI_GUID_DEFINITION (GlobalVariable)
+
+
+extern EFI_STATUS GetTimerValue ( UINT64 *TimerValue );//extern UINT64 GetCpuTimer ();
+extern UINT64 DivU64x32 (UINT64 Dividend,UINTN Divisor,UINTN *Remainder);
+extern CHAR8 *EfiAsciiStrCpy (CHAR8 *Destination,CHAR8 *Source );
+
+#define Div64(a,b,c) DivU64x32(a,b,c)
+#define Strcpy(a,b) EfiAsciiStrCpy(a,b)
+//**********************************************************************
+// PERFORMANCE FUNCTIONS AND STRUCTURES
+//**********************************************************************
+
+#define EFI_PERF_PEI_ENTRY_MAX_NUM 50
+
+typedef struct {
+ CHAR8 Token[EFI_PERF_PDBFILENAME_LENGTH];
+ UINT32 Duration;
+} EFI_PERF_DATA;
+
+typedef struct {
+ UINT64 BootToOs;
+ UINT64 S3Resume;
+ UINT32 S3EntryNum;
+ EFI_PERF_DATA S3Entry[EFI_PERF_PEI_ENTRY_MAX_NUM];
+ UINT64 CpuFreq;
+ UINT64 BDSRaw;
+ UINT32 Count;
+ UINT32 Signiture;
+} EFI_PERF_HEADER;
+//*************************************************************************
+//<AMI_PHDR_START>
+//
+// Name: WriteBootToOsPerformanceData
+//
+// Description:
+// VOID WriteBootToOsPerformanceData() allocates a block of memory and
+// writes performance data into it.
+//
+// Input:
+// VOID.
+//
+// Output:
+// VOID.
+//
+// Modified:
+//
+// Referrals:
+// GetCpuTimer
+// Div64
+// Strcpy
+//
+// Notes:
+// This function must only be called once; by default, it is called by BDS.
+//
+//<AMI_PHDR_END>
+//*************************************************************************
+VOID WriteBootToOsPerformanceData (){
+ static EFI_PHYSICAL_ADDRESS AcpiLowMemoryBase = 0;
+ static BOOLEAN FirstCall = TRUE;
+
+ EFI_STATUS Status;
+ EFI_CPU_ARCH_PROTOCOL *Cpu;
+ EFI_PERFORMANCE_PROTOCOL *DrvPerf;
+ UINT32 AcpiLowMemoryLength;
+ UINT32 LimitCount;
+ EFI_PERF_HEADER PerfHeader;
+ EFI_PERF_DATA PerfData;
+ EFI_GAUGE_DATA *DumpData;
+ EFI_HANDLE *Handles;
+ UINTN NoHandles;
+ UINT8 *Ptr;
+ UINT8 *PdbFileName;
+ UINT32 Index;
+ UINT64 Ticker;
+ UINT64 Freq;
+ UINT32 Duration;
+ UINT64 CurrentTicker;
+ UINT64 TimerPeriod;
+ EFI_GUID gEfiGlobalVariableGuid = EFI_GLOBAL_VARIABLE_GUID;
+ IN CHAR8 *Dest;
+ IN CHAR16 *Src;
+ UINT32 VarAttr;
+ UINTN VarSize;
+
+
+
+ // Retrive time stamp count as early as possilbe
+ GetTimerValue(&Ticker);//Ticker = GetCpuTimer (); //Bruce[c]
+
+ // Allocate a block of memory that contain performance data to OS for the first call
+ if(FirstCall)
+ {
+ Status = gBS->AllocatePages (
+ AllocateAnyPages,
+ EfiRuntimeServicesData,
+ 4,
+ &AcpiLowMemoryBase
+ );
+ if (EFI_ERROR (Status)) {
+ return ;
+ }
+ }
+
+ AcpiLowMemoryLength = EFI_PAGES_TO_SIZE(4);
+
+ Ptr = (UINT8 *) ((UINT32) AcpiLowMemoryBase + sizeof (EFI_PERF_HEADER));
+ LimitCount = (AcpiLowMemoryLength - sizeof (EFI_PERF_HEADER)) / sizeof (EFI_PERF_DATA);
+
+ // Get performance architecture protocol
+ Status = gBS->LocateProtocol (
+ &gEfiPerformanceProtocolGuid,
+ NULL,
+ &DrvPerf
+ );
+ if (EFI_ERROR (Status)) {
+ gBS->FreePages (AcpiLowMemoryBase, 4);
+ return ;
+ }
+ // Initialize performance data structure
+ gBS->SetMem (&PerfHeader, sizeof (EFI_PERF_HEADER), 0);
+
+ // Get CPU frequency
+ Status = gBS->LocateProtocol (
+ &gEfiCpuArchProtocolGuid,
+ NULL,
+ &Cpu
+ );
+ if (EFI_ERROR (Status)) {
+ gBS->FreePages (AcpiLowMemoryBase, 4);
+ return ;
+ }
+ // Get Cpu Frequency
+ Status = Cpu->GetTimerValue (Cpu, 0, &(CurrentTicker), &TimerPeriod);
+ if (EFI_ERROR (Status)) {
+ gBS->FreePages (AcpiLowMemoryBase, 4);
+ return ;
+ }
+
+ Freq = Div64(1000000000000, (UINTN) TimerPeriod, NULL);
+ PerfHeader.CpuFreq = Freq;
+
+ // Record current raw performance data
+ PerfHeader.BDSRaw = Ticker;
+
+ // Put Detailed performance data into memory
+ Handles = NULL;
+ Status = gBS->LocateHandleBuffer (
+ AllHandles,
+ NULL,
+ NULL,
+ &NoHandles,
+ &Handles
+ );
+ if (EFI_ERROR (Status)) {
+ gBS->FreePages (AcpiLowMemoryBase, 1);
+ return ;
+ }
+
+ // Get DXE drivers performance
+ for (Index = 0; Index < NoHandles; Index++) {
+ Ticker = 0;
+ PdbFileName = NULL;
+ DumpData = DrvPerf->GetGauge (
+ DrvPerf, // Context
+ NULL, // Handle
+ NULL, // Token
+ NULL, // Host
+ NULL // PrecGauge
+ );
+ while (DumpData) {
+ if (DumpData->Handle == Handles[Index]) {
+ PdbFileName = &(DumpData->PdbFileName[0]);
+ if (DumpData->StartTick < DumpData->EndTick) {
+ Ticker += (DumpData->EndTick - DumpData->StartTick);
+ }
+ }
+
+ DumpData = DrvPerf->GetGauge (
+ DrvPerf, // Context
+ NULL, // Handle
+ NULL, // Token
+ NULL, // Host
+ DumpData // PrecGauge
+ );
+ }
+
+ Duration = (UINT32) Div64 (
+ Ticker,
+ (UINT32) Freq,
+ NULL
+ );
+
+ if (Duration > 0) {
+ gBS->SetMem (&PerfData, sizeof (EFI_PERF_DATA), 0);
+
+ if (PdbFileName != NULL) {
+ Strcpy (PerfData.Token, PdbFileName);
+ }
+
+ PerfData.Duration = Duration;
+
+ gBS->CopyMem (Ptr, &PerfData, sizeof (EFI_PERF_DATA));
+ Ptr += sizeof (EFI_PERF_DATA);
+
+ PerfHeader.Count++;
+ if (PerfHeader.Count == LimitCount) {
+ goto Done;
+ }
+ }
+ }
+
+ gBS->FreePool (Handles);
+
+ // Get inserted performance data
+ DumpData = DrvPerf->GetGauge (
+ DrvPerf, // Context
+ NULL, // Handle
+ NULL, // Token
+ NULL, // Host
+ NULL // PrecGauge
+ );
+ while (DumpData) {
+ if ((DumpData->Handle) || (DumpData->StartTick > DumpData->EndTick)) {
+ DumpData = DrvPerf->GetGauge (
+ DrvPerf, // Context
+ NULL, // Handle
+ NULL, // Token
+ NULL, // Host
+ DumpData // PrecGauge
+ );
+ continue;
+ }
+
+ gBS->SetMem (&PerfData, sizeof (EFI_PERF_DATA), 0);
+
+ //convert CHAR16 string to CHAR8 string
+ Src = DumpData->Token;
+ Dest = (UINT8 *) PerfData.Token;
+ while (*Src) *Dest++ = (UINT8) (*Src++);
+ *Dest = 0;
+
+ PerfData.Duration = (UINT32) Div64 (
+ DumpData->EndTick - DumpData->StartTick,
+ (UINT32) Freq,
+ NULL
+ );
+
+ gBS->CopyMem(Ptr, &PerfData, sizeof (EFI_PERF_DATA));
+ Ptr += sizeof (EFI_PERF_DATA);
+
+ PerfHeader.Count++;
+ if (PerfHeader.Count == LimitCount) {
+ goto Done;
+ }
+
+ DumpData = DrvPerf->GetGauge (
+ DrvPerf, // Context
+ NULL, // Handle
+ NULL, // Token
+ NULL, // Host
+ DumpData // PrecGauge
+ );
+ }
+
+Done:
+ PerfHeader.Signiture = 0x66726550;
+
+ // Put performance data to memory
+ gBS->CopyMem (
+ (UINTN *) (UINTN) AcpiLowMemoryBase,
+ &PerfHeader,
+ sizeof (EFI_PERF_HEADER)
+ );
+
+ if(FirstCall)
+ {
+ VarAttr = 0;
+ VarSize = 0;
+
+ Status = gRT->GetVariable(
+ L"PerfDataMemAddr",
+ &gEfiGlobalVariableGuid,
+ &VarAttr,
+ &VarSize,
+ NULL );
+ if( EFI_ERROR(Status) && Status != EFI_BUFFER_TOO_SMALL )
+ {
+ VarAttr = EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS;
+ VarSize = sizeof(UINT32);
+ }
+
+ gRT->SetVariable (
+ L"PerfDataMemAddr",
+ &gEfiGlobalVariableGuid,
+ VarAttr,
+ VarSize,
+ (VOID *) &AcpiLowMemoryBase );
+
+ FirstCall = FALSE;
+ }
+}
+
+#endif
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/AmtWrapper/Dxe/Performance.h b/Board/EM/MeWrapper/AmtWrapper/Dxe/Performance.h
new file mode 100644
index 0000000..4fffd9e
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/Dxe/Performance.h
@@ -0,0 +1,87 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/AmtWrapper/AmtWrapperDxe/Performance.h 1 2/08/12 1:08a Klzhan $
+//
+// $Revision: 1 $
+//
+// $Date: 2/08/12 1:08a $
+//
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/AmtWrapper/AmtWrapperDxe/Performance.h $
+//
+// 1 2/08/12 1:08a Klzhan
+// Initial Check in
+//
+// 1 2/25/11 1:44a Klzhan
+// Initial Check-in
+//
+// 1 12/03/10 5:10a Klzhan
+// Initial Check-in.
+//
+//
+//**********************************************************************
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: Performance.h
+//
+// Description: This file included the performance relete function header
+// and definition.
+//
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+/*++
+
+Copyright (c) 2004, Intel Corporation
+All rights reserved. This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution. The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+Module Name:
+
+ Performance.h
+
+Abstract:
+
+ This file included the performance relete function header and
+ definition.
+
+--*/
+
+#ifndef _PERF_H_
+#define _PERF_H_
+
+#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/AmtWrapper/Protocol/AmtWrapper/AmtWrapper.c b/Board/EM/MeWrapper/AmtWrapper/Protocol/AmtWrapper/AmtWrapper.c
new file mode 100644
index 0000000..d6fc5c3
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/Protocol/AmtWrapper/AmtWrapper.c
@@ -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/AmtWrapper/AmtWrapperProtocolLib/AmtWrapper/AmtWrapper.c 1 2/08/12 1:09a Klzhan $
+//
+// $Revision: 1 $
+//
+// $Date: 2/08/12 1:09a $
+//
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/AmtWrapper/AmtWrapperProtocolLib/AmtWrapper/AmtWrapper.c $
+//
+// 1 2/08/12 1:09a Klzhan
+// Initial Check in
+//
+// 1 2/25/11 1:42a Klzhan
+// Initial Check-in
+//
+// 1 12/03/10 5:10a Klzhan
+// Initial Check-in.
+//
+//
+//**********************************************************************
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: AmtWrapper.c
+//
+// Description: Amt Wrapper Define file
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+#include "Efi.h"
+
+#include EFI_PROTOCOL_DEFINITION(AmtWrapper)
+
+EFI_GUID gEfiAmtWrapperProtocolGuid = EFI_AMT_WRAPPER_PROTOCOL_GUID;
+
+EFI_GUID_STRING(&gEfiAmtWrapperProtocolGuid, "AMT Wrapper Protocol", "AMT Wrapper Protocol");
+
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/AmtWrapper/Protocol/AmtWrapper/AmtWrapper.h b/Board/EM/MeWrapper/AmtWrapper/Protocol/AmtWrapper/AmtWrapper.h
new file mode 100644
index 0000000..57ef64c
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/Protocol/AmtWrapper/AmtWrapper.h
@@ -0,0 +1,180 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/AmtWrapper/AmtWrapperProtocolLib/AmtWrapper/AmtWrapper.h 1 2/08/12 1:09a Klzhan $
+//
+// $Revision: 1 $
+//
+// $Date: 2/08/12 1:09a $
+//
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/AmtWrapper/AmtWrapperProtocolLib/AmtWrapper/AmtWrapper.h $
+//
+// 1 2/08/12 1:09a Klzhan
+// Initial Check in
+//
+// 1 2/25/11 1:43a Klzhan
+// Initial Check-in
+//
+// 1 12/03/10 5:10a Klzhan
+// Initial Check-in.
+//
+//
+//**********************************************************************
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: AmtWrapper.c
+//
+// Description: Amt Wrapper Define file
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+#ifndef _EFI_BDS_ASF_H
+#define _EFI_BDS_ASF_H
+
+#define EFI_AMT_WRAPPER_PROTOCOL_GUID \
+ { 0xd54f49f6, 0xdd4, 0x4276, 0xb0, 0x9c, 0xdf, 0xe1, 0xfd, 0x80, 0x85, 0xf0 }
+
+EFI_FORWARD_DECLARATION (AMT_WRAPPER_PROTOCOL);
+
+typedef
+EFI_STATUS
+(EFIAPI *AMT_WRAPPER_INIT) (
+ EFI_HANDLE ImageHandle,
+ EFI_SYSTEM_TABLE *SystemTable
+);
+
+typedef
+BOOLEAN
+(EFIAPI *AMT_WRAPPER_GET) (
+ UINTN Index,
+ VOID *pVar
+);
+
+typedef
+BOOLEAN
+(EFIAPI *AMT_WRAPPER_SET) (
+ UINTN Index,
+ VOID *pVar
+);
+
+typedef
+BOOLEAN
+(EFIAPI *ACTIVE_MANAGEMENT_ENABLE_KVM) (
+ IN VOID
+);
+
+typedef
+BOOLEAN
+(EFIAPI *AMT_INITIALIZATION_KVM) (
+ IN VOID
+);
+
+typedef
+BOOLEAN
+(EFIAPI *ACTIVE_MANAGEMENT_ENABLE_SOL) (
+ IN VOID
+);
+
+typedef
+BOOLEAN
+(EFIAPI *ACTIVE_MANAGEMENT_ENABLE_IDER) (
+ IN VOID
+);
+
+/*
+typedef
+EFI_STATUS
+(EFIAPI *AMT_WRAPPER_INITIALIZATION) (
+ IN VOID
+);
+*/
+
+typedef
+EFI_STATUS
+(EFIAPI *BDS_BOOT_VIA_ASF) (
+ IN VOID
+);
+
+typedef
+BOOLEAN
+(EFIAPI *ACTIVE_MANAGEMENT_PAUSE_BOOT) (
+ IN VOID
+);
+
+typedef
+BOOLEAN
+(EFIAPI *ACTIVE_MANAGEMENT_ENTER_SETUP) (
+ IN VOID
+);
+
+typedef
+BOOLEAN
+(EFIAPI *ACTIVE_MANAGEMENT_CONSOLE_LOCKED) (
+ IN VOID
+);
+typedef
+EFI_STATUS
+(EFIAPI *BDSLIB_UPDATE_CONSOLE_VARIABLE) (
+ IN CHAR16 *ConVarName,
+ IN EFI_DEVICE_PATH_PROTOCOL *CustomizedConDevicePath,
+ IN EFI_DEVICE_PATH_PROTOCOL *ExclusiveDevicePath
+);
+
+typedef struct _AMT_WRAPPER_PROTOCOL {
+ AMT_WRAPPER_INIT AmtWrapperInit;
+ AMT_WRAPPER_GET AmtWrapperGet;
+ AMT_WRAPPER_SET AmtWrapperSet;
+ ACTIVE_MANAGEMENT_ENABLE_SOL ActiveManagementEnableSol;
+ ACTIVE_MANAGEMENT_ENABLE_IDER ActiveManagementEnableIdeR;
+ ACTIVE_MANAGEMENT_PAUSE_BOOT ActiveManagementPauseBoot;
+ ACTIVE_MANAGEMENT_ENTER_SETUP ActiveManagementEnterSetup;
+ //AMT_WRAPPER_INITIALIZATION AsfSupportInit;
+ BDS_BOOT_VIA_ASF BdsBootViaAsf;
+ BDSLIB_UPDATE_CONSOLE_VARIABLE BdsLibUpdateConsoleVariable;
+ ACTIVE_MANAGEMENT_CONSOLE_LOCKED ActiveManagementConsoleLocked;
+ ACTIVE_MANAGEMENT_ENABLE_KVM ActiveManagementEnableKvm;
+ AMT_INITIALIZATION_KVM AmtInitializationKvm;
+} AMT_WRAPPER_PROTOCOL;
+
+#define GET_SOL_DP 1
+#define GET_TIME_OUT 2 // return UINT16
+#define GET_BOOT_OPTION 3 // return UINT16
+#define GET_IS_SOL 4 // return UINT16
+#define GET_IS_IDER 5 // return UINT16
+
+#define SET_BIOS_WDT_START 1
+#define SET_WDT_STOP 2
+#define SET_OS_SOL 3
+#define SET_OS_WDT_START 4
+
+#endif //_EFI_HECI_H
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/AmtWrapper/Protocol/AmtWrapperProtocolLib.cif b/Board/EM/MeWrapper/AmtWrapper/Protocol/AmtWrapperProtocolLib.cif
new file mode 100644
index 0000000..403d469
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/Protocol/AmtWrapperProtocolLib.cif
@@ -0,0 +1,11 @@
+<component>
+ name = "AmtWrapperProtocolLib"
+ category = ModulePart
+ LocalRoot = "Board\EM\MeWrapper\AmtWrapper\Protocol"
+ RefName = "AmtWrapperProtocolLib"
+[files]
+"AmtWrapperProtocolLib.sdl"
+"AmtWrapperProtocolLib.mak"
+"AmtWrapper\AmtWrapper.h"
+"AmtWrapper\AmtWrapper.c"
+<endComponent>
diff --git a/Board/EM/MeWrapper/AmtWrapper/Protocol/AmtWrapperProtocolLib.mak b/Board/EM/MeWrapper/AmtWrapper/Protocol/AmtWrapperProtocolLib.mak
new file mode 100644
index 0000000..551df9d
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/Protocol/AmtWrapperProtocolLib.mak
@@ -0,0 +1,65 @@
+#**********************************************************************
+#**********************************************************************
+#** **
+#** (C)Copyright 1985-2010, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 6145-F Northbelt Pkwy, Norcross, GA 30071 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#**********************************************************************
+#**********************************************************************
+#**********************************************************************
+# $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/AmtWrapper/AmtWrapperProtocolLib/AmtWrapperProtocolLib.mak 1 2/08/12 1:09a Klzhan $
+#
+# $Revision: 1 $
+#
+# $Date: 2/08/12 1:09a $
+#**********************************************************************
+# Revision History
+# ----------------
+#
+#**********************************************************************
+#<AMI_FHDR_START>
+#
+# Name: AmtWrapperProtocolLib.mak
+#
+# Description:
+#
+#<AMI_FHDR_END>
+#**********************************************************************
+all : AmtWrapperProtocolLib
+
+$(BUILD_DIR)\AmtWrapperProtocolLib.lib : AmtWrapperProtocolLib
+
+AmtWrapperProtocolLib : $(BUILD_DIR)\AmtWrapperProtocolLib.mak AmtWrapperProtocolLibBin
+
+$(BUILD_DIR)\AmtWrapperProtocolLib.mak : $(AmtWrapperProtocolLib_DIR)\$(@B).cif $(AmtWrapperProtocolLib_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(AmtWrapperProtocolLib_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+AmtWrapperProtocolLib_INCLUDES=\
+ $(EDK_INCLUDES) \
+ $(ME_INCLUDES) \
+ $(MISCFRAMEWORK_INCLUDES)
+
+AmtWrapperProtocolLibBin :
+ $(MAKE) /$(MAKEFLAGS) $(EDK_DEFAULTS)\
+ /f $(BUILD_DIR)\AmtWrapperProtocolLib.mak all\
+ "MY_INCLUDES=$(AmtWrapperProtocolLib_INCLUDES)" \
+ TYPE=LIBRARY \
+
+#**********************************************************************
+#**********************************************************************
+#** **
+#** (C)Copyright 1985-2010, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 6145-F Northbelt Pkwy, Norcross, GA 30071 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#**********************************************************************
+#********************************************************************** \ No newline at end of file
diff --git a/Board/EM/MeWrapper/AmtWrapper/Protocol/AmtWrapperProtocolLib.sdl b/Board/EM/MeWrapper/AmtWrapper/Protocol/AmtWrapperProtocolLib.sdl
new file mode 100644
index 0000000..bc00d62
--- /dev/null
+++ b/Board/EM/MeWrapper/AmtWrapper/Protocol/AmtWrapperProtocolLib.sdl
@@ -0,0 +1,34 @@
+TOKEN
+ Name = "AmtWrapperProtocolLib_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable AmtWrapperProtocolLib support in Project"
+ TokenType = Boolean
+ TargetMAK = Yes
+ Master = Yes
+End
+
+PATH
+ Name = "AmtWrapperProtocolLib_DIR"
+End
+
+ELINK
+ Name = "/I$(AmtWrapperProtocolLib_DIR)\AmtWrapper"
+ Parent = "ME_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+MODULE
+ Help = "Includes AmtWrapperProtocolLib.mak to Project"
+ File = "AmtWrapperProtocolLib.mak"
+End
+
+ELINK
+ Name = "AmtWrapperProtocolLib_LIB"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\AmtWrapperProtocolLib.lib"
+ Parent = "AmtWrapperProtocolLib_LIB"
+ InvokeOrder = AfterParent
+End
diff --git a/Board/EM/MeWrapper/AtAmUi/AtAmUi.c b/Board/EM/MeWrapper/AtAmUi/AtAmUi.c
new file mode 100644
index 0000000..8a2cffe
--- /dev/null
+++ b/Board/EM/MeWrapper/AtAmUi/AtAmUi.c
@@ -0,0 +1,1120 @@
+/** @file
+ This file contines rouines responsible for handling the UI.
+
+@copyright
+ Copyright (c) 2012 - 2013 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.
+
+ 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
+
+**/
+#include "AtAmUi.h"
+#include EFI_PROTOCOL_CONSUMER (ConsoleControl)
+#include EFI_PROTOCOL_CONSUMER (GraphicsOutput)
+DXE_AT_POLICY_PROTOCOL *mDxePlatformAtPolicy;
+EFI_GUID gAlertAtHandlerGuid = ME_ALERT_AT_HANDLER_GUID;
+EFI_GUID gEfiAtAmProtocolGuid = EFI_ATAM_PROTOCOL_GUID;
+EFI_EVENT gAlertAtHandlerEvent;
+EFI_ATAM_PROTOCOL *mAtAm = NULL;
+
+//
+// Driver entry point
+//
+EFI_DRIVER_ENTRY_POINT (AtAmUiEntryPoint);
+
+/**
+ ATAM UI driver entry point.
+
+ @param[in] ImageHandle Handle for this drivers loaded image protocol.
+ @param[in] SystemTable EFI system table.
+
+ @retval EFI_SUCCESS The function completed successfully.
+ @retval EFI_UNSUPPORTED The function is unsupported by this driver
+**/
+EFI_STATUS
+AtAmUiEntryPoint (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+
+ EfiInitializeDriverLib (ImageHandle, SystemTable);
+ Status = gBS->LocateProtocol (
+ &gDxePlatformAtPolicyGuid,
+ NULL,
+ &mDxePlatformAtPolicy
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "ATAM: No AT Platform Policy Protocol available"));
+ return Status;
+ }
+ ASSERT_EFI_ERROR (Status);
+
+ if (mDxePlatformAtPolicy->At.AtAmBypass == 1) {
+ return EFI_SUCCESS;
+ }
+
+ if (mAtAm == NULL) {
+ Status = gBS->LocateProtocol (
+ &gEfiAtAmProtocolGuid,
+ NULL,
+ (VOID **) &mAtAm
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "ATAM: ATAM Protocol failed, Status = %r\n", Status));
+ return Status;
+ } else {
+ DEBUG ((EFI_D_ERROR, "ATAM: ATAM Protocol success, Status = %r\n", Status));
+ }
+ }
+
+ Status = gBS->CreateEventEx (
+ EFI_EVENT_NOTIFY_SIGNAL,
+ EFI_TPL_CALLBACK,
+ AtAmUiCallback,
+ NULL,
+ &gAlertAtHandlerGuid,
+ &gAlertAtHandlerEvent
+ );
+
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "ATAM: AT - Error Creating Event to Process Suspend Mode\n"));
+ }
+
+ return Status;
+}
+EFI_CONSOLE_CONTROL_PROTOCOL *ConsoleControl;
+EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
+EFI_CONSOLE_CONTROL_SCREEN_MODE ScreenMode;
+EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *GraphicsModeInfo;
+UINTN UgaBltSize = 0;
+EFI_UGA_PIXEL *UgaBlt = NULL;
+INT32 TextMode;
+UINTN StyleGetTextMode();
+
+VOID
+GraphicsSave
+(
+ VOID
+)
+{
+ UINTN SizeOfGraphicsModeInfo;
+
+ EFI_STATUS
+ Status = gBS->LocateProtocol( &gEfiConsoleControlProtocolGuid, NULL, &ConsoleControl);
+
+ if(EFI_ERROR(Status))
+ {
+ ConsoleControl = NULL;
+ return;
+ }
+
+ Status = ConsoleControl->GetMode(ConsoleControl, &ScreenMode, NULL, NULL);
+ if(ScreenMode == EfiConsoleControlScreenText)
+ {
+ ConsoleControl = NULL;
+ return;
+ }
+
+ Status = gBS->LocateProtocol( &gEfiGraphicsOutputProtocolGuid, NULL, &GraphicsOutput);
+ if(EFI_ERROR(Status))
+ {
+ GraphicsOutput = NULL;
+ return;
+ }
+
+ Status = GraphicsOutput->QueryMode( GraphicsOutput, GraphicsOutput->Mode->Mode,
+ &SizeOfGraphicsModeInfo ,&GraphicsModeInfo);
+ if(EFI_ERROR(Status))
+ {
+ GraphicsModeInfo = NULL;
+ return;
+ }
+
+ UgaBltSize = GraphicsModeInfo->HorizontalResolution *
+ GraphicsModeInfo->VerticalResolution *
+ sizeof(EFI_UGA_PIXEL);
+
+ UgaBlt = AllocateZeroPool (UgaBltSize);
+ if( UgaBlt == NULL )
+ return;
+
+ Status = GraphicsOutput->Blt(
+ GraphicsOutput,
+ UgaBlt,
+ EfiBltVideoToBltBuffer,
+ 0, 0,
+ 0, 0,
+ GraphicsModeInfo->HorizontalResolution,
+ GraphicsModeInfo->VerticalResolution,
+ 0);
+
+ Status = ConsoleControl->SetMode( ConsoleControl, EfiConsoleControlScreenText );
+ TextMode = gST->ConOut->Mode->Mode;
+ gST->ConOut->SetMode(gST->ConOut, StyleGetTextMode());
+}
+
+VOID
+GraphicsRestore
+(
+ VOID
+)
+{
+ if(!ConsoleControl)
+ return;
+
+ gST->ConOut->SetMode(gST->ConOut, TextMode);
+ ConsoleControl->SetMode( ConsoleControl, EfiConsoleControlScreenGraphics );
+
+ if(!GraphicsOutput)
+ return;
+
+ if(!UgaBlt || !GraphicsModeInfo)
+ return;
+
+ GraphicsOutput->Blt(
+ GraphicsOutput,
+ UgaBlt,
+ EfiBltBufferToVideo,
+ 0, 0,
+ 0, 0,
+ GraphicsModeInfo->HorizontalResolution,
+ GraphicsModeInfo->VerticalResolution,
+ 0);
+
+ ZeroMem(UgaBlt, UgaBltSize);
+ FreePool(UgaBlt);
+}
+/**
+ ATAM UI callback.
+
+ @param[in] Event The event registered
+ @param[in] Context Event context. Not used in this event handler.
+
+ @retval None
+**/
+VOID
+EFIAPI
+AtAmUiCallback (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+{
+ EFI_STATUS Status;
+ DXE_AT_POLICY_PROTOCOL *pAtPlatformPolicy;
+ AT_STATE_INFO AtStateInfo;
+ EFI_TPL TplBackup;
+
+ pAtPlatformPolicy = NULL;
+
+ DEBUG ((EFI_D_ERROR, "ATAM: AtAmUiCallback \n"));
+ //
+ // change TPL to APPLICATION as required by ConIn to function
+ //
+ TplBackup = gBS->RaiseTPL (TPL_HIGH_LEVEL);
+ gBS->RestoreTPL (TplBackup);
+ if (TplBackup != TPL_APPLICATION) {
+ gBS->RestoreTPL(TPL_APPLICATION);
+ }
+
+ Status = gBS->LocateProtocol (
+ &gDxePlatformAtPolicyGuid,
+ NULL,
+ (VOID **) &pAtPlatformPolicy
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "ATAM: ATAM LocateProtocol failed. \n"));
+ }
+
+ if (mAtAm == NULL) {
+ Status = gBS->LocateProtocol (
+ &gEfiAtAmProtocolGuid,
+ NULL,
+ (VOID **) &mAtAm
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "ATAM: ATAM Protocol failed, Status = %r\n", Status));
+ }
+ }
+
+ mAtAm->AtAmGetAtStateInfo (mAtAm, &AtStateInfo);
+
+ if (AtStateInfo.State == AT_STATE_STOLEN && pAtPlatformPolicy->At.AtPba == 1 && pAtPlatformPolicy->At.AtSupported == 0) {
+ AtAmUiTheftNotification ();
+
+ } else if (AtStateInfo.State == AT_STATE_STOLEN && AtStateInfo.flags.LockState == 1 && AtStateInfo.flags.AuthenticateModule == AT_AM_SELECTION_ATAM) {
+ GraphicsSave();
+ AtAmUiRecovery ();
+ GraphicsRestore();
+ } else if (AtStateInfo.State == AT_STATE_SUSPEND) {
+ GraphicsSave();
+ AtAmUiExitSuspendState ();
+ GraphicsRestore();
+ } else if (AtStateInfo.State == AT_STATE_ACTIVE) {
+ if (pAtPlatformPolicy->At.AtEnterSuspendState) {
+ GraphicsSave();
+ AtAmUiEnterSuspendState ();
+ GraphicsRestore();
+ }
+ }
+
+ //
+ // Restore TPL
+ //
+ if (TplBackup != TPL_APPLICATION) {
+ gBS->RaiseTPL(TplBackup);
+ }
+
+
+ return;
+}
+
+/**
+ Function handling entering suspend mode.
+
+ @retval EFI_SUCCESS The function completed successfully.
+ @retval EFI_OUT_OF_RESOURCES Unable to allocate necessary data structures.
+**/
+EFI_STATUS
+AtAmUiEnterSuspendState (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ UINT8 *PasswordASCII;
+ CHAR16 *PasswordUNICODE;
+ CHAR16 *UniCodeNonceStr;
+ UINT32 NumOfAttempts;
+ UINT8 NonceStr[STR_NONCE_LENGTH];
+ UINT32 CRow;
+ UINT32 CCol;
+ UINT8 *IsvString;
+ UINT32 IsvId;
+ AT_BIOS_RECOVERY_CONFIG RecoveryConfig;
+
+ Status = EFI_SUCCESS;
+ NumOfAttempts = ATAMUI_SUSPEND_ATTEMPTS;
+
+ UniCodeNonceStr = AllocateZeroPool ((STR_NONCE_LENGTH + 1) * sizeof (CHAR16));
+ PasswordASCII = AllocateZeroPool ((ATAM_SETUP_PASSWORD_LENGTH + 1) * sizeof (UINT8));
+ PasswordUNICODE = AllocateZeroPool ((ATAM_SETUP_PASSWORD_LENGTH + 1) * sizeof (CHAR16));
+ IsvString = AllocateZeroPool ((RECOVERY_STRING_LENGTH + 1) * sizeof (UINT8));
+
+ if (PasswordASCII == NULL || PasswordUNICODE == NULL || UniCodeNonceStr == NULL || IsvString == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ if (mAtAm == NULL) {
+ Status = gBS->LocateProtocol (
+ &gEfiAtAmProtocolGuid,
+ NULL,
+ (VOID **) &mAtAm
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "ATAM: ATAM Protocol failed, Status = %r\n", Status));
+ }
+ }
+
+ AtAmUiStrGetCursor (&CRow, &CCol);
+
+ do {
+ AtAmUiStrClearScreen ();
+
+ RecoveryConfig.IsvPlatformId[0] = L'\0';
+ Status = mAtAm->AtAmGetRecoveryConfig (mAtAm, &RecoveryConfig);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "ATAM: AtAmGetRecoveryConfig command failed, Status = %r\n", Status));
+ }
+ if (RecoveryConfig.IsvPlatformId[0] != L'\0') {
+ AtAmUiStrSetCursor(4, 13);
+ AtAmUiStrDisplayFix (STR_ATAMUI_PLATFORM_ID, FALSE);
+ AtAmUiStrDisplay ((CHAR16 *) RecoveryConfig.IsvPlatformId);
+ }
+
+ AtAmUiStrSetCursor(4, 14);
+ Status = mAtAm->AtAmGetIsvId (mAtAm, IsvString, &IsvId);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "ATAM: AtAmGetIsvId command failed, Status = %r\n", Status));
+ }
+ AtAmUiStrDisplay ((CHAR16 *) IsvString);
+
+ AtAmUiStrEnableCursor (FALSE);
+
+ AtAmUiStrDisplayFix (STR_ATAMUI_SUS_ENTER_INFO, TRUE);
+
+ AtAmUiStrSetCursor (4, 2);
+ AtAmUiStrDisplayFix (STR_ATAMUI_SUS_REFER, FALSE);
+ Status = mAtAm->AtAmGetNonce (mAtAm, NonceStr);
+ if (Status == EFI_SUCCESS) {
+ Uint8ToUnicode (NonceStr, UniCodeNonceStr);
+ AtAmUiStrDisplay ((UINT16 *) UniCodeNonceStr);
+ } else {
+ AtAmUiStrDisplayFix (STR_ATAMUI_SUS_NONCE_FAILED, FALSE);
+ DEBUG ((EFI_D_ERROR, "ATAM: Get Nonce failed, Status = %r\n", Status));
+ }
+
+ AtAmUiStrDisplayFix (STR_ATAMUI_SUS_ENTER_TOKEN, TRUE);
+ AtAmUiStrEnableCursor (TRUE);
+ AtAmUiGetPassword (PasswordASCII, ATAM_SETUP_PASSWORD_LENGTH, PasswordUNICODE, 1);
+ AtAmUiStrEnableCursor (FALSE);
+
+ Status = mAtAm->AtAmSetSuspendState (mAtAm, ATAM_ENTER_SUSPEND_STATE, PasswordASCII);
+ if (Status != EFI_SUCCESS) {
+ AtAmUiStrDisplayFix (STR_ATAMUI_SUS_ENTER_FAILED, TRUE);
+ AtAmUiDelay (2 * AT_AM_UI_1_SECOND);
+ }
+
+ } while (--NumOfAttempts && (Status != EFI_SUCCESS));
+
+ if (Status == EFI_SUCCESS) {
+ AtAmUiStrDisplayFix (STR_ATAMUI_SUS_ENTER_SUCCESS, TRUE);
+ } else {
+ AtAmUiStrDisplayFix (STR_ATAMUI_SUS_ATTEMPT_EXC, TRUE);
+ }
+
+ ZeroMem (UniCodeNonceStr, (STR_NONCE_LENGTH + 1) * sizeof (UINT16));
+ ZeroMem (PasswordASCII, (ATAM_SETUP_PASSWORD_LENGTH + 1) * sizeof (CHAR8));
+ ZeroMem (PasswordUNICODE, (ATAM_SETUP_PASSWORD_LENGTH + 1) * sizeof (CHAR16));
+
+ FreePool (UniCodeNonceStr);
+ FreePool (PasswordASCII);
+ FreePool (PasswordUNICODE);
+
+ AtAmUiDelay (AT_AM_UI_1_SECOND);
+
+ AtAmUiStrClearScreen ();
+ AtAmUiStrSetCursor (CCol, CRow);
+
+ return Status;
+}
+
+/**
+ Function handling exiting suspend mode.
+
+ @param[in] None
+
+ @retval EFI_SUCCESS The function completed successfully.
+ @retval EFI_OUT_OF_RESOURCES Unable to allocate necessary data structures.
+**/
+EFI_STATUS
+AtAmUiExitSuspendState (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ UINT8 *PasswordASCII;
+ CHAR16 *PasswordUNICODE;
+ CHAR16 *UniCodeNonceStr;
+ UINT32 NumOfAttempts;
+ UINT8 NonceStr[STR_NONCE_LENGTH];
+ EFI_INPUT_KEY Key;
+ UINT32 CRow;
+ UINT32 CCol;
+ UINT8 *IsvString;
+ UINT32 IsvId;
+ AT_BIOS_RECOVERY_CONFIG RecoveryConfig;
+
+ Status = EFI_SUCCESS;
+ NumOfAttempts = 3;
+
+ UniCodeNonceStr = AllocateZeroPool ((STR_NONCE_LENGTH + 1) * sizeof (CHAR16));
+ PasswordASCII = AllocateZeroPool ((ATAM_SETUP_PASSWORD_LENGTH + 1) * sizeof (UINT8));
+ PasswordUNICODE = AllocateZeroPool ((ATAM_SETUP_PASSWORD_LENGTH + 1) * sizeof (CHAR16));
+ IsvString = AllocateZeroPool ((RECOVERY_STRING_LENGTH + 1) * sizeof (UINT8));
+
+ if (PasswordASCII == NULL || PasswordUNICODE == NULL || UniCodeNonceStr == NULL || IsvString == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ if (mAtAm == NULL) {
+ Status = gBS->LocateProtocol (
+ &gEfiAtAmProtocolGuid,
+ NULL,
+ (VOID **) &mAtAm
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "ATAM: ATAM Protocol failed, Status = %r\n", Status));
+ }
+ }
+
+ AtAmUiStrGetCursor (&CRow, &CCol);
+
+ do {
+ AtAmUiStrClearScreen ();
+ AtAmUiStrDisplayFix (STR_ATAMUI_SUS_EXIT_QUESTION, TRUE);
+
+ AtAmUiStrGetChar (&Key);
+ if (Key.UnicodeChar == L'y' || Key.UnicodeChar == L'Y' || Key.UnicodeChar == L'n' || Key.UnicodeChar == L'N') {
+ AtAmUiStrEnableCursor(FALSE);
+ break;
+ }
+ } while (1);
+
+ if (Key.UnicodeChar == L'y' || Key.UnicodeChar == L'Y') {
+ do {
+ AtAmUiStrClearScreen ();
+
+ RecoveryConfig.IsvPlatformId[0] = L'\0';
+ Status = mAtAm->AtAmGetRecoveryConfig (mAtAm, &RecoveryConfig);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "ATAM: AtAmGetRecoveryConfig command failed, Status = %r\n", Status));
+ }
+ if (RecoveryConfig.IsvPlatformId[0] != L'\0') {
+ AtAmUiStrSetCursor(4, 13);
+ AtAmUiStrDisplayFix (STR_ATAMUI_PLATFORM_ID, FALSE);
+ AtAmUiStrDisplay ((CHAR16 *) RecoveryConfig.IsvPlatformId);
+ }
+
+ AtAmUiStrSetCursor(4, 14);
+ Status = mAtAm->AtAmGetIsvId (mAtAm, IsvString, &IsvId);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "ATAM: AtAmGetIsvId command failed, Status = %r\n", Status));
+ }
+ AtAmUiStrDisplay ((CHAR16 *) IsvString);
+
+ AtAmUiStrEnableCursor (FALSE);
+
+ AtAmUiStrDisplayFix (STR_ATAMUI_SUS_EXIT_INFO, TRUE);
+
+ AtAmUiStrSetCursor (4, 3);
+ AtAmUiStrDisplayFix (STR_ATAMUI_RES_REFER, FALSE);
+ mAtAm->AtAmGetNonce (mAtAm, NonceStr);
+ Uint8ToUnicode (NonceStr, UniCodeNonceStr);
+ AtAmUiStrDisplay ((UINT16 *) UniCodeNonceStr);
+
+ AtAmUiStrSetCursor (4, 4);
+ AtAmUiStrDisplayFix (STR_ATAMUI_SUS_ENTER_TOKEN, FALSE);
+
+ AtAmUiStrEnableCursor (TRUE);
+ AtAmUiGetPassword (PasswordASCII, ATAM_SETUP_PASSWORD_LENGTH, PasswordUNICODE, 1);
+ AtAmUiStrEnableCursor (FALSE);
+
+ AtAmUiStrDisplayFix (STR_ATAMUI_CHECKING_AUTHENT, TRUE);
+
+ Status = mAtAm->AtAmSetSuspendState (mAtAm, ATAM_EXIT_SUSPEND_STATE, PasswordASCII);
+ if (Status != EFI_SUCCESS) {
+ AtAmUiStrDisplayFix (STR_ATAMUI_SUS_AUTH_FAILED, FALSE);
+ AtAmUiDelay (AT_AM_UI_1_SECOND);
+ }
+
+ AtAmUiDelay (AT_AM_UI_1_SECOND);
+ } while (--NumOfAttempts && (Status != EFI_SUCCESS));
+
+ if (Status == EFI_SUCCESS) {
+ AtAmUiStrDisplayFix (STR_ATAMUI_SUS_EXIT_SUCCESS, TRUE);
+
+ } else {
+ AtAmUiStrDisplayFix (STR_ATAMUI_SUS_ATTEMPT_EXC, TRUE);
+ AtAmUiDelay (AT_AM_UI_1_SECOND);
+ }
+ } else if (Key.UnicodeChar == L'n' || Key.UnicodeChar == L'N') {
+ AtAmUiStrDisplayFix (STR_ATAMUI_SUS_STAY, TRUE);
+ AtAmUiDelay (2 *AT_AM_UI_1_SECOND);
+ }
+
+ ZeroMem (UniCodeNonceStr, (STR_NONCE_LENGTH + 1) * sizeof (UINT16));
+ ZeroMem (PasswordASCII, (ATAM_SETUP_PASSWORD_LENGTH + 1) * sizeof (CHAR8));
+ ZeroMem (PasswordUNICODE, (ATAM_SETUP_PASSWORD_LENGTH + 1) * sizeof (CHAR16));
+
+ FreePool (UniCodeNonceStr);
+ FreePool (PasswordASCII);
+ FreePool (PasswordUNICODE);
+
+ AtAmUiDelay (AT_AM_UI_1_SECOND);
+
+ AtAmUiStrClearScreen ();
+ AtAmUiStrSetCursor (CCol, CRow);
+
+ return Status;
+}
+
+VOID
+EFIAPI
+ShowAtTimerCallback (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+{
+ UINT32 TimerLeft;
+ UINT32 TimerInterval;
+ static CHAR16 *TimeLeftStr = NULL;
+ EFI_STATUS Status;
+ UINT32 CRow;
+ UINT32 CCol;
+
+ if(!TimeLeftStr)
+ TimeLeftStr = AllocateZeroPool ((ATAM_TIMER_STRING_LENGTH + 1) * sizeof (CHAR16));
+
+ AtAmUiStrGetCursor (&CRow, &CCol);
+ Status = mAtAm->AtAmGetTimer (mAtAm, &TimerLeft, &TimerInterval);
+
+ if(EFI_ERROR(Status))
+ return;
+
+ UnicodeValueToString (TimeLeftStr, 0, TimerLeft, 0);
+ AtAmUiStrDisplayFix (STR_ATAMUI_TIME_LEFT, TRUE);
+ AtAmUiStrDisplay ((CHAR16 *) TimeLeftStr);
+ AtAmUiStrDisplayFix (STR_ATAMUI_TIME_LEFT_SEC,FALSE);
+
+ AtAmUiStrSetCursor(CCol,CRow);
+}
+// Set the default TEXT MODE resolution the same with TSE
+#define MAX_ROWS (UINT8)(31)
+#define MAX_COLS (UINT8)(100)
+UINTN StyleGetTextMode()
+{
+ EFI_STATUS Status;
+ INT32 i;
+ UINTN ModeRows, ModeCols;
+
+
+ // Default Implementation
+ for ( i = 0; i < gST->ConOut->Mode->MaxMode; i++ )
+ {
+ Status = gST->ConOut->QueryMode( gST->ConOut, i, &ModeCols, &ModeRows );
+
+ if ( EFI_ERROR( Status ) )
+ continue;
+
+ if ( ( MAX_COLS <= ModeCols ) && ( MAX_ROWS <= ModeRows ) )
+ return i;
+ }
+
+ // return MaxMode if the mode wasn't found
+ return i;
+}
+/**
+ Function handling recovery proccess.
+
+ @param[in] None
+
+ @retval EFI_SUCCESS The function completed successfully.
+ @retval EFI_OUT_OF_RESOURCES Unable to allocate necessary data structures.
+**/
+EFI_STATUS
+AtAmUiRecovery (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ EFI_INPUT_KEY Key;
+ UINT32 PassType;
+ UINT8 IsAuthenticated;
+ AT_STATE_INFO StateInfo;
+ UINT32 TimerLeft;
+ UINT32 TimerInterval;
+ UINT8 *PasswordASCII;
+ CHAR16 *PasswordUNICODE;
+ CHAR16 *TimeLeftStr;
+ UINT8 *IsvString;
+ UINT32 CRow;
+ UINT32 CCol;
+ UINT32 NumberOfAttempts;
+ UINT32 IsvId;
+ CHAR16 *UniCodeNonceStr;
+ UINT8 NonceStr[STR_NONCE_LENGTH];
+
+ IsAuthenticated = 0;
+
+ PasswordASCII = AllocateZeroPool ((ATAM_SETUP_PASSWORD_LENGTH + 1) * sizeof (UINT8));
+ PasswordUNICODE = AllocateZeroPool ((ATAM_SETUP_PASSWORD_LENGTH + 1) * sizeof (CHAR16));
+ TimeLeftStr = AllocateZeroPool ((ATAM_TIMER_STRING_LENGTH + 1) * sizeof (CHAR16));
+ IsvString = AllocateZeroPool ((RECOVERY_STRING_LENGTH + 1) * sizeof (UINT8));
+ UniCodeNonceStr = AllocateZeroPool ((STR_NONCE_LENGTH + 1) * sizeof (CHAR16));
+
+ if (PasswordASCII == NULL || PasswordUNICODE == NULL || TimeLeftStr == NULL || IsvString == NULL || UniCodeNonceStr == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ if (mAtAm == NULL) {
+ Status = gBS->LocateProtocol (
+ &gEfiAtAmProtocolGuid,
+ NULL,
+ (VOID **) &mAtAm
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "ATAM: ATAM Protocol failed, Status = %r\n", Status));
+ }
+ }
+
+ AtAmUiStrGetCursor (&CRow, &CCol);
+
+ NumberOfAttempts = 3;
+
+ do {
+ AtAmUiStrClearScreen ();
+ AtAmUiDisplayIsvStrings ();
+
+ do {
+ AtAmUiStrEnableCursor (FALSE);
+
+ AtAmUiStrSetCursor(4, 20);
+ Status = mAtAm->AtAmGetIsvId (mAtAm, IsvString, &IsvId);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "ATAM: AtAmGetIsvId command failed, Status = %r\n", Status));
+ }
+ AtAmUiStrDisplay ((CHAR16 *) IsvString);
+
+ mAtAm->AtAmGetAtStateInfo (mAtAm, &StateInfo);
+ AtAmUiStrDisplayFix (STR_ATAMUI_LOCK_DUE_TO, TRUE);
+ switch (StateInfo.LastTheftTrigger) {
+ case 1:
+ AtAmUiStrDisplayFix (STR_ATAMUI_LOCK_TIME, FALSE);
+ break;
+
+ case 2:
+ AtAmUiStrDisplayFix (STR_ATAMUI_LOCK_STOLEN, FALSE);
+ break;
+
+ case 3:
+ AtAmUiStrDisplayFix (STR_ATAMUI_LOCK_THRESHOLD, FALSE);
+ break;
+
+ case 4:
+ AtAmUiStrDisplayFix (STR_ATAMUI_LOCK_ATTACK, FALSE);
+
+ default:
+ break;
+ }
+
+ mAtAm->AtAmGetTimer (mAtAm, &TimerLeft, &TimerInterval);
+ UnicodeValueToString (TimeLeftStr, 0, TimerLeft, 0);
+
+ AtAmUiStrDisplayFix (STR_ATAMUI_TIME_LEFT, TRUE);
+ AtAmUiStrDisplay ((CHAR16 *) TimeLeftStr);
+ AtAmUiStrDisplayFix (STR_ATAMUI_TIME_LEFT_SEC,FALSE);
+
+ AtAmUiStrDisplayFix (STR_ATAMUI_SELECT_PASS, TRUE);
+
+ AtAmUiStrDisplayFix (STR_ATAMUI_SELECT_OPTION, TRUE);
+
+ AtAmUiStrGetChar (&Key);
+ if (Key.UnicodeChar == L'1' || Key.UnicodeChar == L'2') {
+ break;
+ }
+
+ AtAmUiStrDisplayFix (STR_ATAMUI_INVALID_SELECT, TRUE);
+ } while (1);
+
+ AtAmUiStrClearScreen ();
+ AtAmUiDisplayIsvStrings ();
+ AtAmUiStrSetCursor(4, 20);
+ AtAmUiStrDisplay ((CHAR16 *) IsvString);
+ AtAmUiStrDisplayFix (STR_ATAMUI_LOCK_DUE_TO, TRUE);
+ switch (StateInfo.LastTheftTrigger) {
+ case 1:
+ AtAmUiStrDisplayFix (STR_ATAMUI_LOCK_TIME, FALSE);
+ break;
+
+ case 2:
+ AtAmUiStrDisplayFix (STR_ATAMUI_LOCK_STOLEN, FALSE);
+ break;
+
+ case 3:
+ AtAmUiStrDisplayFix (STR_ATAMUI_LOCK_THRESHOLD, FALSE);
+ break;
+
+ case 4:
+ AtAmUiStrDisplayFix (STR_ATAMUI_LOCK_ATTACK, FALSE);
+
+ default:
+ break;
+ }
+ mAtAm->AtAmGetTimer (mAtAm, &TimerLeft, &TimerInterval);
+ UnicodeValueToString (TimeLeftStr, 0, TimerLeft, 0);
+ AtAmUiStrDisplayFix (STR_ATAMUI_TIME_LEFT, TRUE);
+ AtAmUiStrDisplay ((CHAR16 *) TimeLeftStr);
+ AtAmUiStrDisplayFix (STR_ATAMUI_TIME_LEFT_SEC,FALSE);
+
+ switch (Key.UnicodeChar) {
+ case L'1':
+ PassType = AT_CREDENTIAL_TYPE_USER_PASSPHRASE;
+ AtAmUiStrDisplayFix (STR_ATAMUI_USER_PASS, TRUE);
+ AtAmUiStrDisplayFix (STR_ATAMUI_RECO_ENTER_PASS, TRUE);
+ AtAmUiStrEnableCursor (TRUE);
+ AtAmUiGetPassword (PasswordASCII, ATAM_SETUP_PASSWORD_LENGTH, PasswordUNICODE, 0);
+ AtAmUiStrEnableCursor (FALSE);
+ AtAmUiStrDisplayFix (STR_ATAMUI_CHECKING_PASS, TRUE);
+ AtAmUiDelay (AT_AM_UI_1_SECOND);
+ Status = mAtAm->AtAmVerifyPassword (mAtAm, PasswordASCII, PassType, &IsAuthenticated);
+ DEBUG ((EFI_D_ERROR, "ATAM: IsAuthenticated %x\n", IsAuthenticated));
+
+ break;
+
+ case L'2':
+ AtAmUiStrDisplayFix (STR_ATAMUI_RECO_REFER, TRUE);
+ Status = mAtAm->AtAmGetNonce (mAtAm, NonceStr);
+ if (Status == EFI_SUCCESS) {
+ Uint8ToUnicode (NonceStr, UniCodeNonceStr);
+ AtAmUiStrDisplay ((UINT16 *) UniCodeNonceStr);
+ } else {
+ AtAmUiStrDisplayFix (STR_ATAMUI_SUS_NONCE_FAILED, FALSE);
+ DEBUG ((EFI_D_ERROR, "ATAM: Get Nonce failed, Status = %r\n", Status));
+ }
+ AtAmUiStrDisplayFix (STR_ATAMUI_SERV_BASED_RECOV, TRUE);
+ AtAmUiStrSetCursor(4, 6);
+ AtAmUiStrDisplayFix (STR_ATAMUI_RECO_SEC_TOKEN, FALSE);
+
+ PassType = AT_CREDENTIAL_TYPE_SRTK;
+
+ AtAmUiStrEnableCursor (TRUE);
+ AtAmUiGetPassword (PasswordASCII, ATAM_SETUP_PASSWORD_LENGTH, PasswordUNICODE, 1);
+ AtAmUiStrEnableCursor (FALSE);
+
+ AtAmUiStrDisplayFix (STR_ATAMUI_CHECKING_PASS, TRUE);
+ AtAmUiDelay (AT_AM_UI_1_SECOND);
+ Status = mAtAm->AtAmVerifyPassword (mAtAm, PasswordASCII, PassType, &IsAuthenticated);
+ DEBUG ((EFI_D_ERROR, "ATAM: IsAuthenticated %x\n", IsAuthenticated));
+
+ break;
+
+ default:
+ DEBUG ((EFI_D_ERROR, "ATAM: Option not supported. \n"));
+
+ break;
+ }
+
+ ZeroMem (PasswordASCII, (ATAM_SETUP_PASSWORD_LENGTH + 1) * sizeof (UINT8));
+ ZeroMem (PasswordUNICODE, (ATAM_SETUP_PASSWORD_LENGTH + 1) * sizeof (CHAR16));
+
+ NumberOfAttempts--;
+
+ if (NumberOfAttempts && IsAuthenticated == 0) {
+ AtAmUiStrDisplayFix (STR_ATAMUI_RECO_TRY_AGAIN, TRUE);
+ AtAmUiDelay (AT_AM_UI_1_SECOND);
+ }
+
+ } while (NumberOfAttempts && (IsAuthenticated == 0));
+
+ FreePool (TimeLeftStr);
+ FreePool (PasswordASCII);
+ FreePool (PasswordUNICODE);
+ FreePool (IsvString);
+ FreePool (UniCodeNonceStr);
+
+ if (IsAuthenticated == 1) {
+ AtAmUiStrDisplayFix (STR_ATAMUI_RECO_SUCCESS, TRUE);
+ AtAmUiDelay (2 * AT_AM_UI_1_SECOND);
+ } else {
+ AtAmUiStrDisplayFix (STR_ATAMUI_RECO_FAILED, TRUE);
+ AtAmUiDelay (2 * AT_AM_UI_1_SECOND);
+ gRT->ResetSystem (EfiResetShutdown, EFI_SUCCESS, 0, NULL);
+ }
+
+ AtAmUiDelay (AT_AM_UI_1_SECOND);
+ AtAmUiStrClearScreen ();
+ AtAmUiStrSetCursor(CCol, CRow);
+
+ return Status;
+}
+
+/**
+ Function displaing Ivs strings.
+
+ @param[in] None
+
+ @retval EFI_SUCCESS The function completed successfully.
+ @retval EFI_OUT_OF_RESOURCES Unable to allocate necessary data structures.
+**/
+EFI_STATUS
+AtAmUiDisplayIsvStrings (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ CHAR16 *IsvIdString;
+ AT_BIOS_RECOVERY_CONFIG RecoveryConfig;
+ UINT8 *IsvString;
+ UINT32 IsvId;
+ UINT32 CRow;
+ UINT32 CCol;
+
+ IsvId = 0;
+
+ DEBUG ((EFI_D_ERROR, "ATAM: AtAmUiDisplayIsvStrings. \n"));
+
+ IsvIdString = AllocateZeroPool (ISV_PLATFORM_ID_LENGTH * sizeof (CHAR16));
+ IsvString = AllocateZeroPool ((RECOVERY_STRING_LENGTH + 1) * sizeof (UINT8));
+ if (IsvIdString == NULL || IsvString == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ if (mAtAm == NULL) {
+ Status = gBS->LocateProtocol (
+ &gEfiAtAmProtocolGuid,
+ NULL,
+ (VOID **) &mAtAm
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "ATAM: ATAM Protocol failed, Status = %r\n", Status));
+ }
+ }
+
+ AtAmUiStrGetCursor (&CRow, &CCol);
+
+ Status = mAtAm->AtAmGetIsvId (mAtAm, IsvString, &IsvId);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "ATAM: AtAmGetIsvId command failed, Status = %r\n", Status));
+ }
+
+ RecoveryConfig.IsvPlatformId[0] = L'\0';
+ Status = mAtAm->AtAmGetRecoveryConfig (mAtAm, &RecoveryConfig);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "ATAM: AtAmGetRecoveryConfig command failed, Status = %r\n", Status));
+ }
+
+ if (RecoveryConfig.IsvPlatformId[0] != L'\0') {
+ AtAmUiStrDisplayFix (STR_ATAMUI_PLATFORM_ID, TRUE);
+ AtAmUiStrDisplay ((CHAR16 *) RecoveryConfig.IsvPlatformId);
+ }
+
+ if (IsvId != 0) {
+ UnicodeValueToString (IsvIdString, 0, (UINT32) IsvId, 0);
+ AtAmUiStrDisplayFix (STR_ATAMUI_PROVIDER_ID, TRUE);
+ AtAmUiStrDisplay (IsvIdString);
+ }
+
+ FreePool (IsvString);
+ FreePool (IsvIdString);
+
+ return Status;
+}
+
+/**
+ This GetRecoveryPassword() process the AT recovery password user input.
+
+ @param[out] PasswordASCII Pointer to an array of ASCII user input
+ @param[in] MaxPasswordLength Integer value for max password length
+ @param[out] PasswordUNICODE Pointer to an array of UNICODE user input
+ @param[in] ShowPassword TRUE - password is shown, FALSE - pasword is hidden by *
+
+ @retval EFI_SUCCESS The function completed successfully.
+ @retval EFI_OUT_OF_RESOURCES Do not have enough resources to allocate memory or password too long.
+**/
+EFI_STATUS
+AtAmUiGetPassword (
+ OUT UINT8 *PasswordASCII,
+ IN INTN MaxPasswordLength,
+ OUT CHAR16 *PasswordUNICODE,
+ IN UINT8 ShowPassword
+ )
+{
+ INTN StrIndex;
+ EFI_INPUT_KEY Key = { 0, 0 };
+ CHAR16 StarChar[2] = { L' ', L'\0' };
+
+ DEBUG ((EFI_D_ERROR, "ATAM: AtAmUiGetRecoveryPassword \n"));
+
+ PasswordASCII[0] = L'\0';
+ PasswordUNICODE[0] = L'\0';
+
+ Key.UnicodeChar = 0;
+ Key.ScanCode = 0;
+ StrIndex = 0;
+
+ DEBUG ((EFI_D_ERROR, "ATAM: Wait for Key \n"));
+
+ AtAmUiStrEnableCursor (TRUE);
+ do {
+ Key.ScanCode = 0;
+ Key.UnicodeChar = 0;
+ AtAmUiStrGetChar (&Key);
+ DEBUG ((EFI_D_ERROR, "ATAM: PasswordUNICODE: %s\n", PasswordUNICODE));
+
+ switch (Key.UnicodeChar) {
+ case CHAR_NULL:
+ ///
+ /// Non-printable characters handling: do not print caps/numlock, pgup/dn, Fx, cursors etc.
+ /// When escape pressed, return with empty password and ask for password again
+ ///
+ if (Key.ScanCode == SCAN_ESC) {
+ PasswordASCII[0] = L'\0';
+ PasswordUNICODE[0] = L'\0';
+ StrIndex = 0;
+ return EFI_SUCCESS;
+ }
+ break;
+
+ case CHAR_CARRIAGE_RETURN:
+ ///
+ /// Enter handling: when enter pressed, return with the password
+ ///
+ StrIndex = 0;
+
+ DEBUG ((EFI_D_ERROR, "ATAM: Passphrase Entered: %s\n", PasswordUNICODE));
+ return EFI_SUCCESS;
+
+ case CHAR_BACKSPACE:
+ ///
+ /// Backspace handling
+ ///
+ if (StrIndex > 0) {
+ StrIndex--;
+ PasswordASCII[StrIndex] = L'\0';
+ PasswordUNICODE[StrIndex] = L'\0';
+ ///
+ /// Backspace printing on screen
+ ///
+ AtAmUiStrDisplay (L"\b \b");
+ }
+ break;
+
+ default:
+ ///
+ /// Normal (printable) characters handling
+ /// Do not hide password on screen for Server Token Password recovery (usrRsp=2)
+ /// Hide password with '*' for User Password recovery (usrRsp=1)
+ ///
+ StarChar[0] = (ShowPassword == 1) ? Key.UnicodeChar : L'*';
+
+ if (StrIndex >= 0 && StrIndex < MaxPasswordLength) {
+ ///
+ /// Index in range
+ ///
+ PasswordASCII[StrIndex] = (UINT8) Key.UnicodeChar;
+ PasswordUNICODE[StrIndex] = Key.UnicodeChar;
+ StrIndex++;
+ ///
+ /// Print hidden (*) or unhidden password character
+ ///
+ AtAmUiStrDisplay (StarChar);
+ } else if (StrIndex < 0) {
+ ///
+ /// Index out of range: StrIndex < 0 - should never go here
+ ///
+ AtAmUiStrEnableCursor (FALSE);
+ StrIndex = 0;
+ } else {
+ ///
+ /// Index out of range: StrIndex >= ATAM_SETUP_PASSWORD_LENGTH - max password length (49 chars) exceeded,
+ /// only backspace, enter or escape will be accepted
+ ///
+ DEBUG ((EFI_D_ERROR, "ATAM: Password Length Exceeded\n"));
+ }
+ break;
+ }
+
+ } while (1);
+
+ AtAmUiStrEnableCursor (FALSE);
+
+ return EFI_TIMEOUT;
+}
+
+/**
+ Function displaing Ivs strings.
+
+ @param[in] None
+
+ @retval EFI_SUCCESS The function completed successfully.
+ @retval EFI_OUT_OF_RESOURCES Unable to allocate necessary data structures.
+**/
+EFI_STATUS
+AtAmUiTheftNotification (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ AT_STATE_INFO StateInfo;
+ UINT32 TimerLeft;
+ UINT32 TimerInterval;
+ UINT8 *IsvString;
+ UINT32 IsvId;
+ CHAR16 *TimeLeftStr;
+ UINT8 PbaFailedExceeded;
+ UINT16 PbaFailedAttempts;
+ UINT16 PbaFailedThreshold;
+
+ DEBUG ((EFI_D_ERROR, "ATAM: AtAmUiTheftNotification\n"));
+
+ Status = EFI_SUCCESS;
+ PbaFailedExceeded = FALSE;
+
+ Status = gBS->LocateProtocol (
+ &gEfiAtAmProtocolGuid,
+ NULL,
+ (VOID **) &mAtAm
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "ATAM: ATAM failed = %r\n", Status));
+ return Status;
+ }
+
+ Status = mAtAm->AtAmGetPbaCounter(&PbaFailedExceeded, &PbaFailedAttempts, &PbaFailedThreshold);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "ATAM: AtAmGetIsvId = %r\n", Status));
+ return Status;
+ }
+
+ if (PbaFailedThreshold >= PbaFailedAttempts) {
+ return EFI_SUCCESS;
+ } else {
+
+ IsvString = AllocateZeroPool ((RECOVERY_STRING_LENGTH + 1) * sizeof (UINT8));
+ TimeLeftStr = AllocateZeroPool ((ATAM_TIMER_STRING_LENGTH + 1) * sizeof (CHAR16));
+
+ if (IsvString == NULL || TimeLeftStr == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ AtAmUiStrClearScreen ();
+
+ AtAmUiDisplayIsvStrings ();
+
+ AtAmUiStrEnableCursor (FALSE);
+
+ AtAmUiStrSetCursor(4, 20);
+ Status = mAtAm->AtAmGetIsvId (mAtAm, IsvString, &IsvId);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "ATAM: AtAmGetIsvId, Status = %r\n", Status));
+ }
+
+ AtAmUiStrDisplay ((CHAR16 *) IsvString);
+
+ mAtAm->AtAmGetAtStateInfo (mAtAm, &StateInfo);
+ AtAmUiStrDisplayFix (STR_ATAMUI_LOCK_DUE_TO, TRUE);
+ switch (StateInfo.LastTheftTrigger) {
+ case 1:
+ AtAmUiStrDisplayFix (STR_ATAMUI_LOCK_TIME, FALSE);
+ break;
+
+ case 2:
+ AtAmUiStrDisplayFix (STR_ATAMUI_LOCK_STOLEN, FALSE);
+ break;
+
+ case 3:
+ AtAmUiStrDisplayFix (STR_ATAMUI_LOCK_THRESHOLD, FALSE);
+ break;
+
+ case 4:
+ AtAmUiStrDisplayFix (STR_ATAMUI_LOCK_ATTACK, FALSE);
+
+ default:
+ break;
+ }
+
+ mAtAm->AtAmGetTimer (mAtAm, &TimerLeft, &TimerInterval);
+ UnicodeValueToString (TimeLeftStr, 0, TimerLeft, 0);
+
+ AtAmUiStrDisplayFix (STR_ATAMUI_TIME_LEFT, TRUE);
+ AtAmUiStrDisplay ((CHAR16 *) TimeLeftStr);
+ AtAmUiStrDisplayFix (STR_ATAMUI_TIME_LEFT_SEC,FALSE);
+
+ AtAmUiDelay ((PbaFailedAttempts - PbaFailedThreshold) * 10 * AT_AM_UI_1_SECOND);
+
+ AtAmUiStrClearScreen ();
+
+ return Status;
+ }
+}
+
diff --git a/Board/EM/MeWrapper/AtAmUi/AtAmUi.cif b/Board/EM/MeWrapper/AtAmUi/AtAmUi.cif
new file mode 100644
index 0000000..f59551d
--- /dev/null
+++ b/Board/EM/MeWrapper/AtAmUi/AtAmUi.cif
@@ -0,0 +1,14 @@
+<component>
+ name = "AtAmUi"
+ category = ModulePart
+ LocalRoot = "Board\EM\MeWrapper\AtAmUi\"
+ RefName = "AtAmUi"
+[files]
+"AtAmUi.dxs"
+"AtAmUi.mak"
+"AtAmUi.sdl"
+"AtAmUi.c"
+"AtAmUi.h"
+"AtAmUiString.c"
+"AtAmUiString.h"
+<endComponent>
diff --git a/Board/EM/MeWrapper/AtAmUi/AtAmUi.dxs b/Board/EM/MeWrapper/AtAmUi/AtAmUi.dxs
new file mode 100644
index 0000000..7a69567
--- /dev/null
+++ b/Board/EM/MeWrapper/AtAmUi/AtAmUi.dxs
@@ -0,0 +1,42 @@
+/** @file
+ Dependency expression file for AtAmUi Invocation Driver.
+
+@copyright
+ Copyright (c) 2012 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.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+
+
+#include "AutoGen.h"
+#include "DxeDepex.h"
+
+#if defined (BUILD_WITH_GLUELIB) || defined (BUILD_WITH_EDKII_GLUE_LIB)
+#include "EfiDepex.h"
+#include EFI_PROTOCOL_DEPENDENCY (MeBiosPayloadData)
+#include EFI_PROTOCOL_DEFINITION (Heci)
+#include EFI_PROTOCOL_DEFINITION (At)
+#include EFI_PROTOCOL_DEFINITION (AtAm)
+#include EFI_PROTOCOL_DEFINITION (AtPlatformPolicy)
+#endif
+
+DEPENDENCY_START
+ EFI_AT_PROTOCOL_GUID AND
+ DXE_PLATFORM_AT_POLICY_GUID AND
+ EFI_HECI_PROTOCOL_GUID AND
+ ME_BIOS_PAYLOAD_DATA_PROTOCOL_GUID AND
+ EFI_ATAM_PROTOCOL_GUID
+DEPENDENCY_END
diff --git a/Board/EM/MeWrapper/AtAmUi/AtAmUi.h b/Board/EM/MeWrapper/AtAmUi/AtAmUi.h
new file mode 100644
index 0000000..04e356f
--- /dev/null
+++ b/Board/EM/MeWrapper/AtAmUi/AtAmUi.h
@@ -0,0 +1,150 @@
+/** @file
+ Header file.
+
+@copyright
+ Copyright (c) 2013 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.
+
+ 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
+**/
+#ifndef _ATAMUI_H_
+#define _ATAMUI_H_
+
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#include "AtAmUiString.h"
+#include "AtAm.h"
+#include "AtHi.h"
+#include "AtAmHelper.h"
+#endif
+
+#include EFI_PROTOCOL_CONSUMER (AtAm)
+#include EFI_PROTOCOL_CONSUMER (AtPlatformPolicy)
+
+///
+/// Intel ME Alert AT Handler Event GUID
+/// The event is used to execute AtAmUiCallback () when the system is ready to launch ATAM UI
+/// The event is signaled after consoles are ready in BDS phase.
+///
+#define ME_ALERT_AT_HANDLER_GUID \
+ { \
+ 0xb441df87, 0x8d94, 0x4811, 0x85, 0xf7, 0xf, 0x9a, 0x7b, 0xf8, 0x9d, 0x2a \
+ }
+
+#define ATAMUI_SUSPEND_ATTEMPTS 3
+
+/**
+ ATAM UI callback.
+
+ @param[in] Event The event registered
+ @param[in] Context Event context. Not used in this event handler.
+
+ @retval None
+**/
+VOID
+EFIAPI
+AtAmUiCallback (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+;
+
+/**
+ Function handling entering suspend mode.
+
+ @param[in] None
+
+ @retval EFI_SUCCESS The function completed successfully.
+ @retval EFI_OUT_OF_RESOURCES Unable to allocate necessary data structures.
+**/
+EFI_STATUS
+AtAmUiTheftNotification (
+ VOID
+ )
+;
+
+/**
+ Function handling displaing theft notification.
+
+ @param[in] None
+
+ @retval EFI_SUCCESS The function completed successfully.
+ @retval EFI_OUT_OF_RESOURCES Unable to allocate necessary data structures.
+**/
+EFI_STATUS
+AtAmUiEnterSuspendState (
+ VOID
+ )
+;
+
+/**
+ Function handling exiting suspend mode.
+
+ @param[in] None
+
+ @retval EFI_SUCCESS The function completed successfully.
+ @retval EFI_OUT_OF_RESOURCES Unable to allocate necessary data structures.
+**/
+EFI_STATUS
+AtAmUiExitSuspendState (
+ VOID
+ )
+;
+
+/**
+ Function handling recovery proccess.
+
+ @param[in] None
+
+ @retval EFI_SUCCESS The function completed successfully.
+ @retval EFI_OUT_OF_RESOURCES Unable to allocate necessary data structures.
+**/
+EFI_STATUS
+AtAmUiRecovery (
+ VOID
+ )
+;
+
+/**
+ Function displaing Ivs strings.
+
+ @param[in] None
+
+ @retval EFI_SUCCESS The function completed successfully.
+ @retval EFI_OUT_OF_RESOURCES Unable to allocate necessary data structures.
+**/
+EFI_STATUS
+AtAmUiDisplayIsvStrings (
+ VOID
+ )
+;
+
+/**
+ This GetRecoveryPassword() process the AT recovery password user input.
+
+ @param[out] PasswordASCII Pointer to an array of ASCII user input
+ @param[in] MaxPasswordLength Integer value for max password length
+ @param[out] PasswordUNICODE Pointer to an array of UNICODE user input
+ @param[in] ShowPassword TRUE - password is shown, FALSE - pasword is hidden by *
+
+ @retval EFI_SUCCESS The function completed successfully.
+ @retval EFI_OUT_OF_RESOURCES Do not have enough resources to allocate memory or password too long.
+**/
+EFI_STATUS
+AtAmUiGetPassword (
+ OUT UINT8 *PasswordASCII,
+ IN INTN MaxPasswordLength,
+ OUT CHAR16 *PasswordUNICODE,
+ IN UINT8 ShowPassword
+ )
+;
+#endif
diff --git a/Board/EM/MeWrapper/AtAmUi/AtAmUi.mak b/Board/EM/MeWrapper/AtAmUi/AtAmUi.mak
new file mode 100644
index 0000000..958ee72
--- /dev/null
+++ b/Board/EM/MeWrapper/AtAmUi/AtAmUi.mak
@@ -0,0 +1,148 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/ATAMUI/AtAmUi.mak 1 8/29/12 3:02a Klzhan $
+#
+# $Revision: 1 $
+#
+# $Date: 8/29/12 3:02a $
+#
+#**********************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/ATAMUI/AtAmUi.mak $
+#
+# 1 8/29/12 3:02a Klzhan
+# [TAG] EIPNone
+# [Category] Spec Update
+# [Severity] Important
+# [Description] Support AT5
+# [Files] AtAmUi.cif
+# AtAmUi.dxs
+# AtAmUi.mak
+# AtAmUi.sdl
+# AtAmUi.c
+# AtAmUi.h
+# AtAmUiString.c
+# AtAmUiString.h
+#
+# 2 2/23/12 8:58a Klzhan
+# Support New EDK
+#
+# 1 2/08/12 1:08a Klzhan
+# Initial Check in
+#
+# 2 9/15/11 2:12a Klzhan
+# Remove AMI Lib.
+#
+# 1 2/25/11 1:43a Klzhan
+# Initial Check-in
+#
+# 1 12/03/10 5:10a Klzhan
+# Initial Check-in.
+#
+#
+#**********************************************************************
+#
+#<AMI_FHDR_START>
+#----------------------------------------------------------------------------
+#
+# Name: AmtWrapperDxe.mak
+#
+# Description: Makfile for Amt Wrapper Dxe module
+#
+#----------------------------------------------------------------------------
+#<AMI_FHDR_END>
+EDK : AtAmUi
+
+AtAmUi : $(BUILD_DIR)\AtAmUi.mak AtAmUiBin
+
+$(BUILD_DIR)\AtAmUi.mak : $(AtAmUi_DIR)\AtAmUi.mak $(BUILD_RULES)
+ $(CIF2MAK) $(AtAmUi_DIR)\AtAmUi.cif $(CIF2MAK_DEFAULTS)
+
+AtAmUi_INCLUDES=\
+ $(EDK_INCLUDES)\
+ $(MISCFRAMEWORK_INCLUDES)\
+ $(ME_INCLUDES)\
+ $(INTEL_MCH_INCLUDES)\
+ $(INTEL_PCH_INCLUDES)\
+ $(IndustryStandard_INCLUDES)\
+ $(EdkIIGlueLib_INCLUDES)\
+ /IInclude\
+ $(NB_INCLUDES)\
+ /I$(AtAmDxe_DIR)\
+ /I$(AtDxeLib_DIR)\
+
+AtAmUi_LIBS=\
+ $(EFISCRIPTLIB)\
+ $(EFIDRIVERLIB)\
+ $(EFICOMMONLIB)\
+ $(PRINTLIB)\
+ $(EDKFRAMEWORKPROTOCOLLIB)\
+ $(EFIGUIDLIB)\
+ $(AmtProtocolLib_LIB)\
+ $(AmtLibDxe_LIB)\
+ $(MeLibDxe_LIB)\
+ $(AmtGuidLib_LIB)\
+ $(EdkIIGlueDxeReportStatusCodeLib_LIB)\
+ $(EdkIIGlueDxeDebugLibReportStatusCode_LIB)\
+ $(EdkIIGlueBaseLib_LIB)\
+!IF "$(x64_BUILD)"=="1"
+ $(EdkIIGlueBaseLibX64_LIB)\
+!ELSE
+ $(EdkIIGlueBaseLibIA32_LIB)\
+!ENDIF
+ $(EdkIIGlueDxeServicesTableLib_LIB)\
+ $(EdkIIGlueBasePrintLib_LIB) \
+ $(AtDxeLib_LIB)\
+
+AtAmUi_DEFINES = $(MY_DEFINES)\
+ /D"__EDKII_GLUE_MODULE_ENTRY_POINT__=AtAmUiEntryPoint"\
+ /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_PCI_LIB_PCI_EXPRESS__ \
+ /D __EDKII_GLUE_BASE_LIB__ \
+ /D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ /D __EDKII_GLUE_UEFI_DEVICE_PATH_LIB__ \
+ /D __EDKII_GLUE_UEFI_LIB__\
+ /D __EDKII_GLUE_DXE_MEMORY_ALLOCATION_LIB__ \
+
+
+AtAmUiBin : $(AtAmUi_LIBS)
+ $(MAKE) /$(MAKEFLAGS) $(EDK_DEFAULTS)\
+ /f $(BUILD_DIR)\AtAmUi.mak all\
+ GUID=D2BC3092-92BB-4B21-A26B-CE6f7C3E9857\
+ "MY_INCLUDES=$(AtAmUi_INCLUDES)" \
+ "MY_DEFINES=$(AtAmUi_DEFINES)"\
+ ENTRY_POINT=AtAmUiEntryPoint\
+ DEPEX1=$(AtAmUi_DIR)\AtAmUi.dxs\
+ DEPEX1_TYPE=EFI_SECTION_DXE_DEPEX\
+ TYPE=BS_DRIVER\
+ 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/AtAmUi/AtAmUi.sdl b/Board/EM/MeWrapper/AtAmUi/AtAmUi.sdl
new file mode 100644
index 0000000..ce0ff64
--- /dev/null
+++ b/Board/EM/MeWrapper/AtAmUi/AtAmUi.sdl
@@ -0,0 +1,27 @@
+TOKEN
+ Name = "AtAMUI_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable TdtWrapper support in Project"
+ TokenType = Boolean
+ TargetMAK = Yes
+ TargetH = Yes
+ Master = Yes
+ Token = "AT_SUPPORT" "=" "1"
+End
+
+
+PATH
+ Name = "AtAmUi_DIR"
+End
+
+MODULE
+ Help = "Includes TdtWrapper.mak to Project"
+ File = "AtAmUi.mak"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\AtAmUi.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End
+
diff --git a/Board/EM/MeWrapper/AtAmUi/AtAmUiString.c b/Board/EM/MeWrapper/AtAmUi/AtAmUiString.c
new file mode 100644
index 0000000..021844b
--- /dev/null
+++ b/Board/EM/MeWrapper/AtAmUi/AtAmUiString.c
@@ -0,0 +1,242 @@
+/** @file
+ This file contines function used for handling strings.
+
+@copyright
+ Copyright (c) 2012 - 2013 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.
+
+ 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
+**/
+
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#include "AtAmUiString.h"
+#endif
+
+AT_AM_UI_STRING AtAmUiUSStringIDTab[] = {
+ {STR_ATAMUI_LOCKED_TEXT, 4, 20, L"This device has been locked and may have been lost.\r\n If found, Please use the following information to return the device\r\n "},
+ {STR_ATAMUI_PLATFORM_ID, 4, 23, L"Platform ID: "},
+ {STR_ATAMUI_PROVIDER_ID, 4, 24, L"Intel(R) Anti-Theft Technology service provider Id: "},
+ {STR_ATAMUI_LOCK_DUE_TO, 4, 2, L"This computer has been disabled using Intel(R) Anti-Theft Technology due to: "},
+ {STR_ATAMUI_SELECT_PASS, 4, 5, L"Please select one of the following for platform recovery:\r\n 1 - Passphrase\r\n 2 - Server Recovery Token"},
+ {STR_ATAMUI_TIME_LEFT, 4, 4, L"Time Left to enter Passphrase: "},
+ {STR_ATAMUI_USER_PASS, 4, 5, L"System Recovery"},
+ {STR_ATAMUI_RECO_ENTER_PASS, 4, 6, L"Enter Passphrase: "},
+ {STR_ATAMUI_SERV_BASED_RECOV, 4, 6, L"Server Based Recovery"},
+ {STR_ATAMUI_INVALID_SELECT, 4, 10, L"Invalid Selection, Press 1 or 2 "},
+ {STR_ATAMUI_LOCK_TIME, 4, 0, L"Disable Timer expired"},
+ {STR_ATAMUI_LOCK_STOLEN, 4, 0, L"Stolen Message received"},
+ {STR_ATAMUI_LOCK_THRESHOLD, 4, 0, L"Logon Threshold exceeded"},
+ {STR_ATAMUI_LOCK_ATTACK, 4, 0, L"Platform Attack detected"},
+ {STR_ATAMUI_CHECKING_PASS, 4, 8, L"Checking Recovery Password..."},
+ {STR_ATAMUI_RECO_TRY_AGAIN, 4, 10, L"Recovery Failed. Please try again ..."},
+ {STR_ATAMUI_RECO_FAILED, 4, 11, L"Intel(R) Anti-Theft Technology Recovery Failed.\r\n System will shutdown..."},
+ {STR_ATAMUI_RECO_SUCCESS, 4, 11, L"Intel(R) Anti-Theft Technology Recovery Successful.\r\n System Boot Continue ....."},
+ {STR_ATAMUI_SUS_ENTER_INFO, 4, 1, L"User Has Requested To Enter Intel(R) Anti-Theft Technology Suspend Mode....."},
+ {STR_ATAMUI_RES_REFER, 4, 5, L"Refer the following Platform Resume ID to IT: "},
+ {STR_ATAMUI_RECO_REFER, 4, 5, L"Refer the following Platform Recovery ID to IT: "},
+ {STR_ATAMUI_SUS_REFER, 4, 5, L"Refer the following Platform Suspend ID to IT: "},
+ {STR_ATAMUI_SUS_ENTER_TOKEN, 4, 4, L"Enter Suspend Token: "},
+ {STR_ATAMUI_SUS_ATTEMPT_EXC, 4, 9, L"Exceeded Max Attempts - Exiting .... "},
+ {STR_ATAMUI_SUS_ENTER_SUCCESS,4, 5, L"Successfully Put Platform in Suspended Mode"},
+ {STR_ATAMUI_SUS_ENTER_FAILED, 4, 5, L"Failed to Put Platform into Suspended Mode"},
+ {STR_ATAMUI_SUS_AUTH_FAILED, 4, 5, L"Failed to Authenticate "},
+ {STR_ATAMUI_SUS_EXIT_QUESTION,4, 1, L"Intel(R) Anti-Theft Technology in Suspended State: Exit? (y/n)?"},
+ {STR_ATAMUI_SUS_EXIT_INFO, 4, 2, L"Exit Intel(R) Anti-Theft Technology Suspend Mode....."},
+ {STR_ATAMUI_SUS_EXIT_SUCCESS, 4, 7, L"Successfully Exited Suspend Mode"},
+ {STR_ATAMUI_SUS_STAY, 4, 7, L"Stay in Suspend Mode...."},
+ {STR_ATAMUI_SUS_NONCE_FAILED, 0, 0, L"NONCE unknown"},
+ {STR_ATAMUI_TIME_LEFT_SEC, 0, 0, L" seconds "},
+ {STR_ATAMUI_SELECT_OPTION, 4, 9, L"Select one of the above options to proceed ..."},
+ {STR_ATAMUI_CHECKING_AUTHENT, 4, 6, L"Checking Authentication .."},
+ {STR_ATAMUI_RECO_SEC_TOKEN, 4, 6, L"Server Recovery Token: "}
+};
+
+UINTN AtAmUiUSStringIDTabEntries = sizeof (AtAmUiUSStringIDTab) / sizeof (AT_AM_UI_STRING);
+
+/**
+ This function gets character inputted.
+
+ @param[out] Key Pointer to buffer for keystroke.
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+AtAmUiStrGetChar (
+ OUT EFI_INPUT_KEY *Key
+ )
+{
+ EFI_STATUS Status;
+ UINTN Delay = 300000;
+ Status = EFI_SUCCESS;
+
+ Key->UnicodeChar = L'\0';
+ Key->ScanCode = 0;
+ while (Delay) {
+ Status = gST->ConIn->ReadKeyStroke (gST->ConIn, Key);
+ if (!(EFI_ERROR (Status))) {
+ break;
+ }
+ Delay --;
+ }
+
+ return Status;
+}
+
+/**
+ This routine displays the string out to the screen based on defined strings.
+ It uses X and Y to calculate the start location of string where it will be displayed. Function
+ uses string ID to indicate which strings are going to be shown by AtAmUiDisplay(). There will
+ be UseXY flag to indicate if there will be used coordinates from Strings library or not. If
+ not, the cursor will be moved behind last printed sign. It will be used to print e.g. '*' sign
+ during password entering. In graphic mode it is overridden by requirement. In graphic mode, X
+ and Y can be calculated the start location of string.
+
+ @param[in] StringID Unique string ID crated as enum type of AT_AM_UI_STRING_ID
+ @param[in] UseXY Set the current cursor position for the displayed string if it is TRUE
+ FALSE - don't use coordinates from String library. Cursor is moved behind
+ last printed sign.
+ TRUE - Use coordinates from String library.
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+AtAmUiStrDisplayFix (
+ IN UINT32 StringID,
+ IN BOOLEAN UseXY
+ )
+{
+ EFI_STATUS Status;
+ UINTN i;
+
+ for (i = 0; i < AtAmUiUSStringIDTabEntries; i++) {
+ if (AtAmUiUSStringIDTab[i].StrID == StringID) {
+ if (UseXY) {
+ Status = AtAmUiStrSetCursor (AtAmUiUSStringIDTab[i].X, AtAmUiUSStringIDTab[i].Y);
+ }
+
+ Status = AtAmUiStrDisplay (AtAmUiUSStringIDTab[i].String);
+ return Status;
+ }
+ }
+
+ return EFI_NOT_FOUND;
+}
+
+/**
+ This routine displays the string out to the screen.
+ For multi-language support, a language table is expected to be selected by customization here. For example,
+ the default language table is US-English in AtAmUiUSStringTab[], a second language table is created by
+ customization in AtAmUiSECStringTab[].
+
+ @param[in] String The NULL-terminated Unicode string to be displayed on the output device(s)
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+AtAmUiStrDisplay (
+ IN CHAR16 *String
+ )
+{
+
+ return gST->ConOut->OutputString (gST->ConOut, String);
+}
+
+/**
+ This routine clears the screen.
+ In graphic mode it is overridden by requirement.
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+AtAmUiStrClearScreen (
+ VOID
+ )
+{
+
+ return gST->ConOut->ClearScreen (gST->ConOut);
+}
+
+/**
+ In text mode it is used to set the place of cursor row and cursor column.
+ In graphic mode it is overridden by requirement.
+
+ @param[in] CCol The column position to set the cursor to
+ @param[in] CRow The row position to set the cursor to
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+AtAmUiStrSetCursor (
+ IN UINT32 CCol,
+ IN UINT32 CRow
+ )
+{
+
+ return gST->ConOut->SetCursorPosition (gST->ConOut, CCol, CRow);
+}
+
+/**
+ This function enables or disables cursor.
+ In graphic mode it is overridden by requirement.
+
+ @param[in] Enabled If TRUE, the cursor is set to be visible. If FALSE, the cursor is set to be invisible.
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+AtAmUiStrEnableCursor (
+ IN BOOLEAN Enabled
+ )
+{
+
+ return gST->ConOut->EnableCursor (gST->ConOut, Enabled);
+}
+
+/**
+ In text mode it returns the place of cursor row and cursor column.
+ In graphic mode it is overridden by requirement.
+
+ @param[out] CRow The pointer to return current cursor row
+ @param[out] CCol The pointer to return current cursor column
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+AtAmUiStrGetCursor (
+ OUT UINT32 *CRow,
+ OUT UINT32 *CCol
+ )
+{
+ *CRow = gST->ConOut->Mode->CursorRow;
+ *CCol = gST->ConOut->Mode->CursorColumn;
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Function handling delay code.
+ In graphic mode it is overridden by requirement.
+
+ @param[in] delay The number of microseconds to stall execution.
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+AtAmUiDelay (
+ IN UINT32 delay
+ )
+{
+
+ return gBS->Stall (delay);;
+}
+
diff --git a/Board/EM/MeWrapper/AtAmUi/AtAmUiString.h b/Board/EM/MeWrapper/AtAmUi/AtAmUiString.h
new file mode 100644
index 0000000..0331127
--- /dev/null
+++ b/Board/EM/MeWrapper/AtAmUi/AtAmUiString.h
@@ -0,0 +1,208 @@
+/** @file
+ Heder file.
+
+@copyright
+ Copyright (c) 2012 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.
+
+ 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
+**/
+
+#ifndef _ATAMUISTRING_H_
+#define _ATAMUISTRING_H_
+
+typedef enum _AT_AM_UI_STRING_ID {
+ STR_ATAMUI_LOCKED_TEXT,
+ STR_ATAMUI_PLATFORM_ID,
+ STR_ATAMUI_PROVIDER_ID,
+ STR_ATAMUI_LOCK_DUE_TO,
+ STR_ATAMUI_SELECT_PASS,
+ STR_ATAMUI_TIME_LEFT,
+ STR_ATAMUI_USER_PASS,
+ STR_ATAMUI_SERV_BASED_RECOV,
+ STR_ATAMUI_INVALID_SELECT,
+ STR_ATAMUI_LOCK_TIME,
+ STR_ATAMUI_LOCK_STOLEN,
+ STR_ATAMUI_LOCK_THRESHOLD,
+ STR_ATAMUI_LOCK_ATTACK,
+ STR_ATAMUI_CHECKING_PASS,
+ STR_ATAMUI_RECO_TRY_AGAIN,
+ STR_ATAMUI_RECO_FAILED,
+ STR_ATAMUI_RECO_SUCCESS,
+ STR_ATAMUI_SUS_ENTER_INFO,
+ STR_ATAMUI_RES_REFER,
+ STR_ATAMUI_RECO_REFER,
+ STR_ATAMUI_SUS_REFER,
+ STR_ATAMUI_SUS_ENTER_TOKEN,
+ STR_ATAMUI_SUS_ATTEMPT_EXC,
+ STR_ATAMUI_SUS_ENTER_SUCCESS,
+ STR_ATAMUI_SUS_ENTER_FAILED,
+ STR_ATAMUI_SUS_AUTH_FAILED,
+ STR_ATAMUI_SUS_EXIT_QUESTION,
+ STR_ATAMUI_SUS_EXIT_INFO,
+ STR_ATAMUI_SUS_EXIT_SUCCESS,
+ STR_ATAMUI_SUS_STAY,
+ STR_ATAMUI_SUS_NONCE_FAILED,
+ STR_ATAMUI_RECO_ENTER_PASS,
+ STR_ATAMUI_TIME_LEFT_SEC,
+ STR_ATAMUI_SELECT_OPTION,
+ STR_ATAMUI_CHECKING_AUTHENT,
+ STR_ATAMUI_FAILED_TO_AUTHENT,
+ STR_ATAMUI_RECO_SEC_TOKEN,
+
+ //
+ // this has to be a last element of this enum
+ //
+ STR_ATAMUI_END_OF_TAB
+} AT_AM_UI_STRING_ID;
+
+///
+/// Strings will be kept in array. There can be created many tables with strings in various
+/// languages. A language table can be selected within AtAmUiStrDisplay () to display string in
+/// targeted language with the unique string ID. The same unique string ID is applied to all
+/// language tables
+///
+typedef struct _AT_AM_UI_STRING {
+ UINTN StrID; ///< Unique string ID crated as enum type AT_AM_UI_STRING_ID
+ UINT8 X; ///< The place of cursor row to be display
+ UINT8 Y; ///< The place of cursor column to be display
+ CHAR16 *String; ///< Pointer to the string
+} AT_AM_UI_STRING;
+
+#define AT_AM_UI_1_SECOND 1000000
+
+/**
+ This function gets character inputted.
+
+ @param[out] Key Pointer to buffer for keystroke.
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+AtAmUiStrGetChar (
+ OUT EFI_INPUT_KEY *Key
+ )
+;
+
+/**
+ This routine displays the string out to the screen based on defined strings.
+ It uses X and Y to calculate the start location of string where it will be displayed. Function
+ uses string ID to indicate which strings are going to be shown by AtAmUiDisplay(). There will
+ be UseXY flag to indicate if there will be used coordinates from Strings library or not. If
+ not, the cursor will be moved behind last printed sign. It will be used to print e.g. '*' sign
+ during password entering. In graphic mode it is overridden by requirement. In graphic mode, X
+ and Y can be calculated the start location of string.
+
+ @param[in] StringID Unique string ID crated as enum type of AT_AM_UI_STRING_ID
+ @param[in] UseXY Set the current cursor position for the displayed string if it is TRUE
+ FALSE - don't use coordinates from String library. Cursor is moved behind
+ last printed sign.
+ TRUE - Use coordinates from String library.
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+AtAmUiStrDisplayFix (
+ IN UINT32 StringID,
+ IN BOOLEAN UseXY
+ )
+;
+
+/**
+ This routine displays the string out to the screen.
+ For multi-language support, a language table is expected to be selected by customization here. For example,
+ the default language table is US-English in AtAmUiUSStringTab[], a second language table is created by
+ customization in AtAmUiSECStringTab[].
+
+ @param[in] String The NULL-terminated Unicode string to be displayed on the output device(s)
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+AtAmUiStrDisplay (
+ IN CHAR16 *String
+ )
+;
+
+/**
+ This routine clears the screen.
+ In graphic mode it is overridden by requirement.
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+AtAmUiStrClearScreen (
+ VOID
+ )
+;
+
+/**
+ In text mode it is used to set the place of cursor row and cursor column.
+ In graphic mode it is overridden by requirement.
+
+ @param[in] CCol The column position to set the cursor to be displayed
+ @param[in] CRow The row position to set the cursor to be displayed
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+AtAmUiStrSetCursor (
+ IN UINT32 CCol,
+ IN UINT32 CRow
+ )
+;
+
+/**
+ This function enables or disables cursor.
+ In graphic mode it is overridden by requirement.
+
+ @param[in] Enabled If TRUE, the cursor is set to be visible. If FALSE, the cursor is set to be invisible.
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+AtAmUiStrEnableCursor (
+ IN BOOLEAN Enabled
+ )
+;
+
+/**
+ In text mode it returns the place of cursor row and cursor column.
+ In graphic mode it is overridden by requirement.
+
+ @param[out] CRow The pointer to return current cursor row
+ @param[out] CCol The pointer to return current cursor column
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+AtAmUiStrGetCursor (
+ OUT UINT32 *CRow,
+ OUT UINT32 *CCol
+ )
+;
+
+/**
+ Function handling delay code.
+ In graphic mode it is overridden by requirement.
+
+ @param[in] delay The number of microseconds to stall execution.
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+AtAmUiDelay (
+ IN UINT32 delay
+ )
+;
+
+#endif
diff --git a/Board/EM/MeWrapper/Icc/Icc.cif b/Board/EM/MeWrapper/Icc/Icc.cif
new file mode 100644
index 0000000..43ca476
--- /dev/null
+++ b/Board/EM/MeWrapper/Icc/Icc.cif
@@ -0,0 +1,13 @@
+<component>
+ name = "Icc"
+ category = ModulePart
+ LocalRoot = "Board\EM\MeWrapper\Icc\"
+ RefName = "Icc"
+[files]
+"Icc.sdl"
+[parts]
+"IccProtocolLib"
+"IccPlatform"
+"IccSetup"
+"IccOverClocking"
+<endComponent>
diff --git a/Board/EM/MeWrapper/Icc/Icc.sdl b/Board/EM/MeWrapper/Icc/Icc.sdl
new file mode 100644
index 0000000..5fef879
--- /dev/null
+++ b/Board/EM/MeWrapper/Icc/Icc.sdl
@@ -0,0 +1,25 @@
+TOKEN
+ Name = "ICC_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable ICC support in Project"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ TargetH = Yes
+ Master = Yes
+End
+
+PATH
+ Name = "Icc_DIR"
+End
+
+ELINK
+ Name = "ICC_INCLUDES"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "/I$(Icc_DIR)"
+ Parent = "ICC_INCLUDES"
+ InvokeOrder = AfterParent
+End
diff --git a/Board/EM/MeWrapper/Icc/IccPlatform/IccPlatform.c b/Board/EM/MeWrapper/Icc/IccPlatform/IccPlatform.c
new file mode 100644
index 0000000..4098481
--- /dev/null
+++ b/Board/EM/MeWrapper/Icc/IccPlatform/IccPlatform.c
@@ -0,0 +1,1187 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/Icc/IccPlatform/IccPlatform.c 9 5/14/14 9:56p Tristinchou $
+//
+// $Revision: 9 $
+//
+// $Date: 5/14/14 9:56p $
+//
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/Icc/IccPlatform/IccPlatform.c $
+//
+// 9 5/14/14 9:56p Tristinchou
+// [TAG] EIP167030
+// [Category] Improvement
+// [Description] Remove the variable runtime attribute and keep original
+// attributes.
+//
+// 8 4/19/13 4:08a Klzhan
+// [TAG] EIPNone
+// [Category] Improvement
+// [Description] Check DIMM Changed, and update WDT Protocol for XTU
+//
+// 7 1/28/13 5:01a Klzhan
+// Improvement : System might not power on after changing CPU when
+// Overclocking.
+//
+// 6 1/14/13 3:15a Klzhan
+//
+// 5 12/24/12 6:34a Klzhan
+// [TAG] EIP109624
+// [Category] New Feature
+// [Description] Support Lock Icc registers.
+//
+// 4 12/19/12 2:34a Klzhan
+// Update for overclocking.
+//
+// 3 9/19/12 5:54a Klzhan
+// 1. Fix Build Error when Performance is on(IccPlatform.mak).
+// 2. Avoid time-out in ICC setup Page when return from Shell.
+// 3. Remove un-used wait for Fw Init Done.
+//
+// 2 4/24/12 12:28a Klzhan
+//
+// 1 2/08/12 1:06a Klzhan
+// Initial Check in
+//
+// 5 7/27/11 3:21a Klzhan
+// Add Elinks for PCIE and PCI config.
+// Note: Don't List GBE port on this Elink.
+//
+// 4 7/15/11 12:45a Klzhan
+//
+// 3 7/08/11 4:22a Klzhan
+// [TAG] EIP64189
+// [Category] Spec Update
+// [Severity] Important
+// [Description] Update ME RC to 0.7
+//
+// 2 6/27/11 8:39a Klzhan
+// Support new ICC control library
+//
+// 1 2/25/11 1:42a Klzhan
+// Initial Check-in
+//
+// 1 12/03/10 5:10a Klzhan
+// Initial Check-in.
+//
+//
+//**********************************************************************
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: IccPlatform.c
+//
+// Description: Platform-specific ICC code
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+/*++
+Copyright (c) 2009-2010 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+Module Name:
+
+ IccPlatform.c
+
+Abstract:
+
+ Platform-specific ICC code
+
+--*/
+#define __EDKII_GLUE_MEMORY_ALLOCATION_LIB_H__
+#define __EDKII_GLUE_BASE_MEMORY_LIB_H__
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#endif
+#include EFI_PROTOCOL_PRODUCER(IccOverClocking)
+#include EFI_PROTOCOL_PRODUCER(MeBiosPayLoadData)
+#ifdef CougarPoint_SUPPORT
+#include EFI_PROTOCOL_PRODUCER (Wdt)
+#endif
+#if EFI_SPECIFICATION_VERSION>0x20000
+#define __HII_CONFIG_ACCESS__H__
+#else
+#include EFI_PROTOCOL_DEFINITION (Hii)
+#endif
+#include "MeLib.h"
+#include "PchAccess.h"
+#include "IccSetup.h"
+#include "EfiPerf.h"
+//
+// without these include guards, setup.h would include AMI EFI definitions conflicting with those from EDK
+//
+#define __UEFI_HII__H__
+#define __HII_PROTOCOL_H__
+#define _HII_H_
+#define __FORM_CALLBACK_PROTOCOL_H__
+#include "Setup.h"
+#include "IccPlatform.h"
+#include "Board\EM\Platform\PlatformSetup.h"
+#if WdtPei_SUPPORT
+#include "ppi\Wdt\Wdt.h"
+#endif
+UINT64 mNonce;
+EFI_EVENT mFeedEvent;
+ICC_CONFIG mIccConfig;
+
+ICC_OVERCLOCKING_PROTOCOL* gIccOverClockingProtocol;
+
+typedef VOID (ICC_CLOCK_UPDATE) (PLATFORM_PCIE_SLOTS* PCIE_SLOT, PLATFORM_PCI_SLOTS* PCI_SLOT);
+extern ICC_CLOCK_UPDATE OEM_CLOCK_UPDATE_FUNC EndOfOemClockUpdateFunc;
+ICC_CLOCK_UPDATE* OemClockUpdate[] = {OEM_CLOCK_UPDATE_FUNC NULL};
+DXE_MBP_DATA_PROTOCOL *mBIOSPayLoad;
+#if defined PERF_TUNE_SUPPORT && PERF_TUNE_SUPPORT == 1
+
+#define __EFI__H__
+#define __HOB__H__
+#include <Protocol\PerfTuneProtocol.h>
+EFI_GUID gPerfTune3xProtocolGuid = PERF_TUNE_ASL_PROTOCOL_GUID;
+EFI_GUID gPerfTuneDataHobGuid = AMI_PERF_TUNE_DATA_HOB_GUID;
+EFI_GUID gHobListGuid = EFI_HOB_LIST_GUID;
+BOOLEAN gFound = FALSE;
+BOOLEAN gBootCurrent = FALSE;
+UINT16 gCurrentFrequency;
+UINT16 gPEGDMIRatio;
+ICC_CLOCK_SETTINGS gClocksetting;
+
+//----------------------------CPU Ratio GACI DATA----------------------------
+// GACI_DATA DevNameGaciData { ControlID,NumberOfValues,Precision,Flags,DefaultDataValue,MinDataValue,MaxDataValue,MinDisplayValue,MaxDisplayValue}
+static GACI_DATA IccFreqGaciData = {BIOS_HOST_CLOCK_IMPLEMENTATION, 8001, 2, 0, 10000, 10000, 18000, 10000, 18000};
+
+static GACI_DATA IccPegDmiGaciData = {BIOS_PEG_DMI_RATIO_IMPLEMENTATION, 0xFFFF, 2, 0, 0, 0, 0, 0, 0};
+#endif
+
+#define ICC_CLOCK_COUNT 8
+UINT8 ClockID;
+#define MAX(a, b) ((a) > (b) ? (a) : (b))
+#define MIN(a, b) ((a) > (b) ? (b) : (a))
+#ifndef TRACE_ALWAYS
+#define TRACE_ALWAYS -1
+#endif
+typedef struct _CLOCK_DISPLAY_VALUES {
+ UINT16 ClkFreqMax;
+ UINT16 ClkFreqMin;
+ UINT16 ClkFreqCurrent;
+ UINT16 SscPercentMax;
+ UINT16 SscPercentCurrent;
+ UINT16 ClockUsage;
+ UINT8 SscChangeAllowed;
+ UINT8 SscModeUpAvailable;
+ UINT8 SscModeCenterAvailable;
+ UINT8 SscModeDownAvailable;
+ UINT8 SscModeCurrent;
+} CLOCK_DISPLAY_VALUES;
+
+typedef struct _ICC_CLK_REQUEST {
+ UINT16 Frequency;
+ UINT16 SscPercent;
+ UINT8 SscAllowed;
+ UINT8 SscMode;
+ UINT8 EveryBoot;
+} ICC_CLK_REQUEST;
+
+#define IMMEDIATE 0
+#define TEMPORARY 1
+#define PERMANENT 2
+
+#define SSC_MODE_UP 2
+#define SSC_MODE_CENTER 1
+#define SSC_MODE_DOWN 0
+
+#if defined PERF_TUNE_SUPPORT && PERF_TUNE_SUPPORT == 1
+VOID PerfTuneIcc(
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable)
+{
+ VOID *pPerfTuneDataHobList = NULL;
+ PERF_TUNE_DATA_HOB *pBiosSettingData;
+ BIOS_SETTING_DATA BiosSettingData;
+ UINT16 RequestFrequency,PEGDMIRatio,bPEGDMIRatio;
+ ICC_CLOCK_SETTINGS RequestSetting;
+ EFI_GUID SetupGuid = SETUP_GUID;
+ EFI_STATUS Status;
+ BOOLEAN freqConsolidationBypass = TRUE;
+ ICC_LIB_STATUS IccStatus;
+ EFI_PEI_HOB_POINTERS GuidHob;
+ WDT_PROTOCOL *InternalWdtProtocol;
+ UINTN VarSize = sizeof(BIOS_SETTING_DATA);
+ BIOS_SETTING_DATA DefaultData;
+ EFI_GUID EfiSetupGuid = SETUP_GUID;
+
+ //
+ // Get Hob list
+ //
+ Status = EfiLibGetSystemConfigurationTable (&gEfiHobListGuid, &GuidHob.Raw);
+ if (EFI_ERROR (Status)) {
+ return;
+ }
+
+ for (Status = EFI_NOT_FOUND; EFI_ERROR (Status);) {
+ if (END_OF_HOB_LIST (GuidHob)) {
+ Status = EFI_NOT_FOUND;
+ break;
+ }
+ if (GET_HOB_TYPE (GuidHob) == EFI_HOB_TYPE_GUID_EXTENSION) {
+ if (EfiCompareGuid (&gPerfTuneDataHobGuid, &GuidHob.Guid->Name)) {
+ Status = EFI_SUCCESS;
+ pBiosSettingData = (PERF_TUNE_DATA_HOB *)(GuidHob.Raw);
+ break;
+ }
+ }
+ GuidHob.Raw = GET_NEXT_HOB (GuidHob);
+ }
+
+ if (EFI_ERROR(Status)) return;
+
+ if(pBiosSettingData->IsCpuChanged || pBiosSettingData->IsDimmChanged){
+ Status = gRT->GetVariable(
+ L"OcDefault",
+ &EfiSetupGuid,
+ NULL,
+ &VarSize,
+ &DefaultData
+ );
+
+ BiosSettingData = pBiosSettingData->PerfTuneDataHob;
+ RequestFrequency = DefaultData.HostClockFreq;
+ PEGDMIRatio = DefaultData.PEGDMIRatio;
+ }else{
+ BiosSettingData = pBiosSettingData->PerfTuneDataHob;
+ RequestFrequency = BiosSettingData.HostClockFreq;
+ PEGDMIRatio = BiosSettingData.PEGDMIRatio;
+ }
+
+ if ( (PEGDMIRatio == 100) || (PEGDMIRatio == 0) || (PEGDMIRatio == 0xFFFF)){
+ bPEGDMIRatio = 0;
+ }else if ( (PEGDMIRatio == 125) || (PEGDMIRatio == 1)){
+ bPEGDMIRatio = 1;
+ }else if ( (PEGDMIRatio == 167) || (PEGDMIRatio == 2) ){
+ bPEGDMIRatio = 2;
+ }else if ( (PEGDMIRatio == 250) || (PEGDMIRatio == 3) ){
+ bPEGDMIRatio = 3;
+ }else{
+ bPEGDMIRatio = 0;
+ }
+
+ // Return if Overclocking Bclk not found
+ if((!gFound) || ((RequestFrequency == gCurrentFrequency) &&
+ (bPEGDMIRatio == gPEGDMIRatio) && !(pBiosSettingData->IsCpuChanged || pBiosSettingData->IsDimmChanged)) ) return;
+
+ if (bPEGDMIRatio == gPEGDMIRatio){
+ gBootCurrent = FALSE;
+ RequestSetting.Frequency = RequestFrequency * 10000;
+ RequestSetting.SscMode = gClocksetting.SscMode;
+ if (bPEGDMIRatio==0){
+ RequestSetting.SscPercent = 0x32;
+ }else{
+ RequestSetting.SscPercent = 0;
+ }
+ RequestSetting.DmiPegRatio = bPEGDMIRatio;
+ gIccOverClockingProtocol->SetCurrentClockSettings(ClockID,
+ RequestSetting,
+ &IccStatus);
+ gIccOverClockingProtocol->GetCurrentClockSettings
+ (ClockID, &RequestSetting, &IccStatus);
+
+
+ RequestFrequency = RequestSetting.Frequency/10000;
+ PEGDMIRatio = RequestSetting.DmiPegRatio;
+ }else{
+ gBootCurrent = TRUE;
+ RequestSetting.Frequency = RequestFrequency * 10000;
+ RequestSetting.SscMode = gClocksetting.SscMode;
+ if (bPEGDMIRatio==0){
+ RequestSetting.SscPercent = 0x32;
+ }else{
+ RequestSetting.SscPercent = 0;
+ }
+ RequestSetting.DmiPegRatio = bPEGDMIRatio;
+ gIccOverClockingProtocol->SetBootClockSettings(ClockID,
+ RequestSetting,
+ &IccStatus);
+
+ gIccOverClockingProtocol->GetBootClockSettings
+ (ClockID, &RequestSetting, &IccStatus);
+
+
+ RequestFrequency = RequestSetting.Frequency/10000;
+ PEGDMIRatio = RequestSetting.DmiPegRatio;
+ }
+
+ if(IccStatus == ICC_LIB_STATUS_SUCCESS)
+ {
+ // OverClocking Success
+ // ReStore back to OcCurrent
+ BiosSettingData.HostClockFreq = RequestFrequency;
+ IccFreqGaciData.DefaultDataValue = RequestFrequency;
+ if ( PEGDMIRatio == 0 ){
+ BiosSettingData.PEGDMIRatio = 100;
+ IccPegDmiGaciData.DefaultDataValue = 100;
+ }else if ( PEGDMIRatio == 1 ){
+ BiosSettingData.PEGDMIRatio = 125;
+ IccPegDmiGaciData.DefaultDataValue = 125;
+ }else if ( PEGDMIRatio == 2 ){
+ BiosSettingData.PEGDMIRatio = 167;
+ IccPegDmiGaciData.DefaultDataValue = 167;
+ }else if ( PEGDMIRatio == 3 ){
+ BiosSettingData.PEGDMIRatio = 250;
+ IccPegDmiGaciData.DefaultDataValue = 250;
+ }
+
+ Status = gRT->SetVariable(
+ L"OcCurrent",
+ &SetupGuid,
+ EFI_VARIABLE_NON_VOLATILE |
+ EFI_VARIABLE_BOOTSERVICE_ACCESS,
+ sizeof(BIOS_SETTING_DATA),
+ &BiosSettingData );
+ ASSERT_EFI_ERROR (Status);
+ }
+
+ if (gBootCurrent == TRUE){
+ Status = gBS->LocateProtocol(&gWdtProtocolGuid, NULL, &InternalWdtProtocol);
+ if(!EFI_ERROR(Status))
+ {
+ InternalWdtProtocol->AllowKnownReset();
+ }
+ IoWrite8 (0xCF9,0x06);//Setting REG/DMI ratio have to reset.
+ EFI_DEADLOOP();
+ }
+
+ return;
+}
+
+VOID
+IccXtuHandler(
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ UINT8 i;
+ EFI_STATUS Status;
+ PERF_TUNE_ASL_PROTOCOL *PerfTune3xProtocol;
+ UINTN Len = 0;
+ UINT8 *Buffer = NULL;
+ EFI_GUID IccOverClockingProtocolGuid = ICC_OVERCLOCKING_PROTOCOL_GUID;
+
+ Status = gBS->LocateProtocol(&IccOverClockingProtocolGuid, NULL, &gIccOverClockingProtocol);
+ if(EFI_ERROR(Status)) return;
+ Status = gBS->LocateProtocol(&gPerfTune3xProtocolGuid, NULL, &PerfTune3xProtocol);
+ if(EFI_ERROR(Status)) return;
+
+ for(i = 0; i < ICC_CLOCK_COUNT ; i++)
+ {
+ ICC_LIB_STATUS IccStatus;
+ ICC_CLOCK_RANGES ClockRange;
+
+ gIccOverClockingProtocol->GetClockRanges(i, &ClockRange, &IccStatus);
+
+ if ( (ClockRange.UsageMask & (1<<ICC_CLOCK_USAGE_BCLK) ) &&
+ (ClockRange.UsageMask & (1<<ICC_CLOCK_USAGE_DMI) ) &&
+ (ClockRange.UsageMask & (1<<ICC_CLOCK_USAGE_PEG) ) &&
+ (IccStatus == ICC_LIB_STATUS_SUCCESS)
+ ) {
+ if (ClockRange.FrequencyMax != ClockRange.FrequencyMin)
+ gIccOverClockingProtocol->GetCurrentClockSettings
+ (i, &gClocksetting, &IccStatus);
+ if(IccStatus != ICC_LIB_STATUS_SUCCESS)
+ break;
+
+
+ gCurrentFrequency = gClocksetting.Frequency/10000;
+
+ // Init GACI Data
+ IccFreqGaciData.MinDataValue = ClockRange.FrequencyMin/10000;
+ IccFreqGaciData.MinDisplayValue = ClockRange.FrequencyMin/10000;
+
+ IccFreqGaciData.MaxDataValue = ClockRange.FrequencyMax/10000;
+ IccFreqGaciData.MaxDisplayValue = ClockRange.FrequencyMax/10000;
+
+ IccFreqGaciData.DefaultDataValue = gCurrentFrequency;//ClockRange.FrequencyMin/10000;
+ IccFreqGaciData.NumberOfValues = IccFreqGaciData.MaxDataValue - IccFreqGaciData.MinDataValue + 1;
+ gFound = TRUE;
+ ClockID = i;
+
+ gPEGDMIRatio = gClocksetting.DmiPegRatio;
+
+ if ( gPEGDMIRatio == 0 ){
+ IccPegDmiGaciData.DefaultDataValue = 100;
+ }else if ( gPEGDMIRatio == 1 ){
+ IccPegDmiGaciData.DefaultDataValue = 125;
+ }else if ( gPEGDMIRatio == 2 ){
+ IccPegDmiGaciData.DefaultDataValue = 167;
+ }else if ( gPEGDMIRatio == 3 ){
+ IccPegDmiGaciData.DefaultDataValue = 250;
+ }
+ break;
+ }
+ }
+ PerfTuneIcc(ImageHandle,SystemTable);
+ // reference clock frequency
+ Len = sizeof(IccFreqGaciData);
+ Status = gBS->AllocatePool(EfiBootServicesData, Len, &Buffer);
+ gBS->SetMem(Buffer, Len, 0 );
+
+ gBS->CopyMem(Buffer, &IccFreqGaciData, sizeof(IccFreqGaciData));
+ gBS->CopyMem(Buffer + sizeof(IccFreqGaciData), &IccFreqGaciData, sizeof(IccFreqGaciData));
+ Status = PerfTune3xProtocol->SetGaciData(Buffer, Len);
+ //PEG/DMI Ratio
+ Len = sizeof(IccPegDmiGaciData);
+ Status = gBS->AllocatePool(EfiBootServicesData, Len, &Buffer);
+ gBS->SetMem(Buffer, Len, 0 );
+
+ gBS->CopyMem(Buffer, &IccPegDmiGaciData, sizeof(IccPegDmiGaciData));
+ Status = PerfTune3xProtocol->SetGaciData(Buffer, Len);
+ return;
+}
+#endif
+
+EFI_STATUS
+IccPlatformEntryPoint (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+ UINT8 OldProfile;
+#ifdef CougarPoint_SUPPORT
+ UINT8 WdtStatus = V_PCH_OC_WDT_CTL_STATUS_OK;
+ WDT_PROTOCOL *WdtProtocol;
+#endif
+
+
+ DEBUG ((EFI_D_INFO, "(ICC) Entry Point to ICC_Platform\n"));
+
+ Status = ReadMainSetupData (&mIccConfig);
+
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "(ICC) Failed to read setup data! Status = %r\n", Status));
+ return Status;
+ }
+ Status = HeciGetIccProfile (&OldProfile);
+ Status = gBS->LocateProtocol(&gMeBiosPayloadDataProtocolGuid, NULL, &mBIOSPayLoad);
+ if(EFI_ERROR(Status))
+ {
+ DEBUG ((EFI_D_ERROR, "(ICC) Get BIOS PayLoad Data Protocol fail !! Status = %r \n", Status));
+ mBIOSPayLoad = NULL;
+ }
+#ifdef CougarPoint_SUPPORT
+ Status = gBS->LocateProtocol(&gWdtProtocolGuid, NULL, &WdtProtocol);
+ if ( EFI_ERROR(Status) ) {
+ DEBUG ((EFI_D_ERROR, "(ICC) Failed to locate Wdt protocol, Status = %r\n",Status));
+ return EFI_SUCCESS;
+ }
+ WdtStatus = WdtProtocol->CheckStatus();
+
+ if (mIccConfig.ClocksModified != ICC_SETTINGS_NOT_MODIFIED && WdtStatus == V_PCH_OC_WDT_CTL_STATUS_FAILURE) {
+ IccFailureNotification();
+ }
+#endif
+
+ ASSERT_EFI_ERROR (Status);
+
+ if (mIccConfig.ProfileSelection != OPTION_DISABLED) {
+ ProfileSelection(mIccConfig.SelectedIccProfile);
+ };
+
+ IccMessages();
+
+#if defined PERF_TUNE_SUPPORT && PERF_TUNE_SUPPORT == 1
+ IccXtuHandler(ImageHandle,SystemTable);
+#endif
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+ClockFailureReport (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+/*++
+Routine Description:
+ Displays error message just below the "press DEL to enter setup" message
+ and forces user to enter setup. This is used when BIOS-initiated changes
+ to ICC registers caused platform instability and need to be cancelled
+Arguments:
+ Event - not used
+ Context - not used
+Returns:
+ EFI_SUCCESS if everything's OK
+--*/
+{
+ EFI_STATUS Status;
+ EFI_INPUT_KEY Key;
+ UINT32 VarAttr;
+ UINTN VarSize;
+ UINT32 BootFlow;
+ EFI_GUID guidBootFlow = BOOT_FLOW_VARIABLE_GUID;
+
+ Status = EFI_SUCCESS;
+
+ DEBUG ((EFI_D_INFO, "(ICC) ClockFailureReport\n"));
+
+ gST->ConOut->OutputString (
+ gST->ConOut,
+ L"Boot attempt failed after platform clock settings were modified by BIOS!\r\n"
+ );
+ gST->ConOut->OutputString (gST->ConOut, L"Press any key to enter SETUP.\r\n");
+ do {
+ Status = gBS->CheckEvent (gST->ConIn->WaitForKey);
+ } while (Status == EFI_NOT_READY);
+ Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
+
+ VarAttr = 0;
+ VarSize = sizeof(BootFlow);
+ Status = gRT->GetVariable(
+ L"BootFlow",
+ &guidBootFlow,
+ &VarAttr,
+ &VarSize,
+ &BootFlow );
+ if( EFI_ERROR(Status) )
+ {
+ VarAttr = EFI_VARIABLE_BOOTSERVICE_ACCESS;
+ VarSize = sizeof(BootFlow);
+ }
+
+ BootFlow = BOOT_FLOW_CONDITION_FIRST_BOOT;
+ gRT->SetVariable(
+ L"BootFlow",
+ &guidBootFlow,
+ VarAttr,
+ VarSize,
+ &BootFlow );
+
+ return Status;
+}
+
+EFI_STATUS
+DetectUsedClocks (
+ OUT UINT32*UsedClocks,
+ OUT UINT32*AllClocks
+ )
+/*++
+Routine Description:
+ Detects which PCI/PCIE clocks are not needed and can be turned off.
+ For PCIE, PCIE bridge is accessed, one of its registers knows if there are cards
+ present in slots
+ For PCI, this function tries to access PCI devices that would exist if PCI
+ cards were put into slots. If such access fails, then slot must be empty and
+ its clock can be turned off
+Arguments:
+ UsedClocks: bitmask for Clock Enable: 1 = enable, 0 = disable
+ AllClocks: bitmask for Clock Enable Mask: 1 = Clock Enable bit is valid, 0 = ignore Clock Enable bit
+Returns:
+ EFI_SUCCESS in all circumstances except when required protocols can't be located
+--*/
+{
+ UINT32 i;
+ UINT8 PciQnt;
+ UINT8 PciExpressQnt;
+// UINT32 BusNumberRegister;
+ UINT8 BusNumber = 0;
+ UINT8 FunctionNumber;
+ UINT16 VendorID;
+ UINT16 SlotStatus;
+ UINT32 Rcba;
+ UINT32 RootPortFunctionNumber = 0;
+ UINT8 SkipPciDetection = 0;
+ EFI_STATUS Status;
+ EFI_GUID SetupGuid = SETUP_GUID;
+ SETUP_DATA SetupData;
+ UINTN VariableSize;
+ PLATFORM_PCIE_SLOTS PciExpressSlots[] = {PCIE_CLOCK_CONFIG{0,0,0}};
+ PLATFORM_PCI_SLOTS PciSlots[] = {PCI_CLOCK_CONFIG{0,0,0}};
+ //
+ // all PCI/PCIE-related clocks are turned off by default and only turned on when needed
+ // such negative logic covers situation where two or more slots share one clock
+ //
+ for (i = 0; OemClockUpdate[i] != NULL; i++)
+ OemClockUpdate[i](PciExpressSlots, PciSlots);
+
+
+ *UsedClocks = 0xFFFFFFFF;
+ *AllClocks = 0x0;
+
+ PciQnt = (sizeof (PciSlots) / sizeof (PLATFORM_PCI_SLOTS)) - 1;
+ PciExpressQnt = (sizeof (PciExpressSlots) / sizeof (PLATFORM_PCIE_SLOTS)) - 1;
+
+ for (i = 0; i < PciQnt; i++) {
+ *UsedClocks &= ~(PciSlots[i].Clock);
+ *AllClocks |= PciSlots[i].Clock;
+ }
+
+ for (i = 0; i < PciExpressQnt; i++) {
+ *UsedClocks &= ~(PciExpressSlots[i].Clock);
+ *AllClocks |= PciExpressSlots[i].Clock;
+ }
+
+ // PCI Express
+ //
+ //
+ // read RootPortFunctionNumber register, it knows (pcie bridge's function number) - to - (physical slot) mapping
+ //
+ if (PciExpressQnt > 0) {
+
+ Rcba = MmioRead32 (
+ MmPciAddress (
+ 0,
+ DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ R_PCH_LPC_RCBA
+ )
+ );
+
+ Rcba &= B_PCH_LPC_RCBA_BAR;
+ RootPortFunctionNumber = MmioRead32 ((UINTN) (Rcba + R_PCH_RCRB_RPFN));
+ }
+ //
+ // detect cards in PCIE slots
+ //
+ for (i = 0; i < PciExpressQnt; i++) {
+ FunctionNumber =
+ (
+ RootPortFunctionNumber >>
+ (S_PCH_RCRB_PRFN_RP_FIELD * PciExpressSlots[i].RootPortNumber)
+ ) & 0x00000007;
+
+
+ VendorID = MmioRead16 (
+ MmPciAddress (
+ 0,
+ DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS,
+ FunctionNumber,
+ R_PCH_PCIE_VENDOR_ID
+ )
+ );
+
+ SlotStatus = MmioRead16 (
+ MmPciAddress (
+ 0,
+ DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS,
+ FunctionNumber,
+ R_PCH_PCIE_SLSTS
+ )
+ );
+//********************************************************************************
+ VariableSize = sizeof (SETUP_DATA);
+ Status = gRT->GetVariable (
+ L"Setup",
+ &SetupGuid,
+ NULL,
+ &VariableSize,
+ &SetupData
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ PciExpressSlots[i].HotPlugSupport = SetupData.PcieRootPortHPE[i];
+//*********************************************************************************
+ if (PciExpressSlots[i].HotPlugSupport == 1 ||
+ (VendorID != 0xFFFF && ((SlotStatus & B_PCH_PCIE_SLSTS_PDS) != 0))
+ ) {
+ *UsedClocks |= PciExpressSlots[i].Clock;
+ }
+ }
+
+ DEBUG ((EFI_D_INFO, "(ICC) PCI(E) Clocks Disabled: 0x%08x\n", (*AllClocks & ~(*UsedClocks)) ));
+ DEBUG ((EFI_D_INFO, "(ICC) PCI(E) Clocks Enabled: 0x%08x\n", (*AllClocks & *UsedClocks ) ));
+ DEBUG ((EFI_D_INFO, "(ICC) Clocks left alone: 0x%08x\n", ~(*AllClocks) ));
+
+ return EFI_SUCCESS;
+
+}
+
+EFI_STATUS
+EFIAPI
+IccFailureNotification (
+ VOID
+ )
+/*++
+Routine Description:
+ This function should only be called if Watchdog timer expiration was detected
+ after BIOS changes ICC settings. Error message is displayed and BIOS setup is entered.
+Arguments:
+ none
+Returns:
+ EFI_SUCCESS if everything's OK
+--*/
+{
+ EFI_EVENT Event;
+ VOID *EventPointer;
+ EFI_GUID AllDriversConnectedProtocolGuid = BDS_ALL_DRIVERS_CONNECTED_PROTOCOL_GUID;
+ EFI_STATUS Status;
+
+ Status = gBS->CreateEvent (
+ EFI_EVENT_NOTIFY_SIGNAL,
+ EFI_TPL_CALLBACK,
+ ClockFailureReport,
+ NULL,
+ &Event
+ );
+ if (!EFI_ERROR (Status)) {
+ Status = gBS->RegisterProtocolNotify (
+ &AllDriversConnectedProtocolGuid,
+ Event,
+ &EventPointer
+ );
+ }
+
+ DEBUG ((EFI_D_INFO, "(ICC) ClockFailureReport event registration; Status = 0x%02x\n", Status));
+ return Status;
+}
+
+EFI_STATUS
+OnReadyToBoot (
+IN EFI_EVENT Event,
+IN VOID *Context
+)
+{
+ EFI_GUID IccSetupDataGuid = ICC_VOLATILE_SETUP_DATA_GUID;
+ UINT8 ReadyToBoot = 1;
+ EFI_STATUS Status;
+
+ Status = gRT->SetVariable (
+ L"AfterReadyToBoot",
+ &IccSetupDataGuid,
+ EFI_VARIABLE_BOOTSERVICE_ACCESS,
+ sizeof(UINT8),
+ &ReadyToBoot
+ );
+
+ return EFI_SUCCESS;
+}
+EFI_STATUS
+IccMessages (
+ VOID
+ )
+/*++
+Routine Description:
+ Schedules SetClockEnables and LockRegisters Icc heci messages to be executed after PCI enumeration is done
+Arguments:
+ none
+Returns:
+ EFI_SUCCESS if everything's OK
+--*/
+{
+ EFI_EVENT Event;
+ VOID *EventPointer;
+ EFI_GUID AllDriversConnectedProtocolGuid = BDS_ALL_DRIVERS_CONNECTED_PROTOCOL_GUID;
+ EFI_STATUS Status;
+ EFI_EVENT ReadytoBootEvent;
+ EFI_GUID EfiEventReadyToBootGuid = EFI_EVENT_GROUP_READY_TO_BOOT;
+
+ Status = gBS->CreateEvent (
+ EFI_EVENT_NOTIFY_SIGNAL,
+ EFI_TPL_CALLBACK,
+ SendIccMessages,
+ NULL,
+ &Event
+ );
+ if (!EFI_ERROR (Status)) {
+ Status = gBS->RegisterProtocolNotify (
+ &AllDriversConnectedProtocolGuid,
+ Event,
+ &EventPointer
+ );
+ }
+
+ DEBUG ((EFI_D_INFO, "(ICC) IccMessages event registration; Status = 0x%02x\n", Status));
+#if (EFI_SPECIFICATION_VERSION < 0x00020000)
+ gBS->CreateEvent (
+ EFI_EVENT_SIGNAL_READY_TO_BOOT | EFI_EVENT_NOTIFY_SIGNAL_ALL,
+ TPL_CALLBACK,
+ OnReadyToBoot,
+ NULL,
+ &ReadytoBootEvent
+ );
+#else
+ gBS->CreateEventEx (
+ EFI_EVENT_NOTIFY_SIGNAL,
+ TPL_CALLBACK,
+ OnReadyToBoot,
+ NULL,
+ &EfiEventReadyToBootGuid,
+ &ReadytoBootEvent
+ );
+#endif
+ return Status;
+}
+
+
+UINT8
+ReadIccSoftStraps (
+ VOID
+ )
+/*++
+Routine Description:
+ Reads soft straps from flash to check who is responsible for selecting ICC clock profile.
+Arguments:
+Returns:
+ PROFILE_SELECTED_BY_BIOS
+ PROFILE_SELECTED_BY_ME
+--*/
+{
+ UINT32 PchRootComplexBar;
+ UINT32 Softstrap10;
+
+ PchRootComplexBar = MmioRead32 (
+ MmPciAddress (
+ 0,
+ DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ R_PCH_LPC_RCBA
+ )
+ );
+
+ PchRootComplexBar &= ~BIT0;
+
+ MmioAndThenOr32 (
+ PchRootComplexBar + R_PCH_SPI_FDOC,
+ (UINT32) (~(B_PCH_SPI_FDOC_FDSS_MASK | B_PCH_SPI_FDOC_FDSI_MASK)),
+ (UINT32) (V_PCH_SPI_FDOC_FDSS_PCHS | SOFTSTRAP10)
+ );
+
+ Softstrap10 = MmioRead32 (PchRootComplexBar + R_PCH_SPI_FDOD);
+
+ if (Softstrap10 & CLOCK_PROFILE_SELECTOR) {
+ return PROFILE_SELECTED_BY_ME;
+ }
+ return PROFILE_SELECTED_BY_BIOS;
+}
+
+EFI_STATUS
+ReadMainSetupData (
+ OUT ICC_CONFIG* IccConfig
+ )
+/*++
+Routine Description:
+ reads SETUP_DATA and creates IccConfig with all Icc-related setup informations
+Arguments:
+Returns:
+ filled SETUP_DATA struct
+--*/
+{
+ EFI_STATUS Status;
+ UINT32 SetupVarAttr;
+ UINTN VariableSize;
+ UINT32 Attributes;
+ EFI_GUID SetupGuid = SETUP_GUID;
+ EFI_GUID IccPersistentDataGuid = ICC_PERSISTENT_DATA_GUID;
+ SETUP_DATA SetupData;
+ ICC_PERSISTENT_DATA IccPersistentData;
+
+ DEBUG ((EFI_D_ERROR, "(ICC) ReadMainSetupData\n"));
+
+ SetupVarAttr = 0;
+ VariableSize = sizeof (SETUP_DATA);
+
+ Status = gRT->GetVariable(
+ L"Setup",
+ &SetupGuid,
+ &SetupVarAttr,
+ &VariableSize,
+ &SetupData );
+ if( EFI_ERROR(Status) ) {
+ DEBUG ((EFI_D_ERROR, "Failed to read SETUP_DATA! Status = %r\n", Status));
+ return Status;
+ }
+
+ VariableSize = sizeof (ICC_PERSISTENT_DATA);
+
+ Status = gRT->GetVariable (
+ L"IccPersistentData",
+ &IccPersistentDataGuid,
+ &Attributes,
+ &VariableSize,
+ &IccPersistentData
+ );
+ if (EFI_ERROR (Status)) {
+ IccPersistentData.ClocksModified = ICC_SETTINGS_NOT_MODIFIED;
+ }
+
+ IccConfig->ClocksModified = IccPersistentData.ClocksModified;
+
+ IccConfig->SelectedIccProfile = SetupData.IccSelectedProfile;
+
+ if ( ReadIccSoftStraps () != PROFILE_SELECTED_BY_BIOS ) {
+ IccConfig->ProfileSelection = OPTION_DISABLED;
+ } else {
+ IccConfig->ProfileSelection = OPTION_ENABLED;
+ }
+
+ IccConfig->LockIccRegisters = OPTION_ENABLED;
+
+ //
+ // in LockMask, 0 means lock and 1 means don't lock this particular register
+ //
+ if (SetupData.IccLockRegisters == OPTION_LOCK_STATIC) {
+ IccConfig->LockMask[2] = STATIC_REGISTERS_MASK2;
+ IccConfig->LockMask[1] = STATIC_REGISTERS_MASK1;
+ IccConfig->LockMask[0] = STATIC_REGISTERS_MASK0;
+ } else {
+ IccConfig->LockMask[2] = 0;
+ IccConfig->LockMask[1] = 0;
+ IccConfig->LockMask[0] = 0;
+ }
+
+ if (SetupData.IccSetClockEnables == OPTION_ENABLED) {
+ IccConfig->SetClkEnables = OPTION_ENABLED;
+ } else {
+ IccConfig->SetClkEnables = OPTION_DISABLED;
+ }
+
+ if (IccConfig->ProfileSelection != SetupData.IccDisplayProfile) {
+ SetupData.IccDisplayProfile = IccConfig->ProfileSelection;
+ Status = gRT->SetVariable(
+ L"Setup",
+ &SetupGuid,
+ SetupVarAttr,
+ sizeof(SETUP_DATA),
+ &SetupData );
+ }
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+ProfileSelection (
+ IN UINT8 NewProfile
+ )
+/*++
+Routine Description:
+ Chooses ICC clock profile to be used by platform for future boots.
+Arguments:
+ NewProfile - requested clock profile
+Returns:
+ nothing (and the platform reboots) if profile was changed
+ EFI_SUCCESS if there was no need to change profile
+ other result if HECI communication failed
+--*/
+{
+ EFI_STATUS Status;
+ UINT8 OldProfile;
+
+ Status = HeciGetIccProfile (&OldProfile);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "(ICC) Failed to read clock profile, status = %r.\n", Status));
+ return Status;
+ }
+
+ if (NewProfile != OldProfile) {
+ Status = HeciSetIccProfile (NewProfile);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "(ICC) Failed to change clock profile, status = %r.\n", Status));
+ return Status;
+ }
+
+ DEBUG ((EFI_D_INFO, "(ICC) Clock Profile was changed, rebooting platform.\n"));
+ Status = HeciSendCbmResetRequest(CBM_RR_REQ_ORIGIN_BIOS_POST, CBM_HRR_GLOBAL_RESET);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "(ICC) Failed to trigger reset, status = %r.\n", Status));
+ return Status;
+ }
+
+ EFI_DEADLOOP();
+ }
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+WaitForFwInitComplete (
+ UINT32 mSeconds
+)
+/*++
+Routine Description:
+ waits for Fw init complete - safety measure to prevent sending Heci messages
+ while FW can't receive them.
+Arguments:
+ mSeconds - limit for wait time, in miliseconds
+Returns:
+ EFI_SUCCESS if Fw init is complete
+ EFI_TIMEOUT if init is still not complete after allocated time
+ other errors when something's wrong with Heci protocol
+--*/
+{
+ EFI_HECI_PROTOCOL *Heci;
+ UINT32 MeStatus;
+ UINT32 MeMode;
+ UINT32 RetryCount;
+ EFI_STATUS Status;
+
+ RetryCount = 0;
+
+ Status = gBS->LocateProtocol (
+ &gEfiHeciProtocolGuid,
+ NULL,
+ &Heci
+ );
+
+ if (EFI_ERROR(Status)) {
+ DEBUG ((EFI_D_ERROR, "(ICC) Failed to locate Heci protocol! Status = %r\n", Status));
+ return Status;
+ }
+
+ Status = Heci->GetMeMode (&MeMode);
+ if (EFI_ERROR (Status) || (MeMode != ME_MODE_NORMAL)) {
+ return EFI_UNSUPPORTED;
+ }
+
+ PERF_START (0, L"Icc waiting for FwInitComplete", NULL, 0) ;
+ while (1) {
+ Heci->GetMeStatus (&MeStatus);
+ if (ME_STATUS_IS_ME_FW_INIT_COMPLETE (MeStatus)) {
+ PERF_END (0, L"Icc waiting for FwInitComplete", NULL, 0) ;
+ DEBUG ((EFI_D_INFO, "(ICC) Waited %d ms for FwInitComplete.\n", RetryCount));
+ return EFI_SUCCESS;
+ }
+ if (RetryCount > mSeconds) {
+ PERF_END (0, L"Icc waiting for FwInitComplete", NULL, 0) ;
+ DEBUG ((EFI_D_ERROR, "(ICC) Time out! Waited %d ms for FwInitComplete.\n", RetryCount));
+ return EFI_TIMEOUT;
+ }
+ RetryCount++;
+ gBS->Stall (1000);//1ms
+ }
+}
+
+EFI_STATUS
+SendIccMessages (
+IN EFI_EVENT Event,
+IN VOID *Context
+)
+/*++
+Routine Description:
+ Sends SetClockEnables and LockRegisters Icc Heci messages
+Arguments:
+ none
+Returns:
+ nothing
+--*/
+{
+ EFI_STATUS Status;
+ UINT8 ResponseMode = 1, AccessMode = 0;/*0 - set, 1 - get*/
+ ICC_LOCK_REGS_INFO IccLockRegs;
+ EFI_GUID SetupGuid = SETUP_GUID;
+ SETUP_DATA SetupData;
+ UINTN VariableSize;
+
+ DEBUG ((EFI_D_INFO, "(ICC) Send Icc Heci Messages\n"));
+
+ if (mIccConfig.ProfileSelection != OPTION_DISABLED) {
+ ProfileSelection(mIccConfig.SelectedIccProfile);
+ };
+
+ VariableSize = sizeof (SETUP_DATA);
+ Status = gRT->GetVariable (
+ L"Setup",
+ &SetupGuid,
+ NULL,
+ &VariableSize,
+ &SetupData);
+
+ ASSERT_EFI_ERROR (Status);
+
+ if (mIccConfig.SetClkEnables == OPTION_ENABLED) {
+ DetectUsedClocks (&mIccConfig.ClkEnables,
+ &mIccConfig.ClkEnablesMask
+ );
+
+ Status = HeciSetIccClockEnables (mIccConfig.ClkEnables,
+ mIccConfig.ClkEnablesMask,
+ ResponseMode
+ );
+ }
+
+ if(mBIOSPayLoad)
+ {
+ gBS->CopyMem(&(IccLockRegs.RegBundles),
+ &(mBIOSPayLoad->MeBiosPayload.IccProfile.IccLockRegInfo.RegBundles),
+ sizeof(ICC_REG_BUNDLES));
+
+ gBS->CopyMem((IccLockRegs.RegMask),
+ (mBIOSPayLoad->MeBiosPayload.IccProfile.IccLockRegInfo.RegMask),
+ sizeof(UINT32) * IccLockRegs.RegBundles.BundlesCnt);
+
+ VariableSize = sizeof(UINT32) * 3;
+ Status = gRT->GetVariable(
+ L"IccLockDefault",
+ &SetupGuid,
+ NULL,
+ &VariableSize,
+ IccLockRegs.RegMask );
+ if( Status == EFI_NOT_FOUND )
+ {
+ Status = gRT->SetVariable(
+ L"IccLockDefault",
+ &SetupGuid,
+ EFI_VARIABLE_NON_VOLATILE |
+ EFI_VARIABLE_BOOTSERVICE_ACCESS,
+ VariableSize,
+ IccLockRegs.RegMask );
+ }
+ if(SetupData.IccLockRegisters == 3)
+ {
+ IccLockRegs.RegBundles.AU = 0;
+ IccLockRegs.RegBundles.BundlesCnt = 3;
+ }
+
+ if(SetupData.IccLockRegisters == 4)
+ {
+ IccLockRegs.RegBundles.BundlesCnt = 0;
+ IccLockRegs.RegBundles.AU = 0;
+ }
+
+ if(SetupData.IccLockRegisters == 5)
+ {
+ IccLockRegs.RegBundles.BundlesCnt = 0;
+ IccLockRegs.RegBundles.AU = 1;
+ }
+
+ Status = HeciLockIccRegisters (AccessMode, ResponseMode, &IccLockRegs);
+
+ }
+
+ 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 **
+//** **
+//*************************************************************************
+//*************************************************************************
diff --git a/Board/EM/MeWrapper/Icc/IccPlatform/IccPlatform.cif b/Board/EM/MeWrapper/Icc/IccPlatform/IccPlatform.cif
new file mode 100644
index 0000000..7677f59
--- /dev/null
+++ b/Board/EM/MeWrapper/Icc/IccPlatform/IccPlatform.cif
@@ -0,0 +1,12 @@
+<component>
+ name = "IccPlatform"
+ category = ModulePart
+ LocalRoot = "Board\EM\MeWrapper\Icc\IccPlatform"
+ RefName = "IccPlatform"
+[files]
+"IccPlatform.sdl"
+"IccPlatform.dxs"
+"IccPlatform.mak"
+"IccPlatform.c"
+"IccPlatform.h"
+<endComponent> \ No newline at end of file
diff --git a/Board/EM/MeWrapper/Icc/IccPlatform/IccPlatform.dxs b/Board/EM/MeWrapper/Icc/IccPlatform/IccPlatform.dxs
new file mode 100644
index 0000000..a2912b9
--- /dev/null
+++ b/Board/EM/MeWrapper/Icc/IccPlatform/IccPlatform.dxs
@@ -0,0 +1,116 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/Icc/IccPlatform/IccPlatform.dxs 2 5/13/13 2:41a Klzhan $
+//
+// $Revision: 2 $
+//
+// $Date: 5/13/13 2:41a $
+//
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/Icc/IccPlatform/IccPlatform.dxs $
+//
+// 2 5/13/13 2:41a Klzhan
+// [TAG] EIPNone
+// [Category] Improvement
+// [Description] Fix build error when Icc_OverClocking_support is
+// disabled
+//
+// 1 2/08/12 1:06a Klzhan
+// Initial Check in
+//
+// 2 6/27/11 8:39a Klzhan
+// Support New XTU protocol.
+//
+// 1 2/25/11 1:42a Klzhan
+// Initial Check-in
+//
+// 1 12/03/10 5:10a Klzhan
+// Initial Check-in.
+//
+//
+//**********************************************************************
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: IccPlatform.dxs
+//
+// Description: Platform-specific ICC code
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+/*++
+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:
+
+ IccPlatform.dxs
+
+Abstract:
+
+ Platform-specific ICC code
+
+--*/
+#include "Token.h"
+#include "AutoGen.h"
+#include "DxeDepex.h"
+#if defined (BUILD_WITH_GLUELIB) || defined (BUILD_WITH_EDKII_GLUE_LIB)
+#include "EfiDepex.h"
+#endif
+#include EFI_PROTOCOL_DEPENDENCY (PciRootBridgeIo)
+#include EFI_PROTOCOL_DEPENDENCY (Wdt)
+#include EFI_PROTOCOL_DEPENDENCY (PchInfo)
+#include "Protocol\IccOverClocking\IccOverClocking.h"
+#if defined PERF_TUNE_SUPPORT && PERF_TUNE_SUPPORT == 1
+
+#define PERF_TUNE_ASL_PROTOCOL_GUID \
+ {0x32519f22, 0x3eb, 0x47b6, 0xb3, 0xef, 0xdb, 0x93, 0x98, 0xd6, 0x4e, 0x45}
+#endif
+
+DEPENDENCY_START
+#if defined PERF_TUNE_SUPPORT && PERF_TUNE_SUPPORT == 1
+ PERF_TUNE_ASL_PROTOCOL_GUID AND
+#endif
+#if IccOverClocking_SUPPORT
+ ICC_OVERCLOCKING_PROTOCOL_GUID AND
+#endif
+ EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_GUID AND
+ WDT_PROTOCOL_GUID AND
+ EFI_PCH_INFO_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/Icc/IccPlatform/IccPlatform.h b/Board/EM/MeWrapper/Icc/IccPlatform/IccPlatform.h
new file mode 100644
index 0000000..fb4bda4
--- /dev/null
+++ b/Board/EM/MeWrapper/Icc/IccPlatform/IccPlatform.h
@@ -0,0 +1,260 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/Icc/IccPlatform/IccPlatform.h 1 2/08/12 1:06a Klzhan $
+//
+// $Revision: 1 $
+//
+// $Date: 2/08/12 1:06a $
+//
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/Icc/IccPlatform/IccPlatform.h $
+//
+// 1 2/08/12 1:06a Klzhan
+// Initial Check in
+//
+// 4 7/27/11 3:21a Klzhan
+// Add Elinks for PCIE and PCI config.
+// Note: Don't List GBE port on this Elink.
+//
+// 3 7/15/11 12:45a Klzhan
+//
+// 2 6/27/11 8:38a Klzhan
+// Remove un-use define.
+//
+// 1 2/25/11 1:42a Klzhan
+// Initial Check-in
+//
+// 1 12/03/10 5:10a Klzhan
+// Initial Check-in.
+//
+//
+//**********************************************************************
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: IccPlatform.h
+//
+// Description: Platform-specific ICC code
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+
+/*++
+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:
+
+ IccPlatform.h
+
+Abstract:
+
+ Platform-specific ICC code
+
+--*/
+
+#ifdef CougarPoint_SUPPORT
+#define SOFTSTRAP10 R_PCH_SPI_STRP10
+#else
+#define SOFTSTRAP10 R_PCH_SPI_PCHSTRP10
+#endif
+
+#define ICC_INIT_TIMEOUT 5000 // ms
+
+#define RETAIN_CLOCK_ENABLES_AT_RESUME_FROM_S3 0x1
+#define CLOCK_PROFILE_SELECTOR BIT22
+
+#define PROFILE_SELECTED_BY_BIOS 0
+#define PROFILE_SELECTED_BY_ME 1
+
+//
+// 96-bit mask of registers to be locked by LockIccRegister heci message
+// 0 = lock, 1 = don't
+// see CPT c-spec for register names
+//
+#define STATIC_REGISTERS_MASK2 0x00000000
+#define STATIC_REGISTERS_MASK1 0x0F0f0013
+#define STATIC_REGISTERS_MASK0 0x00000000
+
+#define OPTION_DISABLED 0
+#define OPTION_ENABLED 1
+#define OPTION_MANUAL 2
+#define OPTION_AUTO 3
+#define OPTION_LOCK_STATIC 4
+#define OPTION_LOCK_ALL 5
+#define OPTION_USE_OEM 6
+#define OPTION_OVERRIDE 7
+//
+// OCLKEN (ICC clock enables) register bit definitions
+//
+#define CLOCK_Flex0 BIT0
+#define CLOCK_Flex1 BIT1
+#define CLOCK_Flex2 BIT2
+#define CLOCK_Flex3 BIT3
+#define CLOCK_PCI_Clock0 BIT7
+#define CLOCK_PCI_Clock1 BIT8
+#define CLOCK_PCI_Clock2 BIT9
+#define CLOCK_PCI_Clock3 BIT10
+#define CLOCK_PCI_Clock4 BIT11
+#define CLOCK_SRC0 BIT16
+#define CLOCK_SRC1 BIT17
+#define CLOCK_SRC2 BIT18
+#define CLOCK_SRC3 BIT19
+#define CLOCK_SRC4 BIT20
+#define CLOCK_SRC5 BIT21
+#define CLOCK_SRC6 BIT22
+#define CLOCK_SRC7 BIT23
+#define CLOCK_CSI_SRC8 BIT24
+#define CLOCK_CSI_DP BIT25
+#define CLOCK_PEG_A BIT26
+#define CLOCK_PEG_B BIT27
+#define CLOCK_DMI BIT28
+
+#define BDS_ALL_DRIVERS_CONNECTED_PROTOCOL_GUID \
+ {0xdbc9fd21, 0xfad8, 0x45b0, 0x9e, 0x78, 0x27, 0x15, 0x88, 0x67, 0xcc, 0x93}
+
+typedef struct {
+ UINT32 Clock;
+ UINT8 DeviceNumber;
+ BOOLEAN HotPlugSupport;
+} PLATFORM_PCI_SLOTS;
+
+typedef struct {
+ UINT32 Clock;
+ UINT8 RootPortNumber;
+ BOOLEAN HotPlugSupport;
+} PLATFORM_PCIE_SLOTS;
+
+typedef struct _ICC_CONFIG {
+ UINT8 LockIccRegisters;
+ UINT8 SetClkEnables;
+ UINT8 ProfileSelection;
+ UINT8 SelectedIccProfile;
+ UINT32 LockMask[3];
+ UINT32 ClkEnables;
+ UINT32 ClkEnablesMask;
+ UINT8 ClocksModified;
+} ICC_CONFIG;
+
+VOID
+DisableProfileSelection (
+ VOID
+ );
+
+EFI_STATUS
+ProfileSelection (
+ IN UINT8 NewProfile
+ );
+
+EFI_STATUS
+DetectUsedClocks (
+ OUT UINT32 *UsedClocks,
+ OUT UINT32 *AllClocks
+ );
+
+EFI_STATUS
+CallSetClockEnables (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ );
+
+EFI_STATUS
+ReadMainSetupData (
+ ICC_CONFIG* IccConfig
+ );
+
+UINT8
+ReadIccSoftStraps (
+ VOID
+ );
+
+EFI_STATUS
+WaitForFwInitComplete (
+ UINT32 uSeconds
+ );
+
+EFI_STATUS
+IccFailureNotification (
+ VOID
+ );
+
+EFI_STATUS
+SendIccMessages (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ );
+
+EFI_STATUS
+IccMessages (
+ VOID
+ );
+
+#ifdef CougarPoint_SUPPORT
+
+EFI_STATUS
+WdtSupport (
+ VOID
+ );
+
+EFI_STATUS
+FeedWatchdog (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ );
+
+EFI_STATUS
+StopFeedingWatchdog (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ );
+
+#endif;
+
+#if defined PERF_TUNE_SUPPORT && PERF_TUNE_SUPPORT == 1
+typedef struct _ACPI_HDR {
+ UINT32 Signature;
+ UINT32 Length;
+ UINT8 Revision;
+ UINT8 Checksum;
+ UINT8 OemId[6];
+ UINT8 OemTblId[8];
+ UINT32 OemRev;
+ UINT32 CreatorId;
+ UINT32 CreatorRev;
+} ACPI_HDR,*PACPI_HDR;
+#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/Icc/IccPlatform/IccPlatform.mak b/Board/EM/MeWrapper/Icc/IccPlatform/IccPlatform.mak
new file mode 100644
index 0000000..71bca92
--- /dev/null
+++ b/Board/EM/MeWrapper/Icc/IccPlatform/IccPlatform.mak
@@ -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/Icc/IccPlatform/IccPlatform.mak 5 9/27/12 6:23a Klzhan $
+#
+# $Revision: 5 $
+#
+# $Date: 9/27/12 6:23a $
+#
+#**********************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/Icc/IccPlatform/IccPlatform.mak $
+#
+# 5 9/27/12 6:23a Klzhan
+# Fix build error
+#
+# 4 9/19/12 5:54a Klzhan
+# 1. Fix Build Error when Performance is on(IccPlatform.mak).
+# 2. Avoid time-out in ICC setup Page when return from Shell.
+# 3. Remove un-used wait for Fw Init Done.
+#
+# 3 4/24/12 12:28a Klzhan
+#
+# 2 2/23/12 8:57a Klzhan
+# Support New EDK
+#
+# 1 2/08/12 1:06a Klzhan
+# Initial Check in
+#
+# 4 9/06/11 6:38a Klzhan
+# Remove __EDKII_GLUE_EDK_DXE_RUNTIME_DRIVER_LIB__
+#
+# 3 7/27/11 3:21a Klzhan
+# Add Elinks for PCIE and PCI config.
+# Note: Don't List GBE port on this Elink.
+#
+# 2 7/15/11 12:45a Klzhan
+#
+# 1 2/25/11 1:42a Klzhan
+# Initial Check-in
+#
+# 1 12/03/10 5:10a Klzhan
+# Initial Check-in.
+#
+#
+#**********************************************************************
+#<AMI_FHDR_START>
+#----------------------------------------------------------------------------
+#
+# Name: IccPlatform.mak
+#
+# Description: MakFile for Platform-specific ICC code
+#
+#----------------------------------------------------------------------------
+#<AMI_FHDR_END>
+all : IccPlatform
+
+$(BUILD_DIR)\IccPlatform.mak : $(IccPlatform_DIR)\$(@B).cif $(BUILD_RULES)
+ $(CIF2MAK) $(IccPlatform_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+IccPlatform : $(BUILD_DIR)\IccPlatform.mak IccPlatform_Bin
+
+IccPlatform_INCLUDES=\
+ $(EDK_INCLUDES)\
+ $(EdkIIGlueLib_INCLUDES)\
+ $(ME_INCLUDES)\
+ $(MISCFRAMEWORK_INCLUDES)\
+ $(INTEL_MCH_INCLUDES)\
+ $(NB_INCLUDES)\
+ $(INTEL_PCH_INCLUDES)\
+ $(ICC_INCLUDES)\
+ /I$(PROJECT_DIR)\
+ /IInclude\
+
+IccPlatform_LIBS=\
+ $(EDKPROTOCOLLIB)\
+ $(EDKFRAMEWORKPROTOCOLLIB)\
+ $(EFISCRIPTLIB)\
+ $(EFIGUIDLIB)\
+ $(MeProtocolLib_LIB)\
+ $(MeLibDxe_LIB)\
+ $(EdkIIGlueBaseLib_LIB)\
+ $(EdkIIGlueBasePrintLib_LIB)\
+!IF "$(x64_BUILD)"=="1"
+ $(EdkIIGlueBaseLibX64_LIB)\
+!ELSE
+ $(EdkIIGlueBaseLibIA32_LIB)\
+!ENDIF
+ $(EdkIIGlueBaseMemoryLib_LIB)\
+ $(EdkIIGlueDxeReportStatusCodeLib_LIB)\
+ $(EdkIIGlueEdkDxeRuntimeDriverLib_LIB)\
+ $(EdkIIGluePeiDxeDebugLibReportStatusCode_LIB)\
+ $(EdkIIGlueDxeDebugLibReportStatusCode_LIB)\
+ $(EdkIIGlueUefiBootServicesTableLib_LIB)\
+ $(EdkIIGlueUefiLib_LIB)\
+ $(EdkIIGlueDxeMemoryAllocationLib_LIB)\
+ $(EdkIIGlueDxeServicesTableLib_LIB)\
+ $(EdkIIGlueBasePciCf8Lib_LIB)\
+ $(EFIDRIVERLIB)\
+ $(INTEL_PCH_PROTOCOL_LIB)\
+
+DxeCpuBuildDefine = \
+!IF "$(x64_BUILD)"=="1"
+ /DMDE_CPU_X64\
+!ELSE
+ /DMDE_CPU_IA32\
+!ENDIF
+
+IccPlatform_DEFINES=\
+ $(MY_DEFINES)\
+ $(DxeCpuBuildDefine)\
+ /D"__EDKII_GLUE_MODULE_ENTRY_POINT__=IccPlatformEntryPoint"\
+ /D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ /D __EDKII_GLUE_DXE_REPORT_STATUS_CODE_LIB__ \
+ /D __EDKII_GLUE_PEI_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ /D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__\
+
+ICC_ELINKS = \
+/D\"OEM_CLOCK_UPDATE_FUNC=$(OEMClockUpdateFunc)\"\
+!IF "$(OEMPCIEClockConfig)" == ""
+/D\"PCIE_CLOCK_CONFIG=$(PCIEClockConfig)\"\
+!ELSE
+/D\"PCIE_CLOCK_CONFIG=$(OEMPCIEClockConfig)\"\
+!ENDIF
+!IF "$(OEMPCIClockConfig)" == ""
+/D\"PCI_CLOCK_CONFIG=$(PCIClockConfig)\"
+!ELSE
+/D\"PCI_CLOCK_CONFIG=$(OEMPCIClockConfig)\"
+!ENDIF
+
+
+IccPlatform_Bin : $(IccPlatform_LIBS) $(OemClock_LIB)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\IccPlatform.mak all\
+ "MY_INCLUDES=$(IccPlatform_INCLUDES)"\
+ "MY_DEFINES=$(IccPlatform_DEFINES)"\
+ "CFLAGS=$(CFLAGS) $(ICC_ELINKS)" \
+ GUID=14257B56-BDA2-4faf-8E4F-C885DF75583C\
+ ENTRY_POINT=_ModuleEntryPoint \
+ EDKIIModule=DXEDRIVER\
+ TYPE=BS_DRIVER \
+ DEPEX1=$(IccPlatform_DIR)\IccPlatform.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 **
+#** **
+#*************************************************************************
+#************************************************************************* \ No newline at end of file
diff --git a/Board/EM/MeWrapper/Icc/IccPlatform/IccPlatform.sdl b/Board/EM/MeWrapper/Icc/IccPlatform/IccPlatform.sdl
new file mode 100644
index 0000000..0bb0e9a
--- /dev/null
+++ b/Board/EM/MeWrapper/Icc/IccPlatform/IccPlatform.sdl
@@ -0,0 +1,67 @@
+TOKEN
+ Name = "IccPlatform_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ TargetH = Yes
+ Master = Yes
+ Help = "Main switch to enable ICC support in Project in DXE Phase"
+End
+
+MODULE
+ Help = "Includes IccPlatform.mak to Project"
+ File = "IccPlatform.mak"
+End
+
+PATH
+ Name = "IccPlatform_DIR"
+ Help = "Icc platform dir"
+End
+
+ELINK
+ Name = "/I$(IccPlatform_DIR)"
+ Parent = "ICC_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\IccPlatform.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "PCIEClockConfig"
+ InvokeOrder = ReplaceParent
+ Help = "This Elink for Disable un-used PCIE port. Format is {Clock, PCIE_PORT_NUMBER, HotPlug)"
+End
+
+ELINK
+ Name = "PCIClockConfig"
+ InvokeOrder = ReplaceParent
+ Help = "This Elink for Disable un-used PCI port. Format is {Clock, PCIE_PORT_NUMBER, HotPlug)"
+End
+
+ELINK
+ Name = "OEMPCIEClockConfig"
+ InvokeOrder = ReplaceParent
+ Help = "This Elink for Disable un-used PCIE port. Format is {Clock, PCIE_PORT_NUMBER, HotPlug)"
+End
+
+ELINK
+ Name = "OEMPCIClockConfig"
+ InvokeOrder = ReplaceParent
+ Help = "This Elink for Disable un-used PCI port. Format is {Clock, PCIE_PORT_NUMBER, HotPlug)"
+End
+
+ELINK
+ Name = "OEMClockUpdateFunc"
+ InvokeOrder = ReplaceParent
+ Help = "This Elink for Disable un-used PCI port. Format is {Clock, PCIE_PORT_NUMBER, HotPlug)"
+End
+
+ELINK
+ Name = "OemClock_LIB"
+ InvokeOrder = ReplaceParent
+End
diff --git a/Board/EM/MeWrapper/Icc/IccSetup/IccCallbacks.c b/Board/EM/MeWrapper/Icc/IccSetup/IccCallbacks.c
new file mode 100644
index 0000000..8dcd104
--- /dev/null
+++ b/Board/EM/MeWrapper/Icc/IccSetup/IccCallbacks.c
@@ -0,0 +1,1272 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/Icc/IccSetup/IccCallbacks.c 11 5/14/14 9:57p Tristinchou $
+//
+// $Revision: 11 $
+//
+// $Date: 5/14/14 9:57p $
+//
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/Icc/IccSetup/IccCallbacks.c $
+//
+// 11 5/14/14 9:57p Tristinchou
+// [TAG] EIP167030
+// [Category] Improvement
+// [Description] Remove the variable runtime attribute and keep original
+// attributes.
+//
+// 10 8/09/13 2:17a Klzhan
+// [TAG] EIP131037
+// [Category] Improvement
+// [Description] Skip Using Icc Protocol after End of Post.
+//
+// 9 5/13/13 2:42a Klzhan
+// [TAG] EIPNone
+// [Category] Improvement
+// [Description] FIx build error when Icc_OverClocking_Support is
+// disabled.
+//
+// 8 12/27/12 6:36a Klzhan
+// [TAG] EIP104882
+// [Category] Improvement
+// [Description] Avoid running ICC callbacks when Load Default.
+//
+// 7 10/30/12 8:37a Klzhan
+// Support DMI Ratio for new ICC.
+//
+// 6 9/19/12 5:58a Klzhan
+// Avoid time-out in ICC setup Page when return from Shell.
+//
+// 5 7/02/12 11:43p Klzhan
+// [TAG] EIP94113
+// [Category] Spec Update
+// [Severity] Important
+// [Description] Update ME RC0.6
+//
+// 4 5/14/12 5:29a Klzhan
+// Remove Debug code
+//
+// 3 5/14/12 4:47a Klzhan
+// [TAG] EIP89676
+// [Category] Spec Update
+// [Severity] Important
+// [Description] Support New ICC library
+// [Files] IccSetup.mak
+// IccSetup.sdl
+// IccCallbacks.c
+// IccCallbacks.h
+// IccSetup.h
+// IccSetupMenu.sd
+// IccSetupSubmenu.sd
+// IccStrings.uni
+// IccLoadDefault.c
+// IccSetup.cif
+//
+// 2 4/24/12 12:30a Klzhan
+// Update modulepart to latest
+//
+// 1 2/08/12 1:07a Klzhan
+// Initial Check in
+//
+// 6 9/06/11 6:11a Klzhan
+// [TAG] EIP67462
+// [Category] Spec Update
+// [Severity] Important
+// [Description] Update ICC 08.00.00.022.1
+// [Files] IccSetup.mak
+// IccSetup.sdl
+// IccCallbacks.c
+// IccCallbacks.h
+// IccSetup.h
+// IccSetupMenu.sd
+// IccSetupSubmenu.sd
+// IccStrings.uni
+// IccLoadDefault.c
+// IccSetup.cif
+//
+// 5 7/26/11 5:58a Klzhan
+// Support EFI 2.3
+//
+// 4 6/27/11 3:22a Klzhan
+// Correct SscMode when Set frequency.
+//
+// 3 6/24/11 7:20a Klzhan
+// Remove un-use debug message.
+//
+// 2 6/23/11 11:31p Klzhan
+// [TAG] EIP62129
+// [Category] Spec Update
+// [Severity] Important
+// [Description] Support ICC Control Library 8.0.0.19.
+// [Files] IccCallbacks.c, IccCallbacks.h
+//
+// 1 2/25/11 1:42a Klzhan
+// Initial Check-in
+//
+// 1 12/03/10 5:10a Klzhan
+// Initial Check-in.
+//
+//
+//**********************************************************************
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: IccCallbacks.c
+//
+// Description: Setup hooks for ICC.
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+/*++
+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:
+
+ IccCallbacks.c
+
+Abstract:
+
+ Setup hooks for ICC.
+
+--*/
+
+#include <AmiDxeLib.h>
+#include <Setup.h>
+#include <SetupStrTokens.h>
+#include "AUTOID.h"
+#include "Protocol\AMIPostMgr.h"
+#include "Protocol\IccOverClocking\IccOverClocking.h"
+#include "IccSetup.h"
+#include "IccCallbacks.h"
+#include "PchAccess.h"
+#ifdef CougarPoint_SUPPORT
+#include "Protocol\Wdt\Wdt.h"
+#include "Protocol\WdtApp\WdtApp.h"
+#endif
+#include "Protocol\MePlatformPolicy\MePlatformPolicy.h"
+
+UINT8 mActiveSubmenu = ICC_CLOCK_COUNT;
+ICC_OVERCLOCKING_PROTOCOL* gIccOverClockingProtocol;
+ICC_CLOCK_RANGES mRanges[ICC_CLOCK_COUNT];
+CLOCK_DISPLAY_VALUES values; // Store clock Infomations of current page.
+UINT16 mBootTimeClkDiv[ICC_CLOCK_COUNT];
+UINT8 mWatchdogEnabled;
+
+CHAR16* mClockUsageName[] = {
+ L"BCLK",
+ L"DMI",
+ L"PEG",
+ L"PCIe",
+ L"PCI33",
+ L"RESERVED",
+ L"SATA",
+ L"USB3",
+ L"IGD",
+ L"IGD Bending",
+ L"RESERVED",
+ L"GFX",
+ L"USB Legacy",
+ L"PCH Legacy"
+};
+
+CHAR16* mClockName[] = {
+ L"Clock1",
+ L"Clock2",
+ L"Clock3",
+ L"Clock4",
+ L"Clock5",
+ L"Clock6",
+ L"Clock7",
+ L"Clock8"
+};
+
+CHAR16* mClockUsageNone = L"Not used";
+
+UINT16* mModeName[] = {
+ L"Down",
+ L"Center",
+ L"Up",
+ L"None"
+};
+
+EFI_HII_HANDLE gHiiHandle;
+//
+// Blocks entry to ICC clock submenus after End Of Post event
+//
+UINT8 mAfterEndOfPost = 0;
+
+#define NAME_ARRAY_SIZE (( sizeof(mClockUsageName)/sizeof(mClockUsageName[0]) ))
+
+#if (SUPPORTED_CLOCKS != ICC_CLOCK_COUNT)
+#error Ambiguous number of supported clocks
+#endif
+
+#ifndef StrCat
+#define StrCat(a,b) Wcscpy (a + Wcslen (a), b)
+#endif
+
+#define AMI_CALLBACK_CONTROL_UPDATE 1
+#define AMI_CALLBACK_RETRIEVE 2
+#define AMI_CALLBACK_FORM_OPEN 3
+#define AMI_CALLBACK_FORM_CLOSE 4
+#define AMI_CALLBACK_FORM_DEFAULT_STANDARD 0x1000
+#define AMI_CALLBACK_FORM_DEFAULT_MANUFACTURING 0x1001
+
+EFI_STATUS
+OnReadyToBoot (
+IN EFI_EVENT Event,
+IN VOID *Context
+)
+/*++
+Routine Description:
+
+ This function is executed on ReadyToBoot event.
+ If permanent or temporary ICC modifications were made, platform needs to be restarted.
+ Unlike ordinary setup options, ICC modifications can't be programmed to cause automatic reset.
+ Instead this function, executed on ReadyToBoot event, causes reset.
+
+Arguments:
+ Event pointer to event that caused this function to be executed
+ Context not used here
+
+Returns:
+ always SUCCESS
+--*/
+{
+ mAfterEndOfPost = 1;
+ pBS->CloseEvent(Event);
+ if (GetIccPersistentData() == ICC_SETTINGS_RECENTLY_MODIFIED) {
+ pRS->ResetSystem(EfiResetCold, 0, 0, 0);
+ } else if (GetIccPersistentData() == ICC_SETTINGS_PREVIOUSLY_MODIFIED) {
+ SetIccPersistentData(ICC_SETTINGS_NOT_MODIFIED);
+ }
+ return EFI_SUCCESS;
+}
+
+VOID
+InitICCStrings (
+ EFI_HII_HANDLE HiiHandle,
+ UINT16 Class
+ )
+/*++
+Routine Description:
+
+ This function is executed when Setup module loads.
+ Registers OnReadyToBoot function to be executed on ReadyToBoot event.
+ Remembers HiiHandle, pointer to setup browser's runtime variable store
+
+Arguments:
+ HiiHandle
+ Class
+
+Returns:
+ always SUCCESS
+--*/
+{
+ static UINT8 mInitStringComplete = 0;
+ EFI_EVENT Event;
+ EFI_GUID EfiEventReadyToBootGuid = EFI_EVENT_GROUP_READY_TO_BOOT;
+
+ if (mInitStringComplete == 1) {
+ return;
+ } else {
+ if(Class == ADVANCED_FORM_SET_CLASS) {
+ mInitStringComplete = 1;
+ gHiiHandle = HiiHandle;
+
+ if (GetIccPersistentData() == ICC_SETTINGS_RECENTLY_MODIFIED) {
+ SetIccPersistentData(ICC_SETTINGS_PREVIOUSLY_MODIFIED);
+ }
+
+#if (EFI_SPECIFICATION_VERSION < 0x00020000)
+ pBS->CreateEvent (
+ EFI_EVENT_SIGNAL_READY_TO_BOOT | EFI_EVENT_NOTIFY_SIGNAL_ALL,
+ TPL_CALLBACK,
+ OnReadyToBoot,
+ NULL,
+ &Event
+ );
+#else
+ pBS->CreateEventEx (
+ EFI_EVENT_NOTIFY_SIGNAL,
+ TPL_CALLBACK,
+ OnReadyToBoot,
+ NULL,
+ &EfiEventReadyToBootGuid,
+ &Event
+ );
+#endif
+
+ }
+ }
+}
+
+EFI_STATUS
+InitIccMenu (
+ IN ICC_VOLATILE_SETUP_DATA* IccSetupData
+ )
+/*++
+Routine Description:
+ Initializes text strings and setup variables connected with ICC menu.
+ If there is an error during initialization, displays messagebox with error details
+Arguments:
+ Pointer to Icc setup data structure
+Returns:
+ EFI_SUCCESS if everything went OK
+ otherwise, an ERROR
+--*/
+{
+ UINTN VariableSize;
+ UINT8 i;
+ EFI_STATUS Status;
+#if IccOverClocking_SUPPORT
+ ICC_LIB_STATUS IccStatus;
+#endif
+ ICC_LIB_VERSION Version;
+ SETUP_DATA SetupData;
+ EFI_GUID IccOverClockingProtocolGuid = ICC_OVERCLOCKING_PROTOCOL_GUID;
+ EFI_GUID IccSetupDataGuid = ICC_VOLATILE_SETUP_DATA_GUID;
+ EFI_GUID SetupGuid = SETUP_GUID;
+ CALLBACK_PARAMETERS *CallbackParameter = GetCallbackParameters();
+
+#if EFI_SPECIFICATION_VERSION >= 0x2001E
+ if ((CallbackParameter->Action == AMI_CALLBACK_RETRIEVE) ||
+ (CallbackParameter->Action == AMI_CALLBACK_FORM_OPEN) ||
+ (CallbackParameter->Action == AMI_CALLBACK_FORM_CLOSE) ||
+ (CallbackParameter->Action == AMI_CALLBACK_FORM_DEFAULT_STANDARD) ||
+ (CallbackParameter->Action == AMI_CALLBACK_FORM_DEFAULT_MANUFACTURING))
+ return EFI_SUCCESS;
+#endif
+
+ VariableSize = sizeof (SETUP_DATA);
+
+ Status = pRS->GetVariable (
+ L"Setup",
+ &SetupGuid,
+ NULL,
+ &VariableSize,
+ &SetupData
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ VariableSize = sizeof(UINT8);
+ Status = pRS->GetVariable (
+ L"AfterReadyToBoot",
+ &IccSetupDataGuid,
+ NULL,
+ &VariableSize,
+ &mAfterEndOfPost);
+#if IccOverClocking_SUPPORT
+ Status = pBS->LocateProtocol(&IccOverClockingProtocolGuid, NULL, &gIccOverClockingProtocol);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ VariableSize = sizeof (UINTN);
+ mWatchdogEnabled = SetupData.IccWdtEnabled;
+
+ IccStatus = IccInitOverclocking(&Version);
+
+ if ( IccStatus != ICC_LIB_STATUS_SUCCESS ) {
+ MessageBox ( MSGBOX_TYPE_OK, NULL, STRING_TOKEN(STR_ICC_MSGBOX_INIT_ERROR_STRANGE), IccStatus);
+ IccSetupData->AllowAdvancedOptions = 0;
+ return EFI_DEVICE_ERROR;
+ }
+#else
+ return EFI_SUCCESS;
+#endif
+ // If init success, Set allowadvancedOption true
+// IccSetupData->AllowAdvancedOptions = 1;
+
+ InitString(
+ gHiiHandle,
+ STRING_TOKEN(STR_ICC_LIB_VERSION_NR),
+ L"%d.%d.%d.%d",
+ Version.Major,
+ Version.Minor,
+ Version.Hotfix,
+ Version.Build
+ );
+ if(mAfterEndOfPost != 1)
+ {
+ IccSetupData->AllowAdvancedOptions = 1;
+ for (i=0; i<ICC_CLOCK_COUNT; i++) {
+ IccGetFrequencies(i, &values);
+ IccSetupData->Frequency[i] = values.ClkFreqCurrent;
+ IccSetupData->SscPercent[i] = values.SscPercentCurrent;
+ IccSetupData->SscMode[i] = values.SscModeCurrent;
+ // Workaround for architecture bugs: read - don't modify - write sequence doesn't work for some clocks
+ // These clocks must not be allowed to be modified - they'll cause ICC Lib to return misleading errors
+ if (/* (values.ClockUsage & (1<<ICC_CLOCK_USAGE_GFX)) ||
+ (values.ClockUsage & (1<<ICC_CLOCK_USAGE_GFX_BENDING)) ||*/
+ (values.ClockUsage == 0)
+ ) {
+ IccSetupData->ShowSsc[i] = 0;
+ IccSetupData->ShowClock[i] = 0;
+ } else {
+ IccSetupData->ShowSsc[i] = values.SscChangeAllowed;
+ if (values.ClkFreqMax == values.ClkFreqMin) {
+ IccSetupData->ShowClock[i] = 0;
+ } else {
+ IccSetupData->ShowClock[i] = 1;
+ }
+ }
+ }
+ }else
+ IccSetupData->AllowAdvancedOptions = 0;
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+EFIAPI
+IccMenuEntry (
+ IN EFI_HII_HANDLE HiiHandle,
+ IN UINT16 Class,
+ IN UINT16 SubClass,
+ IN UINT16 Key
+)
+/*++
+Routine Description:
+ Setup callback executed when user enters Advanced->ICC menu
+ Think of it as an entry point to efi overclocking module
+ Initializes ICC OverClocking and if there are errors, disables entry into submenus
+ Without access to submenus, it is guaranteed no other callback will be executed.
+Arguments:
+Returns:
+ always SUCCESS, but in case of errors entry into submenus is disabled
+--*/
+{
+ static UINT8 FirstEntry = 1;
+ static UINT8 EopReported = 0;
+ ICC_VOLATILE_SETUP_DATA* IccSetupData = NULL;
+ EFI_STATUS Status;
+ EFI_GUID IccSetupDataGuid = ICC_VOLATILE_SETUP_DATA_GUID;
+ UINTN SelectionBufferSize = sizeof(ICC_VOLATILE_SETUP_DATA);
+ CALLBACK_PARAMETERS *CallbackParameter = GetCallbackParameters();
+ EFI_GUID DxePlatformMePolicyGuid = DXE_PLATFORM_ME_POLICY_GUID;
+ DXE_ME_POLICY_PROTOCOL *DxePlatformMePolicy;
+
+#if EFI_SPECIFICATION_VERSION >= 0x2001E
+ if ((CallbackParameter->Action == AMI_CALLBACK_RETRIEVE) ||
+ (CallbackParameter->Action == AMI_CALLBACK_FORM_OPEN) ||
+ (CallbackParameter->Action == AMI_CALLBACK_FORM_CLOSE) ||
+ (CallbackParameter->Action == AMI_CALLBACK_FORM_DEFAULT_STANDARD) ||
+ (CallbackParameter->Action == AMI_CALLBACK_FORM_DEFAULT_MANUFACTURING))
+ return EFI_SUCCESS;
+#endif
+
+ if(mAfterEndOfPost == 0) {
+ Status = pBS->LocateProtocol(&DxePlatformMePolicyGuid, NULL, &DxePlatformMePolicy);
+ if(!EFI_ERROR (Status)) {
+ if(DxePlatformMePolicy->MeConfig.EndOfPostDone) {
+ mAfterEndOfPost = 1;
+ }
+ }
+ }
+ //
+ // No changes to ICC menu display
+ //
+ if (EopReported == 1 || (FirstEntry ==0 && mAfterEndOfPost == 0)) {
+ return EFI_SUCCESS;
+ }
+
+ FirstEntry = 0;
+
+#if EFI_SPECIFICATION_VERSION>0x20000
+ Status = pBS->AllocatePool(EfiBootServicesData, SelectionBufferSize, &IccSetupData);
+ if(EFI_ERROR(Status)) {
+ return Status;
+ }
+
+ Status = HiiLibGetBrowserData(&SelectionBufferSize,
+ IccSetupData,
+ &IccSetupDataGuid,
+ ICC_VOLATILE_SETUP_DATA_C_NAME
+ );
+ ASSERT_EFI_ERROR(Status);
+
+#else
+ IccSetupData = (ICC_VOLATILE_SETUP_DATA*)CallbackParameter->Data->NvRamMap;
+#endif
+
+ if (mAfterEndOfPost == 1 && EopReported == 0) {
+ IccSetupData->AllowAdvancedOptions = 0;
+ EopReported = 1;
+ MessageBox ( MSGBOX_TYPE_OK, NULL, STRING_TOKEN(STR_ICC_MSGBOX_AFTER_EOP));
+ } else {
+ Status = InitIccMenu(IccSetupData);
+ if (EFI_ERROR(Status)) {
+// IccSetupData->AllowAdvancedOptions = 0;
+ MessageBox ( MSGBOX_TYPE_OK, NULL, STRING_TOKEN(STR_ICC_MSGBOX_INIT_ERROR_STRANGE));
+ } else {
+// IccSetupData->AllowAdvancedOptions = 1;
+ }
+ }
+
+ Status = pRS->SetVariable(
+ ICC_VOLATILE_SETUP_DATA_C_NAME,
+ &IccSetupDataGuid,
+ EFI_VARIABLE_BOOTSERVICE_ACCESS |
+ EFI_VARIABLE_NON_VOLATILE,
+ sizeof(ICC_VOLATILE_SETUP_DATA),
+ IccSetupData );
+
+#if EFI_SPECIFICATION_VERSION>0x20000
+ Status = HiiLibSetBrowserData(
+ SelectionBufferSize, IccSetupData,
+ &IccSetupDataGuid, ICC_VOLATILE_SETUP_DATA_C_NAME
+ );
+ ASSERT_EFI_ERROR(Status);
+ pBS->FreePool(IccSetupData);
+
+#endif;
+
+ return EFI_SUCCESS;
+}
+
+
+
+EFI_STATUS
+EFIAPI
+IccSubmenuEntry (
+ IN EFI_HII_HANDLE HiiHandle,
+ IN UINT16 Class,
+ IN UINT16 SubClass,
+ IN UINT16 Key
+)
+
+/*++
+Routine Description:
+ Setup callback executed when user enters any submenu of Advanced->ICC
+ Personalizes common strings for that particular clock submenu
+ Stores information on which submenu we're in, that's needed for other callbacks
+Arguments:
+Returns:
+ always SUCCESS
+--*/
+{
+ UINT8 SubMenuNumber = ICC_CLOCK_COUNT;
+ CHAR16 StringBuffer[100];
+ UINT8 i;
+ UINT8 NeedComma;
+ UINT8 LineOverflow;
+ CALLBACK_PARAMETERS *CallbackParameter = GetCallbackParameters();
+
+#if EFI_SPECIFICATION_VERSION >= 0x2001E
+ if ((CallbackParameter->Action == AMI_CALLBACK_RETRIEVE) ||
+ (CallbackParameter->Action == AMI_CALLBACK_FORM_OPEN) ||
+ (CallbackParameter->Action == AMI_CALLBACK_FORM_CLOSE) ||
+ (CallbackParameter->Action == AMI_CALLBACK_FORM_DEFAULT_STANDARD) ||
+ (CallbackParameter->Action == AMI_CALLBACK_FORM_DEFAULT_MANUFACTURING))
+ return EFI_SUCCESS;
+#endif
+
+ switch (Key) {
+ case KEY_FORM1:
+ SubMenuNumber = 0;
+ break;
+ case KEY_FORM2:
+ SubMenuNumber = 1;
+ break;
+ case KEY_FORM3:
+ SubMenuNumber = 2;
+ break;
+ case KEY_FORM4:
+ SubMenuNumber = 3;
+ break;
+ case KEY_FORM5:
+ SubMenuNumber = 4;
+ break;
+ case KEY_FORM6:
+ SubMenuNumber = 5;
+ break;
+ case KEY_FORM7:
+ SubMenuNumber = 6;
+ break;
+ case KEY_FORM8:
+ SubMenuNumber = 7;
+ break;
+ default:
+ ASSERT(FALSE);
+ }
+
+ if (SubMenuNumber == mActiveSubmenu) {
+ //
+ //strings already personalized for this menu, no need to change them
+ //
+ return EFI_SUCCESS;
+ }
+
+ mActiveSubmenu = SubMenuNumber;
+
+ IccGetFrequencies(mActiveSubmenu, &values);
+ StringBuffer[0] = 0;
+ NeedComma = 0;
+ LineOverflow = 0;
+
+ //
+ // Concatenate all clock usages into two strings. If first string gets too long, second will be written
+ //
+ InitString(gHiiHandle, STRING_TOKEN(STR_ICC_CLOCK_USAGE_2), L"%s", StringBuffer);
+ if (values.ClockUsage != 0) {
+ for (i=0; i<NAME_ARRAY_SIZE; i++) {
+ if (values.ClockUsage & (1<<i)) {
+ if (NeedComma == 1) {
+ StrCat(StringBuffer, L", ");
+ }
+ if ( Wcslen(StringBuffer) + Wcslen(mClockUsageName[i]) > 25 ) {
+ LineOverflow = 1;
+ InitString(gHiiHandle, STRING_TOKEN(STR_ICC_CLOCK_USAGE_1), L"%s", StringBuffer);
+ StringBuffer[0] = 0;
+ NeedComma = 0;
+ }
+ StrCat(StringBuffer, mClockUsageName[i]);
+ NeedComma = 1;
+ }
+ }
+ } else {
+ StrCat(StringBuffer, mClockUsageNone);
+ }
+ if (LineOverflow) {
+ InitString(gHiiHandle, STRING_TOKEN(STR_ICC_CLOCK_USAGE_2), L"%s", StringBuffer);
+ } else {
+ InitString(gHiiHandle, STRING_TOKEN(STR_ICC_CLOCK_USAGE_1), L"%s", StringBuffer);
+ }
+
+ InitString(gHiiHandle, STRING_TOKEN(STR_ICC_CLOCK_NUMBER), L"%s", mClockName[SubMenuNumber]);
+ InitString(gHiiHandle, STRING_TOKEN(STR_ICC_MAX_FREQUENCY_VALUE), L"%d.%02d MHz", values.ClkFreqMax/100, values.ClkFreqMax%100);
+ InitString(gHiiHandle, STRING_TOKEN(STR_ICC_MIN_FREQUENCY_VALUE), L"%d.%02d MHz", values.ClkFreqMin/100, values.ClkFreqMin%100);
+ InitString(gHiiHandle, STRING_TOKEN(STR_ICC_CURRENT_FREQUENCY_VALUE), L"%d.%02d MHz", values.ClkFreqCurrent/100, values.ClkFreqCurrent%100);
+ InitString(gHiiHandle, STRING_TOKEN(STR_ICC_SSC_MODES_VALUE), L"%s%s%s",
+ (values.SscModeDownAvailable) ? L"Down " : L" ",
+ (values.SscModeCenterAvailable)? L"Center " : L" ",
+ (values.SscModeUpAvailable) ? L"Up " : L" "
+ );
+ InitString(gHiiHandle, STRING_TOKEN(STR_ICC_SSC_CURRENT_MODE_VALUE), L"%s", mModeName[values.SscModeCurrent]);
+ InitString(gHiiHandle, STRING_TOKEN(STR_ICC_SSC_MAX_VALUE), L"%d.%02d%%", values.SscPercentMax/100, values.SscPercentMax%100);
+ InitString(gHiiHandle, STRING_TOKEN(STR_ICC_SSC_CURRENT_VALUE), L"%d.%02d%%", values.SscPercentCurrent/100, values.SscPercentCurrent%100);
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+EFIAPI
+IccAccept (
+ IN EFI_HII_HANDLE HiiHandle,
+ IN UINT16 Class,
+ IN UINT16 SubClass,
+ IN UINT16 Key
+)
+/*++
+Routine Description:
+ Setup callback executed when user chooses 'Accept'
+ Sends requested clock parameters to ICC OverClocking
+Arguments:
+ interface to ITEM_CALLBACK_EX
+Returns:
+ always SUCCESS
+--*/
+{
+ EFI_STATUS Status;
+ ICC_VOLATILE_SETUP_DATA* IccSetupData = NULL;
+ CLOCK_DISPLAY_VALUES values;
+ UINT8 TypeOfChange;
+ UINTN VarSize = 0;
+#if EFI_SPECIFICATION_VERSION>0x20000
+ UINTN SelectionBufferSize = sizeof(ICC_VOLATILE_SETUP_DATA);
+ EFI_GUID IccSetupDataGuid = ICC_VOLATILE_SETUP_DATA_GUID;
+#endif
+ CALLBACK_PARAMETERS *CallbackParameter = GetCallbackParameters();
+
+#if EFI_SPECIFICATION_VERSION >= 0x2001E
+ if ((CallbackParameter->Action == AMI_CALLBACK_RETRIEVE) ||
+ (CallbackParameter->Action == AMI_CALLBACK_FORM_OPEN) ||
+ (CallbackParameter->Action == AMI_CALLBACK_FORM_CLOSE) ||
+ (CallbackParameter->Action == AMI_CALLBACK_FORM_DEFAULT_STANDARD) ||
+ (CallbackParameter->Action == AMI_CALLBACK_FORM_DEFAULT_MANUFACTURING))
+ return EFI_SUCCESS;
+#endif
+
+ switch (Key) {
+ case KEY_CHANGE_NOW1:
+ case KEY_CHANGE_NOW2:
+ case KEY_CHANGE_NOW3:
+ case KEY_CHANGE_NOW4:
+ case KEY_CHANGE_NOW5:
+ case KEY_CHANGE_NOW6:
+ TypeOfChange = IMMEDIATE;
+ break;
+ case KEY_CHANGE_ONCE1:
+ case KEY_CHANGE_ONCE2:
+ case KEY_CHANGE_ONCE3:
+ case KEY_CHANGE_ONCE4:
+ case KEY_CHANGE_ONCE5:
+ case KEY_CHANGE_ONCE6:
+ TypeOfChange = TEMPORARY;
+ break;
+ case KEY_CHANGE_PERM1:
+ case KEY_CHANGE_PERM2:
+ case KEY_CHANGE_PERM3:
+ case KEY_CHANGE_PERM4:
+ case KEY_CHANGE_PERM5:
+ case KEY_CHANGE_PERM6:
+ TypeOfChange = PERMANENT;
+ break;
+ default:
+ ASSERT(FALSE);
+ TypeOfChange = 0; //prevent compilator warning
+ }
+
+#if EFI_SPECIFICATION_VERSION>0x20000
+ Status = pBS->AllocatePool(EfiBootServicesData, SelectionBufferSize, &IccSetupData);
+ if(EFI_ERROR(Status))
+ return Status;
+
+ Status = HiiLibGetBrowserData(
+ &SelectionBufferSize, IccSetupData,
+ &IccSetupDataGuid, ICC_VOLATILE_SETUP_DATA_C_NAME
+ );
+ ASSERT_EFI_ERROR(Status);
+#else
+ IccSetupData = (ICC_VOLATILE_SETUP_DATA*)CallbackParameter->Data->NvRamMap;
+#endif
+ Status = SendClockChangeRequest(IccSetupData, mActiveSubmenu, TypeOfChange);
+ IccGetFrequencies(mActiveSubmenu, &values);
+
+ InitString(gHiiHandle, STRING_TOKEN(STR_ICC_CURRENT_FREQUENCY_VALUE), L"%d.%02d MHz", values.ClkFreqCurrent/100, values.ClkFreqCurrent%100);
+ InitString(gHiiHandle, STRING_TOKEN(STR_ICC_SSC_CURRENT_MODE_VALUE), L"%s", mModeName[values.SscModeCurrent]);
+ InitString(gHiiHandle, STRING_TOKEN(STR_ICC_SSC_CURRENT_VALUE), L"%d.%02d%%", values.SscPercentCurrent/100, values.SscPercentCurrent%100);
+
+#if EFI_SPECIFICATION_VERSION>0x20000
+ pBS->FreePool(IccSetupData);
+#endif;
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+EFIAPI
+IccFreqChange (
+ IN EFI_HII_HANDLE HiiHandle,
+ IN UINT16 Class,
+ IN UINT16 SubClass,
+ IN UINT16 Key
+)
+/*++
+Routine Description:
+ Setup callback executed when user changes frequency
+ Calls IccFrequencyRounding() which fixes frequency and SSC parameters to allowed values
+ Having these parameters fixed decreases number of errors caused by sending wrong parameters
+Arguments:
+Returns:
+ always SUCCESS
+--*/
+{
+ EFI_STATUS Status;
+ ICC_VOLATILE_SETUP_DATA* IccSetupData = NULL;
+ ICC_CLOCK_FREQUENCY ExpectFrequency, UserFrequency;
+ BOOLEAN HigherFrequency = FALSE;
+ ICC_LIB_STATUS IccStatus;
+#if EFI_SPECIFICATION_VERSION>0x20000
+ UINTN SelectionBufferSize = sizeof(ICC_VOLATILE_SETUP_DATA);
+ EFI_GUID IccSetupDataGuid = ICC_VOLATILE_SETUP_DATA_GUID;
+#endif
+
+ CALLBACK_PARAMETERS *CallbackParameter = GetCallbackParameters();
+
+#if EFI_SPECIFICATION_VERSION >= 0x2001E
+ if ((CallbackParameter->Action == AMI_CALLBACK_RETRIEVE) ||
+ (CallbackParameter->Action == AMI_CALLBACK_FORM_OPEN) ||
+ (CallbackParameter->Action == AMI_CALLBACK_FORM_CLOSE))
+ return EFI_SUCCESS;
+#endif
+
+#if EFI_SPECIFICATION_VERSION>0x20000
+ Status = pBS->AllocatePool(EfiBootServicesData, SelectionBufferSize, &IccSetupData);
+ if(EFI_ERROR(Status))
+ return Status;
+
+ Status = HiiLibGetBrowserData(
+ &SelectionBufferSize, IccSetupData,
+ &IccSetupDataGuid, ICC_VOLATILE_SETUP_DATA_C_NAME
+ );
+ ASSERT_EFI_ERROR(Status);
+#else
+ IccSetupData = (ICC_VOLATILE_SETUP_DATA*)CallbackParameter->Data->NvRamMap;
+#endif
+
+ UserFrequency = IccSetupData->Frequency[mActiveSubmenu];
+
+ if(UserFrequency >= values.ClkFreqMax)
+ {
+ IccSetupData->Frequency[mActiveSubmenu] = values.ClkFreqMax;
+#if EFI_SPECIFICATION_VERSION>0x20000
+ Status = HiiLibSetBrowserData(
+ SelectionBufferSize, IccSetupData,
+ &IccSetupDataGuid, ICC_VOLATILE_SETUP_DATA_C_NAME
+ );
+ ASSERT_EFI_ERROR(Status);
+
+ pBS->FreePool(IccSetupData);
+#endif;
+ return EFI_SUCCESS;
+ }
+
+ if(UserFrequency <= values.ClkFreqMin)
+ {
+ IccSetupData->Frequency[mActiveSubmenu] = values.ClkFreqMin;
+#if EFI_SPECIFICATION_VERSION>0x20000
+ Status = HiiLibSetBrowserData(
+ SelectionBufferSize, IccSetupData,
+ &IccSetupDataGuid, ICC_VOLATILE_SETUP_DATA_C_NAME
+ );
+ ASSERT_EFI_ERROR(Status);
+
+ pBS->FreePool(IccSetupData);
+#endif;
+ return EFI_SUCCESS;
+ }
+
+ if(UserFrequency > values.ClkFreqCurrent)
+ HigherFrequency = TRUE;
+
+ {
+ UserFrequency = (UserFrequency) * 10000;
+ gIccOverClockingProtocol->GetNextFrequency(mActiveSubmenu,
+ UserFrequency,
+ &UserFrequency,
+ &IccStatus);
+
+ gIccOverClockingProtocol->GetPreviousFrequency(mActiveSubmenu,
+ UserFrequency,
+ &ExpectFrequency,
+ &IccStatus);
+ }
+
+ if (IccStatus == ICC_LIB_STATUS_SUCCESS) {
+ IccSetupData->Frequency[mActiveSubmenu] = ExpectFrequency/10000;
+ }
+
+#if EFI_SPECIFICATION_VERSION>0x20000
+ Status = HiiLibSetBrowserData(
+ SelectionBufferSize, IccSetupData,
+ &IccSetupDataGuid, ICC_VOLATILE_SETUP_DATA_C_NAME
+ );
+ ASSERT_EFI_ERROR(Status);
+
+ pBS->FreePool(IccSetupData);
+#endif;
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+SendClockChangeRequest (
+ IN ICC_VOLATILE_SETUP_DATA* IccSetupData,
+ IN UINT8 ClockID,
+ IN UINT8 TypeOfChange
+ )
+/*++
+Routine Description:
+ Executed by setup calback function
+ Based on data entered by user, sends clock change requests to ICC OverClocking
+ Writing to susram or flash requires that old susram and flash contents be invalidated
+ In case of any problem, messagebox is displayed so user can know what corrective action is required
+Arguments:
+ initial clock divider value
+Returns:
+ validated clock divider value
+--*/
+{
+
+ UINT8 answer = 1;
+ ICC_LIB_STATUS IccStatus;
+ ICC_CLOCK_SETTINGS RequestSetting;
+ BOOLEAN freqConsolidationBypass = TRUE, permanentChange;
+
+ if(TypeOfChange == PERMANENT)
+ permanentChange = TRUE;
+
+ if(TypeOfChange == TEMPORARY)
+ permanentChange = FALSE;
+
+ // Prepare Setting
+ gIccOverClockingProtocol->GetCurrentClockSettings(ClockID, &RequestSetting, &IccStatus);
+ RequestSetting.Frequency = IccSetupData->Frequency[ClockID] * 10000;
+ RequestSetting.SscMode = SscNumberToSscMode(IccSetupData->SscMode[ClockID]);
+ RequestSetting.SscPercent = (UINT8)IccSetupData->SscPercent[ClockID];
+ // Only ICC_DMI_PEG_RATIO_5_TO_5 is support in PPT.
+ RequestSetting.DmiPegRatio = (UINT8)IccSetupData->DmiPegRatio[ClockID];
+
+ if(TypeOfChange == IMMEDIATE)
+ {
+ gIccOverClockingProtocol->SetCurrentClockSettings(ClockID,
+ RequestSetting,
+ &IccStatus);
+ }else
+ {
+ gIccOverClockingProtocol->SetBootClockSettings(ClockID,
+ RequestSetting,
+ &IccStatus);
+ }
+
+ if (IccStatus != ICC_LIB_STATUS_SUCCESS) {
+ if (TypeOfChange == TEMPORARY) {
+ MessageBox (MSGBOX_TYPE_OKCANCEL, &answer, STRING_TOKEN(STR_ICC_MSGBOX_ONCE_OVERWRITE));
+ } else if (TypeOfChange == PERMANENT) {
+ MessageBox (MSGBOX_TYPE_OKCANCEL, &answer, STRING_TOKEN(STR_ICC_MSGBOX_PERM_OVERWRITE));
+ }
+ if (answer != MSGBOX_YES) {
+ return ICC_LIB_STATUS_SUCCESS;
+ }
+ }
+
+ switch (IccStatus) {
+ case ICC_LIB_STATUS_DYNAMIC_CHANGE_NOT_ALLOWED:
+ MessageBox (MSGBOX_TYPE_OKCANCEL, &answer, STRING_TOKEN(STR_ICC_MSGBOX_NO_DYNAMIC), mClockName[ClockID]);
+ break;
+ case ICC_LIB_STATUS_REGISTER_IS_LOCKED:
+ MessageBox ( MSGBOX_TYPE_OK, NULL, STRING_TOKEN(STR_ICC_MSGBOX_LOCKED));
+ break;
+ case ICC_LIB_STATUS_FREQ_TOO_HIGH:
+ MessageBox ( MSGBOX_TYPE_OK, NULL, STRING_TOKEN(STR_ICC_MSGBOX_FREQ_HIGH), mClockName[ClockID] );
+ break;
+ case ICC_LIB_STATUS_FREQ_TOO_LOW:
+ MessageBox (MSGBOX_TYPE_OK, NULL, STRING_TOKEN(STR_ICC_MSGBOX_FREQ_LOW), mClockName[ClockID] );
+ break;
+ case ICC_LIB_STATUS_SSC_TOO_HIGH:
+ case ICC_LIB_STATUS_SSC_OUT_OF_RANGE:
+ MessageBox ( MSGBOX_TYPE_OK, NULL, STRING_TOKEN(STR_ICC_MSGBOX_SSC_HIGH), mClockName[ClockID] );
+ break;
+ case ICC_LIB_STATUS_SSC_TOO_LOW:
+ MessageBox (MSGBOX_TYPE_OK, NULL, STRING_TOKEN(STR_ICC_MSGBOX_SSC_LOW), mClockName[ClockID] );
+ break;
+ case ICC_LIB_STATUS_SSC_MODE_NOT_SUPPORTED:
+ MessageBox ( MSGBOX_TYPE_OK, NULL, STRING_TOKEN(STR_ICC_MSGBOX_SSC_MODE), mClockName[ClockID] );
+ break;
+ case ICC_LIB_STATUS_FREQ_MUST_HAVE_ZERO_SSC:
+ MessageBox ( MSGBOX_TYPE_OK, NULL, STRING_TOKEN(STR_ICC_MSGBOX_SSC_DISABLED), mClockName[ClockID] );
+ break;
+ case ICC_LIB_STATUS_SSC_CHANGE_NOT_ALLOWED:
+ MessageBox ( MSGBOX_TYPE_OK, NULL, STRING_TOKEN(STR_ICC_MSGBOX_SSC_CONSTANT), mClockName[ClockID] );
+ break;
+ case ICC_LIB_STATUS_MEI_INITIALIZATION_FAILED:
+ case ICC_LIB_STATUS_MEI_CONNECTION_FAILED:
+ MessageBox ( MSGBOX_TYPE_OK, NULL, STRING_TOKEN(STR_ICC_MSGBOX_HECI));
+ break;
+ case ICC_LIB_STATUS_SUCCESS:
+ if (TypeOfChange == IMMEDIATE) {
+ MessageBox ( MSGBOX_TYPE_OK, NULL, STRING_TOKEN(STR_ICC_MSGBOX_SUCCESS));
+ } else {
+ MessageBox ( MSGBOX_TYPE_OK, NULL, STRING_TOKEN(STR_ICC_MSGBOX_SUCCESS_NEED_REBOOT));
+ }
+ break;
+ default:
+ MessageBox ( MSGBOX_TYPE_OK, NULL, STRING_TOKEN(STR_ICC_MSGBOX_UNKNOWN), IccStatus );
+ break;
+ }
+
+ return IccStatus;
+}
+
+EFI_STATUS
+MessageBox (
+ IN UINT8 type,
+ OPTIONAL OUT UINT8* answer,
+ IN UINT16 StringId,
+ ...
+ )
+/*++
+Routine Description:
+ Wrapper function that displays messagebox. Text for Messagebox is specified with printf-like parameters.
+ Arguments:
+ type - messagebox type
+ answer - pointer to where user's answer will be stored
+ format, ... - parameters to printf
+Returns:
+--*/
+{
+ static AMI_POST_MANAGER_PROTOCOL* pAmiPostMgr = NULL;
+ EFI_GUID AmiPostManagerProtocolGuid = AMI_POST_MANAGER_PROTOCOL_GUID;
+ EFI_STATUS Status;
+ UINT8 LocalAnswer;
+ CHAR16* StrBuffer = 0;
+ CHAR16* LocalBuffer;
+ UINTN LocalBufferSize;
+ UINTN StrLen = 0;
+ va_list ArgList = va_start(ArgList,StringId);
+
+ if (pAmiPostMgr == NULL) {
+ Status = pBS->LocateProtocol(&AmiPostManagerProtocolGuid, NULL, &pAmiPostMgr);
+ ASSERT (pAmiPostMgr);
+ ASSERT_EFI_ERROR (Status);
+ }
+
+ HiiLibGetString(gHiiHandle, StringId, &StrLen, StrBuffer);
+ Status = pBS->AllocatePool(EfiBootServicesData, StrLen, &StrBuffer);
+ ASSERT_EFI_ERROR(Status);
+ HiiLibGetString(gHiiHandle, StringId, &StrLen, StrBuffer);
+
+ LocalBufferSize = (StrLen+1)*2;
+
+ while (1) {
+ Status = pBS->AllocatePool(EfiBootServicesData, LocalBufferSize, &LocalBuffer);
+ ASSERT_EFI_ERROR(Status);
+ if (LocalBufferSize <= Swprintf_s_va_list(LocalBuffer, LocalBufferSize, StrBuffer, ArgList) ) {
+ Status = pBS->FreePool(LocalBuffer);
+ ASSERT_EFI_ERROR(Status);
+ LocalBufferSize*=2;
+ } else {
+ break;
+ }
+ }
+
+ va_end(ArgList);
+
+ Status = pAmiPostMgr->DisplayMsgBox(L"Intel ICC", LocalBuffer, type, &LocalAnswer);
+ pBS->FreePool(StrBuffer);
+ pBS->FreePool(LocalBuffer);
+
+ ASSERT_EFI_ERROR (Status);
+ if (answer != NULL) {
+ *answer = LocalAnswer;
+ }
+ return Status;
+}
+
+ICC_LIB_STATUS
+EFIAPI
+IccInitOverclocking (
+ ICC_LIB_VERSION* Version
+ )
+/*++
+Routine Description:
+ Initializes ICC OverClocking and asks about initial clock-related data. The data is:
+ clock parameters from CURRENT record (will be displayed as current and boot-time frequencies)
+ clock parameters from FLASH record (needed in case we try to write flash record later)
+ clock ranges - max/min supported frequencies
+Arguments:
+
+Returns:
+ EFI_SUCCESS - if there were no errors, updates global variables
+ EFI_DEVICE_ERROR - if there were errors when interfacing ICC OverClocking
+
+--*/
+{
+ UINT8 i;
+ ICC_LIB_STATUS IccStatus;
+
+ gIccOverClockingProtocol->GetInfo(Version, &i, &IccStatus);
+
+ if (IccStatus != ICC_LIB_STATUS_SUCCESS) {
+ TRACE ((TRACE_ALWAYS, "(ICC) IccOverClocking failed to start. IccStatus=0x%x, version = %d.%d.%d.%d\n", IccStatus, Version->Major, Version->Minor, Version->Hotfix, Version->Build));
+ return IccStatus;
+ }
+
+ return 0;
+}
+
+VOID
+IccGetFrequencies (
+ IN UINT8 ClockNumber,
+ OUT CLOCK_DISPLAY_VALUES* Values
+ )
+/*++
+Routine Description:
+ Called by Setup module, feeds it with clock data required to display all clock related information on bios setup screen
+ Converts data from clock divider value to clock frequency
+Arguments:
+ ClockNumber - data for which clock should be returned
+Returns:
+ values - clock-related data required to display values on ICC setup screen
+--*/
+{
+ ICC_LIB_STATUS IccStatus;
+ ICC_CLOCK_RANGES ClockRange;
+ ICC_CLOCK_SETTINGS Clocksetting;
+
+ gIccOverClockingProtocol->GetClockRanges(ClockNumber, &ClockRange, &IccStatus);
+ Values->ClockUsage = (UINT16)ClockRange.UsageMask;
+ Values->ClkFreqMax = ClockRange.FrequencyMax/10000;
+ Values->ClkFreqMin = ClockRange.FrequencyMin/10000;
+ Values->SscChangeAllowed = (UINT8)ClockRange.SscChangeAllowed;
+ Values->SscModeCenterAvailable = (UINT8)ClockRange.SscCenterAllowed;
+ Values->SscModeUpAvailable = (UINT8)ClockRange.SscUpAllowed;
+ Values->SscModeDownAvailable = (UINT8)ClockRange.SscDownAllowed;
+ Values->SscPercentMax = (UINT16)ClockRange.SscPercentMax;
+
+ gIccOverClockingProtocol->GetCurrentClockSettings(ClockNumber, &Clocksetting, &IccStatus);
+ Values->ClkFreqCurrent = Clocksetting.Frequency/10000;
+ Values->SscPercentCurrent = (UINT16)Clocksetting.SscPercent;
+ Values->SscModeCurrent = SscModeToSscNumber(Clocksetting.SscMode);
+
+}
+
+UINT32
+SscNumberToSscMode (
+ IN UINT8 SscModeNumber
+ )
+/*++
+Routine Description:
+ Converts SSC mode description. ICC OverClocking uses 3 bit one-hot format.
+ For displaying things in BIOS setup, numeric value is more convenient
+ This function should be called 3 times, once for each bit in ICC OverClocking format.
+Arguments:
+ SscModeNumber - mode number from BIOS setup
+ Mode - particular mode we're checking for
+Returns:
+ 0 - SSC number does not represent Mode
+ 1 - SSC number represents Mode
+--*/
+{
+ switch(SscModeNumber)
+ {
+ case SSC_MODE_NONE:
+ return ICC_SSC_NONE;
+
+ case SSC_MODE_UP:
+ return ICC_SSC_UP;
+
+ case SSC_MODE_CENTER:
+ return ICC_SSC_CENTER;
+
+ case SSC_MODE_DOWN:
+ return ICC_SSC_DOWN;
+
+ default:
+ TRACE ((TRACE_ALWAYS, "(ICC) Invalid SscModeNumber value \n"));
+ EFI_DEADLOOP();
+ return 0;
+ }
+};
+
+UINT8
+SscModeToSscNumber (
+ IN UINT8 SscMode
+ )
+/*++
+Routine Description:
+ Converts SSC mode description. ICC OverClocking uses 3 bit one-hot format. BIOS setup requires 8bit numeric value.
+Arguments:
+ three bits from ICC OverClocking format
+Returns:
+ SSC mode in BIOS setup format
+--*/
+{
+ switch(SscMode)
+ {
+ case ICC_SSC_NONE:
+ return SSC_MODE_NONE;
+
+ case ICC_SSC_UP:
+ return SSC_MODE_UP;
+
+ case ICC_SSC_CENTER:
+ return SSC_MODE_CENTER;
+
+ case ICC_SSC_DOWN:
+ return SSC_MODE_DOWN;
+
+ default:
+ TRACE ((TRACE_ALWAYS, "(ICC) Invalid SscMode value \n"));
+ EFI_DEADLOOP();
+ return 0;
+ }
+}
+
+VOID
+SetIccPersistentData (
+ IN UINT8 FlowPhase
+)
+/*++
+Routine Description:
+ Sets ClocksModified field of IccPersistentData EFI variable
+Arguments:
+ new value of IccPersistentData
+Returns:
+ none
+--*/
+{
+
+ EFI_GUID IccPersistentDataGuid = ICC_PERSISTENT_DATA_GUID;
+ ICC_PERSISTENT_DATA IccPersistentData;
+
+ IccPersistentData.ClocksModified = FlowPhase;
+
+ pRS->SetVariable(
+ L"IccPersistentData",
+ &IccPersistentDataGuid,
+ EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,
+ sizeof(IccPersistentData),
+ &IccPersistentData );
+}
+
+UINT8
+GetIccPersistentData (
+ VOID
+)
+/*++
+Routine Description:
+ Reads IccPersistentData EFI variable
+Arguments:
+ none
+Returns:
+ value of ClocksModified field
+--*/
+{
+ EFI_GUID IccPersistentDataGuid = ICC_PERSISTENT_DATA_GUID;
+ ICC_PERSISTENT_DATA IccPersistentData;
+ UINTN VariableSize;
+ EFI_STATUS Status;
+ VariableSize = sizeof(IccPersistentData);
+
+ Status = pRS->GetVariable(
+ L"IccPersistentData",
+ &IccPersistentDataGuid,
+ NULL,
+ &VariableSize,
+ &IccPersistentData );
+ if(EFI_ERROR(Status))
+ return ICC_SETTINGS_NOT_MODIFIED;
+ else
+ return IccPersistentData.ClocksModified;
+}
+
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/Icc/IccSetup/IccCallbacks.h b/Board/EM/MeWrapper/Icc/IccSetup/IccCallbacks.h
new file mode 100644
index 0000000..24bae4c
--- /dev/null
+++ b/Board/EM/MeWrapper/Icc/IccSetup/IccCallbacks.h
@@ -0,0 +1,167 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/Icc/IccSetup/IccCallbacks.h 3 10/30/12 8:37a Klzhan $
+//
+// $Revision: 3 $
+//
+// $Date: 10/30/12 8:37a $
+//
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/Icc/IccSetup/IccCallbacks.h $
+//
+// 3 10/30/12 8:37a Klzhan
+// Support DMI Ratio for new ICC.
+//
+// 2 5/14/12 4:47a Klzhan
+// [TAG] EIP89676
+// [Category] Spec Update
+// [Severity] Important
+// [Description] Support New ICC library
+// [Files] IccSetup.mak
+// IccSetup.sdl
+// IccCallbacks.c
+// IccCallbacks.h
+// IccSetup.h
+// IccSetupMenu.sd
+// IccSetupSubmenu.sd
+// IccStrings.uni
+// IccLoadDefault.c
+// IccSetup.cif
+//
+// 1 2/08/12 1:07a Klzhan
+// Initial Check in
+//
+// 3 6/27/11 10:46p Klzhan
+// Update SscNumberToSscMode() for New Icc Control Library.
+//
+// 2 6/23/11 11:31p Klzhan
+// [TAG] EIP62129
+// [Category] Spec Update
+// [Severity] Important
+// [Description] Support ICC Control Library 8.0.0.19.
+// [Files] IccCallbacks.c, IccCallbacks.h
+//
+// 1 2/25/11 1:42a Klzhan
+// Initial Check-in
+//
+// 1 12/03/10 5:10a Klzhan
+// Initial Check-in.
+//
+//
+//**********************************************************************
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: IccCallbacks.h
+//
+// Description: Setup hooks for ICC.
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+/*++
+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:
+
+ IccCallbacks.h
+
+Abstract:
+
+ Setup hooks for ICC
+
+--*/
+
+#define MAX(a, b) ((a) > (b) ? (a) : (b))
+#define MIN(a, b) ((a) > (b) ? (b) : (a))
+
+#define ICC_CLOCK_COUNT 8
+
+typedef struct _CLOCK_DISPLAY_VALUES {
+ UINT32 ClkFreqMax;
+ UINT32 ClkFreqMin;
+ UINT32 ClkFreqCurrent;
+ UINT16 SscPercentMax;
+ UINT16 SscPercentCurrent;
+ UINT16 ClockUsage;
+ UINT8 SscChangeAllowed;
+ UINT8 SscModeUpAvailable;
+ UINT8 SscModeCenterAvailable;
+ UINT8 SscModeDownAvailable;
+ UINT8 SscModeCurrent;
+ UINT8 DmiPegRatio;
+} CLOCK_DISPLAY_VALUES;
+
+typedef struct _ICC_CLK_REQUEST {
+ UINT16 Frequency;
+ UINT16 SscPercent;
+ UINT8 SscAllowed;
+ UINT8 SscMode;
+ UINT8 EveryBoot;
+} ICC_CLK_REQUEST;
+
+#define IMMEDIATE 0
+#define TEMPORARY 1
+#define PERMANENT 2
+
+#define SSC_MODE_NONE 3
+#define SSC_MODE_UP 2
+#define SSC_MODE_CENTER 1
+#define SSC_MODE_DOWN 0
+
+#define ROUND_UP 1
+#define ROUND_DOWN 0
+
+EFI_STATUS SendClockChangeRequest (IN ICC_VOLATILE_SETUP_DATA* IccSetupData, IN UINT8 ClkMask, IN UINT8 TypeOfChange);
+EFI_STATUS MessageBox (IN UINT8 type, OUT UINT8* answer, IN UINT16 StringId, ...);
+UINT16 FrequencyToDivider (IN UINT16 Frequency);
+UINT16 DividerToFrequency (IN UINT16 Divider);
+UINT16 FixDividerValue (IN UINT16 Divider, IN UINT8 Direction);
+UINT32 SscNumberToSscMode (IN UINT8 SscModeNumber);
+UINT8 SscModeToSscNumber (IN UINT8 SscMode);
+ICC_LIB_STATUS IccInitOverclocking (ICC_LIB_VERSION*);
+ICC_LIB_STATUS IccInvalidateRecord (IN UINT8 RecordType);
+VOID IccGetFrequencies (IN UINT8 ClockNumber, OUT CLOCK_DISPLAY_VALUES* values);
+EFI_STATUS IccRoundFrequency (IN OUT ICC_CLK_REQUEST* IccSetupData, IN UINT8 ClockNumber);
+ICC_LIB_STATUS IccSendRequestRecord (IN UINT8 TypeOfChange, IN UINT32 ClockMask, IN ICC_CLK_REQUEST* IccExchange, OUT UINT8* ErrorLocation);
+UINTN Wcslen(CHAR16 *string);
+CHAR16* Wcscpy(CHAR16 *string1, CHAR16* string2);
+VOID StrCat (IN OUT CHAR16 *Destination, IN CHAR16 *Source);
+VOID SetIccPersistentData (IN UINT8 FlowPhase);
+UINT8 GetIccPersistentData (VOID);
+
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/Icc/IccSetup/IccLoadDefault.c b/Board/EM/MeWrapper/Icc/IccSetup/IccLoadDefault.c
new file mode 100644
index 0000000..94c558f
--- /dev/null
+++ b/Board/EM/MeWrapper/Icc/IccSetup/IccLoadDefault.c
@@ -0,0 +1,141 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/Icc/IccSetup/IccLoadDefault.c 3 2/22/13 2:27a Klzhan $
+//
+// $Revision: 3 $
+//
+// $Date: 2/22/13 2:27a $
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/Icc/IccSetup/IccLoadDefault.c $
+//
+// 3 2/22/13 2:27a Klzhan
+// [TAG] EIP115268
+// [Category] Bug Fix
+// [Severity] Important
+// [Symptom] Icc Setup Item be hidden after load default(F3)
+// [RootCause] New TSE check gGrowserCallbackEnabled
+// [Solution] Enable gGrowserCallbackEnabled when call HiiSetBrowserData
+//
+// 2 4/24/12 12:31a Klzhan
+// Update modulepart to latest
+//
+// 1 2/08/12 1:07a Klzhan
+// Initial Check in
+//
+// 1 5/04/11 3:08a Klzhan
+// EIP58767 : ICC Setup item will not be hidden when load default.
+//
+// 1 11/01/10 9:42a Tonywu
+// Fix that the "ICC OverClocking" form will be hidden when setup loads
+// defaults.
+//
+//**********************************************************************
+//<AMI_FHDR_START>
+//
+// Name: IccLoadDefault.c
+//
+// Description: Enter when loaded default in SETUP.
+//
+//<AMI_FHDR_END>
+//**********************************************************************
+
+#include <Setup.h>
+#include <AmiLib.h>
+#include <AmiDxeLib.h>
+#include "IccSetup.h"
+
+EFI_STATUS FindVariableIndex(CHAR16 *Name, EFI_GUID *Guid, UINT32 *Index);
+
+extern BOOLEAN gBrowserCallbackEnabled;
+
+VOID IccSetupLoadDefault(VOID)
+{
+ UINT8 i;
+ EFI_STATUS Status;
+
+ UINTN SelectionBufferSize = sizeof(ICC_VOLATILE_SETUP_DATA);
+ EFI_GUID IccSetupDataGuid = ICC_VOLATILE_SETUP_DATA_GUID;
+ ICC_VOLATILE_SETUP_DATA* IccSetupData = NULL;
+ ICC_VOLATILE_SETUP_DATA* TseIccSetupData = NULL;
+ BOOLEAN OrgBrowserCallbackEnabled = gBrowserCallbackEnabled;
+
+ Status = pBS->AllocatePool(EfiBootServicesData, SelectionBufferSize, &IccSetupData);
+ if (!EFI_ERROR(Status))
+ {
+ Status = pRS->GetVariable (
+ ICC_VOLATILE_SETUP_DATA_C_NAME,
+ &IccSetupDataGuid,
+ NULL,
+ &SelectionBufferSize,
+ IccSetupData);
+ ASSERT_EFI_ERROR(Status);
+ if (!EFI_ERROR(Status))
+ {
+ if (IccSetupData->AllowAdvancedOptions == 1)
+ {
+ Status = pBS->AllocatePool(EfiBootServicesData, SelectionBufferSize, &TseIccSetupData);
+ if(EFI_ERROR(Status)) {
+ return;
+ }
+ gBrowserCallbackEnabled = TRUE;
+ Status = HiiLibGetBrowserData(&SelectionBufferSize,
+ TseIccSetupData,
+ &IccSetupDataGuid,
+ L"IccAdvancedSetupDataVar"
+ );
+ if(EFI_ERROR(Status))
+ {
+ pBS->FreePool(TseIccSetupData);
+ gBrowserCallbackEnabled = OrgBrowserCallbackEnabled;
+ return;
+ }
+
+ TseIccSetupData->AllowAdvancedOptions = IccSetupData->AllowAdvancedOptions;
+ for (i=0; i<6 ;i++)
+ {
+ TseIccSetupData->ShowClock[i] = IccSetupData->ShowClock[i];
+ TseIccSetupData->ShowSsc[i] = IccSetupData->ShowSsc[i];
+ TseIccSetupData->Frequency[i] = IccSetupData->Frequency[i];
+ TseIccSetupData->SscPercent[i] = IccSetupData->SscPercent[i];
+ }
+ Status = HiiLibSetBrowserData(
+ SelectionBufferSize, TseIccSetupData,
+ &IccSetupDataGuid, L"IccAdvancedSetupDataVar");
+
+ pBS->FreePool(TseIccSetupData);
+ gBrowserCallbackEnabled = OrgBrowserCallbackEnabled;
+
+ }
+ }
+
+ }
+}
+
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/Icc/IccSetup/IccSetup.cif b/Board/EM/MeWrapper/Icc/IccSetup/IccSetup.cif
new file mode 100644
index 0000000..65e9d9f
--- /dev/null
+++ b/Board/EM/MeWrapper/Icc/IccSetup/IccSetup.cif
@@ -0,0 +1,16 @@
+<component>
+ name = "IccSetup"
+ category = ModulePart
+ LocalRoot = "Board\EM\MeWrapper\Icc\IccSetup"
+ RefName = "IccSetup"
+[files]
+"IccSetup.mak"
+"IccSetup.sdl"
+"IccCallbacks.c"
+"IccCallbacks.h"
+"IccSetup.h"
+"IccSetupMenu.sd"
+"IccSetupSubmenu.sd"
+"IccStrings.uni"
+"IccLoadDefault.c"
+<endComponent>
diff --git a/Board/EM/MeWrapper/Icc/IccSetup/IccSetup.h b/Board/EM/MeWrapper/Icc/IccSetup/IccSetup.h
new file mode 100644
index 0000000..69ae39d
--- /dev/null
+++ b/Board/EM/MeWrapper/Icc/IccSetup/IccSetup.h
@@ -0,0 +1,139 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/Icc/IccSetup/IccSetup.h 4 10/30/12 8:37a Klzhan $
+//
+// $Revision: 4 $
+//
+// $Date: 10/30/12 8:37a $
+//
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/Icc/IccSetup/IccSetup.h $
+//
+// 4 10/30/12 8:37a Klzhan
+// Support DMI Ratio for new ICC.
+//
+// 3 5/14/12 4:47a Klzhan
+// [TAG] EIP89676
+// [Category] Spec Update
+// [Severity] Important
+// [Description] Support New ICC library
+// [Files] IccSetup.mak
+// IccSetup.sdl
+// IccCallbacks.c
+// IccCallbacks.h
+// IccSetup.h
+// IccSetupMenu.sd
+// IccSetupSubmenu.sd
+// IccStrings.uni
+// IccLoadDefault.c
+// IccSetup.cif
+//
+// 2 4/24/12 12:30a Klzhan
+// Update modulepart to latest
+//
+// 1 2/08/12 1:07a Klzhan
+// Initial Check in
+//
+// 1 2/25/11 1:42a Klzhan
+// Initial Check-in
+//
+// 1 12/03/10 5:10a Klzhan
+// Initial Check-in.
+//
+//
+//**********************************************************************
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: IccSetup.h
+//
+// Description: Setup hooks for ICC.
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+/*++
+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:
+
+ IccSetup.h
+
+Abstract:
+
+ Setup hooks for ICC
+
+--*/
+#define SUPPORTED_CLOCKS 8
+
+//
+// Icc Persistent Data - needs to be remembered after platform power cycle
+//
+#define ICC_PERSISTENT_DATA_GUID \
+{0x64192dca, 0xd034, 0x49d2, 0xa6, 0xde, 0x65, 0xa8, 0x29, 0xeb, 0x4c, 0x74}
+
+#define ICC_PERSISTENT_DATA_C_NAME L"IccPersistentData"
+
+typedef struct _ICC_PERSISTENT_DATA {
+ UINT8 ClocksModified;
+} ICC_PERSISTENT_DATA;
+
+#define ICC_SETTINGS_NOT_MODIFIED 0
+#define ICC_SETTINGS_RECENTLY_MODIFIED 1
+#define ICC_SETTINGS_PREVIOUSLY_MODIFIED 2
+
+//
+// Icc Volatile Setup Data - volatile (to prevent flash wear) data used by TSE
+//
+#define ICC_VOLATILE_SETUP_DATA_GUID \
+{0x7b77fb8b, 0x1e0d, 0x4d7e, 0x95, 0x3f, 0x39, 0x80, 0xa2, 0x61, 0xe0, 0x77}
+
+#define ICC_VOLATILE_SETUP_DATA_C_NAME L"IccAdvancedSetupDataVar"
+#pragma pack(1)
+typedef struct _ICC_VOLATILE_SETUP_DATA {
+ UINT16 Frequency[SUPPORTED_CLOCKS];
+ UINT8 SscMode[SUPPORTED_CLOCKS];
+ UINT16 SscPercent[SUPPORTED_CLOCKS];
+ UINT8 ShowSsc[SUPPORTED_CLOCKS];
+ UINT8 ShowClock[SUPPORTED_CLOCKS];
+ UINT8 ShowDmiPegRatio[SUPPORTED_CLOCKS];
+ UINT8 DmiPegRatio[SUPPORTED_CLOCKS];
+ UINT8 ShowProfile;
+ UINT8 AllowAdvancedOptions;
+} ICC_VOLATILE_SETUP_DATA;
+#pragma pack()
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/Icc/IccSetup/IccSetup.mak b/Board/EM/MeWrapper/Icc/IccSetup/IccSetup.mak
new file mode 100644
index 0000000..24d038e
--- /dev/null
+++ b/Board/EM/MeWrapper/Icc/IccSetup/IccSetup.mak
@@ -0,0 +1,99 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/Icc/IccSetup/IccSetup.mak 1 2/08/12 1:07a Klzhan $
+#
+# $Revision: 1 $
+#
+# $Date: 2/08/12 1:07a $
+#
+#**********************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/Icc/IccSetup/IccSetup.mak $
+#
+# 1 2/08/12 1:07a Klzhan
+# Initial Check in
+#
+# 2 5/04/11 3:06a Klzhan
+# EIP58767 : ICC setup items will not be hidden when load default.
+#
+# 1 2/25/11 1:42a Klzhan
+# Initial Check-in
+#
+# 1 12/03/10 5:10a Klzhan
+# Initial Check-in.
+#
+#
+#**********************************************************************
+#
+#<AMI_FHDR_START>
+#----------------------------------------------------------------------------
+#
+# Name: IccSetup.mak
+#
+# Description: Makefile Setup hooks for ICC.
+#
+#----------------------------------------------------------------------------
+#<AMI_FHDR_END>
+All :
+
+SetupSdbs : $(BUILD_DIR)\IccSetup.sdb
+
+SetupBin : $(BUILD_DIR)\IccCallbacks.obj
+
+$(BUILD_DIR)\IccSetup.mak : $(IccSetup_DIR)\$(@B).cif $(IccSetup_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(IccSetup_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+$(BUILD_DIR)\IccSetup.sdb : $(BUILD_DIR)\IccSetup.mak $(IccSetup_DIR)\*.sd $(IccSetup_DIR)\*.uni
+ $(MAKE) /$(MAKEFLAGS) $(BUILD_DEFAULTS)\
+ /f $(BUILD_DIR)\IccSetup.mak all\
+ TYPE=SDB NAME=IccSetup
+
+$(BUILD_DIR)\IccCallbacks.obj : $(IccSetup_DIR)\IccCallbacks.c
+ $(CC) $(CFLAGS)\
+ $(INTEL_MCH_INCLUDES) \
+ $(INTEL_PCH_INCLUDES) \
+ $(ME_INCLUDES)\
+ $(ICC_INCLUDES)\
+ $(NB_INCLUDES) \
+ $(WDT_APP_INCLUDES) \
+ /Fo$(BUILD_DIR)\ $(IccSetup_DIR)\IccCallbacks.c
+
+#---------------------------------------------------------------------------
+# Icc SETUP load dafault hook
+#---------------------------------------------------------------------------
+AMITSEBin : $(BUILD_DIR)\IccLoadDefault.obj
+
+IccLoadDefault_CFLAGS=$(CFLAGS) \
+ -I $(TSEBIN_DIR)\Inc \
+ -I $(TSEBIN_DIR)
+
+$(BUILD_DIR)\IccLoadDefault.obj : $(IccSetup_DIR)\IccLoadDefault.c
+ $(CC) $(IccLoadDefault_CFLAGS) /Fo$(BUILD_DIR)\IccLoadDefault.obj $(IccSetup_DIR)\IccLoadDefault.c
+
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/Icc/IccSetup/IccSetup.sdl b/Board/EM/MeWrapper/Icc/IccSetup/IccSetup.sdl
new file mode 100644
index 0000000..a4ef233
--- /dev/null
+++ b/Board/EM/MeWrapper/Icc/IccSetup/IccSetup.sdl
@@ -0,0 +1,263 @@
+TOKEN
+ Name = "IccSetup_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ TargetH = Yes
+ Master = Yes
+ Help = "Main switch to enable ICC support in Project in DXE Phase"
+End
+
+MODULE
+ Help = "Includes IccSetup.mak to Project"
+ File = "IccSetup.mak"
+End
+
+PATH
+ Name = "IccSetup_DIR"
+ Help = "Icc Setup dir"
+End
+
+ELINK
+ Name = "/I$(IccSetup_DIR)"
+ Parent = "ICC_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\IccSetup.sdb"
+ Parent = "SETUP_SDBS"
+ Priority = 86
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "$(IccSetup_DIR)\IccSetupMenu.sd"
+ Parent = "SETUP_DEFINITIONS"
+ Priority = 86
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "$(IccSetup_DIR)\IccSetupSubmenu.sd"
+ Parent = "SETUP_DEFINITIONS"
+ Priority = 86
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "InitICCStrings,"
+ Parent = "SetupStringInit"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "ITEM_CALLBACK(ADVANCED_FORM_SET_CLASS,0,KEY_ICCMENU,IccMenuEntry),"
+ Parent = "SetupItemCallbacks"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "ITEM_CALLBACK(ADVANCED_FORM_SET_CLASS,0,KEY_FORM1,IccSubmenuEntry),"
+ Parent = "SetupItemCallbacks"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "ITEM_CALLBACK(ADVANCED_FORM_SET_CLASS,0,KEY_FORM2,IccSubmenuEntry),"
+ Parent = "SetupItemCallbacks"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "ITEM_CALLBACK(ADVANCED_FORM_SET_CLASS,0,KEY_FORM3,IccSubmenuEntry),"
+ Parent = "SetupItemCallbacks"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "ITEM_CALLBACK(ADVANCED_FORM_SET_CLASS,0,KEY_FORM4,IccSubmenuEntry),"
+ Parent = "SetupItemCallbacks"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "ITEM_CALLBACK(ADVANCED_FORM_SET_CLASS,0,KEY_FORM5,IccSubmenuEntry),"
+ Parent = "SetupItemCallbacks"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "ITEM_CALLBACK(ADVANCED_FORM_SET_CLASS,0,KEY_FORM6,IccSubmenuEntry),"
+ Parent = "SetupItemCallbacks"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "ITEM_CALLBACK(ADVANCED_FORM_SET_CLASS,0,KEY_FORM7,IccSubmenuEntry),"
+ Parent = "SetupItemCallbacks"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "ITEM_CALLBACK(ADVANCED_FORM_SET_CLASS,0,KEY_FORM8,IccSubmenuEntry),"
+ Parent = "SetupItemCallbacks"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "ITEM_CALLBACK(ADVANCED_FORM_SET_CLASS,0,KEY_CHANGE_NOW1,IccAccept),"
+ Parent = "SetupItemCallbacks"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "ITEM_CALLBACK(ADVANCED_FORM_SET_CLASS,0,KEY_CHANGE_NOW2,IccAccept),"
+ Parent = "SetupItemCallbacks"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "ITEM_CALLBACK(ADVANCED_FORM_SET_CLASS,0,KEY_CHANGE_NOW3,IccAccept),"
+ Parent = "SetupItemCallbacks"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "ITEM_CALLBACK(ADVANCED_FORM_SET_CLASS,0,KEY_CHANGE_NOW4,IccAccept),"
+ Parent = "SetupItemCallbacks"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "ITEM_CALLBACK(ADVANCED_FORM_SET_CLASS,0,KEY_CHANGE_NOW5,IccAccept),"
+ Parent = "SetupItemCallbacks"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "ITEM_CALLBACK(ADVANCED_FORM_SET_CLASS,0,KEY_CHANGE_NOW6,IccAccept),"
+ Parent = "SetupItemCallbacks"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "ITEM_CALLBACK(ADVANCED_FORM_SET_CLASS,0,KEY_CHANGE_NOW7,IccAccept),"
+ Parent = "SetupItemCallbacks"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "ITEM_CALLBACK(ADVANCED_FORM_SET_CLASS,0,KEY_CHANGE_NOW8,IccAccept),"
+ Parent = "SetupItemCallbacks"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "ITEM_CALLBACK(ADVANCED_FORM_SET_CLASS,0,KEY_CHANGE_PERM1,IccAccept),"
+ Parent = "SetupItemCallbacks"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "ITEM_CALLBACK(ADVANCED_FORM_SET_CLASS,0,KEY_CHANGE_PERM2,IccAccept),"
+ Parent = "SetupItemCallbacks"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "ITEM_CALLBACK(ADVANCED_FORM_SET_CLASS,0,KEY_CHANGE_PERM3,IccAccept),"
+ Parent = "SetupItemCallbacks"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "ITEM_CALLBACK(ADVANCED_FORM_SET_CLASS,0,KEY_CHANGE_PERM4,IccAccept),"
+ Parent = "SetupItemCallbacks"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "ITEM_CALLBACK(ADVANCED_FORM_SET_CLASS,0,KEY_CHANGE_PERM5,IccAccept),"
+ Parent = "SetupItemCallbacks"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "ITEM_CALLBACK(ADVANCED_FORM_SET_CLASS,0,KEY_CHANGE_PERM6,IccAccept),"
+ Parent = "SetupItemCallbacks"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "ITEM_CALLBACK(ADVANCED_FORM_SET_CLASS,0,KEY_CHANGE_PERM7,IccAccept),"
+ Parent = "SetupItemCallbacks"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "ITEM_CALLBACK(ADVANCED_FORM_SET_CLASS,0,KEY_CHANGE_PERM8,IccAccept),"
+ Parent = "SetupItemCallbacks"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "ITEM_CALLBACK(ADVANCED_FORM_SET_CLASS,0,KEY_FREQ1,IccFreqChange),"
+ Parent = "SetupItemCallbacks"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "ITEM_CALLBACK(ADVANCED_FORM_SET_CLASS,0,KEY_FREQ2,IccFreqChange),"
+ Parent = "SetupItemCallbacks"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "ITEM_CALLBACK(ADVANCED_FORM_SET_CLASS,0,KEY_FREQ3,IccFreqChange),"
+ Parent = "SetupItemCallbacks"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "ITEM_CALLBACK(ADVANCED_FORM_SET_CLASS,0,KEY_FREQ4,IccFreqChange),"
+ Parent = "SetupItemCallbacks"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "ITEM_CALLBACK(ADVANCED_FORM_SET_CLASS,0,KEY_FREQ5,IccFreqChange),"
+ Parent = "SetupItemCallbacks"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "ITEM_CALLBACK(ADVANCED_FORM_SET_CLASS,0,KEY_FREQ6,IccFreqChange),"
+ Parent = "SetupItemCallbacks"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "ITEM_CALLBACK(ADVANCED_FORM_SET_CLASS,0,KEY_FREQ7,IccFreqChange),"
+ Parent = "SetupItemCallbacks"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "ITEM_CALLBACK(ADVANCED_FORM_SET_CLASS,0,KEY_FREQ8,IccFreqChange),"
+ Parent = "SetupItemCallbacks"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\IccLoadDefault.obj"
+ Parent = "AMITSE_Objects"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "IccSetupLoadDefault,"
+ Parent = "LoadSetupDefaults,"
+ InvokeOrder = AfterParent
+End \ No newline at end of file
diff --git a/Board/EM/MeWrapper/Icc/IccSetup/IccSetupMenu.sd b/Board/EM/MeWrapper/Icc/IccSetup/IccSetupMenu.sd
new file mode 100644
index 0000000..06ed9f7
--- /dev/null
+++ b/Board/EM/MeWrapper/Icc/IccSetup/IccSetupMenu.sd
@@ -0,0 +1,438 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/Icc/IccSetup/IccSetupMenu.sd 4 12/24/12 6:37a Klzhan $
+//
+// $Revision: 4 $
+//
+// $Date: 12/24/12 6:37a $
+//
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/Icc/IccSetup/IccSetupMenu.sd $
+//
+// 4 12/24/12 6:37a Klzhan
+// [TAG] EIP109624
+// [Category] New Feature
+// [Description] Support Lock Icc registers.
+//
+// 3 5/14/12 4:47a Klzhan
+// [TAG] EIP89676
+// [Category] Spec Update
+// [Severity] Important
+// [Description] Support New ICC library
+// [Files] IccSetup.mak
+// IccSetup.sdl
+// IccCallbacks.c
+// IccCallbacks.h
+// IccSetup.h
+// IccSetupMenu.sd
+// IccSetupSubmenu.sd
+// IccStrings.uni
+// IccLoadDefault.c
+// IccSetup.cif
+//
+// 2 4/24/12 12:31a Klzhan
+// Update modulepart to latest
+//
+// 1 2/08/12 1:07a Klzhan
+// Initial Check in
+//
+// 1 2/25/11 1:42a Klzhan
+// Initial Check-in
+//
+// 1 12/03/10 5:10a Klzhan
+// Initial Check-in.
+//
+//
+//**********************************************************************
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: IccSetup.sd
+//
+// Description: SD file for ICC Setup
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+/*++
+
+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:
+
+ IccSetupMenu.sd
+
+Abstract:
+
+ Icc's advanced menu layout
+
+--*/
+
+#ifdef SETUP_DATA_DEFINITION
+
+ UINT8 IccWdtEnabled;
+ UINT8 IccSetClockEnables;
+ UINT8 IccLockRegisters;
+ UINT8 IccDisplayProfile;
+ UINT8 IccSelectedProfile;
+ UINT8 IccProfileEnable;
+
+#endif
+
+#ifdef CONTROL_DEFINITION
+ #define ICC_GOTO_INTELICC\
+ goto ICC_FORM_ID, \
+ prompt = STRING_TOKEN(STR_ICC_FORM),\
+ help = STRING_TOKEN(STR_ICC_FORM_HELP),\
+ flags = INTERACTIVE,\
+ key = AUTO_ID(KEY_ICCMENU);
+#endif
+#ifdef ADVANCED_FORM_SET
+
+#ifdef FORM_SET_TYPEDEF
+
+#include "IccSetup.h"
+
+#endif
+
+
+#ifdef FORM_SET_VARSTORE
+
+ varstore ICC_VOLATILE_SETUP_DATA,
+ key = AUTO_ID(ICC_VOLATILE_SETUP_DATA_VAR),
+ name = IccAdvancedSetupDataVar,
+ guid = ICC_VOLATILE_SETUP_DATA_GUID;
+
+#endif
+
+#ifdef FORM_SET_ITEM
+#endif
+
+#ifdef FORM_SET_GOTO
+ //
+ // this grayout is always false, but ensures that callback function will receive pointer to ICC_VOLATILE_SETUP_DATA instead SETUP_DATA
+ //
+ grayoutif ideqval ICC_VOLATILE_SETUP_DATA.AllowAdvancedOptions == 2;
+ ICC_GOTO_INTELICC
+ endif;
+#endif
+
+#ifdef FORM_SET_FORM
+ #ifndef ICC_FORM_SETUP
+ #define ICC_FORM_SETUP
+
+ form formid = AUTO_ID(ICC_FORM_ID),
+ title = STRING_TOKEN(STR_ENABLED);
+ grayoutif ideqval SYSTEM_ACCESS.Access == SYSTEM_PASSWORD_USER;
+ oneof varid = SETUP_DATA.IccWdtEnabled,
+ prompt = STRING_TOKEN(STR_ICC_WDT_ENABLE),
+ help = STRING_TOKEN(STR_ICC_WDT_ENABLE_HELP),
+ option text = STRING_TOKEN(STR_DISABLED), value = 0, flags = DEFAULT | MANUFACTURING | RESET_REQUIRED;
+ option text = STRING_TOKEN(STR_ENABLED), value = 1, flags = RESET_REQUIRED;
+ endoneof;
+
+ oneof varid = SETUP_DATA.IccSetClockEnables,
+ prompt = STRING_TOKEN(STR_ICC_CLOCK_ENABLING),
+ help = STRING_TOKEN(STR_ICC_CLOCK_ENABLING_HELP),
+ option text = STRING_TOKEN(STR_DISABLED), value = 0, flags = RESET_REQUIRED;
+ option text = STRING_TOKEN(STR_ENABLED), value = 1, flags = DEFAULT | MANUFACTURING | RESET_REQUIRED;
+ endoneof;
+
+ oneof varid = SETUP_DATA.IccLockRegisters,
+ prompt = STRING_TOKEN(STR_ICC_LOCK_EOP),
+ help = STRING_TOKEN(STR_ICC_LOCK_HELP),
+ option text = STRING_TOKEN(STR_ICC_DEFAULT), value = 3, flags = DEFAULT | MANUFACTURING | RESET_REQUIRED;
+ option text = STRING_TOKEN(STR_ICC_LOCK), value = 4, flags = MANUFACTURING | RESET_REQUIRED;
+ option text = STRING_TOKEN(STR_ICC_UNLOCK), value = 5, flags = RESET_REQUIRED;
+ endoneof;
+ endif;
+ grayoutif ideqval SYSTEM_ACCESS.Access == SYSTEM_PASSWORD_USER;
+ suppressif ideqval SETUP_DATA.IccDisplayProfile == 0;
+ numeric varid = SETUP_DATA.IccSelectedProfile,
+ prompt = STRING_TOKEN(STR_ICC_PROFILE),
+ help = STRING_TOKEN(STR_ICC_PROFILE_HELP),
+ flags = RESET_REQUIRED,
+ minimum = 0,
+ maximum = 7,
+ step = 1,
+ default = 0,
+ endnumeric;
+ SUPPRESS_GRAYOUT_ENDIF
+
+ SEPARATOR
+
+ SUBTITLE(STRING_TOKEN(STR_ICC_OVERCLOCKING))
+
+ SEPARATOR
+
+ text
+ help = STRING_TOKEN(STR_EMPTY),
+ text = STRING_TOKEN(STR_ICC_LIB_VERSION),
+ text = STRING_TOKEN(STR_ICC_LIB_VERSION_NR),
+ flags = 0, key = AUTO_ID(KEY_ACCEPT);
+
+ suppressif ideqval ICC_VOLATILE_SETUP_DATA.AllowAdvancedOptions == 0;
+
+ goto ICC_ADVFORM_ID1,
+ prompt = STRING_TOKEN(STR_ICC_SUBFORM1),
+ help = STRING_TOKEN(STR_ICC_FORM_HELP),
+ flags = INTERACTIVE,
+ key = AUTO_ID(KEY_FORM1);
+
+ goto ICC_ADVFORM_ID2,
+ prompt = STRING_TOKEN(STR_ICC_SUBFORM2),
+ help = STRING_TOKEN(STR_ICC_FORM_HELP),
+ flags = INTERACTIVE,
+ key = AUTO_ID(KEY_FORM2);
+
+ goto ICC_ADVFORM_ID3,
+ prompt = STRING_TOKEN(STR_ICC_SUBFORM3),
+ help = STRING_TOKEN(STR_ICC_FORM_HELP),
+ flags = INTERACTIVE,
+ key = AUTO_ID(KEY_FORM3);
+
+ goto ICC_ADVFORM_ID4,
+ prompt = STRING_TOKEN(STR_ICC_SUBFORM4),
+ help = STRING_TOKEN(STR_ICC_FORM_HELP),
+ flags = INTERACTIVE,
+ key = AUTO_ID(KEY_FORM4);
+
+ goto ICC_ADVFORM_ID5,
+ prompt = STRING_TOKEN(STR_ICC_SUBFORM5),
+ help = STRING_TOKEN(STR_ICC_FORM_HELP),
+ flags = INTERACTIVE,
+ key = AUTO_ID(KEY_FORM5);
+
+ goto ICC_ADVFORM_ID6,
+ prompt = STRING_TOKEN(STR_ICC_SUBFORM6),
+ help = STRING_TOKEN(STR_ICC_FORM_HELP),
+ flags = INTERACTIVE,
+ key = AUTO_ID(KEY_FORM6);
+
+ goto ICC_ADVFORM_ID7,
+ prompt = STRING_TOKEN(STR_ICC_SUBFORM7),
+ help = STRING_TOKEN(STR_ICC_FORM_HELP),
+ flags = INTERACTIVE,
+ key = AUTO_ID(KEY_FORM7);
+
+ goto ICC_ADVFORM_ID8,
+ prompt = STRING_TOKEN(STR_ICC_SUBFORM8),
+ help = STRING_TOKEN(STR_ICC_FORM_HELP),
+ flags = INTERACTIVE,
+ key = AUTO_ID(KEY_FORM8);
+ endif;
+
+ endform;
+
+#define INSIDE_ICC_SUBMENU
+
+#define CLOCK_NUMBER OFFSET_0
+#ifdef SETUP_DATA_DEFINITION
+AUTO_ID(KEY_FREQ1)
+AUTO_ID(KEY_CHANGE_NOW1)
+AUTO_ID(KEY_CHANGE_ONCE1)
+AUTO_ID(KEY_CHANGE_PERM1)
+#endif
+#define KEY_FREQ KEY_FREQ1
+#define MENU_NUMBER ICC_ADVFORM_ID1
+#define KEY_CHANGE_NOW KEY_CHANGE_NOW1
+#define KEY_CHANGE_ONCE KEY_CHANGE_ONCE1
+#define KEY_CHANGE_PERM KEY_CHANGE_PERM1
+form formid = AUTO_ID(ICC_ADVFORM_ID1),
+#include "IccSetupSubmenu.sd"
+#undef MENU_NUMBER
+#undef KEY_CHANGE_NOW
+#undef KEY_CHANGE_ONCE
+#undef KEY_CHANGE_PERM
+#undef CLOCK_NUMBER
+
+#define CLOCK_NUMBER OFFSET_1
+#ifdef SETUP_DATA_DEFINITION
+AUTO_ID(KEY_FREQ2)
+AUTO_ID(KEY_CHANGE_NOW2)
+AUTO_ID(KEY_CHANGE_ONCE2)
+AUTO_ID(KEY_CHANGE_PERM2)
+#endif
+#undef KEY_FREQ
+#define KEY_FREQ KEY_FREQ2
+#define MENU_NUMBER ICC_ADVFORM_ID2
+#define KEY_CHANGE_NOW KEY_CHANGE_NOW2
+#define KEY_CHANGE_ONCE KEY_CHANGE_ONCE2
+#define KEY_CHANGE_PERM KEY_CHANGE_PERM2
+form formid = AUTO_ID(ICC_ADVFORM_ID2),
+#include "IccSetupSubmenu.sd"
+#undef MENU_NUMBER
+#undef KEY_CHANGE_NOW
+#undef KEY_CHANGE_ONCE
+#undef KEY_CHANGE_PERM
+#undef CLOCK_NUMBER
+
+#define CLOCK_NUMBER OFFSET_2
+#ifdef SETUP_DATA_DEFINITION
+AUTO_ID(KEY_FREQ3)
+AUTO_ID(KEY_CHANGE_NOW3)
+AUTO_ID(KEY_CHANGE_ONCE3)
+AUTO_ID(KEY_CHANGE_PERM3)
+#endif
+#undef KEY_FREQ
+#define KEY_FREQ KEY_FREQ3
+#define KEY_CHANGE_NOW KEY_CHANGE_NOW3
+#define KEY_CHANGE_ONCE KEY_CHANGE_ONCE3
+#define KEY_CHANGE_PERM KEY_CHANGE_PERM3
+#define MENU_NUMBER ICC_ADVFORM_ID3
+form formid = AUTO_ID(ICC_ADVFORM_ID3),
+#include "IccSetupSubmenu.sd"
+#undef MENU_NUMBER
+#undef KEY_CHANGE_NOW
+#undef KEY_CHANGE_ONCE
+#undef KEY_CHANGE_PERM
+#undef CLOCK_NUMBER
+
+#define CLOCK_NUMBER OFFSET_3
+#ifdef SETUP_DATA_DEFINITION
+AUTO_ID(KEY_FREQ4)
+AUTO_ID(KEY_CHANGE_NOW4)
+AUTO_ID(KEY_CHANGE_ONCE4)
+AUTO_ID(KEY_CHANGE_PERM4)
+#endif
+#undef KEY_FREQ
+#define KEY_FREQ KEY_FREQ4
+#define KEY_CHANGE_NOW KEY_CHANGE_NOW4
+#define KEY_CHANGE_ONCE KEY_CHANGE_ONCE4
+#define KEY_CHANGE_PERM KEY_CHANGE_PERM4
+#define MENU_NUMBER ICC_ADVFORM_ID4
+form formid = AUTO_ID(ICC_ADVFORM_ID4),
+#include "IccSetupSubmenu.sd"
+#undef MENU_NUMBER
+#undef KEY_CHANGE_NOW
+#undef KEY_CHANGE_ONCE
+#undef KEY_CHANGE_PERM
+#undef CLOCK_NUMBER
+
+#define CLOCK_NUMBER OFFSET_4
+#ifdef SETUP_DATA_DEFINITION
+AUTO_ID(KEY_FREQ5)
+AUTO_ID(KEY_CHANGE_NOW5)
+AUTO_ID(KEY_CHANGE_ONCE5)
+AUTO_ID(KEY_CHANGE_PERM5)
+#endif
+#undef KEY_FREQ
+#define KEY_FREQ KEY_FREQ5
+#define KEY_CHANGE_NOW KEY_CHANGE_NOW5
+#define KEY_CHANGE_ONCE KEY_CHANGE_ONCE5
+#define KEY_CHANGE_PERM KEY_CHANGE_PERM5
+#define MENU_NUMBER ICC_ADVFORM_ID5
+form formid = AUTO_ID(ICC_ADVFORM_ID5),
+#include "IccSetupSubmenu.sd"
+#undef MENU_NUMBER
+#undef KEY_CHANGE_NOW
+#undef KEY_CHANGE_ONCE
+#undef KEY_CHANGE_PERM
+#undef CLOCK_NUMBER
+
+#define CLOCK_NUMBER OFFSET_5
+#ifdef SETUP_DATA_DEFINITION
+AUTO_ID(KEY_FREQ6)
+AUTO_ID(KEY_CHANGE_NOW6)
+AUTO_ID(KEY_CHANGE_ONCE6)
+AUTO_ID(KEY_CHANGE_PERM6)
+#endif
+#undef KEY_FREQ
+#define KEY_FREQ KEY_FREQ6
+#define KEY_CHANGE_NOW KEY_CHANGE_NOW6
+#define KEY_CHANGE_ONCE KEY_CHANGE_ONCE6
+#define KEY_CHANGE_PERM KEY_CHANGE_PERM6
+#define MENU_NUMBER ICC_ADVFORM_ID6
+form formid = AUTO_ID(ICC_ADVFORM_ID6),
+#include "IccSetupSubmenu.sd"
+#undef MENU_NUMBER
+#undef KEY_CHANGE_NOW
+#undef KEY_CHANGE_ONCE
+#undef KEY_CHANGE_PERM
+#undef CLOCK_NUMBER
+
+#define CLOCK_NUMBER OFFSET_6
+#ifdef SETUP_DATA_DEFINITION
+AUTO_ID(KEY_FREQ7)
+AUTO_ID(KEY_CHANGE_NOW7)
+AUTO_ID(KEY_CHANGE_ONCE7)
+AUTO_ID(KEY_CHANGE_PERM7)
+#endif
+#undef KEY_FREQ
+#define KEY_FREQ KEY_FREQ7
+#define KEY_CHANGE_NOW KEY_CHANGE_NOW7
+#define KEY_CHANGE_ONCE KEY_CHANGE_ONCE7
+#define KEY_CHANGE_PERM KEY_CHANGE_PERM7
+#define MENU_NUMBER ICC_ADVFORM_ID7
+form formid = AUTO_ID(ICC_ADVFORM_ID7),
+#include "IccSetupSubmenu.sd"
+#undef MENU_NUMBER
+#undef KEY_CHANGE_NOW
+#undef KEY_CHANGE_ONCE
+#undef KEY_CHANGE_PERM
+#undef CLOCK_NUMBER
+
+#define CLOCK_NUMBER OFFSET_7
+#ifdef SETUP_DATA_DEFINITION
+AUTO_ID(KEY_FREQ8)
+AUTO_ID(KEY_CHANGE_NOW8)
+AUTO_ID(KEY_CHANGE_ONCE8)
+AUTO_ID(KEY_CHANGE_PERM8)
+#endif
+#undef KEY_FREQ
+#define KEY_FREQ KEY_FREQ8
+#define KEY_CHANGE_NOW KEY_CHANGE_NOW8
+#define KEY_CHANGE_ONCE KEY_CHANGE_ONCE8
+#define KEY_CHANGE_PERM KEY_CHANGE_PERM8
+#define MENU_NUMBER ICC_ADVFORM_ID8
+form formid = AUTO_ID(ICC_ADVFORM_ID8),
+#include "IccSetupSubmenu.sd"
+#undef MENU_NUMBER
+#undef KEY_CHANGE_NOW
+#undef KEY_CHANGE_ONCE
+#undef KEY_CHANGE_PERM
+#undef CLOCK_NUMBER
+
+#undef INSIDE_ICC_SUBMENU
+
+ #endif // ICC_FORM_SETUP
+
+#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/Icc/IccSetup/IccSetupSubmenu.sd b/Board/EM/MeWrapper/Icc/IccSetup/IccSetupSubmenu.sd
new file mode 100644
index 0000000..0ebcfab
--- /dev/null
+++ b/Board/EM/MeWrapper/Icc/IccSetup/IccSetupSubmenu.sd
@@ -0,0 +1,239 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/Icc/IccSetup/IccSetupSubmenu.sd 3 11/20/12 3:09a Klzhan $
+//
+// $Revision: 3 $
+//
+// $Date: 11/20/12 3:09a $
+//
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/Icc/IccSetup/IccSetupSubmenu.sd $
+//
+// 3 11/20/12 3:09a Klzhan
+// [TAG] EIPNone
+// [Category] Improvement
+// [Description] AMI CSP Intel BIOS Setup Unify Rule.
+//
+// 2 10/30/12 8:37a Klzhan
+// Support DMI Ratio for new ICC.
+//
+// 1 2/08/12 1:07a Klzhan
+// Initial Check in
+//
+// 2 9/06/11 6:11a Klzhan
+// [TAG] EIP67462
+// [Category] Spec Update
+// [Severity] Important
+// [Description] Update ICC 08.00.00.022.1
+// [Files] IccSetup.mak
+// IccSetup.sdl
+// IccCallbacks.c
+// IccCallbacks.h
+// IccSetup.h
+// IccSetupMenu.sd
+// IccSetupSubmenu.sd
+// IccStrings.uni
+// IccLoadDefault.c
+// IccSetup.cif
+//
+// 1 2/25/11 1:42a Klzhan
+// Initial Check-in
+//
+// 1 12/03/10 5:10a Klzhan
+// Initial Check-in.
+//
+//
+//**********************************************************************
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: IccSetup.sd
+//
+// Description: SD file for ICC Setup
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+/*++
+
+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:
+
+ IccSetupSubmenu.sd
+
+Abstract:
+
+ Icc's overclocking submenu layout
+
+--*/
+
+//This file should be included multiple times into IccSetupMenu.sd
+
+#ifdef INSIDE_ICC_SUBMENU
+
+title = STRING_TOKEN(STR_EMPTY);
+
+ text
+ help = STRING_TOKEN(STR_EMPTY),
+ text = STRING_TOKEN(STR_ICC_CLOCK_NUMBER),
+ text = STRING_TOKEN(STR_EMPTY),
+ flags = 0, key = 0;
+
+ text
+ help = STRING_TOKEN(STR_EMPTY),
+ text = STRING_TOKEN(STR_ICC_CLOCK_USAGE_1),
+ text = STRING_TOKEN(STR_EMPTY),
+ flags = 0, key = 0;
+
+ text
+ help = STRING_TOKEN(STR_EMPTY),
+ text = STRING_TOKEN(STR_ICC_CLOCK_USAGE_2),
+ text = STRING_TOKEN(STR_EMPTY),
+ flags = 0, key = 0;
+
+ SEPARATOR
+
+ text
+ help = STRING_TOKEN(STR_EMPTY),
+ text = STRING_TOKEN(STR_ICC_MAX_FREQUENCY),
+ text = STRING_TOKEN(STR_ICC_MAX_FREQUENCY_VALUE),
+ flags = 0, key = 0;
+
+ text
+ help = STRING_TOKEN(STR_EMPTY),
+ text = STRING_TOKEN(STR_ICC_MIN_FREQUENCY),
+ text = STRING_TOKEN(STR_ICC_MIN_FREQUENCY_VALUE),
+ flags = 0, key = 0;
+
+ text
+ help = STRING_TOKEN(STR_EMPTY),
+ text = STRING_TOKEN(STR_ICC_CURRENT_FREQUENCY),
+ text = STRING_TOKEN(STR_ICC_CURRENT_FREQUENCY_VALUE),
+ flags = 0, key = 0;
+
+ suppressif ideqval ICC_VOLATILE_SETUP_DATA.ShowClock[CLOCK_NUMBER] == 0;
+ grayoutif ideqval SYSTEM_ACCESS.Access == SYSTEM_PASSWORD_USER;
+ numeric varid = ICC_VOLATILE_SETUP_DATA.Frequency[CLOCK_NUMBER],
+ prompt = STRING_TOKEN(STR_ICC_NEW_FREQUENCY),
+ help = STRING_TOKEN(STR_ICC_NEW_FREQUENCY_HELP),
+ flags = INTERACTIVE,
+ key = KEY_FREQ,
+ minimum = 0,
+ maximum = 65535,
+ step = 1,
+ default = 0,
+ endnumeric;
+ SUPPRESS_GRAYOUT_ENDIF
+
+ grayoutif ideqval SYSTEM_ACCESS.Access == SYSTEM_PASSWORD_USER;
+ suppressif ideqval ICC_VOLATILE_SETUP_DATA.ShowSsc[CLOCK_NUMBER] == 0;
+ text
+ help = STRING_TOKEN(STR_EMPTY),
+ text = STRING_TOKEN(STR_ICC_SSC_MODES),
+ text = STRING_TOKEN(STR_ICC_SSC_MODES_VALUE),
+ flags = 0, key = 0;
+ SUPPRESS_GRAYOUT_ENDIF
+
+ text
+ help = STRING_TOKEN(STR_EMPTY),
+ text = STRING_TOKEN(STR_ICC_SSC_CURRENT_MODE),
+ text = STRING_TOKEN(STR_ICC_SSC_CURRENT_MODE_VALUE),
+ flags = 0, key = 0;
+
+ grayoutif ideqval SYSTEM_ACCESS.Access == SYSTEM_PASSWORD_USER;
+ suppressif ideqval ICC_VOLATILE_SETUP_DATA.ShowSsc[CLOCK_NUMBER] == 0;
+ oneof varid = ICC_VOLATILE_SETUP_DATA.SscMode[CLOCK_NUMBER],
+ prompt = STRING_TOKEN(STR_ICC_SSC_MODE_SELECTION),
+ help = STRING_TOKEN(STR_ICC_SSC_MODE_SELECTION_HELP),
+ option text = STRING_TOKEN(STR_ICC_MODE_DOWN), value = 0, flags = DEFAULT;
+ option text = STRING_TOKEN(STR_ICC_MODE_CENTRE), value = 1, flags = 0;
+ option text = STRING_TOKEN(STR_ICC_MODE_UP), value = 2, flags = 0;
+ endoneof;
+ SUPPRESS_GRAYOUT_ENDIF
+
+ grayoutif ideqval SYSTEM_ACCESS.Access == SYSTEM_PASSWORD_USER;
+ suppressif ideqval ICC_VOLATILE_SETUP_DATA.ShowSsc[CLOCK_NUMBER] == 0;
+ text
+ help = STRING_TOKEN(STR_EMPTY),
+ text = STRING_TOKEN(STR_ICC_SSC_MAX),
+ text = STRING_TOKEN(STR_ICC_SSC_MAX_VALUE),
+ flags = 0, key = 0;
+ SUPPRESS_GRAYOUT_ENDIF
+
+ text
+ help = STRING_TOKEN(STR_EMPTY),
+ text = STRING_TOKEN(STR_ICC_SSC_CURRENT),
+ text = STRING_TOKEN(STR_ICC_SSC_CURRENT_VALUE),
+ flags = 0, key = 0;
+
+ grayoutif ideqval SYSTEM_ACCESS.Access == SYSTEM_PASSWORD_USER;
+ suppressif ideqval ICC_VOLATILE_SETUP_DATA.ShowSsc[CLOCK_NUMBER] == 0;
+ numeric varid = ICC_VOLATILE_SETUP_DATA.SscPercent[CLOCK_NUMBER],
+ prompt = STRING_TOKEN(STR_ICC_SSC_NEW_PERCENT),
+ help = STRING_TOKEN(STR_ICC_SSC_NEW_PERCENT_HELP),
+ flags = 0,
+ key = 0,
+ minimum = 0,
+ maximum = 999,
+ step = 1,
+ default = 0,
+ endnumeric;
+ SUPPRESS_GRAYOUT_ENDIF
+
+ grayoutif ideqval SYSTEM_ACCESS.Access == SYSTEM_PASSWORD_USER;
+ suppressif ideqval ICC_VOLATILE_SETUP_DATA.ShowDmiPegRatio[CLOCK_NUMBER] == 0;
+ oneof varid = ICC_VOLATILE_SETUP_DATA.DmiPegRatio[CLOCK_NUMBER],
+ prompt = STRING_TOKEN(STR_DMI_PEG_RATIO),
+ help = STRING_TOKEN(STR_DMI_PEG_RATIO_HELP),
+ option text = STRING_TOKEN(STR_DMI_PEG_RATIO_55), value = 0, flags = DEFAULT;
+ option text = STRING_TOKEN(STR_DMI_PEG_RATIO_54), value = 1, flags = 0;
+ option text = STRING_TOKEN(STR_DMI_PEG_RATIO_53), value = 2, flags = 0;
+ option text = STRING_TOKEN(STR_DMI_PEG_RATIO_52), value = 3, flags = 0;
+ endoneof;
+ SUPPRESS_GRAYOUT_ENDIF
+
+ grayoutif ideqval SYSTEM_ACCESS.Access == SYSTEM_PASSWORD_USER;
+ suppressif ideqval ICC_VOLATILE_SETUP_DATA.ShowSsc[CLOCK_NUMBER] == 0 AND ideqval ICC_VOLATILE_SETUP_DATA.ShowClock[CLOCK_NUMBER] == 0;
+ goto MENU_NUMBER,prompt=STRING_TOKEN(STR_ICC_IMMEDIATE_CHANGES),help=STRING_TOKEN(STR_ICC_IMMEDIATE_CHANGES_HELP),flags=INTERACTIVE,key=KEY_CHANGE_NOW;
+ goto MENU_NUMBER,prompt=STRING_TOKEN(STR_ICC_PERMANENT_CHANGES),help=STRING_TOKEN(STR_ICC_PERMANENT_CHANGES_HELP),flags=INTERACTIVE,key=KEY_CHANGE_PERM;
+ SUPPRESS_GRAYOUT_ENDIF
+
+ endform;
+
+#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/Icc/IccSetup/IccStrings.uni b/Board/EM/MeWrapper/Icc/IccSetup/IccStrings.uni
new file mode 100644
index 0000000..29f0557
--- /dev/null
+++ b/Board/EM/MeWrapper/Icc/IccSetup/IccStrings.uni
Binary files differ
diff --git a/Board/EM/MeWrapper/Icc/OverClocking/IccOverClocking.cif b/Board/EM/MeWrapper/Icc/OverClocking/IccOverClocking.cif
new file mode 100644
index 0000000..b548eaf
--- /dev/null
+++ b/Board/EM/MeWrapper/Icc/OverClocking/IccOverClocking.cif
@@ -0,0 +1,14 @@
+<component>
+ name = "IccOverClocking"
+ category = ModulePart
+ LocalRoot = "Board\EM\MeWrapper\Icc\OverClocking\"
+ RefName = "IccOverClocking"
+[files]
+"IccOverClocking.sdl"
+"IccOverClocking.dxs"
+"IccOverClocking.mak"
+"IccOverClocking.efi"
+"IccOverClocking9_5.dxs"
+"IccOverClocking9_5.efi"
+"IccProtocol.h"
+<endComponent>
diff --git a/Board/EM/MeWrapper/Icc/OverClocking/IccOverClocking.dxs b/Board/EM/MeWrapper/Icc/OverClocking/IccOverClocking.dxs
new file mode 100644
index 0000000..06ebd96
--- /dev/null
+++ b/Board/EM/MeWrapper/Icc/OverClocking/IccOverClocking.dxs
@@ -0,0 +1,109 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/Icc/IccOverClocking/IccOverClocking.dxs 2 12/04/12 4:39a Klzhan $
+//
+// $Revision: 2 $
+//
+// $Date: 12/04/12 4:39a $
+//
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/Icc/IccOverClocking/IccOverClocking.dxs $
+//
+// 2 12/04/12 4:39a Klzhan
+// [TAG] EIP107309
+// [Category] New Feature
+// [Description] Support ICC library for ME 9.5
+// [Files] IccOverClocking.sdl
+// IccOverClocking.dxs
+// IccOverClocking.mak
+// IccOverClocking.efi
+// IccOverClocking.cif
+//
+// 1 2/08/12 1:07a Klzhan
+// Initial Check in
+//
+// 1 2/25/11 1:42a Klzhan
+// Initial Check-in
+//
+// 1 12/03/10 5:10a Klzhan
+// Initial Check-in.
+//
+//
+//**********************************************************************
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: IccOverClocking.dxs
+//
+// Description: Icc control library.
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+/*++
+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:
+
+ IccOverClocking.dxs
+
+Abstract:
+
+ Icc control library
+
+--*/
+
+#include "AutoGen.h"
+#include "DxeDepex.h"
+#if defined (BUILD_WITH_GLUELIB) || defined (BUILD_WITH_EDKII_GLUE_LIB)
+#include "EfiDepex.h"
+#endif
+
+#include EFI_PROTOCOL_DEFINITION (Heci)
+#ifdef CougarPoint_SUPPORT
+#include EFI_PROTOCOL_DEFINITION (Wdt)
+#endif
+#include "IccProtocol.h"
+DEPENDENCY_START
+#ifdef CougarPoint_SUPPORT
+ WDT_PROTOCOL_GUID AND
+#endif
+ EFI_HECI_PROTOCOL_GUID
+ AND
+ ICC_9_0_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/Icc/OverClocking/IccOverClocking.efi b/Board/EM/MeWrapper/Icc/OverClocking/IccOverClocking.efi
new file mode 100644
index 0000000..237ad24
--- /dev/null
+++ b/Board/EM/MeWrapper/Icc/OverClocking/IccOverClocking.efi
Binary files differ
diff --git a/Board/EM/MeWrapper/Icc/OverClocking/IccOverClocking.mak b/Board/EM/MeWrapper/Icc/OverClocking/IccOverClocking.mak
new file mode 100644
index 0000000..732fa52
--- /dev/null
+++ b/Board/EM/MeWrapper/Icc/OverClocking/IccOverClocking.mak
@@ -0,0 +1,111 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2010, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
+#**********************************************************************
+#
+# $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/Icc/IccOverClocking/IccOverClocking.mak 2 1/18/13 12:31a Klzhan $
+#
+# $Revision: 2 $
+#
+# $Date: 1/18/13 12:31a $
+#
+#**********************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/Icc/IccOverClocking/IccOverClocking.mak $
+#
+# 2 1/18/13 12:31a Klzhan
+# [TAG] EIPNone
+# [Category] Bug Fix
+# [Symptom] ICC library not loaded when ME 9.5
+# [Files] IccOverClocking.sdl
+# IccOverClocking.dxs
+# IccOverClocking.mak
+# IccOverClocking.efi
+# IccOverClocking9_5.dxs
+# IccOverClocking9_5.efi
+# IccProtocol.h
+# IccOverClocking.cif
+#
+# 1 2/08/12 1:07a Klzhan
+# Initial Check in
+#
+# 2 9/26/11 6:21a Klzhan
+# Fix build error with New EDK
+#
+# 1 2/25/11 1:42a Klzhan
+# Initial Check-in
+#
+# 2 12/03/10 5:37a Klzhan
+# Fix Build Error.
+#
+# 1 12/03/10 5:10a Klzhan
+# Initial Check-in.
+#
+#
+#**********************************************************************
+#
+#<AMI_FHDR_START>
+#----------------------------------------------------------------------------
+#
+# Name: IccOverClocking.mak
+#
+# Description: Setup hooks for ICC.
+#
+#----------------------------------------------------------------------------
+#<AMI_FHDR_END>
+all : $(BUILD_DIR)\IccOverClocking.ffs $(BUILD_DIR)\IccOverClocking9_5.ffs
+
+IccOverClocking_INCLUDES=\
+ $(INTEL_PCH_INCLUDES)\
+ $(EDK_INCLUDES)\
+ $(EdkIIGlueLib_INCLUDES)\
+ $(ME_INCLUDES)\
+ $(ICC_INCLUDES)\
+
+$(BUILD_DIR)\IccOverClocking.ffs : $(IccOverClocking_DIR)\$(@B).efi $(IccOverClocking_DIR)\$(@B).mak Core\FFS.mak
+ $(MAKE) /$(MAKEFLAGS) /f Core\FFS.mak \
+ CPFLAGS="$(GLOBAL_DEFINES) /D TIANO_RELEASE_VERSION=0x00080006 $(EXTRA_DEFINES) $(IccOverClocking_INCLUDES)" \
+ BUILD_DIR=$(BUILD_DIR) SOURCE_DIR=$(IccOverClocking_DIR) \
+ GUID=5BBA83E5-F027-4ca7-BFD0-16358CC9E123\
+ NAME=$(@B)\
+ TYPE=EFI_FV_FILETYPE_DRIVER \
+ DEPEX1=$(IccOverClocking_DIR)\IccOverClocking.dxs\
+ DEPEX1_TYPE=EFI_SECTION_DXE_DEPEX \
+ PEFILE=$(IccOverClocking_DIR)\$(@B).efi FFSFILE=$@ COMPRESS=1 \
+
+
+$(BUILD_DIR)\IccOverClocking9_5.ffs : $(IccOverClocking_DIR)\IccOverClocking9_5.efi $(IccOverClocking_DIR)\IccOverClocking.mak Core\FFS.mak
+ $(MAKE) /$(MAKEFLAGS) /f Core\FFS.mak \
+ CPFLAGS="$(GLOBAL_DEFINES) /D TIANO_RELEASE_VERSION=0x00080006 $(EXTRA_DEFINES) $(IccOverClocking_INCLUDES)" \
+ BUILD_DIR=$(BUILD_DIR) SOURCE_DIR=$(IccOverClocking_DIR) \
+ GUID=8e68e3c5-fc59-4280-8467-3800d31a8162\
+ NAME=$(@B)\
+ TYPE=EFI_FV_FILETYPE_DRIVER \
+ DEPEX1=$(IccOverClocking_DIR)\IccOverClocking9_5.dxs\
+ DEPEX1_TYPE=EFI_SECTION_DXE_DEPEX \
+ PEFILE=$(IccOverClocking_DIR)\$(@B).efi FFSFILE=$@ COMPRESS=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/Icc/OverClocking/IccOverClocking.sdl b/Board/EM/MeWrapper/Icc/OverClocking/IccOverClocking.sdl
new file mode 100644
index 0000000..782cb57
--- /dev/null
+++ b/Board/EM/MeWrapper/Icc/OverClocking/IccOverClocking.sdl
@@ -0,0 +1,32 @@
+TOKEN
+ Name = "IccOverClocking_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ TargetH = Yes
+ Master = Yes
+ Help = "Main switch to enable IccOverClocking support in Project"
+End
+
+MODULE
+ Help = "Includes IccOverClocking.mak to Project"
+ File = "IccOverClocking.mak"
+End
+
+PATH
+ Name = "IccOverClocking_DIR"
+ Help = "Icc Support commands"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\IccOverClocking.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\IccOverClocking9_5.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End \ No newline at end of file
diff --git a/Board/EM/MeWrapper/Icc/OverClocking/IccOverClocking9_5.dxs b/Board/EM/MeWrapper/Icc/OverClocking/IccOverClocking9_5.dxs
new file mode 100644
index 0000000..be16aac
--- /dev/null
+++ b/Board/EM/MeWrapper/Icc/OverClocking/IccOverClocking9_5.dxs
@@ -0,0 +1,101 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/Icc/IccOverClocking/IccOverClocking9_5.dxs 1 12/04/12 4:42a Klzhan $
+//
+// $Revision: 1 $
+//
+// $Date: 12/04/12 4:42a $
+//
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/Icc/IccOverClocking/IccOverClocking9_5.dxs $
+//
+// 1 12/04/12 4:42a Klzhan
+// [TAG] EIP107309
+// [Category] New Feature
+// [Description] Support ICC library for ME 9.5
+//
+// 1 2/25/11 1:42a Klzhan
+// Initial Check-in
+//
+// 1 12/03/10 5:10a Klzhan
+// Initial Check-in.
+//
+//
+//**********************************************************************
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: IccOverClocking.dxs
+//
+// Description: Icc control library.
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+/*++
+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:
+
+ IccOverClocking.dxs
+
+Abstract:
+
+ Icc control library
+
+--*/
+
+#include "AutoGen.h"
+#include "DxeDepex.h"
+#if defined (BUILD_WITH_GLUELIB) || defined (BUILD_WITH_EDKII_GLUE_LIB)
+#include "EfiDepex.h"
+#endif
+
+#include EFI_PROTOCOL_DEFINITION (Heci)
+#ifdef CougarPoint_SUPPORT
+#include EFI_PROTOCOL_DEFINITION (Wdt)
+#endif
+#include "IccProtocol.h"
+DEPENDENCY_START
+#ifdef CougarPoint_SUPPORT
+ WDT_PROTOCOL_GUID AND
+#endif
+ EFI_HECI_PROTOCOL_GUID
+ AND
+ ICC_9_5_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/Icc/OverClocking/IccOverClocking9_5.efi b/Board/EM/MeWrapper/Icc/OverClocking/IccOverClocking9_5.efi
new file mode 100644
index 0000000..43dd6e3
--- /dev/null
+++ b/Board/EM/MeWrapper/Icc/OverClocking/IccOverClocking9_5.efi
Binary files differ
diff --git a/Board/EM/MeWrapper/Icc/OverClocking/IccProtocol.h b/Board/EM/MeWrapper/Icc/OverClocking/IccProtocol.h
new file mode 100644
index 0000000..4d4f106
--- /dev/null
+++ b/Board/EM/MeWrapper/Icc/OverClocking/IccProtocol.h
@@ -0,0 +1,67 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/Icc/IccOverClocking/IccProtocol.h 1 12/04/12 4:46a Klzhan $
+//
+// $Revision: 1 $
+//
+// $Date: 12/04/12 4:46a $
+//
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/Icc/IccOverClocking/IccProtocol.h $
+//
+// 1 12/04/12 4:46a Klzhan
+// [TAG] EIP107309
+// [Category] New Feature
+// [Description] Support ICC library for ME 9.5
+//
+//
+//**********************************************************************
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: IccProtocol.h
+//
+// Description: Protocol GUID define.
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+
+#ifndef _ICC_PROTOCOL_H_
+#define _ICC_PROTOCOL_H_
+
+#define ICC_9_0_GUID \
+ {0xAE4BD7F4, 0xB58F, 0x4D12, 0xBC, 0xC4, 0x98, 0x4, 0xD7, 0x55, 0xCF, 0x42}
+
+#define ICC_9_5_GUID \
+ {0x33DDC8EC, 0x20D2, 0x45C6, 0x9C, 0xB0, 0x5D, 0x7A, 0xC6, 0xCA, 0x10, 0x8C}
+
+#endif
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/Icc/Protocol/IccOverClocking/IccOverClocking.c b/Board/EM/MeWrapper/Icc/Protocol/IccOverClocking/IccOverClocking.c
new file mode 100644
index 0000000..e26e236
--- /dev/null
+++ b/Board/EM/MeWrapper/Icc/Protocol/IccOverClocking/IccOverClocking.c
@@ -0,0 +1,98 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/Icc/IccProtocolLib/IccOverClocking/IccOverClocking.c 1 2/08/12 1:05a Klzhan $
+//
+// $Revision: 1 $
+//
+// $Date: 2/08/12 1:05a $
+//
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/Icc/IccProtocolLib/IccOverClocking/IccOverClocking.c $
+//
+// 1 2/08/12 1:05a Klzhan
+// Initial Check in
+//
+// 1 2/25/11 1:42a Klzhan
+// Initial Check-in
+//
+// 1 12/03/10 5:10a Klzhan
+// Initial Check-in.
+//
+//
+//**********************************************************************
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: IccOverClocking.c
+//
+// Description: ICC OverClocking protocol
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+/*++
+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:
+
+ IccOverClocking.c
+
+Abstract:
+
+ ICC OverClocking protocol
+
+--*/
+
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+
+#include "EdkIIGlueDxe.h"
+#endif
+
+#include "IccOverClocking.h"
+
+//
+// Protocol GUID definition
+//
+EFI_GUID gIccOverClockingProtocolGuid = ICC_OVERCLOCKING_PROTOCOL_GUID;
+
+//
+// Protocol description
+//
+EFI_GUID_STRING
+ (&gIccOverClockingProtocolGuid, "ICC OverClocking Protocol", "Integrated Clock Control OverClocking Protocol");
+
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/Icc/Protocol/IccOverClocking/IccOverClocking.h b/Board/EM/MeWrapper/Icc/Protocol/IccOverClocking/IccOverClocking.h
new file mode 100644
index 0000000..8dc0baa
--- /dev/null
+++ b/Board/EM/MeWrapper/Icc/Protocol/IccOverClocking/IccOverClocking.h
@@ -0,0 +1,278 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/Icc/IccProtocolLib/IccOverClocking/IccOverClocking.h 3 5/14/12 4:45a Klzhan $
+//
+// $Revision: 3 $
+//
+// $Date: 5/14/12 4:45a $
+//
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/Icc/IccProtocolLib/IccOverClocking/IccOverClocking.h $
+//
+// 3 5/14/12 4:45a Klzhan
+// [TAG] EIP89676
+// [Category] Spec Update
+// [Severity] Important
+// [Description] Update ICC library
+//
+// 2 5/11/12 3:37a Klzhan
+// [TAG] EIP89676
+// [Category] Spec Update
+// [Severity] Important
+// [Description] Update New ICC library 9.0.0.5
+//
+// 1 2/08/12 1:05a Klzhan
+// Initial Check in
+//
+// 3 9/06/11 6:09a Klzhan
+// [TAG] EIP67462
+// [Category] Spec Update
+// [Severity] Important
+// [Description] Update ICC 08.00.00.022.1
+//
+// 2 6/23/11 11:29p Klzhan
+// [TAG] EIP62129
+// [Category] Spec Update
+// [Severity] Important
+// [Description] Update ICC control Library to 8.0.0.19.
+// [Files] IccOverClocking.efi, IccOverClocking.h
+//
+// 1 2/25/11 1:42a Klzhan
+// Initial Check-in
+//
+// 1 12/03/10 5:10a Klzhan
+// Initial Check-in.
+//
+//
+//**********************************************************************
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: IccOverClocking.h
+//
+// Description: ICC OverClocking protocol
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+/*++
+
+ Any software source code reprinted in this document is furnished under
+ a software license and may only be used or copied in accordance with
+ the terms of that license.
+
+
+ Copyright 2010-2011, Intel Corporation. All rights reserved.
+
+--*/
+
+#ifndef _ICC_OVERCLOCKING_H_
+#define _ICC_OVERCLOCKING_H_
+
+/* Types used by ICC LIB */
+
+typedef enum _ICC_LIB_STATUS
+{
+ ICC_LIB_STATUS_SUCCESS, // 0
+ ICC_LIB_STATUS_INVALID_PARAMS, // 1
+ ICC_LIB_STATUS_INVALID_CLOCK_NUMBER, // 2
+ ICC_LIB_STATUS_CLOCK_NOT_FOUND, // 3
+ ICC_LIB_STATUS_INVALID_FREQ_VALUE, // 4
+ ICC_LIB_STATUS_FREQ_TOO_LOW, // 5
+ ICC_LIB_STATUS_FREQ_TOO_HIGH, // 6
+ ICC_LIB_STATUS_FREQ_MUST_HAVE_ZERO_SSC, // 7
+ ICC_LIB_STATUS_SSC_CHANGE_NOT_ALLOWED, // 8
+ ICC_LIB_STATUS_INVALID_SSC_MODE, // 9
+ ICC_LIB_STATUS_SSC_MODE_NOT_SUPPORTED, // a
+ ICC_LIB_STATUS_SSC_OUT_OF_RANGE, // b
+ ICC_LIB_STATUS_SSC_TOO_HIGH, // c
+ ICC_LIB_STATUS_SSC_TOO_LOW, // d
+ ICC_LIB_STATUS_SSC_CHANGE_NOT_ALLOWED_SSC_DISABLED, // e
+ ICC_LIB_STATUS_DYNAMIC_CHANGE_NOT_ALLOWED, // f
+ ICC_LIB_STATUS_INVALID_DMI_PEG_RATIO, // 10
+ ICC_LIB_STATUS_REGISTER_IS_LOCKED, // 11
+ ICC_LIB_STATUS_MEI_INITIALIZATION_FAILED, // 12
+ ICC_LIB_STATUS_MEI_CONNECTION_FAILED, // 13
+ ICC_LIB_STATUS_UNEXPECTED_FW_ERROR, // 14
+ ICC_LIB_STATUS_UNSUPPORTED_HW, // 15
+ ICC_LIB_STATUS_CLOCK_DISABLED_FAILED_PROGRAMMING, // 16
+ ICC_LIB_STATUS_FREQ_AND_SSC_NOT_MATCH, // 17
+ ICC_LIB_STATUS_WAITING_FOR_WARM_RESET, // 18
+ ICC_LIB_STATUS_NOT_ALLOWED_IN_USER_MODE, // 19
+ ICC_LIB_STATUS_TOO_MANY_CONNECTIONS, // 1a
+ ICC_LIB_STATUS_INVALID_COOKIE, // 1b
+ ICC_LIB_STATUS_DMI_PEG_RATIO_CHANGE_NOT_ALLOWED, // 1c
+ ICC_LIB_STATUS_NO_USAGE_DEFINED_FOR_THE_CLOCK, // 1d
+ ICC_LIB_STATUS_DATA_NOT_AVAILABLE, // 1e
+
+ ICC_LIB_STATUS_UNSPECIFIED_ERROR = 0xFFFF
+} ICC_LIB_STATUS;
+
+ typedef enum _ICC_CLOCK_USAGE
+ {
+ ICC_CLOCK_USAGE_BCLK = 0,
+ ICC_CLOCK_USAGE_DMI,
+ ICC_CLOCK_USAGE_PEG,
+ ICC_CLOCK_USAGE_PCIE,
+ ICC_CLOCK_USAGE_PCI33,
+ ICC_CLOCK_USAGE_RESERVED,
+ ICC_CLOCK_USAGE_SATA,
+ ICC_CLOCK_USAGE_USB3,
+ ICC_CLOCK_USAGE_DISPLAY,
+ ICC_CLOCK_USAGE_DISPLAY_NON_SPREAD,
+ ICC_CLOCK_USAGE_27MHZ_DOWN_GFX,
+ ICC_CLOCK_USAGE_DISPLAY_VGA,
+ ICC_CLOCK_USAGE_USB_LEGACY,
+ ICC_CLOCK_USAGE_14_31818_MHZ
+ } ICC_CLOCK_USAGE;
+
+// @brief Defines a generic version structure used in the software build process.
+typedef struct _ICC_LIB_VERSION
+{
+ UINT16 Major;
+ UINT16 Minor;
+ UINT16 Hotfix;
+ UINT16 Build;
+} ICC_LIB_VERSION;
+
+// ssc mode
+typedef enum _ICC_SSC_MODE
+ {
+ ICC_SSC_NONE = 0, // if used in SET, it means DONT CARE and current percent
+ // value will be used regardless of percent value
+ ICC_SSC_UP = 1,
+ ICC_SSC_CENTER = 2,
+ ICC_SSC_DOWN = 4
+} ICC_SSC_MODE;
+
+typedef UINT32 ICC_CLOCK_FREQUENCY;
+
+// Ratio used to modify the BCLK value and to produce
+// the PEG Slot Frequency (~100MHz). BCLK / ratio = PEG
+// Used in HW where the BCLK, DMI, & PEG use a common clock
+typedef enum _ICC_DMI_PEG_RATIO
+{
+ ICC_DMI_PEG_RATIO_5_TO_5 = 0, //< 5/5 = 1 - 1:1 ratio used when BCLK at 100MHz
+ ICC_DMI_PEG_RATIO_5_TO_4, //< 5/4 = 1.25 - Used when BCLK around 125MHz
+ ICC_DMI_PEG_RATIO_5_TO_3, //< 5/3 = 1.66 - Used when BCLK around 166MHz
+ ICC_DMI_PEG_RATIO_5_TO_2 //< 5/2 = 2.5 - Used when BCLK around 250MHz
+} ICC_DMI_PEG_RATIO;
+
+typedef struct _ICC_CLOCK_SETTINGS
+{
+ ICC_CLOCK_FREQUENCY Frequency;
+ ICC_SSC_MODE SscMode;
+ UINT8 SscPercent; // encoding example: 1.28% -> SSC_SPREAD value is 128
+ ICC_DMI_PEG_RATIO DmiPegRatio;
+} ICC_CLOCK_SETTINGS;
+
+typedef UINT16 ICC_CLOCK_USAGE_MASK;
+
+typedef struct _ICC_CLOCK_RANGES
+{
+ ICC_CLOCK_FREQUENCY FrequencyMin;
+ ICC_CLOCK_FREQUENCY FrequencyMax;
+ UINT8 SscChangeAllowed;
+ UINT8 SscUpAllowed;
+ UINT8 SscCenterAllowed;
+ UINT8 SscDownAllowed;
+ UINT8 SscPercentMax;
+ // that field is actually still a bit mask, but usually applications will never use it.
+ ICC_CLOCK_USAGE_MASK UsageMask;
+ UINT8 SscHaltAllowed;
+} ICC_CLOCK_RANGES;
+
+typedef UINT8 ICC_CLOCK_ID;
+
+typedef UINT32 ICC_CLOCK_ID_MASK;
+
+typedef enum _ICC_RECORD_INVALIDATION_REASON
+{
+ ICC_LIB_RIR_RECORD_VALID = 0,
+ ICC_LIB_RIR_AC_POWER_LOSS,
+ ICC_LIB_RIR_CMOS_BATTERY_REMOVED,
+ ICC_LIB_RIR_PLATFORM_BOOT_TIMEOUT,
+ ICC_LIB_RIR_WDT_EXPIRED,
+ ICC_LIB_RIR_RESERVED,
+ ICC_LIB_RIR_INVALIDATE_BY_REQUEST,
+ ICC_LIB_RIR_FW_BUG
+} ICC_RECORD_INVALIDATION_REASON;
+
+//
+// GUID for the ICC OverClocking Protocol
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#define ICC_OVERCLOCKING_PROTOCOL_GUID \
+ {0x8e8cbc58, 0x834c, 0x41e3, 0xb8, 0xca, 0xf0, 0x0c, 0xcf, 0x5a, 0x71, 0x7c}
+
+#else
+
+#define ICC_OVERCLOCKING_PROTOCOL_GUID \
+ {0x8e8cbc58, 0x834c, 0x41e3, { 0xb8, 0xca, 0xf0, 0x0c, 0xcf, 0x5a, 0x71, 0x7c } }
+
+#endif
+//
+// Extern the GUID for protocol users.
+//
+extern EFI_GUID gIccOverClockingProtocolGuid;
+
+typedef VOID (EFIAPI *ICC_LIB_GET_INFO) (ICC_LIB_VERSION*, UINT8*, ICC_LIB_STATUS*);
+typedef VOID (EFIAPI *ICC_LIB_GET_CLOCK_ID) (ICC_CLOCK_USAGE, ICC_CLOCK_ID_MASK*, ICC_LIB_STATUS*);
+typedef VOID (EFIAPI *ICC_LIB_GET_CLOCK_RANGES) (ICC_CLOCK_ID, ICC_CLOCK_RANGES*, ICC_LIB_STATUS*);
+typedef VOID (EFIAPI *ICC_LIB_GET_CURRENT_CLOCK_SETTINGS) (ICC_CLOCK_ID, ICC_CLOCK_SETTINGS*, ICC_LIB_STATUS*);
+typedef VOID (EFIAPI *ICC_LIB_SET_CURRENT_CLOCK_SETTINGS) (ICC_CLOCK_ID, ICC_CLOCK_SETTINGS, ICC_LIB_STATUS*);
+typedef VOID (EFIAPI *ICC_LIB_GET_BOOT_CLOCK_SETTINGS) (ICC_CLOCK_ID, ICC_CLOCK_SETTINGS*, ICC_LIB_STATUS*);
+typedef VOID (EFIAPI *ICC_LIB_SET_BOOT_CLOCK_SETTINGS) (ICC_CLOCK_ID, ICC_CLOCK_SETTINGS, ICC_LIB_STATUS*);
+typedef VOID (EFIAPI *ICC_LIB_GET_DEFAULT_BOOT_SETTINGS) (ICC_CLOCK_ID, ICC_CLOCK_SETTINGS*, ICC_LIB_STATUS*);
+typedef VOID (EFIAPI *ICC_LIB_RESET_CLOCK_BOOT_SETTINGS_TO_DEFAULTS) (ICC_CLOCK_ID, ICC_LIB_STATUS*);
+typedef VOID (EFIAPI *ICC_LIB_RESET_ALL_CLOCKS_BOOT_SETTINGS_TO_DEFAULTS) (ICC_LIB_STATUS*);
+typedef VOID (EFIAPI *ICC_GET_NEXT_FREQUENCY) (ICC_CLOCK_ID, ICC_CLOCK_FREQUENCY, ICC_CLOCK_FREQUENCY*, ICC_LIB_STATUS*);
+typedef VOID (EFIAPI *ICC_GET_PREVIOUS_FREQUENCY) (ICC_CLOCK_ID, ICC_CLOCK_FREQUENCY, ICC_CLOCK_FREQUENCY*, ICC_LIB_STATUS*);
+typedef VOID (EFIAPI *ICC_LIB_GET_BOOT_CLOCK_SETTINGS_INVALIDATION_REASON) (ICC_RECORD_INVALIDATION_REASON*, ICC_LIB_STATUS*);
+
+
+typedef struct _ICC_OVERCLOCKING_PROTOCOL {
+ ICC_LIB_GET_INFO GetInfo;
+ ICC_LIB_GET_CLOCK_ID GetClockId;
+ ICC_LIB_GET_CLOCK_RANGES GetClockRanges;
+ ICC_LIB_GET_CURRENT_CLOCK_SETTINGS GetCurrentClockSettings;
+ ICC_LIB_SET_CURRENT_CLOCK_SETTINGS SetCurrentClockSettings;
+ ICC_LIB_GET_BOOT_CLOCK_SETTINGS GetBootClockSettings;
+ ICC_LIB_SET_BOOT_CLOCK_SETTINGS SetBootClockSettings;
+ ICC_LIB_GET_DEFAULT_BOOT_SETTINGS GetDefaultClockSettings;
+ ICC_LIB_RESET_CLOCK_BOOT_SETTINGS_TO_DEFAULTS ResetClockBootSettingsToDefaults;
+ ICC_LIB_RESET_ALL_CLOCKS_BOOT_SETTINGS_TO_DEFAULTS ResetAllClocksBootSettingsToDefaults;
+ ICC_GET_NEXT_FREQUENCY GetNextFrequency;
+ ICC_GET_PREVIOUS_FREQUENCY GetPreviousFrequency;
+ ICC_LIB_GET_BOOT_CLOCK_SETTINGS_INVALIDATION_REASON GetBootClockSettingsInvalidationReason;
+} ICC_OVERCLOCKING_PROTOCOL;
+
+#endif /* _ICC_OVERCLOCKING_H_ */
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/Icc/Protocol/IccProtocolLib.cif b/Board/EM/MeWrapper/Icc/Protocol/IccProtocolLib.cif
new file mode 100644
index 0000000..178021d
--- /dev/null
+++ b/Board/EM/MeWrapper/Icc/Protocol/IccProtocolLib.cif
@@ -0,0 +1,11 @@
+<component>
+ name = "IccProtocolLib"
+ category = ModulePart
+ LocalRoot = "Board\EM\MeWrapper\Icc\Protocol"
+ RefName = "IccProtocolLib"
+[files]
+"IccProtocolLib.sdl"
+"IccProtocolLib.mak"
+"IccOverClocking\IccOverClocking.h"
+"IccOverClocking\IccOverClocking.c"
+<endComponent>
diff --git a/Board/EM/MeWrapper/Icc/Protocol/IccProtocolLib.mak b/Board/EM/MeWrapper/Icc/Protocol/IccProtocolLib.mak
new file mode 100644
index 0000000..3eb9b6b
--- /dev/null
+++ b/Board/EM/MeWrapper/Icc/Protocol/IccProtocolLib.mak
@@ -0,0 +1,78 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/Icc/IccProtocolLib/IccProtocolLib.mak 1 2/08/12 1:05a Klzhan $
+#
+# $Revision: 1 $
+#
+# $Date: 2/08/12 1:05a $
+#
+#**********************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/Icc/IccProtocolLib/IccProtocolLib.mak $
+#
+# 1 2/08/12 1:05a Klzhan
+# Initial Check in
+#
+# 1 2/25/11 1:41a Klzhan
+# Initial Check-in
+#
+# 1 12/03/10 5:10a Klzhan
+# Initial Check-in.
+#
+#
+#**********************************************************************
+#
+#<AMI_FHDR_START>
+#----------------------------------------------------------------------------
+#
+# Name: IccProtocolLib.mak
+#
+# Description: MakeFile for IccProtocolLib
+#
+#----------------------------------------------------------------------------
+#<AMI_FHDR_END>
+all : IccProtocolLib
+
+$(IccProtocol_LIB) : IccProtocolLib
+
+IccProtocolLib : $(BUILD_DIR)\IccProtocolLib.mak IccProtocolLibBin
+
+$(BUILD_DIR)\IccProtocolLib.mak : $(IccProtocol_DIR)\$(@B).cif $(IccProtocol_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(IccProtocol_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+IccProtocolLib_INCLUDES =\
+ $(EDK_INCLUDES)\
+ $(INTEL_PCH_INCLUDES)\
+
+IccProtocolLibBin :
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\IccProtocolLib.mak all\
+ "MY_INCLUDES=$(IccProtocolLib_INCLUDES)" \
+ TYPE=LIBRARY \
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/Icc/Protocol/IccProtocolLib.sdl b/Board/EM/MeWrapper/Icc/Protocol/IccProtocolLib.sdl
new file mode 100644
index 0000000..2f3f33e
--- /dev/null
+++ b/Board/EM/MeWrapper/Icc/Protocol/IccProtocolLib.sdl
@@ -0,0 +1,29 @@
+TOKEN
+ Name = "IccProtocolLib_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable IccProtocolLib support in Project"
+End
+
+PATH
+ Name = "IccProtocol_DIR"
+End
+
+MODULE
+ File = "IccProtocolLib.mak"
+ Help = "Includes IccProtocolLib.mak to Project"
+End
+
+ELINK
+ Name = "IccProtocol_LIB"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\IccProtocolLib.lib"
+ Parent = "IccProtocol_LIB"
+ InvokeOrder = AfterParent
+End
diff --git a/Board/EM/MeWrapper/MdesStatusCode/MdesStatusCode.cif b/Board/EM/MeWrapper/MdesStatusCode/MdesStatusCode.cif
new file mode 100644
index 0000000..8acdb06
--- /dev/null
+++ b/Board/EM/MeWrapper/MdesStatusCode/MdesStatusCode.cif
@@ -0,0 +1,10 @@
+<component>
+ name = "MdesStatusCode"
+ category = ModulePart
+ LocalRoot = "Board\EM\MeWrapper\MdesStatusCode"
+ RefName = "MdesStatusCode"
+[files]
+"MdesStatusCode.sdl"
+"MdesStatusCode.mak"
+"MdesStatusCodeDxe.c"
+<endComponent>
diff --git a/Board/EM/MeWrapper/MdesStatusCode/MdesStatusCode.mak b/Board/EM/MeWrapper/MdesStatusCode/MdesStatusCode.mak
new file mode 100644
index 0000000..ed2a77b
--- /dev/null
+++ b/Board/EM/MeWrapper/MdesStatusCode/MdesStatusCode.mak
@@ -0,0 +1,89 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/MdesStatusCode/MdesStatusCode.mak 1 7/27/12 5:12a Klzhan $
+#
+# $Revision: 1 $
+#
+# $Date: 7/27/12 5:12a $
+#**********************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/MdesStatusCode/MdesStatusCode.mak $
+#
+# 1 7/27/12 5:12a Klzhan
+# [TAG] EIPNone
+# [Category] New Feature
+# [Description] Add support MDES
+# [Files] MdesStatusCode.cif
+# MdesStatusCode.sdl
+# MdesStatusCode.mak
+# MdesStatusCodeDxe.c
+#
+# 2 12/08/11 3:29a Klzhan
+# [TAG] EIPNone
+# [Category] Improvement
+# [Description] Fix build error when AMT disabled.
+#
+# 1 10/19/11 9:06a Calvinchen
+# [TAG] EIPNone
+# [Category] New Feature
+# [Description] Added MDES BIOS Status Code Support.
+# [Files] MdesStatusCode.cif
+# MdesStatusCode.sdl
+# MdesStatusCode.mak
+# MdesStatusCodeDxe.c
+#
+#
+#**********************************************************************
+#
+#<AMI_FHDR_START>
+#---------------------------------------------------------------------------
+# Name: MeStatusCode.mak
+#
+# Description: AMT Status Code Makfile.
+#
+#---------------------------------------------------------------------------
+#<AMI_FHDR_END>
+
+#---------------------------------------------------------------------------
+# AMT StatusCode for DXE
+#---------------------------------------------------------------------------
+MdesStatusCodeIncludes =\
+ /I$(MeProtocolLib_DIR)\MePlatformPolicy \
+ $(ME_INCLUDES)\
+ /I$(MdesStatusCodeDrv_DIR)
+
+CORE_DXEBin : $(BUILD_DIR)\$(STATUS_CODE_DIR)\MdesStatusCodeDxe.obj
+
+$(BUILD_DIR)\$(STATUS_CODE_DIR)\MdesStatusCodeDxe.obj : $(MdesStatusCode_DIR)\MdesStatusCodeDxe.c
+ $(CC) $(CFLAGS:/W4=/W3) /DTIANO_RELEASE_VERSION=0x00080006 $(MdesStatusCodeIncludes) /DDXE_STATUS_CODE $(AlertStandardFormatDxe_INCLUDES) $(EDK_INCLUDES) $(STATUS_CODE_INCLUDES) /Fo$(BUILD_DIR)\$(STATUS_CODE_DIR)\MdesStatusCodeDxe.obj $(MdesStatusCode_DIR)\MdesStatusCodeDxe.c
+
+RUNTIMEBin : $(BUILD_DIR)\$(STATUS_CODE_DIR)\MdesStatusCodeRuntime.obj
+$(BUILD_DIR)\$(STATUS_CODE_DIR)\MdesStatusCodeRuntime.obj : $(MdesStatusCode_DIR)\MdesStatusCodeDxe.c
+ $(CC) $(CFLAGS:/W4=/W3) /DTIANO_RELEASE_VERSION=0x00080006 $(EDK_INCLUDES) $(STATUS_CODE_INCLUDES) /Fo$(BUILD_DIR)\$(STATUS_CODE_DIR)\MdesStatusCodeRuntime.obj $(MdesStatusCode_DIR)\MdesStatusCodeDxe.c
+
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, 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/MdesStatusCode/MdesStatusCode.sdl b/Board/EM/MeWrapper/MdesStatusCode/MdesStatusCode.sdl
new file mode 100644
index 0000000..d936706
--- /dev/null
+++ b/Board/EM/MeWrapper/MdesStatusCode/MdesStatusCode.sdl
@@ -0,0 +1,31 @@
+TOKEN
+ Name = "MdesStatusCode_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable MeStatusCode support in Project"
+ TokenType = Boolean
+ TargetH = Yes
+ TargetMAK = Yes
+ Master = Yes
+End
+
+PATH
+ Name = "MdesStatusCode_DIR"
+End
+
+MODULE
+ Help = "Includes MdesStatusCode.mak to Project"
+ File = "MdesStatusCode.mak"
+End
+
+ELINK
+ Name = "DXE(MdesBiosStatusCode),"
+ Parent = "ReportMiscStatus"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "DXE(MdesBiosStatusCodeInit),"
+ Parent = "StatusCodeInitialize"
+ InvokeOrder = AfterParent
+End
+
diff --git a/Board/EM/MeWrapper/MdesStatusCode/MdesStatusCodeDxe.c b/Board/EM/MeWrapper/MdesStatusCode/MdesStatusCodeDxe.c
new file mode 100644
index 0000000..3f46c3e
--- /dev/null
+++ b/Board/EM/MeWrapper/MdesStatusCode/MdesStatusCodeDxe.c
@@ -0,0 +1,206 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/MdesStatusCode/MdesStatusCodeDxe.c 1 7/27/12 5:12a Klzhan $
+//
+// $Revision: 1 $
+//
+// $Date: 7/27/12 5:12a $
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/MdesStatusCode/MdesStatusCodeDxe.c $
+//
+// 1 7/27/12 5:12a Klzhan
+// [TAG] EIPNone
+// [Category] New Feature
+// [Description] Add support MDES
+// [Files] MdesStatusCode.cif
+// MdesStatusCode.sdl
+// MdesStatusCode.mak
+// MdesStatusCodeDxe.c
+//
+// 1 10/19/11 9:06a Calvinchen
+// [TAG] EIPNone
+// [Category] New Feature
+// [Description] Added MDES BIOS Status Code Support.
+// [Files] MdesStatusCode.cif
+// MdesStatusCode.sdl
+// MdesStatusCode.mak
+// MdesStatusCodeDxe.c
+//
+//
+//**********************************************************************
+//
+//<AMI_FHDR_START>
+//---------------------------------------------------------------------------
+// Name: MdesStatusCodeDxe.c
+//
+// Description: Processes ASF messages for DXE.
+//
+//---------------------------------------------------------------------------
+//<AMI_FHDR_END>
+/*++
+
+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:
+
+ AmtStatusCodeDxe.c
+
+Abstract:
+ Processes ASF messages
+
+--*/
+
+//#include "Tiano.h"
+#include <AmiDxeLib.h>
+#ifdef DXE_STATUS_CODE
+#include <AmiDxeLib.h>
+#include <token.h>
+#include <Setup.h>
+#include "MePlatformPolicy.h"
+#include "MdesStatusCodeDxe.h"
+EFI_GUID gSetupGuid = SETUP_GUID;
+EFI_GUID gMdesStatusCodeProtocolGuid = MDES_STATUS_CODE_PROTOCOL_GUID;
+EFI_GUID gDxePlatformMePolicyGuid = DXE_PLATFORM_ME_POLICY_GUID;
+extern EFI_BOOT_SERVICES *pBS;
+#endif
+
+VOID MdesBiosStatusCode(
+ IN VOID **Dummy,
+ IN EFI_STATUS_CODE_TYPE Type,
+ IN EFI_STATUS_CODE_VALUE Value,
+ IN UINT32 Instance,
+ IN EFI_GUID *CallerId OPTIONAL,
+ IN EFI_STATUS_CODE_DATA *Data OPTIONAL
+)
+/*++
+Routine Description:
+
+ Provides an interface that a software module can call to report an ASF DXE status code.
+
+Arguments:
+
+ PeiServices - PeiServices pointer.
+
+ Type - Indicates the type of status code being reported.
+
+ Value - Describes the current status of a hardware or software entity.
+ This included information about the class and subclass that is
+ used to classify the entity as well as an operation.
+
+ Instance - The enumeration of a hardware or software entity within
+ the system. Valid instance numbers start with 1.
+
+ CallerId - This optional parameter may be used to identify the caller.
+ This parameter allows the status code driver to apply different
+ rules to different callers.
+
+ Data - This optional parameter may be used to pass additional data.
+
+Returns:
+
+ None
+
+--*/
+{
+#ifdef DXE_STATUS_CODE
+ //
+ // Do nothing, because AMT ASF driver will handle that.
+ //
+ EFI_STATUS Status;
+ MDES_STATUS_CODE_PROTOCOL *MdesStatusCodeProtocol;
+ static UINTN MdesEnable = 0;
+ static UINTN MdesEnableChecked = 0;
+ DXE_ME_POLICY_PROTOCOL *MePlatformPolicy;
+
+ if (MdesEnableChecked == 0) {
+ Status = pBS->LocateProtocol (&gDxePlatformMePolicyGuid, NULL, &MePlatformPolicy);
+ if (EFI_ERROR(Status)) {
+ //
+ // Check if GetVariable function has been initialized
+ //
+ return;
+ } else {
+ MdesEnableChecked = 1;
+ //
+ // set gfMDESCheck to 1 to lock geting variable next time
+ //
+ if (!(EFI_ERROR (Status))) {
+ if (MePlatformPolicy->MeConfig.MdesForBiosState == 1) {
+ //
+ // check if function is set in BIOS Menu
+ //
+ MdesEnable = 1;
+ }
+ }
+ }
+ }
+ if (MdesEnable == 1) {
+ Status = pBS->LocateProtocol (&gMdesStatusCodeProtocolGuid, NULL, &MdesStatusCodeProtocol);
+ if (EFI_ERROR (Status)) {
+ return;
+ }
+
+ MdesStatusCodeProtocol->SendMdesStatusCode (Type, Value, Instance, CallerId, Data);
+ }
+#endif
+ return ;
+}
+
+EFI_STATUS
+MdesBiosStatusCodeInit(
+ IN EFI_HANDLE *ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+)
+/*++
+Routine Description:
+
+ Init routine for DXE ASF StatusCode.
+
+Arguments:
+
+ FfsHeader - FfsHeader pointer.
+ PeiServices - PeiServices pointer.
+
+Returns:
+
+ EFI_SUCCESS - The function completed successfully
+
+--*/
+{
+ 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 **
+//** **
+//*************************************************************************
+//*************************************************************************
diff --git a/Board/EM/MeWrapper/MePciPlatform/MePciPlatform.c b/Board/EM/MeWrapper/MePciPlatform/MePciPlatform.c
new file mode 100644
index 0000000..db1c1ee
--- /dev/null
+++ b/Board/EM/MeWrapper/MePciPlatform/MePciPlatform.c
@@ -0,0 +1,342 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/MePciPlatform/MePciPlatform.c 1 2/08/12 1:05a Klzhan $
+//
+// $Revision: 1 $
+//
+// $Date: 2/08/12 1:05a $
+//
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/MePciPlatform/MePciPlatform.c $
+//
+// 1 2/08/12 1:05a 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: MePciPlatform.c
+//
+// Description:
+//
+//----------------------------------------------------------------------------
+//<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) 2008 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:
+
+ MePciPlatform.c
+
+Abstract:
+
+
+--*/
+#include "MePciPlatform.h"
+
+#define SETUP_GUID \
+ {0xEC87D643, 0xEBA4, 0x4BB5, 0xA1, 0xE5, 0x3F, 0x3E, 0x36, 0xB2, 0x0D, 0xA9}
+EFI_GUID gSetupGuid = SETUP_GUID;
+//-jeff PLATFORM_INFO_PROTOCOL *gPlatformInfoProtocol;
+
+EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;
+EFI_PCI_PLATFORM_PROTOCOL *MePciPlatformInstance;
+PLATFORM_PCI_EXPRESS_BRIDGE *mPlatformPciExpressBridge;
+
+EFI_STATUS
+EFIAPI
+PhaseNotify (
+ IN EFI_PCI_PLATFORM_PROTOCOL *This,
+ IN EFI_HANDLE HostBridge,
+ IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PHASE Phase,
+ IN EFI_PCI_CHIPSET_EXECUTION_PHASE ChipsetPhase
+ )
+/*++
+
+ Routine Description:
+ The PlatformNotify() function can be used to notify the platform driver so that
+ it can perform platform-specific actions. No specific actions are required.
+ Eight notification points are defined at this time. More synchronization points
+ may be added as required in the future. The PCI bus driver calls the platform driver
+ twice for every Phase-once before the PCI Host Bridge Resource Allocation Protocol
+ driver is notified, and once after the PCI Host Bridge Resource Allocation Protocol
+ driver has been notified.
+ This member function may not perform any error checking on the input parameters. It
+ also does not return any error codes. If this member function detects any error condition,
+ it needs to handle those errors on its own because there is no way to surface any
+ errors to the caller.
+
+ Arguments:
+ This - Pointer to the EFI_PCI_PLATFORM_PROTOCOL instance.
+ HostBridge - The handle of the host bridge controller.
+ Phase - The phase of the PCI bus enumeration.
+ ChipsetPhase - Defines the execution phase of the PCI chipset driver.
+
+ Returns:
+ EFI_SUCCESS - The function completed successfully.
+
+--*/
+{
+/*
+ EFI_STATUS Status;
+
+ if (Phase == EfiPciHostBridgeEndBusAllocation && ChipsetPhase == ChipsetEntry) {
+ Status = HeciSetClockEnables (CurrentClockMask, CurrentClockEnables, TRUE);
+ }
+*/
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+EFIAPI
+PlatformPrepController (
+ IN EFI_PCI_PLATFORM_PROTOCOL *This,
+ IN EFI_HANDLE HostBridge,
+ IN EFI_HANDLE RootBridge,
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_PCI_ADDRESS PciAddress,
+ IN EFI_PCI_CONTROLLER_RESOURCE_ALLOCATION_PHASE Phase,
+ IN EFI_PCI_CHIPSET_EXECUTION_PHASE ChipsetPhase
+ )
+/*++
+
+ Routine Description:
+ The PlatformPrepController() function can be used to notify the platform driver so that
+ it can perform platform-specific actions. No specific actions are required.
+ Several notification points are defined at this time. More synchronization points may be
+ added as required in the future. The PCI bus driver calls the platform driver twice for
+ every PCI controller-once before the PCI Host Bridge Resource Allocation Protocol driver
+ is notified, and once after the PCI Host Bridge Resource Allocation Protocol driver has
+ been notified.
+ This member function may not perform any error checking on the input parameters. It also
+ does not return any error codes. If this member function detects any error condition, it
+ needs to handle those errors on its own because there is no way to surface any errors to
+ the caller.
+
+ Arguments:
+ This - Pointer to the EFI_PCI_PLATFORM_PROTOCOL instance.
+ HostBridge - The associated PCI host bridge handle.
+ RootBridge - The associated PCI root bridge handle.
+ PciAddress - The address of the PCI device on the PCI bus.
+ Phase - The phase of the PCI controller enumeration.
+ ChipsetPhase - Defines the execution phase of the PCI chipset driver.
+
+ Returns:
+ EFI_SUCCESS - The function completed successfully.
+
+--*/
+{
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+EFIAPI
+GetPlatformPolicy (
+ IN EFI_PCI_PLATFORM_PROTOCOL *This,
+ OUT EFI_PCI_PLATFORM_POLICY *PciPolicy
+ )
+/*++
+
+ Routine Description:
+ The GetPlatformPolicy() function retrieves the platform policy regarding PCI
+ enumeration. The PCI bus driver and the PCI Host Bridge Resource Allocation Protocol
+ driver can call this member function to retrieve the policy.
+
+ Arguments:
+ This - Pointer to the EFI_PCI_PLATFORM_PROTOCOL instance.
+ PciPolicy - The platform policy with respect to VGA and ISA aliasing.
+
+ Returns:
+ EFI_SUCCESS - The function completed successfully.
+ EFI_INVALID_PARAMETER - PciPolicy is NULL.
+
+--*/
+{
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+EFIAPI
+GetPciRom (
+ IN EFI_PCI_PLATFORM_PROTOCOL *This,
+ IN EFI_HANDLE PciHandle,
+ OUT VOID **RomImage,
+ OUT UINTN *RomSize
+ )
+/*++
+
+ Routine Description:
+ The GetPciRom() function gets the PCI device's option ROM from a platform-specific location.
+ The option ROM will be loaded into memory. This member function is used to return an image
+ that is packaged as a PCI 2.2 option ROM. The image may contain both legacy and EFI option
+ ROMs. See the EFI 1.10 Specification for details. This member function can be used to return
+ option ROM images for embedded controllers. Option ROMs for embedded controllers are typically
+ stored in platform-specific storage, and this member function can retrieve it from that storage
+ and return it to the PCI bus driver. The PCI bus driver will call this member function before
+ scanning the ROM that is attached to any controller, which allows a platform to specify a ROM
+ image that is different from the ROM image on a PCI card.
+
+ Arguments:
+ This - Pointer to the EFI_PCI_PLATFORM_PROTOCOL instance.
+ PciHandle - The handle of the PCI device.
+ RomImage - If the call succeeds, the pointer to the pointer to the option ROM image.
+ Otherwise, this field is undefined. The memory for RomImage is allocated
+ by EFI_PCI_PLATFORM_PROTOCOL.GetPciRom() using the EFI Boot Service AllocatePool().
+ It is the caller's responsibility to free the memory using the EFI Boot Service
+ FreePool(), when the caller is done with the option ROM.
+ RomSize - If the call succeeds, a pointer to the size of the option ROM size. Otherwise,
+ this field is undefined.
+
+ Returns:
+ EFI_SUCCESS - The option ROM was available for this device and loaded into memory.
+ EFI_NOT_FOUND - No option ROM was available for this device.
+ EFI_OUT_OF_RESOURCES - No memory was available to load the option ROM.
+ EFI_DEVICE_ERROR - An error occurred in getting the option ROM.
+
+--*/
+{
+ return EFI_NOT_FOUND;
+}
+
+//
+// Driver entry point
+//
+EFI_DRIVER_ENTRY_POINT (MePlatformPolicyEntryPoint)
+
+//
+// Function implementations
+//
+EFI_STATUS
+EFIAPI
+MePciPlatformEntryPoint (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+)
+/*++
+
+Routine Description:
+
+ Entry point for the Management Engine Driver.
+
+Arguments:
+
+ ImageHandle Image handle of this driver.
+ SystemTable Global system service table.
+
+Returns:
+
+ EFI_SUCCESS Initialization complete.
+ EFI_UNSUPPORTED The chipset is unsupported by this driver.
+ EFI_OUT_OF_RESOURCES Do not have enough resources to initialize the driver.
+ EFI_DEVICE_ERROR Device error, driver exits abnormally.
+
+--*/
+{
+ EFI_STATUS Status;
+ EFI_HECI_PROTOCOL *Heci;
+ UINT32 MeMode;
+
+
+ EfiInitializeDriverLib (ImageHandle, SystemTable);
+
+ //
+ // Locate Heci protocol
+ //
+ Status = gBS->LocateProtocol (&gEfiHeciProtocolGuid, NULL, &Heci);
+ if (EFI_ERROR(Status)) {
+ DEBUG ((EFI_D_ERROR, "MePciPlatform locate Heci failed and the Status is %r\n", Status));
+ return Status;
+ }
+
+ Status = Heci->GetMeMode(&MeMode);
+ if (EFI_ERROR(Status)) {
+ DEBUG ((EFI_D_ERROR, "MePciPlatform Get Me mode failed and the Status is %r\n", Status));
+ return Status;
+ }
+ if (MeMode == ME_MODE_SECOVER) {
+ DEBUG ((EFI_D_ERROR, "SetICC doesn't supported in this mode\n"));
+ return EFI_UNSUPPORTED;
+ }
+
+ MePciPlatformInstance = (EFI_PCI_PLATFORM_PROTOCOL *) (UINTN) AllocatePool (sizeof (EFI_PCI_PLATFORM_PROTOCOL));
+
+ //-jeff Status = gBS->LocateProtocol(&gPlatformInfoProtocolGuid, NULL, &gPlatformInfoProtocol);
+ //-jeff ASSERT_EFI_ERROR (Status);
+
+ // Locate root bridge IO protocol
+ //
+ Status = gBS->LocateProtocol (&gEfiPciRootBridgeIoProtocolGuid, NULL, &PciRootBridgeIo);
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+
+ MePciPlatformInstance->PhaseNotify = PhaseNotify;
+ MePciPlatformInstance->PlatformPrepController = PlatformPrepController;
+ MePciPlatformInstance->GetPlatformPolicy = GetPlatformPolicy;
+ MePciPlatformInstance->GetPciRom = GetPciRom;
+
+ //
+ // Install the EFI_MANAGEMENT_ENGINE_PROTOCOL interface
+ //
+ Status = gBS->InstallProtocolInterface (
+ &ImageHandle,
+ &gEfiPciPlatformProtocolGuid,
+ EFI_NATIVE_INTERFACE,
+ MePciPlatformInstance
+ );
+
+ return Status;
+}
+
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/MePciPlatform/MePciPlatform.cif b/Board/EM/MeWrapper/MePciPlatform/MePciPlatform.cif
new file mode 100644
index 0000000..3b2bea3
--- /dev/null
+++ b/Board/EM/MeWrapper/MePciPlatform/MePciPlatform.cif
@@ -0,0 +1,12 @@
+<component>
+ name = "MePciPlatform"
+ category = ModulePart
+ LocalRoot = "Board\EM\MeWrapper\MePciPlatform"
+ RefName = "MePciPlatform"
+[files]
+"MePciPlatform.c"
+"MePciPlatform.h"
+"MePciPlatform.sdl"
+"MePciPlatform.mak"
+"MePciPlatform.dxs"
+<endComponent>
diff --git a/Board/EM/MeWrapper/MePciPlatform/MePciPlatform.dxs b/Board/EM/MeWrapper/MePciPlatform/MePciPlatform.dxs
new file mode 100644
index 0000000..1a16fc8
--- /dev/null
+++ b/Board/EM/MeWrapper/MePciPlatform/MePciPlatform.dxs
@@ -0,0 +1,98 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/MePciPlatform/MePciPlatform.dxs 1 2/08/12 1:05a Klzhan $
+//
+// $Revision: 1 $
+//
+// $Date: 2/08/12 1:05a $
+//
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/MePciPlatform/MePciPlatform.dxs $
+//
+// 1 2/08/12 1:05a 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: MePciPlatform.dxs
+//
+// Description:
+//
+//----------------------------------------------------------------------------
+//<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) 2008 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:
+
+ MePciPlatform.dxs
+
+Abstract:
+
+ Dependency expression source file.
+
+--*/
+
+#include "EfiDepex.h"
+#include EFI_PROTOCOL_DEFINITION (Heci)
+#include EFI_PROTOCOL_DEFINITION (PciRootBridgeIo)
+
+DEPENDENCY_START
+ EFI_HECI_PROTOCOL_GUID AND
+ EFI_PCI_ROOT_BRIDGE_IO_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/MePciPlatform/MePciPlatform.h b/Board/EM/MeWrapper/MePciPlatform/MePciPlatform.h
new file mode 100644
index 0000000..818c3dc
--- /dev/null
+++ b/Board/EM/MeWrapper/MePciPlatform/MePciPlatform.h
@@ -0,0 +1,154 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/MePciPlatform/MePciPlatform.h 1 2/08/12 1:05a Klzhan $
+//
+// $Revision: 1 $
+//
+// $Date: 2/08/12 1:05a $
+//
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/MePciPlatform/MePciPlatform.h $
+//
+// 1 2/08/12 1:05a 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: MePciPlatform.h
+//
+// Description:
+//
+//----------------------------------------------------------------------------
+//<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) 2008 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:
+
+ MePciPlatform.h
+
+Abstract:
+
+
+--*/
+#ifndef _DXE_ME_PCI_PLATFORM_H_
+#define _DXE_ME_PCI_PLATFORM_H_
+
+#include "EdkIIGlueDxe.h"
+#include "MeLib.h"
+
+#include EFI_PROTOCOL_PRODUCER (PciPlatform)
+#include EFI_PROTOCOL_DEFINITION (PciRootBridgeIo)
+
+#define EFI_DRIVER_ENTRY_POINT(x)
+
+#define Flex0 (1 << 0)
+#define Flex1 (1 << 1)
+#define Flex2 (1 << 2)
+#define Flex3 (1 << 3)
+#define PCI_Clock0 (1 << 7)
+#define PCI_Clock1 (1 << 8)
+#define PCI_Clock2 (1 << 9)
+#define PCI_Clock3 (1 << 10)
+#define PCI_Clock4 (1 << 11)
+#define SRC0 (1 << 16)
+#define SRC1 (1 << 17)
+#define SRC2 (1 << 18)
+#define SRC3 (1 << 19)
+#define SRC4 (1 << 20)
+#define SRC5 (1 << 21)
+#define SRC6 (1 << 22)
+#define SRC7 (1 << 23)
+#define CSI_SRC8 (1 << 24)
+#define CSI_DP (1 << 25)
+#define PEG_A (1 << 26)
+#define PEG_B (1 << 27)
+#define DMI (1 << 28)
+
+#define PCI_SKIP 0xFF
+#define R_PCH_PCIE_SLSTS 0x5A
+
+typedef union _R_PCH_PCIE_SLSTS_VALUE {
+ UINT16 REG;
+ struct {
+ UINT16 ReservedBIT0 : 1;
+ UINT16 PFD : 1;
+ UINT16 MSC : 1;
+ UINT16 PDC : 1;
+ UINT16 ReservedBIT4 : 1;
+ UINT16 MS : 1;
+ UINT16 PDS : 1;
+ UINT16 ReservedBIT7 : 1;
+ UINT16 LASC : 1;
+ UINT16 Reserved : 7;
+ } Fields;
+} R_PCH_PCIE_SLSTS_VALUE;
+
+typedef union _PCI_CFG_ADDR {
+ UINT64 ADDR;
+ EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_PCI_ADDRESS Addr;
+} PCI_CFG_ADDR;
+
+typedef struct {
+ PCI_CFG_ADDR PciExpressBridgeAddress;
+ BOOLEAN HotPlugSupport;
+ UINT32 ClockEnables;
+} PLATFORM_PCI_EXPRESS_BRIDGE;
+
+#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/MePciPlatform/MePciPlatform.mak b/Board/EM/MeWrapper/MePciPlatform/MePciPlatform.mak
new file mode 100644
index 0000000..b9ea7e4
--- /dev/null
+++ b/Board/EM/MeWrapper/MePciPlatform/MePciPlatform.mak
@@ -0,0 +1,122 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/MePciPlatform/MePciPlatform.mak 3 9/27/12 4:52a Klzhan $
+#
+# $Revision: 3 $
+#
+# $Date: 9/27/12 4:52a $
+#
+#**********************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/MePciPlatform/MePciPlatform.mak $
+#
+# 3 9/27/12 4:52a Klzhan
+# [TAG] EIP102254
+# [Category] Spec Update
+# [Severity] Important
+# [Description] Update ME RC 0.7
+#
+# 2 2/23/12 8:57a Klzhan
+# Support New EDK
+#
+# 1 2/08/12 1:05a Klzhan
+# Initial Check in
+#
+# 1 2/25/11 1:41a Klzhan
+# Initial Check-in
+#
+# 1 12/03/10 5:10a Klzhan
+# Initial Check-in.
+#
+#
+#**********************************************************************
+#
+#<AMI_FHDR_START>
+#----------------------------------------------------------------------------
+#
+# Name: MePciPlatform.h
+#
+# Description:
+#
+#----------------------------------------------------------------------------
+#<AMI_FHDR_END>
+All : MePciPlatform
+
+MePciPlatform : $(BUILD_DIR)\MePciPlatform.mak MePciPlatformBin
+
+$(BUILD_DIR)\MePciPlatform.mak : $(MePciPlatform_DIR)\$(@B).cif $(MePciPlatform_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(MePciPlatform_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+MePciPlatform_INCLUDES=\
+ $(EDK_INCLUDES) \
+ $(ME_INCLUDES) \
+ $(MISCFRAMEWORK_INCLUDES) \
+ $(NB_INCLUDES)\
+ $(SB_INCLUDES)\
+ $(EdkIIGlueLib_INCLUDES)\
+ $(INTEL_PCH_INCLUDES)\
+
+MePciPlatform_LIBS=\
+ $(EFIDRIVERLIB)\
+ $(MeProtocolLib_LIB)\
+ $(MeLibDxe_LIB)\
+ $(EdkIIGlueBaseLib_LIB)\
+!IF "$(x64_BUILD)"=="1"
+ $(EdkIIGlueBaseLibX64_LIB)\
+!ELSE
+ $(EdkIIGlueBaseLibIA32_LIB)\
+!ENDIF
+ $(EdkIIGlueDxeReportStatusCodeLib_LIB)\
+ $(EdkIIGlueDxeDebugLibReportStatusCode_LIB)\
+ $(EdkIIGlueDxeMemoryAllocationLib_LIB)\
+ $(EDKFRAMEWORKPROTOCOLLIB)\
+
+DxeCpuBuildDefine = \
+!IF "$(x64_BUILD)"=="1"
+ /DMDE_CPU_X64\
+!ELSE
+ /DMDE_CPU_IA32\
+!ENDIF
+
+MePciPlatform_DEFINES = \
+ $(DxeCpuBuildDefine)\
+
+MePciPlatformBin : $(MePciPlatform_LIBS)
+ $(MAKE) /$(MAKEFLAGS) $(EDK_DEFAULTS)\
+ /f $(BUILD_DIR)\MePciPlatform.mak all\
+ GUID=459C70C3-9344-4484-9F93-7822530D0D11\
+ "MY_INCLUDES = $(MePciPlatform_INCLUDES)" \
+ "MY_DEFINES=$(MePciPlatform_DEFINES)"\
+ ENTRY_POINT=MePciPlatformEntryPoint\
+ DEPEX1=$(MePciPlatform_DIR)\MePciPlatform.dxs\
+ DEPEX1_TYPE=EFI_SECTION_DXE_DEPEX\
+ TYPE=BS_DRIVER\
+ 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/MePciPlatform/MePciPlatform.sdl b/Board/EM/MeWrapper/MePciPlatform/MePciPlatform.sdl
new file mode 100644
index 0000000..5c9f445
--- /dev/null
+++ b/Board/EM/MeWrapper/MePciPlatform/MePciPlatform.sdl
@@ -0,0 +1,24 @@
+TOKEN
+ Name = "MePciPlatform_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable MePciPlatform support in Project"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+End
+
+PATH
+ Name = "MePciPlatform_DIR"
+End
+
+MODULE
+ Help = "Includes MePciPlatform.mak to Project"
+ File = "MePciPlatform.mak"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\MePciPlatform.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End
diff --git a/Board/EM/MeWrapper/MePlatformPolicy/MePlatformPolicy.c b/Board/EM/MeWrapper/MePlatformPolicy/MePlatformPolicy.c
new file mode 100644
index 0000000..cdff1aa
--- /dev/null
+++ b/Board/EM/MeWrapper/MePlatformPolicy/MePlatformPolicy.c
@@ -0,0 +1,692 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//*************************************************************************
+//*************************************************************************
+//**********************************************************************
+//
+// $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/MePlatformPolicy/MePlatformPolicy.c 14 5/14/14 10:33p Tristinchou $
+//
+// $Revision: 14 $
+//
+// $Date: 5/14/14 10:33p $
+//
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/MePlatformPolicy/MePlatformPolicy.c $
+//
+// 14 5/14/14 10:33p Tristinchou
+// [TAG] EIPNone
+// [Category] Improvement
+// [Description] Load ICC library while using ME 9.1
+//
+// 13 5/14/14 9:59p Tristinchou
+// [TAG] EIP167030
+// [Category] Improvement
+// [Description] Remove the variable runtime attribute and keep original
+// attributes.
+//
+// 12 5/13/14 4:02a Tristinchou
+// [TAG] EIPNone
+// [Category] Improvement
+// [Description] Fix BPF version check error while using MEBX 9.1
+//
+// 11 7/11/13 5:50a Klzhan
+// [TAG] EIP128534
+// [Category] Improvement
+// [Description] Restore Logo after information shows
+//
+// 10 6/21/13 3:07a Klzhan
+// [TAG] EIP127189
+// [Category] Spec Update
+// [Severity] Important
+// [Description] Update ME RC 1.60
+//
+// 9 5/13/13 2:39a Klzhan
+// [TAG] EIPNone
+// [Category] Improvement
+// [Description] Fix build error when ICC_OVERCLOCKING_SUPPORT disabled.
+//
+// 8 12/07/12 5:12a Klzhan
+// [TAG] EIP107613
+// [Category] Improvement
+// [Description] Skip Send HECI protocol when Boot on Flash Update
+//
+// 7 12/04/12 5:56a Klzhan
+// [TAG] EIP107309
+// [Category] New Feature
+// [Description] Support ICC library for ME 9.5
+// [Files] MePlatformPolicy.c
+// MePlatformPolicy.h
+// MePlatformPolicy.sdl
+// MePlatformPolicy.mak
+// MePlatformPolicy.cif
+//
+// 6 9/27/12 4:49a Klzhan
+// [TAG] EIP102254
+// [Category] Spec Update
+// [Severity] Important
+// [Description] Update ME RC 0.7
+//
+// 5 7/02/12 11:34p Klzhan
+// [TAG] EIP94113
+// [Category] Spec Update
+// [Severity] Important
+// [Description] Update ME RC 0.6
+//
+// 4 5/14/12 4:40a Klzhan
+// [TAG] EIP89952
+// [Category] Spec Update
+// [Severity] Important
+// [Description] Update ME RC 0.56
+// [Files] MePlatformPolicy.c
+// MePlatformPolicy.h
+// MePlatformPolicy.sdl
+// MePlatformPolicy.mak
+// MePlatformPolicy.cif
+//
+// 3 4/23/12 11:13p Klzhan
+//
+// 2 4/03/12 8:11a Klzhan
+// [TAG] EIP86914
+// [Category] Spec Update
+// [Severity] Important
+// [Description] Update ME RC.
+//
+// 1 2/08/12 1:04a Klzhan
+// Initial Check in
+//
+// 10 9/26/11 5:46a Klzhan
+// [TAG] EIP70516
+// [Category] Spec Update
+// [Severity] Important
+// [Description] Update ME 8.0 RC 0.8
+//
+// 9 9/15/11 6:36a Klzhan
+// [TAG] EIP65738
+// [Category] Improvement
+// [Description] Disable SOL and IDER when AMT is disabled.
+//
+// 8 9/07/11 4:49a Klzhan
+// Get thermal reporting data from HOB.
+//
+// 7 7/26/11 8:25a Klzhan
+// [TAG] EIP64542
+// [Category] Improvement
+// [Description] Replace Getvariable by GetSBSetupData
+//
+// 6 7/26/11 6:33a Klzhan
+// Always_MeFwDowngrade
+//
+// 5 7/11/11 4:41a Klzhan
+// Fix system can't boot on ME FW 1076.
+//
+// 4 7/08/11 9:14a Klzhan
+// Restore to older ME Platform Policy module part.
+// To fix system hangs with other modules.
+//
+// 3 7/08/11 4:20a Klzhan
+// [TAG] EIP64189
+// [Category] Spec Update
+// [Severity] Important
+// [Description] Update ME RC to 0.7
+// [Files] MePlatformPolicy.c
+// MePlatformPolicy.h
+// MePlatformPolicy.sdl
+// MePlatformPolicy.mak
+// MePlatformPolicy.cif
+//
+// 2 4/18/11 9:47a Klzhan
+// Improvement : Move ME FW downgrade related code to ME platform policy.
+// Improvement : Update ME platform policy revision to 7.
+//
+// 1 2/25/11 1:41a Klzhan
+// Initial Check-in
+//
+// 1 12/03/10 5:09a Klzhan
+// Initial Check-in.
+//
+//
+//**********************************************************************
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: MePlatformPolicy.c
+//
+// Description:
+//
+//----------------------------------------------------------------------------
+//<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) 2008 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:
+
+ MePlatformPolicy.c
+
+Abstract:
+
+
+--*/
+#include "EdkIIGlueDxe.h"
+#include "MePlatformPolicy.h"
+#include "MeSetup.h"
+#include <SetupDataDefinition.h>
+#include "MeChipsetLib.h"
+#include <token.h>
+#if IccOverClocking_SUPPORT
+#include "IccProtocol.h"
+#endif
+DXE_ME_POLICY_PROTOCOL mDxePlatformMePolicy = { 0 };
+SETUP_DATA *gSetupData = NULL;
+EFI_MEBX_API_ENTRY_POINT HookedMebxEntryPoint;
+
+#define ME_INFO_SETUP_GUID \
+ {0x78259433, 0x7B6D, 0x4DB3, 0x9A, 0xE8, 0x36, 0xC4, 0xC2, 0xC3, 0xA1, 0x7D}
+
+EFI_GUID gSetupGuid = SETUP_GUID;
+EFI_GUID gEfiFirmwareVolumeProtocolGuid = EFI_FIRMWARE_VOLUME_PROTOCOL_GUID;
+EFI_GUID gMeSetupInfoGuid = ME_INFO_SETUP_GUID;
+EFI_GUID gEfiMebxProtocolGuid = INTEL_MEBX_PROTOCOL_GUID;
+
+//
+// Driver entry point
+//
+EFI_DRIVER_ENTRY_POINT (MePlatformPolicyEntryPoint)
+
+//
+// Module Global Variable
+//
+//TR_CONFIG mTrConfig = { 0 };
+
+//
+// TS DIMM thermal polling Smbus Address.
+// This is platform specific.
+//
+EFI_STATUS
+HookMebxEntry (
+ IN UINT32 BiosParams,
+ OUT UINT32 *MebxReturnValue
+)
+{
+ MEBX_BPF *MebxBpf = NULL;
+ ME_BIOS_EXTENSION_SETUP *MebxSetup = NULL;
+
+ MebxBpf = (MEBX_BPF*)BiosParams;
+ MebxSetup = (ME_BIOS_EXTENSION_SETUP*)MebxBpf->MeBiosSyncDataPtr;
+
+ //Modify the BPF version before MEBX entry
+ MebxBpf->BpfVersion = 0xA000;
+ MebxSetup->InterfaceVersion = 0xA000;
+
+ return HookedMebxEntryPoint( BiosParams, MebxReturnValue);
+}
+
+VOID
+MebxProtocolCallBack (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+)
+{
+ EFI_STATUS Status;
+ EFI_MEBX_PROTOCOL *MebxProtocol = NULL;
+
+ Status = gBS->LocateProtocol(
+ &gEfiMebxProtocolGuid,
+ NULL,
+ &MebxProtocol );
+ if( EFI_ERROR(Status) )
+ return;
+
+ //If MEBX version is 10, hook the entry to modify the BPF version
+ if( (MebxProtocol->MebxVersion.Major == 10) )
+ {
+ HookedMebxEntryPoint = MebxProtocol->CoreMebxEntry;
+ MebxProtocol->CoreMebxEntry = HookMebxEntry;
+ }
+
+ gBS->CloseEvent( Event );
+}
+
+UINT8 mTsDimmSmbusAddress[] = { 0x30, 0x34 };
+EFI_STATUS
+DummyHeciSendACK(
+ IN OUT UINT32 *Message,
+ IN OUT UINT32 Length,
+ IN OUT UINT32 *RecLength,
+ IN UINT8 HostAddress,
+ IN UINT8 MEAddress
+ )
+{
+ return EFI_SUCCESS;
+}
+//
+// Function implementations
+//
+EFI_STATUS
+EFIAPI
+MePlatformPolicyEntryPoint (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+)
+/*++
+
+Routine Description:
+
+ Entry point for the Management Engine Driver.
+
+Arguments:
+
+ ImageHandle Image handle of this driver.
+ SystemTable Global system service table.
+
+Returns:
+
+ EFI_SUCCESS Initialization complete.
+ EFI_UNSUPPORTED The chipset is unsupported by this driver.
+ EFI_OUT_OF_RESOURCES Do not have enough resources to initialize the driver.
+ EFI_DEVICE_ERROR Device error, driver exits abnormally.
+
+--*/
+{
+ EFI_STATUS Status;
+ SETUP_DATA SetupData;
+ UINT32 SetupVarAttr;
+ UINTN SetupVariableSize;
+ EFI_HECI_PROTOCOL *Heci;
+ UINT32 MeMode = ME_MODE_FAILED;
+ ME_INFO_SETUP_DATA MeInfoSetupData;
+ UINT8 Index = 0;
+ DXE_MBP_DATA_PROTOCOL *mBIOSPayLoad;
+ EFI_GUID gEfiHeciProtocolGuid = HECI_PROTOCOL_GUID;
+ EFI_GUID gDimmTsInfoGuid = DIMM_TS_INFO_GUID;
+ EFI_BOOT_MODE BootMode;
+ EFI_PEI_HOB_POINTERS HobList;
+ EFI_EVENT MebxProtocolEvent;
+ VOID *MebxProtocolReg = NULL;
+
+ EfiInitializeDriverLib (ImageHandle, SystemTable);
+ Status = gBS->LocateProtocol (
+ &gEfiHeciProtocolGuid,
+ NULL,
+ &Heci
+ );
+
+ if (EFI_ERROR(Status)) return EFI_SUCCESS;
+
+ EfiGetSystemConfigurationTable (&gEfiHobListGuid, &HobList.Raw);
+ if (HobList.Header->HobType != EFI_HOB_TYPE_HANDOFF) {
+ DEBUG ((EFI_D_ERROR, "(Wdt) Handoff Hob missing!\n"));
+ return EFI_NOT_FOUND;
+ }
+
+ BootMode = HobList.HandoffInformationTable->BootMode;
+
+ if((BootMode == BOOT_ON_FLASH_UPDATE) ||
+ (BootMode == BOOT_ASSUMING_NO_CONFIGURATION_CHANGES))
+ {
+ // Install Dummy HECI protocol.
+ Heci->SendwACK = DummyHeciSendACK;
+ }
+
+
+ Status = Heci->GetMeMode (&MeMode);
+ //
+ // Default ME information for SETUP
+ //
+ MeInfoSetupData.MeFirmwareInfo = MeMode;
+ MeInfoSetupData.MeMajor = 0;
+ MeInfoSetupData.MeMinor = 0;
+ MeInfoSetupData.MeHotFix = 0;
+ MeInfoSetupData.MeBuildNo = 0;
+ //
+ // ME DXE Policy Init
+ //
+ mDxePlatformMePolicy.Revision = DXE_PLATFORM_ME_POLICY_PROTOCOL_REVISION_2;
+
+ SetupVarAttr = 0;
+ SetupVariableSize = sizeof(SETUP_DATA);
+ Status = gRT->GetVariable (
+ L"Setup",
+ &gSetupGuid,
+ &SetupVarAttr,
+ &SetupVariableSize,
+ &SetupData
+ );
+ if(EFI_ERROR(Status))
+ {
+ mDxePlatformMePolicy.MeConfig.MeFwDownGrade = 0;
+ SetupVarAttr = EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_NON_VOLATILE;
+ }
+
+ if(!EFI_ERROR(Status))
+ {
+ //
+ // Initialzie the Me Configuration
+ //
+ mDxePlatformMePolicy.MeConfig.EndOfPostEnabled = 1;
+ mDxePlatformMePolicy.MeConfig.MeLocalFwUpdEnabled = 0;
+ mDxePlatformMePolicy.MeConfig.MdesForBiosState = SetupData.MDESForBiosState;
+
+ //
+ // Please don't change the default value of EndOfPostDone,
+ // the value will be update to 1 after the moment EOP message should be sent
+ //
+ mDxePlatformMePolicy.MeConfig.EndOfPostDone = 0;
+
+
+ }else
+ {
+ // Default
+ mDxePlatformMePolicy.MeConfig.EndOfPostEnabled = 1;
+ mDxePlatformMePolicy.MeConfig.MeLocalFwUpdEnabled = 0;
+ }
+
+ //
+ // Thermal reporting policy is based on strap settings
+ //
+ MmioAndThenOr32 (
+ PCH_RCRB_BASE + R_PCH_SPI_FDOC,
+ (UINT32) (~(B_PCH_SPI_FDOC_FDSS_MASK | B_PCH_SPI_FDOC_FDSI_MASK)),
+ (UINT32) (V_PCH_SPI_FDOC_FDSS_PCHS | R_PCH_SPI_STRP15)
+ );
+ mDxePlatformMePolicy.MeReportError = ShowMeReportError;
+
+// Debug UpdateDxeMePlatformPolicy (&mMeDxePlatformPolicy);
+ mDxePlatformMePolicy.MeConfig.MeFwDownGrade = SetupData.MeFwDowngrade;
+ //
+ // If Me Fw is in ME_MODE_SECOVER, we will clear "Simple Firmware Downgrade" BIOS setup options
+ //
+ if (MeMode == ME_MODE_SECOVER) {
+ SetupData.MeFwDowngrade = 0;
+ }
+ Status = gBS->LocateProtocol (
+ &gMeBiosPayloadDataProtocolGuid,
+ NULL,
+ &mBIOSPayLoad
+ );
+ if(!EFI_ERROR(Status))
+ {
+ SetupData.MeImageType = (UINT8)mBIOSPayLoad->MeBiosPayload.FwPlatType.RuleData.Fields.IntelMeFwImageType;
+ SetupData.MeFirmwareInfo = MeMode;
+
+ MeInfoSetupData.MeMajor = mBIOSPayLoad->MeBiosPayload.FwVersionName.MajorVersion;
+ MeInfoSetupData.MeMinor = mBIOSPayLoad->MeBiosPayload.FwVersionName.MinorVersion;
+ MeInfoSetupData.MeHotFix = mBIOSPayLoad->MeBiosPayload.FwVersionName.HotfixVersion;
+ MeInfoSetupData.MeBuildNo = mBIOSPayLoad->MeBiosPayload.FwVersionName.BuildVersion;
+ }
+#if IccOverClocking_SUPPORT
+ if((MeInfoSetupData.MeMajor == 9) && (MeInfoSetupData.MeMinor == 5))
+ {
+ EFI_GUID gIcc95Guid = ICC_9_5_GUID;
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &ImageHandle,
+ &gIcc95Guid,
+ NULL,
+ NULL
+ );
+ }
+
+ if( (MeInfoSetupData.MeMajor == 9) &&
+ ((MeInfoSetupData.MeMinor == 0) || (MeInfoSetupData.MeMinor == 1)) )
+ {
+ EFI_GUID gIcc90Guid = ICC_9_0_GUID;
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &ImageHandle,
+ &gIcc90Guid,
+ NULL,
+ NULL
+ );
+ }
+#endif
+ Status = gRT->SetVariable (
+ L"MeInfoSetup",
+ &gMeSetupInfoGuid,
+ EFI_VARIABLE_BOOTSERVICE_ACCESS,
+ sizeof(MeInfoSetupData),
+ &MeInfoSetupData
+ );
+
+ Status = gRT->SetVariable (
+ L"Setup",
+ &gSetupGuid,
+ SetupVarAttr,
+ sizeof(SETUP_DATA),
+ &SetupData
+ );
+
+ //Create the event for MEBX_PROTOCOL
+ Status = gBS->CreateEvent(
+ EFI_EVENT_NOTIFY_SIGNAL,
+ EFI_TPL_NOTIFY,
+ MebxProtocolCallBack,
+ NULL,
+ &MebxProtocolEvent );
+
+ Status = gBS->RegisterProtocolNotify(
+ &gEfiMebxProtocolGuid,
+ MebxProtocolEvent,
+ &MebxProtocolReg );
+
+ //
+ // Install protocol to to allow access to this Policy.
+ //
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &ImageHandle,
+ &gDxePlatformMePolicyGuid,
+ &mDxePlatformMePolicy,
+ NULL
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ return Status;
+}
+#include EFI_PROTOCOL_CONSUMER (ConsoleControl)
+#include EFI_PROTOCOL_CONSUMER (GraphicsOutput)
+EFI_CONSOLE_CONTROL_PROTOCOL *ConsoleControl;
+EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
+EFI_CONSOLE_CONTROL_SCREEN_MODE ScreenMode;
+UINTN UgaBltSize = 0;
+EFI_UGA_PIXEL *UgaBlt = NULL;
+VOID
+GraphicsSave
+(
+ VOID
+)
+{
+ EFI_STATUS
+ Status = gBS->LocateProtocol( &gEfiConsoleControlProtocolGuid, NULL, &ConsoleControl);
+
+ if(EFI_ERROR(Status))
+ {
+ ConsoleControl = NULL;
+ return;
+ }
+
+ Status = ConsoleControl->GetMode(ConsoleControl, &ScreenMode, NULL, NULL);
+ if(ScreenMode == EfiConsoleControlScreenText)
+ {
+ ConsoleControl = NULL;
+ return;
+ }
+
+ Status = gBS->LocateProtocol( &gEfiGraphicsOutputProtocolGuid, NULL, &GraphicsOutput);
+ if(EFI_ERROR(Status))
+ {
+ GraphicsOutput = NULL;
+ return;
+ }
+ UgaBltSize = GraphicsOutput->Mode->Info[GraphicsOutput->Mode->Mode].HorizontalResolution *
+ GraphicsOutput->Mode->Info[GraphicsOutput->Mode->Mode].VerticalResolution *
+ sizeof(EFI_UGA_PIXEL);
+
+ UgaBlt = AllocateZeroPool (UgaBltSize);
+
+ Status = GraphicsOutput->Blt(
+ GraphicsOutput,
+ UgaBlt,
+ EfiBltVideoToBltBuffer,
+ 0, 0,
+ 0, 0,
+ GraphicsOutput->Mode->Info->HorizontalResolution,
+ GraphicsOutput->Mode->Info->VerticalResolution,
+ 0);
+
+ Status = ConsoleControl->SetMode( ConsoleControl, EfiConsoleControlScreenText );
+}
+
+VOID
+GraphicsRestore
+(
+ VOID
+)
+{
+ if(!ConsoleControl)
+ return;
+
+ ConsoleControl->SetMode( ConsoleControl, EfiConsoleControlScreenGraphics );
+
+ if(!GraphicsOutput)
+ return;
+
+ GraphicsOutput->Blt(
+ GraphicsOutput,
+ UgaBlt,
+ EfiBltBufferToVideo,
+ 0, 0,
+ 0, 0,
+ GraphicsOutput->Mode->Info->HorizontalResolution,
+ GraphicsOutput->Mode->Info->VerticalResolution,
+ 0);
+
+}
+VOID
+ShowMeReportError (
+ IN ME_ERROR_MSG_ID MsgId
+ )
+/*++
+
+Routine Description:
+
+ Show Me Error message.
+
+Arguments:
+
+ MsgId Me error message ID.
+
+Returns:
+
+ None.
+
+--*/
+{
+ UINTN MsgDelay;
+
+ MsgDelay = HECI_MSG_DELAY;
+ GraphicsSave();
+ gST->ConOut->ClearScreen (gST->ConOut);
+
+ switch (MsgId) {
+ case MSG_EOP_ERROR:
+ gST->ConOut->OutputString (gST->ConOut, L"Error sending End Of Post message to ME, System HALT!\n");
+ break;
+
+ case MSG_ME_FW_UPDATE_FAILED:
+ gST->ConOut->OutputString (gST->ConOut, L"ME FW Update Failed, please try again!\n");
+ break;
+
+ case MSG_ASF_BOOT_DISK_MISSING:
+ gST->ConOut->OutputString (gST->ConOut, L"Boot disk missing, please insert boot disk and press ENTER\r\n");
+ break;
+
+ case MSG_KVM_TIMES_UP:
+ gST->ConOut->OutputString (gST->ConOut, L"Error!! Times up and the KVM session was cancelled!!");
+ break;
+
+ case MSG_KVM_REJECTED:
+ gST->ConOut->OutputString (gST->ConOut, L"Error!! The request has rejected and the KVM session was cancelled!!");
+ break;
+
+ case MSG_HMRFPO_LOCK_FAILURE:
+ gST->ConOut->OutputString (gST->ConOut, L"(A7) Me FW Downgrade - Request MeSpiLock Failed\n");
+ break;
+
+ case MSG_HMRFPO_UNLOCK_FAILURE:
+ gST->ConOut->OutputString (gST->ConOut, L"(A7) Me FW Downgrade - Request MeSpiEnable Failed\n");
+ break;
+
+ case MSG_ME_FW_UPDATE_WAIT:
+ gST->ConOut->OutputString (
+ gST->ConOut,
+ L"Intel(R) Firmware Update is in progress. It may take up to 90 seconds. Please wait.\n"
+ );
+ break;
+
+ case MSG_ILLEGAL_CPU_PLUGGED_IN:
+ gST->ConOut->OutputString (
+ gST->ConOut,
+ L"\n\n\rAn unsupported CPU/PCH configuration has been identified.\n"
+ );
+ gST->ConOut->OutputString (
+ gST->ConOut,
+ L"\rPlease refer to the Haswell Platform Validation Matrix\n\rfor supported CPU/PCH combinations."
+ );
+ break;
+
+ case MSG_KVM_WAIT:
+ gST->ConOut->OutputString (gST->ConOut, L"Waiting Up to 8 Minutes For KVM FW.....");
+ break;
+
+ case MSG_PLAT_DISABLE_WAIT:
+ gST->ConOut->OutputString (gST->ConOut, L"WARNING! Firmware encountered errors and will reboot the platform in 30 minutes.");
+ MsgDelay = 5 * HECI_MSG_DELAY;
+ break;
+
+ default:
+ DEBUG ((EFI_D_ERROR, "This Message Id hasn't been defined yet, MsgId = %x\n", MsgId));
+ break;
+ }
+
+ gBS->Stall (MsgDelay);
+ GraphicsRestore();
+}
+
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//*************************************************************************
+//*************************************************************************
diff --git a/Board/EM/MeWrapper/MePlatformPolicy/MePlatformPolicy.cif b/Board/EM/MeWrapper/MePlatformPolicy/MePlatformPolicy.cif
new file mode 100644
index 0000000..8db83d4
--- /dev/null
+++ b/Board/EM/MeWrapper/MePlatformPolicy/MePlatformPolicy.cif
@@ -0,0 +1,13 @@
+<component>
+ name = "MePlatformPolicy"
+ category = ModulePart
+ LocalRoot = "Board\EM\MeWrapper\MePlatformPolicy"
+ RefName = "MePlatformPolicy"
+[files]
+"MePlatformPolicy.c"
+"MePlatformPolicy.h"
+"MePlatformPolicy.sdl"
+"MePlatformPolicy.mak"
+[parts]
+"MePeiPolicyInit"
+<endComponent>
diff --git a/Board/EM/MeWrapper/MePlatformPolicy/MePlatformPolicy.h b/Board/EM/MeWrapper/MePlatformPolicy/MePlatformPolicy.h
new file mode 100644
index 0000000..f90a135
--- /dev/null
+++ b/Board/EM/MeWrapper/MePlatformPolicy/MePlatformPolicy.h
@@ -0,0 +1,232 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//*************************************************************************
+//*************************************************************************
+//**********************************************************************
+//
+// $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/MePlatformPolicy/MePlatformPolicy.h 3 5/13/14 4:02a Tristinchou $
+//
+// $Revision: 3 $
+//
+// $Date: 5/13/14 4:02a $
+//
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/MePlatformPolicy/MePlatformPolicy.h $
+//
+// 3 5/13/14 4:02a Tristinchou
+// [TAG] EIPNone
+// [Category] Improvement
+// [Description] Fix BPF version check error while using MEBX 9.1
+//
+// 2 5/14/12 4:40a Klzhan
+// [TAG] EIP89952
+// [Category] Spec Update
+// [Severity] Important
+// [Description] Update ME RC 0.56
+// [Files] MePlatformPolicy.c
+// MePlatformPolicy.h
+// MePlatformPolicy.sdl
+// MePlatformPolicy.mak
+// MePlatformPolicy.cif
+//
+// 1 2/08/12 1:04a Klzhan
+// Initial Check in
+//
+// 5 9/07/11 4:49a Klzhan
+// Get thermal reporting data from HOB.
+//
+// 4 7/11/11 4:41a Klzhan
+// Fix system can't boot on ME FW 1076.
+//
+// 3 7/08/11 9:14a Klzhan
+// Restore to older ME Platform Policy module part.
+// To fix system hangs with other modules.
+//
+// 2 7/08/11 4:20a Klzhan
+// [TAG] EIP64189
+// [Category] Spec Update
+// [Severity] Important
+// [Description] Update ME RC to 0.7
+// [Files] MePlatformPolicy.c
+// MePlatformPolicy.h
+// MePlatformPolicy.sdl
+// MePlatformPolicy.mak
+// MePlatformPolicy.cif
+//
+// 1 2/25/11 1:41a Klzhan
+// Initial Check-in
+//
+// 1 12/03/10 5:09a Klzhan
+// Initial Check-in.
+//
+//
+//**********************************************************************
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: MePlatformPolicy.h
+//
+// Description:
+//
+//----------------------------------------------------------------------------
+//<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) 2008 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:
+
+ MePlatformPolicy.h
+
+Abstract:
+
+
+--*/
+#ifndef _DXE_ME_PLATFORM_POLICY_H_
+#define _DXE_ME_PLATFORM_POLICY_H_
+
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#endif
+
+#include EFI_PROTOCOL_PRODUCER (MEPlatformPolicy)
+#include "PchAccess.h"
+#include "token.h"
+#include "MeLib.h"
+#include "HeciRegs.h"
+#include "MeChipset.h"
+// Debug #include "MePlatformPolicyUpdateDxeLib.h"
+
+#include EFI_PROTOCOL_DEFINITION (PciRootBridgeIo)
+#include EFI_PROTOCOL_CONSUMER (MePlatformPolicy)
+#include EFI_PROTOCOL_CONSUMER (MebxProtocol)
+#include EFI_GUID_DEFINITION (MeBiosExtensionSetup)
+#if EFI_SPECIFICATION_VERSION<=0x20000
+#include EFI_PROTOCOL_DEFINITION (Hii)
+#include EFI_PROTOCOL_DEFINITION (FormCallBack)
+#endif
+#define EFI_DRIVER_ENTRY_POINT(x)
+
+#define DIMM_TS_INFO_GUID \
+ { \
+ 0xce673a28, 0x800d, 0x4b4a, 0x83, 0x16, 0x26, 0x61, 0xf9, 0xb3, 0xd9, 0xc6 \
+ }
+
+#define HECI_MSG_DELAY 2000000 // show warning msg and stay for 2 seconds.
+#ifndef GUID_VARIABLE_DECLARATION
+#define GUID_VARIABLE_DECLARATION(Variable, Guid) extern EFI_GUID Variable
+#endif
+typedef struct{
+ UINT8 MeFirmwareInfo;
+ UINT32 MeMajor;
+ UINT32 MeMinor;
+ UINT32 MeHotFix;
+ UINT32 MeBuildNo;
+} ME_INFO_SETUP_DATA;
+#ifndef TS_DIMM1_SMBUS_ADDRESS
+#define TS_DIMM1_SMBUS_ADDRESS 0x30
+#endif
+
+#ifndef TS_DIMM2_SMBUS_ADDRESS
+#define TS_DIMM2_SMBUS_ADDRESS 0x32
+#endif
+
+#ifndef TS_DIMM3_SMBUS_ADDRESS
+#define TS_DIMM3_SMBUS_ADDRESS 0x34
+#endif
+
+#ifndef TS_DIMM4_SMBUS_ADDRESS
+#define TS_DIMM4_SMBUS_ADDRESS 0x36
+#endif
+
+#define SETUP_GUID { 0xEC87D643, 0xEBA4, 0x4BB5, 0xA1, 0xE5, 0x3F, 0x3E, 0x36, 0xB2, 0x0D, 0xA9 }
+
+typedef struct _MEBX_DEBUG_FLAGS_ {
+ UINT16 Port80 : 1; ///< Port 80h
+ UINT16 Rsvd : 15; ///< Reserved
+} MEBX_DEBUG_FLAGS;
+
+typedef struct _MEBX_OEM_RESOLUTION_SETTINGS_ {
+ UINT16 MebxNonUiTextMode : 4;
+ UINT16 MebxUiTextMode : 4;
+ UINT16 MebxGraphicsMode : 4;
+ UINT16 Rsvd : 4;
+} MEBX_OEM_RESOLUTION_SETTINGS;
+
+typedef struct {
+ UINT16 BpfVersion;
+ UINT8 CpuReplacementTimeout;
+ UINT8 Reserved[7];
+ UINT8 ActiveRemoteAssistanceProcess;
+ UINT8 CiraTimeout;
+ UINT16 OemFlags;
+ MEBX_DEBUG_FLAGS MebxDebugFlags;
+ UINT32 MeBiosSyncDataPtr;
+ UINT32 UsbKeyDataStructurePtr;
+ MEBX_OEM_RESOLUTION_SETTINGS OemResolutionSettings;
+ UINT8 Reserved3[0x2E];
+} MEBX_BPF;
+
+VOID
+EFIAPI
+ShowMeReportError (
+ IN ME_ERROR_MSG_ID MsgId
+ )
+/*++
+
+Routine Description:
+
+ Show Me Error message.
+
+Arguments:
+
+ MsgId Me error message ID.
+
+Returns:
+
+ None.
+
+--*/
+;
+#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/MePlatformPolicy/MePlatformPolicy.mak b/Board/EM/MeWrapper/MePlatformPolicy/MePlatformPolicy.mak
new file mode 100644
index 0000000..21937b0
--- /dev/null
+++ b/Board/EM/MeWrapper/MePlatformPolicy/MePlatformPolicy.mak
@@ -0,0 +1,139 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2010, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
+#**********************************************************************
+#
+# $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/MePlatformPolicy/MePlatformPolicy.mak 4 12/04/12 5:57a Klzhan $
+#
+# $Revision: 4 $
+#
+# $Date: 12/04/12 5:57a $
+#
+#**********************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/MePlatformPolicy/MePlatformPolicy.mak $
+#
+# 4 12/04/12 5:57a Klzhan
+# [TAG] EIP107309
+# [Category] New Feature
+# [Description] Support ICC library for ME 9.5
+# [Files] MePlatformPolicy.c
+# MePlatformPolicy.h
+# MePlatformPolicy.sdl
+# MePlatformPolicy.mak
+# MePlatformPolicy.cif
+#
+# 3 4/23/12 11:13p Klzhan
+#
+# 2 2/23/12 8:56a Klzhan
+# Support New EDK
+#
+# 1 2/08/12 1:04a Klzhan
+# Initial Check in
+#
+# 5 9/07/11 4:49a Klzhan
+# Get thermal reporting data from HOB.
+#
+# 4 7/26/11 8:23a Klzhan
+# [TAG] EIP64542
+# [Category] Improvement
+# [Description] Replace GetSbSetupData.
+#
+# 3 7/11/11 4:41a Klzhan
+# Fix system can't boot on ME FW 1076.
+#
+# 2 7/08/11 4:20a Klzhan
+# [TAG] EIP64189
+# [Category] Spec Update
+# [Severity] Important
+# [Description] Update ME RC to 0.7
+# [Files] MePlatformPolicy.c
+# MePlatformPolicy.h
+# MePlatformPolicy.sdl
+# MePlatformPolicy.mak
+# MePlatformPolicy.cif
+#
+# 1 2/25/11 1:41a Klzhan
+# Initial Check-in
+#
+# 1 12/03/10 5:09a Klzhan
+# Initial Check-in.
+#
+#
+#**********************************************************************
+#<AMI_FHDR_START>
+#----------------------------------------------------------------------------
+#
+# Name: MePlatformPolicy.mak
+#
+# Description:
+#
+#----------------------------------------------------------------------------
+#<AMI_FHDR_END>
+All : MePlatformPolicy
+
+MePlatformPolicy : $(BUILD_DIR)\MePlatformPolicy.mak MePlatformPolicyBin
+
+$(BUILD_DIR)\MePlatformPolicy.mak : $(MePlatformPolicy_DIR)\$(@B).cif $(MePlatformPolicy_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(MePlatformPolicy_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+MePlatformPolicy_INCLUDES=\
+ $(EdkIIGlueLib_INCLUDES)\
+ $(ME_INCLUDES) \
+ $(MISCFRAMEWORK_INCLUDES) \
+ $(NB_INCLUDES)\
+ $(SB_INCLUDES)\
+ /I$(PROJECT_DIR)\
+ /IInclude\
+ /I$(IccOverClocking_DIR)\
+ /I$(INTEL_COUGAR_POINT_INCLUDE_DIR)
+
+MePlatformPolicy_LIBS=\
+ $(EdkIIGlueBaseLib_LIB)\
+ $(EFIDRIVERLIB)\
+ $(MeProtocolLib_LIB)\
+ $(MeLibDxe_LIB)\
+ $(MeChipsetDxeLib_LIB)\
+ $(EdkIIGlueDxeMemoryAllocationLib_LIB)\
+ $(EdkIIGlueBaseLib_LIB)\
+!IF "$(x64_BUILD)"=="1"
+ $(EdkIIGlueBaseLibX64_LIB)\
+!ELSE
+ $(EdkIIGlueBaseLibIA32_LIB)\
+!ENDIF
+ $(EdkIIGlueDxeReportStatusCodeLib_LIB)\
+ $(EdkIIGlueDxeDebugLibReportStatusCode_LIB)\
+
+MePlatformPolicyBin : $(MePlatformPolicy_LIBS)
+ $(MAKE) /$(MAKEFLAGS) $(EDK_DEFAULTS)\
+ /f $(BUILD_DIR)\MePlatformPolicy.mak all\
+ GUID=BA67550C-3628-4137-A53E-42660E081604\
+ "MY_INCLUDES = $(MePlatformPolicy_INCLUDES)" \
+ ENTRY_POINT=MePlatformPolicyEntryPoint\
+ TYPE=BS_DRIVER\
+ COMPRESS=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/MePlatformPolicy/MePlatformPolicy.sdl b/Board/EM/MeWrapper/MePlatformPolicy/MePlatformPolicy.sdl
new file mode 100644
index 0000000..4588fa3
--- /dev/null
+++ b/Board/EM/MeWrapper/MePlatformPolicy/MePlatformPolicy.sdl
@@ -0,0 +1,24 @@
+TOKEN
+ Name = "MePlatformPolicy_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable MePlatformPolicy support in Project"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+End
+
+PATH
+ Name = "MePlatformPolicy_DIR"
+End
+
+MODULE
+ Help = "Includes MePlatformPolicy.mak to Project"
+ File = "MePlatformPolicy.mak"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\MePlatformPolicy.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End
diff --git a/Board/EM/MeWrapper/MePlatformPolicy/Pei/MePeiPolicyInit.c b/Board/EM/MeWrapper/MePlatformPolicy/Pei/MePeiPolicyInit.c
new file mode 100644
index 0000000..f534303
--- /dev/null
+++ b/Board/EM/MeWrapper/MePlatformPolicy/Pei/MePeiPolicyInit.c
@@ -0,0 +1,196 @@
+/*++
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+--*/
+
+/*++
+
+Copyright (c) 1999 - 2010 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+Module Name:
+
+ MePeiPolicyInit.c
+
+Abstract:
+
+ This file is SampleCode for Intel ME PEI Platform Policy initialzation.
+
+--*/
+#include <Token.h>
+#include "MePeiPolicyInit.h"
+#include <Ppi\PchPlatformPolicy\PchPlatformPolicy.h>
+#include <SetupDataDefinition.h>
+
+#define SETUP_GUID { 0xEC87D643, 0xEBA4, 0x4BB5, 0xA1, 0xE5, 0x3F, 0x3E, 0x36, 0xB2, 0x0D, 0xA9 }
+static EFI_GUID gSetupGuid = SETUP_GUID;
+
+
+//
+// Function implementations
+//
+VOID
+PrepareThermalHob (
+ IN EFI_PEI_SERVICES **PeiServices
+)
+{
+ EFI_STATUS Status;
+ EFI_HOB_GUID_TYPE *Hob;
+ UINT8 TsOnDimm[4];
+ EFI_GUID gPchPolicyPpiGuid = PCH_PLATFORM_POLICY_PPI_GUID;
+ PCH_PLATFORM_POLICY_PPI *PchPlatformPolicy;
+ EFI_GUID gDimmTsInfoGuid = DIMM_TS_INFO_GUID;
+
+ Status = (**PeiServices).LocatePpi (PeiServices, &gPchPolicyPpiGuid, 0,
+ NULL, (VOID **)&PchPlatformPolicy);
+
+ if(EFI_ERROR(Status))
+ {
+ return;
+ }
+ // Build the GUID'd HOB for DXE
+ Status = (*PeiServices)->CreateHob (
+ PeiServices,
+ EFI_HOB_TYPE_GUID_EXTENSION,
+ (UINT16) (sizeof (EFI_HOB_GUID_TYPE) + 4),
+ &Hob
+ );
+
+ if (EFI_ERROR (Status))return;
+
+ ((EFI_HOB_GUID_TYPE *)(Hob))->Name = gDimmTsInfoGuid;
+
+ Hob++;
+
+//- TsOnDimm[0] = PchPlatformPolicy->ThermalReportConfig->ThermalReportControl->Dimm1TempReadEnable;
+//- TsOnDimm[1] = PchPlatformPolicy->ThermalReportConfig->ThermalReportControl->Dimm2TempReadEnable;
+//- TsOnDimm[2] = PchPlatformPolicy->ThermalReportConfig->ThermalReportControl->Dimm3TempReadEnable;
+//- TsOnDimm[3] = PchPlatformPolicy->ThermalReportConfig->ThermalReportControl->Dimm4TempReadEnable;
+
+ GlueCopyMem (Hob, TsOnDimm, sizeof(TsOnDimm));
+
+}
+
+EFI_STATUS
+MePeiPolicyInitEntryPoint (
+ IN EFI_FFS_FILE_HEADER *FfsHeader,
+ IN EFI_PEI_SERVICES **PeiServices
+ )
+/*++
+
+Routine Description:
+
+ Initilize Intel ME PEI Platform Policy
+
+Arguments:
+
+ FfsHeader Pointer to Firmware File System file header.
+ PeiServices General purpose services available to every PEIM.
+
+Returns:
+
+ EFI_STATUS
+
+--*/
+{
+ EFI_STATUS Status;
+ PEI_ME_PLATFORM_POLICY_PPI *MePlatformPolicyPpi;
+ EFI_PEI_PPI_DESCRIPTOR *MePlatformPolicyPpiDesc;
+ EFI_PEI_READ_ONLY_VARIABLE_PPI *VariableServices;
+ UINTN VariableSize;
+ SETUP_DATA SetupData;
+
+ //
+ // Allocate descriptor and PPI structures
+ //
+ MePlatformPolicyPpi = (PEI_ME_PLATFORM_POLICY_PPI *) AllocateZeroPool (sizeof (PEI_ME_PLATFORM_POLICY_PPI));
+ ASSERT (MePlatformPolicyPpi != NULL);
+ if (MePlatformPolicyPpi == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ MePlatformPolicyPpiDesc = (EFI_PEI_PPI_DESCRIPTOR *) AllocateZeroPool (sizeof (EFI_PEI_PPI_DESCRIPTOR));
+ ASSERT (MePlatformPolicyPpiDesc != NULL);
+ if (MePlatformPolicyPpiDesc == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ //
+ // Locate Variable Ppi
+ //
+ Status = (*PeiServices)->LocatePpi(PeiServices,
+ &gPeiReadOnlyVariablePpiGuid,
+ 0,
+ NULL,
+ &VariableServices);
+
+ //
+ // Make sure we have a PPI, if not, just return.
+ //
+ if (!VariableServices) {
+ return EFI_UNSUPPORTED;
+ }
+ VariableSize = sizeof(SETUP_DATA);
+ //
+ // Get Setup Variable
+ //
+ Status = VariableServices->PeiGetVariable (
+ PeiServices,
+ L"Setup",
+ &gSetupGuid,
+ NULL,
+ &VariableSize,
+ &SetupData);
+
+ //
+ // Update Itnel PPT
+ //
+ if ( !EFI_ERROR(Status) ) {
+#if IntelPTT_SUPPORT
+ MePlatformPolicyPpi->FTpmSwitch = SetupData.FTpmSwitch;
+#else
+ MePlatformPolicyPpi->FTpmSwitch = 0;
+#endif
+ } else {
+ MePlatformPolicyPpi->FTpmSwitch = 0;
+ }
+
+ //
+ // Initialize the PPI
+ //
+ MePlatformPolicyPpiDesc->Flags = EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST;
+ MePlatformPolicyPpiDesc->Guid = &gPeiMePlatformPolicyPpiGuid;
+
+ //
+ // Update the REVISION number
+ //
+ MePlatformPolicyPpi->Revision = PEI_ME_PLATFORM_POLICY_PPI_REVISION_2;
+
+
+ //
+ // Initialize the Platform Configuration
+ //
+// Debug UpdatePeiMePlatformPolicy (PeiServices, MePlatformPolicyPpi);
+
+ MePlatformPolicyPpiDesc->Ppi = MePlatformPolicyPpi;
+
+ ///
+ /// TBD put initialize codes in here if needs
+ ///
+ ///
+ /// Install the ME PEI Platform Policy PPI
+ ///
+ Status = (**PeiServices).InstallPpi (PeiServices, MePlatformPolicyPpiDesc);
+ ASSERT_PEI_ERROR (PeiServices, Status);
+ DEBUG ((EFI_D_INFO, "ME PEI Platform Policy PPI Installed\n"));
+
+ return Status;
+}
diff --git a/Board/EM/MeWrapper/MePlatformPolicy/Pei/MePeiPolicyInit.cif b/Board/EM/MeWrapper/MePlatformPolicy/Pei/MePeiPolicyInit.cif
new file mode 100644
index 0000000..2c5d34f
--- /dev/null
+++ b/Board/EM/MeWrapper/MePlatformPolicy/Pei/MePeiPolicyInit.cif
@@ -0,0 +1,12 @@
+<component>
+ name = "MePeiPolicyInit"
+ category = ModulePart
+ LocalRoot = "Board\EM\MeWrapper\MePlatformPolicy\Pei"
+ RefName = "MePeiPolicyInit"
+[files]
+"MePeiPolicyInit.c"
+"MePeiPolicyInit.h"
+"MePeiPolicyInit.sdl"
+"MePeiPolicyInit.mak"
+"MePeiPolicyInit.dxs"
+<endComponent>
diff --git a/Board/EM/MeWrapper/MePlatformPolicy/Pei/MePeiPolicyInit.dxs b/Board/EM/MeWrapper/MePlatformPolicy/Pei/MePeiPolicyInit.dxs
new file mode 100644
index 0000000..01778d0
--- /dev/null
+++ b/Board/EM/MeWrapper/MePlatformPolicy/Pei/MePeiPolicyInit.dxs
@@ -0,0 +1,35 @@
+/*++
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+--*/
+
+/*++
+
+Copyright (c) 1999 - 2010 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+Module Name:
+
+ MePeiPolicyInit.dxs
+
+Abstract:
+
+ Dependency expression source file.
+
+--*/
+
+#include "EfiDepex.h"
+#include <Ppi\PchPlatformPolicy\PchPlatformPolicy.h>
+DEPENDENCY_START
+ PCH_PLATFORM_POLICY_PPI_GUID
+DEPENDENCY_END
+
+
diff --git a/Board/EM/MeWrapper/MePlatformPolicy/Pei/MePeiPolicyInit.h b/Board/EM/MeWrapper/MePlatformPolicy/Pei/MePeiPolicyInit.h
new file mode 100644
index 0000000..5d64667
--- /dev/null
+++ b/Board/EM/MeWrapper/MePlatformPolicy/Pei/MePeiPolicyInit.h
@@ -0,0 +1,64 @@
+/*++
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+--*/
+
+/*++
+
+Copyright (c) 1999 - 2010 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+Module Name:
+
+ MePeiPolicyInit.h
+
+Abstract:
+
+ Header file for the MePeiPolicyInit PEIM.
+
+--*/
+#ifndef _ME_PEI_PLATFORM_POLICY_H_
+#define _ME_PEI_PLATFORM_POLICY_H_
+
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGluePeim.h"
+#endif
+
+#include EFI_PPI_DEFINITION (MePlatformPolicyPei)
+// Debug #include "MePlatformPolicyUpdatePeiLib.h"
+#define DIMM_TS_INFO_GUID \
+ { \
+ 0xce673a28, 0x800d, 0x4b4a, 0x83, 0x16, 0x26, 0x61, 0xf9, 0xb3, 0xd9, 0xc6 \
+ }
+
+EFI_STATUS
+MePeiPolicyInitEntryPoint (
+ IN EFI_FFS_FILE_HEADER *FfsHeader,
+ IN EFI_PEI_SERVICES **PeiServices
+ )
+/*++
+
+Routine Description:
+
+ Initilize Intel ME PEI Platform Policy
+
+Arguments:
+
+ FfsHeader Pointer to Firmware File System file header.
+ PeiServices General purpose services available to every PEIM.
+
+Returns:
+
+ EFI_STATUS
+
+--*/
+;
+#endif
diff --git a/Board/EM/MeWrapper/MePlatformPolicy/Pei/MePeiPolicyInit.mak b/Board/EM/MeWrapper/MePlatformPolicy/Pei/MePeiPolicyInit.mak
new file mode 100644
index 0000000..4a097e0
--- /dev/null
+++ b/Board/EM/MeWrapper/MePlatformPolicy/Pei/MePeiPolicyInit.mak
@@ -0,0 +1,111 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2010, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
+
+#**********************************************************************
+# $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/MePlatformPolicy/MePeiPolicyInit/MePeiPolicyInit.mak 2 2/23/12 8:56a Klzhan $
+#
+# $Revision: 2 $
+#
+# $Date: 2/23/12 8:56a $
+#**********************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/MePlatformPolicy/MePeiPolicyInit/MePeiPolicyInit.mak $
+#
+# 2 2/23/12 8:56a Klzhan
+# Support New EDK
+#
+# 1 2/08/12 1:05a Klzhan
+# Initial Check in
+#
+# 1 3/29/11 4:53a Klzhan
+#
+# 1 2/25/11 1:45a Klzhan
+# Initial Check-in
+#
+# 1 12/03/10 5:11a Klzhan
+# Initial Check-in.
+#
+#
+#**********************************************************************
+#<AMI_FHDR_START>
+#
+# Name: AmtPlatformPolicy.mak
+#
+# Description:
+#
+#<AMI_FHDR_END>
+#**********************************************************************
+All : MEPeiPolicyInit
+
+MEPeiPolicyInit : $(BUILD_DIR)\MEPeiPolicyInit.mak MEPeiPolicyInitBin
+
+$(BUILD_DIR)\MEPeiPolicyInit.mak : $(MEPeiPlatformPolicy_DIR)\$(@B).cif $(MEPeiPlatformPolicy_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(MEPeiPlatformPolicy_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+MEPeiPlatformPolicy_INCLUDES=\
+ $(EDK_INCLUDES)\
+ $(EdkIIGlueLib_INCLUDES)\
+ $(ME_INCLUDES)\
+ $(INTEL_PCH_INCLUDES)
+
+
+MEPeiPlatformPolicy_DEFINES=$(MY_DEFINES)\
+ /D "__EDKII_GLUE_MODULE_ENTRY_POINT__=MePeiPolicyInitEntryPoint" \
+ /D __EDKII_GLUE_BASE_LIB__ \
+ /D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ /D __EDKII_GLUE_PEI_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ /D __EDKII_GLUE_PEI_REPORT_STATUS_CODE_LIB__ \
+ /D __EDKII_GLUE_PEI_SERVICES_LIB__ \
+ /D __EDKII_GLUE_PEI_MEMORY_ALLOCATION_LIB__ \
+
+MEPeiPlatformPolicy_LIBS=\
+ $(EDKPROTOCOLLIB)\
+ $(EdkIIGlueBaseLib_LIB)\
+ $(EdkIIGlueBaseLibIA32_LIB)\
+ $(EdkIIGlueBaseIoLibIntrinsic_LIB)\
+ $(EdkIIGluePeiDebugLibReportStatusCode_LIB)\
+ $(EdkIIGluePeiReportStatusCodeLib_LIB)\
+ $(EdkIIGluePeiServicesLib_LIB)\
+ $(MeLibPpi_LIB)\
+ $(EdkIIGluePeiHobLib_LIB)\
+ $(EdkIIGluePeiMemoryAllocationLib_LIB)\
+ $(PEILIB)
+
+MEPeiPolicyInitBin : $(MEPeiPlatformPolicy_LIBS)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\MEPeiPolicyInit.mak all\
+ GUID=12C67BE1-AD2E-4f13-A95F-6EDC2C4392DE\
+ "MY_INCLUDES = $(MEPeiPlatformPolicy_INCLUDES)" \
+ "MY_DEFINES=$(MEPeiPlatformPolicy_DEFINES)"\
+ ENTRY_POINT=MePeiPolicyInitEntryPoint\
+ TYPE=PEIM\
+ EDKIIModule=PEIM\
+ DEPEX1=$(MEPeiPlatformPolicy_DIR)\MEPeiPolicyInit.dxs\
+ DEPEX1_TYPE=EFI_SECTION_PEI_DEPEX\
+ COMPRESS=0
+
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2010, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/Board/EM/MeWrapper/MePlatformPolicy/Pei/MePeiPolicyInit.sdl b/Board/EM/MeWrapper/MePlatformPolicy/Pei/MePeiPolicyInit.sdl
new file mode 100644
index 0000000..ff7d692
--- /dev/null
+++ b/Board/EM/MeWrapper/MePlatformPolicy/Pei/MePeiPolicyInit.sdl
@@ -0,0 +1,25 @@
+TOKEN
+ Name = "MEPeiPlatformPolicy_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable AmtPlatformPolicy support in Project"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+End
+
+PATH
+ Name = "MEPeiPlatformPolicy_DIR"
+End
+
+MODULE
+ Help = "Includes AmtPlatformPolicy.mak to Project"
+ File = "MEPeiPolicyInit.mak"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\MEPeiPolicyInit.ffs"
+ Parent = "FV_BB"
+ InvokeOrder = AfterParent
+End
+
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
new file mode 100644
index 0000000..feae8ed
--- /dev/null
+++ b/Board/EM/MeWrapper/MeSetup/MeSetup.uni
Binary files differ
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
diff --git a/Board/EM/MeWrapper/MeWrapper.cif b/Board/EM/MeWrapper/MeWrapper.cif
new file mode 100644
index 0000000..a2ce9f5
--- /dev/null
+++ b/Board/EM/MeWrapper/MeWrapper.cif
@@ -0,0 +1,18 @@
+<component>
+ name = "MeWrapper"
+ category = ModulePart
+ LocalRoot = "Board\EM\MeWrapper"
+ RefName = "MeWrapper"
+[files]
+"MeWrapper.sdl"
+[parts]
+"MeSetup"
+"MePlatformPolicy"
+"MePciPlatform"
+"Icc"
+"Smbios131"
+"TdtWrapper"
+"MdesStatusCode"
+"AtAmUi"
+"PttWrapper"
+<endComponent>
diff --git a/Board/EM/MeWrapper/MeWrapper.sdl b/Board/EM/MeWrapper/MeWrapper.sdl
new file mode 100644
index 0000000..9ee98b4
--- /dev/null
+++ b/Board/EM/MeWrapper/MeWrapper.sdl
@@ -0,0 +1,20 @@
+TOKEN
+ Name = "MeWrapper_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable ME Wrapper support in Project"
+ Token = "iME_SUPPORT" "=" "1"
+End
+
+PATH
+ Name = "MeWrapper_DIR"
+End
+
+ELINK
+ Name = "/I$(MeWrapper_DIR)"
+ Parent = "ME_INCLUDES"
+ InvokeOrder = AfterParent
+End
diff --git a/Board/EM/MeWrapper/PttWrapper/PttWrapper.c b/Board/EM/MeWrapper/PttWrapper/PttWrapper.c
new file mode 100644
index 0000000..6a8c668
--- /dev/null
+++ b/Board/EM/MeWrapper/PttWrapper/PttWrapper.c
@@ -0,0 +1,142 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/PttWrapper/PttWrapper.c 4 11/05/14 6:00a Tristinchou $
+//
+// $Revision: 4 $
+//
+// $Date: 11/05/14 6:00a $
+//
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/PttWrapper/PttWrapper.c $
+//
+// 4 11/05/14 6:00a Tristinchou
+// [TAG] EIP190594
+// [Description] Avoid install smm protocol with bootservice
+// InstallProtocol()
+//
+// 3 1/18/13 12:20a Klzhan
+// [TAG] EIPNone
+// [Category] Improvement
+// [Description] Fix SMM Variable protocol fail.
+// [Files] PttWrapper.dxs
+// PttWrapper.c
+// PttWrapper.mak
+// PttWrapper.sdl
+// PttWrapper.cif
+//
+// 2 11/20/12 3:35a Klzhan
+// [TAG] EIPNone
+// [Category] Bug Fix
+// [Severity] Important
+// [Symptom] Smm Variable Protocol not installed
+//
+// 1 11/07/12 6:21a Klzhan
+//
+//
+//**********************************************************************
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: PttWrapper.c
+//
+// Description: Setup Hooks for Tdt.
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+#include <EFI.h>
+#include <AmiDxeLib.h>
+#include <ReferenceCode\ME\SampleCode\Protocol\SmmVariable\SmmVariable.h>
+
+
+#define EFI_SMM_RUNTIME_SERVICES_TABLE_GUID \
+ { 0x395c33fe, 0x287f, 0x413e, { 0xa0, 0x55, 0x80, 0x88, 0xc0, 0xe1, 0xd4, 0x3e } }
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: InSmmFunction
+//
+// Description: InSmmFunction
+//
+// Input:
+//
+// Output:
+//
+// Modified:
+//
+// Referrals:
+//
+// Notes:
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS
+InSmmFunction
+(
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+)
+{
+ //Modification in PttHciSmm.c uses RuntimeServices' variable service
+ //directly, so we don't need to install SmmVariableProtocol in gBS.
+
+ return EFI_SUCCESS;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: PttWrapperEntryPoint
+//
+// Description: Driver EntryPoint
+//
+// Input:
+//
+// Output:
+//
+// Modified:
+//
+// Referrals:
+//
+// Notes:
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS
+EFIAPI
+PttWrapperEntryPoint (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+)
+{
+ InitAmiLib(ImageHandle, SystemTable);
+ InitSmmHandlerEx(ImageHandle, SystemTable, InSmmFunction, NULL);
+
+ 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/PttWrapper/PttWrapper.cif b/Board/EM/MeWrapper/PttWrapper/PttWrapper.cif
new file mode 100644
index 0000000..9b38c3e
--- /dev/null
+++ b/Board/EM/MeWrapper/PttWrapper/PttWrapper.cif
@@ -0,0 +1,11 @@
+<component>
+ name = "PttWrapper"
+ category = ModulePart
+ LocalRoot = "Board\EM\MeWrapper\PttWrapper\"
+ RefName = "PttWrapper"
+[files]
+"PttWrapper.dxs"
+"PttWrapper.c"
+"PttWrapper.mak"
+"PttWrapper.sdl"
+<endComponent>
diff --git a/Board/EM/MeWrapper/PttWrapper/PttWrapper.dxs b/Board/EM/MeWrapper/PttWrapper/PttWrapper.dxs
new file mode 100644
index 0000000..c75d348
--- /dev/null
+++ b/Board/EM/MeWrapper/PttWrapper/PttWrapper.dxs
@@ -0,0 +1,99 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/PttWrapper/PttWrapper.dxs 2 1/18/13 12:20a Klzhan $
+//
+// $Revision: 2 $
+//
+// $Date: 1/18/13 12:20a $
+//
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/PttWrapper/PttWrapper.dxs $
+//
+// 2 1/18/13 12:20a Klzhan
+// [TAG] EIPNone
+// [Category] Improvement
+// [Description] Fix SMM Variable protocol fail.
+// [Files] PttWrapper.dxs
+// PttWrapper.c
+// PttWrapper.mak
+// PttWrapper.sdl
+// PttWrapper.cif
+//
+// 1 11/07/12 6:21a Klzhan
+//
+//
+//**********************************************************************
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: TdtSetup.dxs
+//
+// Description: Dependency expression file.
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+/*++
+
+Copyright (c) 2004-2006 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:
+
+ TDTPlatformPolicy.h
+
+Abstract:
+
+ Dependency expression file for TDTPlatformPolicy Invocation Driver.
+
+--*/
+/*++
+ This file contains an 'Intel Peripheral Driver' and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+#include <Protocol/SmmBase.h>
+#include <Protocol/SmmSwDispatch.h>
+
+DEPENDENCY_START
+ EFI_SMM_BASE_PROTOCOL_GUID AND
+ EFI_SMM_SW_DISPATCH_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/PttWrapper/PttWrapper.mak b/Board/EM/MeWrapper/PttWrapper/PttWrapper.mak
new file mode 100644
index 0000000..66da210
--- /dev/null
+++ b/Board/EM/MeWrapper/PttWrapper/PttWrapper.mak
@@ -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/PttWrapper/PttWrapper.mak 1 11/07/12 6:21a Klzhan $
+#
+# $Revision: 1 $
+#
+# $Date: 11/07/12 6:21a $
+#
+#**********************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/PttWrapper/PttWrapper.mak $
+#
+# 1 11/07/12 6:21a Klzhan
+#
+#
+#
+#**********************************************************************
+#<AMI_FHDR_START>
+#
+# Name: PttWrapper.mak
+#
+# Description:
+#
+#<AMI_FHDR_END>
+#**********************************************************************
+
+all : PttWrapper
+
+PttWrapper : $(BUILD_DIR)\PttWrapper.mak PttWrapperBin
+
+$(BUILD_DIR)\PttWrapper.mak : $(PttWrapper_DIR)\$(@B).cif $(PttWrapper_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(PttWrapper_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+PttWrapperBin : $(AMIDXELIB)
+ $(MAKE) /$(MAKEFLAGS) $(BUILD_DEFAULTS)\
+ /f $(BUILD_DIR)\PttWrapper.mak all\
+ GUID=b19ef33c-10a6-4066-9217-8e5ee011a52f\
+ ENTRY_POINT=PttWrapperEntryPoint\
+ TYPE=BS_DRIVER \
+ COMPRESS=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/PttWrapper/PttWrapper.sdl b/Board/EM/MeWrapper/PttWrapper/PttWrapper.sdl
new file mode 100644
index 0000000..c7643e3
--- /dev/null
+++ b/Board/EM/MeWrapper/PttWrapper/PttWrapper.sdl
@@ -0,0 +1,27 @@
+TOKEN
+ Name = "PttWrapper_SUPPORT"
+ Value = "0"
+ Help = "Main switch to enable TdtWrapper support in Project"
+ TokenType = Boolean
+ TargetMAK = Yes
+ TargetH = Yes
+ Master = Yes
+ Token = "PTTHciSmm_SUPPORT" "=" "1"
+End
+
+
+PATH
+ Name = "PttWrapper_DIR"
+End
+
+MODULE
+ Help = "Includes TdtWrapper.mak to Project"
+ File = "PttWrapper.mak"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\PttWrapper.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End
+
diff --git a/Board/EM/MeWrapper/Smbios131/Smbios131.c b/Board/EM/MeWrapper/Smbios131/Smbios131.c
new file mode 100644
index 0000000..0b703ac
--- /dev/null
+++ b/Board/EM/MeWrapper/Smbios131/Smbios131.c
@@ -0,0 +1,553 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/Smbios131/Smbios131.c 7 3/06/13 4:12a Klzhan $
+//
+// $Revision: 7 $
+//
+// $Date: 3/06/13 4:12a $
+//
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/Smbios131/Smbios131.c $
+//
+// 7 3/06/13 4:12a Klzhan
+// Spec update : PlatformBrand = 5 means SBA
+//
+// 6 2/18/13 2:25a Klzhan
+// Improvement : Checking SBA Platform.
+//
+// 5 1/25/13 4:27a Klzhan
+// Return EFI_SUCCESS in entrypoint.
+//
+// 4 12/18/12 2:29a Klzhan
+// [TAG] EIP109707
+// [Category] Spec Update
+// [Severity] Important
+// [Description] Update ME RC 0.81
+// [Files] Smbios131.sdl
+// Smbios131.mak
+// Smbios131.c
+// Smbios131.dxs
+// Smbios131.h
+// Smbios131.cif
+//
+// 3 7/02/12 11:38p Klzhan
+// [TAG] EIP94113
+// [Category] Spec Update
+// [Severity] Important
+// [Description] Update ME RC0.6
+// [Files] Smbios131.sdl
+// Smbios131.mak
+// Smbios131.c
+// Smbios131.dxs
+// Smbios131.h
+// Smbios131.cif
+//
+// 2 4/24/12 12:32a Klzhan
+// Update modulepart to latest
+//
+// 1 2/08/12 1:07a Klzhan
+// Initial Check in
+//
+// 6 7/26/11 9:57a Klzhan
+// Create token for some Bios capabilities parameters.
+//
+// 5 7/26/11 8:37a Klzhan
+// [TAG] EIP64542
+// [Category] Improvement
+// [Description] Replace Getvariable by GetNbSetupdata.
+// [Files] Smbios131.sdl
+// Smbios131.mak
+// Smbios131.c
+// Smbios131.dxs
+// Smbios131.h
+// Smbios131.cif
+//
+// 4 7/11/11 5:40a Klzhan
+// Close Event after SMBIOS 131 created.
+//
+// 3 7/08/11 4:23a Klzhan
+// [TAG] EIP64189
+// [Category] Spec Update
+// [Severity] Important
+// [Description] Update ME RC to 0.7
+//
+// 2 5/19/11 4:39a Klzhan
+// Improvement : Fill MEBX version with EFI MEBX.
+//
+// 1 2/25/11 1:40a Klzhan
+// Initial Check-in
+//
+// 2 12/16/10 4:00a Klzhan
+// [TAG] EIP50237
+// [Category] Bug Fix
+// [Severity] Important
+// [Symptom] Txt Support is not been set in SMBIOS type 131
+// [RootCause] SETUP_CPU_FEATURES has been changed.
+// [Solution] Include PlatformCPULib.h
+// [Files] Smbios131.c and Smbios131.h
+//
+// 1 12/03/10 5:09a Klzhan
+// Initial Check-in.
+//
+//
+//**********************************************************************
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: Smbios131.c
+//
+// Description: Create SMbios type 131.
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+
+#define _SMBIOS_GUID_H_
+#define __EDKII_GLUE_MEMORY_ALLOCATION_LIB_H__
+#define __EDKII_GLUE_BASE_MEMORY_LIB_H__
+
+#include "Smbios131.h"
+#include <Protocol\GlobalNvsArea\GlobalNvsArea.h>
+#include "MePlatformPolicy.h"
+#if EFI_SPECIFICATION_VERSION>0x20000
+#include "SaAccess.h"
+#include "PchAccess.h"
+#else
+#include "Efi.h"
+#include "EfiDriverLib.h"
+#include "SaAccess.h"
+#include "PchAccess.h"
+#include "EdkIIGluePcd.h"
+#include "EdkIIGluePcdPciExpressLib.h"
+#include "EdkIIGlueConfig.h"
+#include "EdkIIGlueIoLib.h"
+#include "EdkIIGluePciExpressLib.h"
+#include "EdkIIGlueUefiLib.h"
+#define __UEFI_HII__H__
+#define __HII_PROTOCOL_H__
+#define _HII_H_
+#define __FORM_CALLBACK_PROTOCOL_H__
+#endif
+#define SETUP_GUID { 0xEC87D643, 0xEBA4, 0x4BB5, 0xA1, 0xE5, 0x3F, 0x3E, 0x36, 0xB2, 0x0D, 0xA9 }
+
+
+#define ME_INFO_SETUP_GUID \
+ {0x78259433, 0x7B6D, 0x4DB3, 0x9A, 0xE8, 0x36, 0xC4, 0xC2, 0xC3, 0xA1, 0x7D}
+
+#include EFI_PROTOCOL_CONSUMER (MebxProtocol)
+
+EFI_GUID gSetupGuid = SETUP_GUID;
+EFI_GUID gMeSetupInfoGuid = ME_INFO_SETUP_GUID;
+EFI_GUID gEfiSmbiosProtocolGuid = EFI_SMBIOS_PROTOCOL_GUID;
+EFI_GUID gEfiEventReadyToBootGuid = EFI_EVENT_GROUP_READY_TO_BOOT;
+EFI_GUID gEfiMeBiosExtensionSetupGuid = EFI_ME_BIOS_EXTENSION_SETUP_GUID;
+CHAR16 gEfiMeBiosExtensionSetupName[] = EFI_ME_BIOS_EXTENSION_SETUP_VARIABLE_NAME;
+EFI_GUID gEfiGlobalVariableGuid = EFI_GLOBAL_VARIABLE_GUID;
+UINT8 METype = 0;
+EFI_EVENT mLegacyBootEvent;
+MEFWCAPS_SKU gMeFwCapsSkuData;
+#if VA_SUPPORT
+EFI_GUID gEfiVaNVMVariableGuid = EFI_VA_NVM_VARIABLE_GUID;
+#endif
+UINT8 TdtWwanSuport = 0;
+EFI_RUNTIME_SERVICES *gRT;
+EFI_BOOT_SERVICES *gBS;
+
+EFI_STATUS
+GetRawImage (
+ IN EFI_GUID *NameGuid,
+ IN OUT VOID **Buffer,
+ IN OUT UINTN *Size
+ )
+/*++
+
+Routine Description:
+
+ Loads binary from RAW section of main firwmare volume
+
+Arguments:
+
+ NameGuid - The guid of binary file
+ Buffer - Returns a pointer to allocated memory. Caller must free it when done.
+ Size - Returns the size of the binary loaded into the buffer.
+
+Returns:
+
+ EFI_NOT_FOUND - Can't found the binary.
+ EFI_LOAD_ERROR - Load fail.
+ EFI_SUCCESS - Load success.
+
+--*/
+{
+ EFI_STATUS Status;
+ UINTN HandleCount;
+ UINTN Index;
+ EFI_FIRMWARE_VOLUME_PROTOCOL *Fv;
+ EFI_HANDLE *HandleBuff;
+ UINT32 AuthenticationStatus;
+
+ Status = gBS->LocateHandleBuffer (
+ ByProtocol,
+ &gEfiFirmwareVolumeProtocolGuid,
+ NULL,
+ &HandleCount,
+ &HandleBuff
+ );
+ if (EFI_ERROR (Status) || HandleCount == 0) {
+ return EFI_NOT_FOUND;
+ }
+ //
+ // Find desired image in all Fvs
+ //
+ for (Index = 0; Index < HandleCount; Index++) {
+ Status = gBS->HandleProtocol (
+ HandleBuff[Index],
+ &gEfiFirmwareVolumeProtocolGuid,
+ &Fv
+ );
+
+ if (EFI_ERROR (Status)) {
+ if (HandleBuff != NULL) {
+ gBS->FreePool (HandleBuff);
+ }
+
+ return EFI_LOAD_ERROR;
+ }
+ //
+ // Try a raw file
+ //
+ Status = Fv->ReadSection (
+ Fv,
+ NameGuid,
+ EFI_SECTION_RAW,
+ 0,
+ Buffer,
+ Size,
+ &AuthenticationStatus
+ );
+
+ if (!EFI_ERROR (Status)) {
+ break;
+ }
+ }
+
+ if (HandleBuff != NULL) {
+ gBS->FreePool (HandleBuff);
+ }
+
+ if (Index >= HandleCount) {
+ return EFI_NOT_FOUND;
+ }
+
+ return EFI_SUCCESS;
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: UpdateSmbios131Table
+//
+// Description: SMBIOS tables 83 are filled here
+//
+// Input: EFI_EVENT Event,
+// VOID *ParentImageHandle
+//
+// Output: EFI_STATUS
+//
+// Modified:
+//
+// Referrals:
+//
+// Notes:
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID
+MePlatformCapabilities (
+ EFI_MISC_OEM_TYPE_0x83 *Type131
+)
+{
+ ME_INFO_SETUP_DATA MeInfoSetupData;
+ PLATFORM_TYPE_RULE_DATA PlatformTypeDate;
+ EFI_STATUS Status;
+ UINTN DataSize;
+
+ DataSize = sizeof (ME_INFO_SETUP_DATA);
+ Status = gRT->GetVariable (
+ L"MeInfoSetup",
+ &gMeSetupInfoGuid,
+ NULL,
+ &DataSize,
+ &MeInfoSetupData
+ );
+ if (EFI_ERROR(Status)) return ;
+ Type131->MeCapabilities.MeEnabled = 1;
+ Type131->MeCapabilities.MeMajorVer = MeInfoSetupData.MeMajor;
+ Type131->MeCapabilities.MeMinorVer = MeInfoSetupData.MeMinor;
+ Type131->MeCapabilities.MeBuildNo = MeInfoSetupData.MeBuildNo;
+ Type131->MeCapabilities.MeHotFixNo = MeInfoSetupData.MeHotFix;
+ Type131->MeCapabilities.AtSupported = gMeFwCapsSkuData.Fields.IntelAT;
+ Type131->MeCapabilities.IntelKVM = gMeFwCapsSkuData.Fields.KVM;
+ Status = HeciGetPlatformType(&PlatformTypeDate);
+ if (EFI_ERROR(Status)) return ;
+ if (PlatformTypeDate.Fields.PlatformBrand == 1) {
+ Type131->MeCapabilities.IntelAmtFw = 1;
+ Type131->MeCapabilities.LocalWakeupTimer = 1;
+ }
+ if (PlatformTypeDate.Fields.PlatformBrand == 2)
+ Type131->MeCapabilities.IntelAmtFwStandard = 1;
+
+ if (PlatformTypeDate.Fields.PlatformBrand == 5)
+ Type131->MeCapabilities.IntelSmallBusiness = 1;
+
+ METype = (UINT8)PlatformTypeDate.Fields.IntelMeFwImageType;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: UpdateSmbios131Table
+//
+// Description: SMBIOS tables 83 are filled here
+//
+// Input: EFI_EVENT Event,
+// VOID *ParentImageHandle
+//
+// Output: EFI_STATUS
+//
+// Modified:
+//
+// Referrals:
+//
+// Notes:
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS
+UpdateSmbios131Table(
+ EFI_EVENT Event,
+ VOID *ParentImageHandle
+)
+{
+ EFI_STATUS Status;
+ EFI_MISC_OEM_TYPE_0x83 Data83;
+ EFI_SMBIOS_PROTOCOL *mSmbiosProtocol;
+ UINT64 Ia32FeatureControl;
+ EFI_CPUID_REGISTER CpuidRegs ;
+#if VA_SUPPORT
+ EFI_VA_NVM_VAR VaNVMVar;
+#endif
+
+ mSmbiosProtocol = NULL;
+ Status = gBS->LocateProtocol(
+ &gEfiSmbiosProtocolGuid,
+ NULL,
+ &mSmbiosProtocol
+ );
+ if (EFI_ERROR(Status)) return Status;
+
+ //Clear all data
+ gBS->SetMem (&Data83, sizeof(EFI_MISC_OEM_TYPE_0x83), 0);
+
+// Data83
+
+ Data83.Header.Type = 0x83;
+ Data83.Header.Length = 0x40;
+ Data83.Header.Handle = 0;
+ gBS->CopyMem (
+ Data83.vProSignature,
+ vPro_Signature,
+ sizeof (UINT32)
+ );
+
+ Ia32FeatureControl = EfiReadMsr(EFI_MSR_IA32_FEATURE_CONTROL);
+ EfiCpuid (1, &CpuidRegs) ;
+
+//CPU
+ Data83.CpuCapabilities.VMXState = (UINT32)(RShiftU64(Ia32FeatureControl, 2));
+ Data83.CpuCapabilities.SMXState = (UINT32)(RShiftU64(Ia32FeatureControl, 1));
+
+ if (CpuidRegs.RegEcx & BIT6) {
+ Data83.CpuCapabilities.LtTxtCap = 1;
+ } else {
+ Data83.CpuCapabilities.LtTxtCap = 0;
+ }
+
+ if ((Ia32FeatureControl & TXT_OPT_IN_VMX_AND_SMX_MSR_VALUE) == TXT_OPT_IN_VMX_AND_SMX_MSR_VALUE) {
+ Data83.CpuCapabilities.LtTxtEnabled = 1;
+ } else {
+ Data83.CpuCapabilities.LtTxtEnabled = 0;
+ }
+
+ if (CpuidRegs.RegEcx & BIT5) {
+ Data83.CpuCapabilities.VTxCap = 1;
+ } else {
+ Data83.CpuCapabilities.VTxCap = 0;
+ }
+ Data83.CpuCapabilities.VTxEnabled = (UINT32)(RShiftU64(Ia32FeatureControl, 2));
+
+//Pch
+ Data83.PchCapabilities.FunctionNumber = PCI_FUNCTION_NUMBER_PCH_LPC;
+ Data83.PchCapabilities.DeviceNumber = PCI_DEVICE_NUMBER_PCH_LPC;
+ Data83.PchCapabilities.BusNumber = DEFAULT_PCI_BUS_NUMBER_PCH;
+ Data83.PchCapabilities.DeviceID = PchLpcPciCfg16(R_PCH_LPC_DEVICE_ID);
+ Data83.PchCapabilities.Reserved = 0;
+
+//Me
+//Filled above along with Data82 table
+ MePlatformCapabilities(&Data83);
+
+// MEBX Version
+ // Fill MEBX Version when ME FW is 5MB
+ if(METype == 4)
+ {
+ EFI_MEBX_PROTOCOL *MebxProtocol;
+ Status = gBS->LocateProtocol (&gEfiMebxProtocolGuid, NULL, &MebxProtocol);
+ if (!EFI_ERROR (Status)) {
+ Data83.vMEBX_Major = MebxProtocol->MebxVersion.Major;
+ Data83.vMEBX_Minor = MebxProtocol->MebxVersion.Minor;
+ Data83.vMEBX_HotFix = MebxProtocol->MebxVersion.Hotfix;
+ Data83.vMEBX_Build = MebxProtocol->MebxVersion.Build;
+ } else {
+ Data83.vMEBX_Major = 0;
+ Data83.vMEBX_Minor = 0;
+ Data83.vMEBX_HotFix = 0;
+ Data83.vMEBX_Build = 0;
+ }
+ }
+
+//NetworkDevice
+ Data83.NetworkDevice.FunctionNumber = PCI_FUNCTION_NUMBER_PCH_LAN; //[2:0] PCI Device Function Number of Wired LAN
+ Data83.NetworkDevice.DeviceNumber = PCI_DEVICE_NUMBER_PCH_LAN; //[7:3] PCI Device Device Number of Wired LAN
+ Data83.NetworkDevice.BusNumber = PCI_BUS_NUMBER_PCH_LAN; //[15:8] PCI Device Bus Number of Wired LAN
+ Data83.NetworkDevice.DeviceID = MmPci16( 0, DEFAULT_PCI_BUS_NUMBER_PCH, PCI_DEVICE_NUMBER_PCH_LAN, PCI_FUNCTION_NUMBER_PCH_LAN, R_PCH_LAN_DEVICE_ID );
+
+//BIOS
+ if(SetupSupportItem & BIT3)
+ Data83.BiosCapabilities.VTxSupport = 1;
+
+ if(SetupSupportItem & BIT1)
+ Data83.BiosCapabilities.TxtSupport = 1;
+
+ Data83.BiosCapabilities.Reserved1 = 0;
+ Data83.BiosCapabilities.Reserved2 = 0;
+
+ if(SetupSupportItem & BIT0)
+ Data83.BiosCapabilities.VTdSupport = 1;
+
+ if(SetupSupportItem & BIT2)
+ Data83.BiosCapabilities.MeSupport = 0;
+
+#if VA_SUPPORT
+ //
+ // Set Default Value for VA
+ //
+ Data83.BiosCapabilities.MaxVASupported = 7; //None. Means BIOS do not support VA.
+
+ //
+ // Get VA Info
+ //
+ DataSize = sizeof(EFI_VA_NVM_VAR);
+ Status = gRT->GetVariable (
+ EFI_VA_NVM_VARIABLE_NAME,
+ &gEfiVaNVMVariableGuid,
+ NULL,
+ &DataSize,
+ &VaNVMVar
+ );
+
+ if (!EFI_ERROR(Status)) {
+ if (VaNVMVar.VAVersion == EFI_VA30_VERSION) {
+ Data83.BiosCapabilities.MaxVASupported = 1;
+ } else if (VaNVMVar.VAVersion == EFI_VA26_VERSION) {
+ Data83.BiosCapabilities.MaxVASupported = 0;
+ }
+ }
+#endif
+
+ // Get TDT Info
+ if(Data83.MeCapabilities.AtSupported){
+ Data83.BiosCapabilities.TdtPbaSupport = 1;
+ Data83.BiosCapabilities.TdtWwanSuport = TdtWwanSuport;
+ }
+ Status = mSmbiosProtocol->SmbiosAddStructure((UINT8 *)&Data83, sizeof(EFI_MISC_OEM_TYPE_0x83));
+ gBS->CloseEvent(Event);
+ return Status;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: AmtSmbios131EntryPoint
+//
+// Description: iAMT SMBIOS Type 131 driver entry point
+//
+// Input: EFI_HANDLE ImageHandle,
+// EFI_SYSTEM_TABLE *SystemTable
+//
+// Output: EFI_STATUS
+//
+// Modified:
+//
+// Referrals:
+//
+// Notes:
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS
+AmtSmbios131EntryPoint(
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+)
+{
+ EFI_STATUS Status;
+ DXE_MBP_DATA_PROTOCOL *mBIOSPayLoad = NULL;
+
+ EfiInitializeDriverLib (ImageHandle, SystemTable);
+
+ Status = HeciGetFwCapsSku(&gMeFwCapsSkuData);
+ if (EFI_ERROR(Status)) return Status;
+ Status = EfiCreateEventReadyToBootEx(
+ EFI_TPL_CALLBACK,
+ UpdateSmbios131Table,
+ (VOID *)&ImageHandle,
+ &mLegacyBootEvent
+ );
+ ASSERT_EFI_ERROR (Status);
+ Status = gBS->LocateProtocol (
+ &gMeBiosPayloadDataProtocolGuid,
+ NULL,
+ &mBIOSPayLoad
+ );
+ if(!EFI_ERROR(Status))
+ {
+#if 0
+ if(mBIOSPayLoad->MeBiosPayload.AtState.flags.WWAN3GPresent &&
+ mBIOSPayLoad->MeBiosPayload.AtState.flags.WWAN3GOOB)
+ TdtWwanSuport = 1;
+#endif
+ }
+ 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/Smbios131/Smbios131.cif b/Board/EM/MeWrapper/Smbios131/Smbios131.cif
new file mode 100644
index 0000000..02aafea
--- /dev/null
+++ b/Board/EM/MeWrapper/Smbios131/Smbios131.cif
@@ -0,0 +1,12 @@
+<component>
+ name = "Smbios131"
+ category = ModulePart
+ LocalRoot = "Board\EM\MeWrapper\Smbios131\"
+ RefName = "Smbios131"
+[files]
+"Smbios131.sdl"
+"Smbios131.mak"
+"Smbios131.c"
+"Smbios131.dxs"
+"Smbios131.h"
+<endComponent>
diff --git a/Board/EM/MeWrapper/Smbios131/Smbios131.dxs b/Board/EM/MeWrapper/Smbios131/Smbios131.dxs
new file mode 100644
index 0000000..8373f04
--- /dev/null
+++ b/Board/EM/MeWrapper/Smbios131/Smbios131.dxs
@@ -0,0 +1,72 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/Smbios131/Smbios131.dxs 1 2/08/12 1:07a Klzhan $
+//
+// $Revision: 1 $
+//
+// $Date: 2/08/12 1:07a $
+//
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/Smbios131/Smbios131.dxs $
+//
+// 1 2/08/12 1:07a Klzhan
+// Initial Check in
+//
+// 1 2/25/11 1:40a Klzhan
+// Initial Check-in
+//
+// 1 12/03/10 5:09a Klzhan
+// Initial Check-in.
+//
+//
+//**********************************************************************
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: Smbios131.dxs
+//
+// Description:
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+#include "EfiDepex.h"
+
+#include "Protocol\SmbiosGetFlashDataProtocol.h"
+#include EFI_PROTOCOL_DEFINITION (AmtPlatformPolicy)
+#include EFI_PROTOCOL_DEFINITION (Heci)
+#include EFI_PROTOCOL_DEFINITION (MePlatformPolicy)
+
+DEPENDENCY_START
+ DXE_PLATFORM_ME_POLICY_GUID AND
+ EFI_HECI_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/Smbios131/Smbios131.h b/Board/EM/MeWrapper/Smbios131/Smbios131.h
new file mode 100644
index 0000000..d8ac599
--- /dev/null
+++ b/Board/EM/MeWrapper/Smbios131/Smbios131.h
@@ -0,0 +1,176 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/Smbios131/Smbios131.h 1 2/08/12 1:07a Klzhan $
+//
+// $Revision: 1 $
+//
+// $Date: 2/08/12 1:07a $
+//
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/Smbios131/Smbios131.h $
+//
+// 1 2/08/12 1:07a Klzhan
+// Initial Check in
+//
+// 1 2/25/11 1:40a Klzhan
+// Initial Check-in
+//
+// 2 12/16/10 3:58a Klzhan
+// [TAG] EIP50237
+// [Category] Bug Fix
+// [Severity] Important
+// [Symptom] Txt Support is not been set in SMBIOS type 131
+// [RootCause] SETUP_CPU_FEATURES structure has been changed.
+// [Solution] Include PlatformCPULib.h.
+// [Files] Smbios131.c and Smbios131.h
+//
+// 1 12/03/10 5:09a Klzhan
+// Initial Check-in.
+//
+//
+//**********************************************************************
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: Smbios131.h
+//
+// Description: Header file for SMbios131 module.
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+#include "Token.h"
+#include <Tiano.h>
+#include <Include\Protocol\SMBios.h>
+#include <Include\Protocol\SmbiosGetFlashDataProtocol.h>
+#include <AmtLib.h>
+#include <MeLib.h>
+#include "CpuFuncs.h"
+
+#include EFI_GUID_DEFINITION (MeBiosExtensionSetup)
+#include EFI_GUID_DEFINITION (GlobalVariable)
+#include EFI_PROTOCOL_DEFINITION (PciIo)
+#include EFI_PROTOCOL_CONSUMER (PciRootBridgeIo)
+#include EFI_PROTOCOL_DEPENDENCY (SaPlatformPolicy)
+#include EFI_PROTOCOL_CONSUMER (Heci)
+#include EFI_PROTOCOL_CONSUMER (TcgService)
+#define MEBX_FILE_GUID \
+ { \
+ 0x7c81c66a, 0x4f11, 0x47ab, 0x82, 0xd3, 0x67, 0xc4, 0xd6, 0x35, 0xae, 0xd1 \
+ }
+#if VA_SUPPORT
+#include EFI_PROTOCOL_DEFINITION(PlatformVaPolicy)
+#endif
+
+#define vPro_Signature "vPro"
+
+#define EFI_MSR_IA32_FEATURE_CONTROL 0x3A
+#define TXT_OPT_IN_VMX_AND_SMX_MSR_VALUE 0xFF03
+#define EFI_VA30_VERSION 0x0300
+#define EFI_VA26_VERSION 0x0206
+
+
+
+
+#define PciMeRegBase PCIEX_BASE_ADDRESS + (UINT32) (22 << 15)
+#define FW_STATUS_REGISTER 0x40
+
+//
+// This is definition for SMBIOS Oem data type 0x81
+//
+#pragma pack (1)
+//
+// This is definition for SMBIOS Oem data type 0x83
+//
+typedef struct {
+ UINT32 VMXState : 1; //[0] VMX state (On/Off)
+ UINT32 SMXState : 1; //[1] SMX state (On/Off)
+ UINT32 LtTxtCap : 1; //[2] LT/TXT capability
+ UINT32 LtTxtEnabled : 1; //[3] LT/TXT Enabled state (Optional for vPro verification)
+ UINT32 VTxCap : 1; //[4] VT-x capability
+ UINT32 VTxEnabled : 1; //[5] VT-x Enabled state (Optional for vPro verification)
+ UINT32 Reserved : 26; //[31:6] Reserved, set to 0
+} CPU_CAP;
+
+typedef struct {
+ UINT32 FunctionNumber : 3; //[2:0] PCI Device Function Number
+ UINT32 DeviceNumber : 5; //[7:3] PCI Device Device Number
+ UINT32 BusNumber : 8; //[15:8] PCI Device Bus Number
+ UINT32 DeviceID : 16; //[31:16] Device Identification Number (DID): This field is the identifier of ICHx PCI device.DID will be set to 0xFF if not found.
+ UINT32 Reserved : 32; //[63:32] Reserved, must set to 0xFF
+} PCH_CAP;
+
+typedef struct {
+ UINT32 FunctionNumber : 3; //[2:0] PCI Device Function Number of Wired LAN
+ UINT32 DeviceNumber : 5; //[7:3] PCI Device Device Number of Wired LAN
+ UINT32 BusNumber : 8; //[15:8] PCI Device Bus Number of Wired LAN
+ UINT32 DeviceID : 16; //[31:16] PCI Device Identifier (DID) of wired NIC. DID will be set to 0xFF if not found.
+ UINT16 Reserved1; //[47:32] Reserved for Wired NIC.
+ UINT32 wFunctionNumber : 3; //[51:48] PCI Device Function Number of Wireless LAN
+ UINT32 wDeviceNumber : 5; //[56:52] PCI Device Device Number of Wireless LAN
+ UINT32 wBusNumber : 8; //[64:57] PCI Device Bus Number of Wireless LAN
+ UINT32 wDeviceID : 16; //[80:65] PCI Device Identifier (DID) of Wireless NIC. DID will be set to 0xFF if not found.
+ UINT16 wReserved1; //[95:81] Reserved for Wireless NIC.
+} NETWORK_DEV;
+
+
+typedef struct {
+ UINT32 Reserved1 : 1; //[0] Reserved, must be set to 0
+ UINT32 VTdSupport : 1; //[1] BIOS supports VT-d in BIOS setup screen (can be editable).
+ UINT32 TxtSupport : 1; //[2] BIOS supports TXT in BIOS setup screen (can be editable).
+ UINT32 Reserved2 : 1; //[3] Reserved, must be set to 0
+ UINT32 MeSupport : 1; //[4] BIOS supports ME in BIOS setup screen (can be editable).
+ UINT32 VTxSupport : 1; //[5] BIOS supports VT-x in BIOS setup screen (can be editable).
+ // The PlaformDataInSpi & MaxVASupported moved from Bit 6 & 7 to 8, 9
+ UINT32 TdtPbaSupport : 1; //[6] BIOS supports VT-d in BIOS setup screen (can be editable).
+ UINT32 TdtWwanSuport : 1; //[7] BIOS supports TXT in BIOS setup screen (can be editable).
+ UINT32 Reserved : 24; //[31:8] Reserved, must set to 0
+} BIOS_CAP;
+
+typedef struct {
+ SMBIOS_STRUCTURE_HEADER Header;
+ CPU_CAP CpuCapabilities;
+ UINT16 vMEBX_Major;
+ UINT16 vMEBX_Minor;
+ UINT16 vMEBX_HotFix;
+ UINT16 vMEBX_Build;
+ PCH_CAP PchCapabilities;
+ ME_CAP MeCapabilities;
+ UINT16 Reserved1[2];
+ NETWORK_DEV NetworkDevice;
+ BIOS_CAP BiosCapabilities;
+ UINT8 vProSignature[4];
+ UINT32 Reserved2;
+ UINT16 Zero; //terminator
+} EFI_MISC_OEM_TYPE_0x83;
+
+#pragma pack ()
+
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/Smbios131/Smbios131.mak b/Board/EM/MeWrapper/Smbios131/Smbios131.mak
new file mode 100644
index 0000000..90ff37b
--- /dev/null
+++ b/Board/EM/MeWrapper/Smbios131/Smbios131.mak
@@ -0,0 +1,158 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/Smbios131/Smbios131.mak 5 12/18/12 2:29a Klzhan $
+#
+# $Revision: 5 $
+#
+# $Date: 12/18/12 2:29a $
+#
+#**********************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/Smbios131/Smbios131.mak $
+#
+# 5 12/18/12 2:29a Klzhan
+# [TAG] EIP109707
+# [Category] Spec Update
+# [Severity] Important
+# [Description] Update ME RC 0.81
+# [Files] Smbios131.sdl
+# Smbios131.mak
+# Smbios131.c
+# Smbios131.dxs
+# Smbios131.h
+# Smbios131.cif
+#
+# 4 7/02/12 11:38p Klzhan
+# [TAG] EIP94113
+# [Category] Spec Update
+# [Severity] Important
+# [Description] Update ME RC0.6
+# [Files] Smbios131.sdl
+# Smbios131.mak
+# Smbios131.c
+# Smbios131.dxs
+# Smbios131.h
+# Smbios131.cif
+#
+# 3 4/24/12 12:32a Klzhan
+# Update modulepart to latest
+#
+# 2 2/23/12 8:57a Klzhan
+# Support New EDK
+#
+# 1 2/08/12 1:07a Klzhan
+# Initial Check in
+#
+# 3 7/26/11 9:57a Klzhan
+# Create token for some Bios capabilities parameters.
+#
+# 2 7/26/11 8:37a Klzhan
+# [TAG] EIP64542
+# [Category] Improvement
+# [Description] Replace Getvariable by GetNbSetupdata.
+# [Files] Smbios131.sdl
+# Smbios131.mak
+# Smbios131.c
+# Smbios131.dxs
+# Smbios131.h
+# Smbios131.cif
+#
+# 1 2/25/11 1:40a Klzhan
+# Initial Check-in
+#
+# 1 12/03/10 5:09a Klzhan
+# Initial Check-in.
+#
+#
+#**********************************************************************
+#
+#<AMI_FHDR_START>
+#----------------------------------------------------------------------------
+#
+# Name: Smbios131.c
+#
+# Description: Create SMbios type 131.
+#
+#----------------------------------------------------------------------------
+#<AMI_FHDR_END>
+# MAK file for the ModulePart:AmtSmbios
+all : AmtSmbios131
+
+$(BUILD_DIR)\Smbios131.mak : $(Smbios131_DIR)\$(@B).cif $(Smbios131_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(Smbios131_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+AmtSmbios131 : $(BUILD_DIR)\Smbios131.mak AmtSmbios131Bin
+
+AmtSmbios131_INCLUDES=\
+ $(EdkIIGlueLib_INCLUDES)\
+ $(INTEL_PLATFORM_PROTOCOL_INCLUDES)\
+ /I$(EDK_SOURCE)\Foundation\Efi\Include\
+ $(NB_INCLUDES)\
+ $(ME_INCLUDES)\
+ $(INTEL_PCH_INCLUDES)\
+ $(INTEL_MCH_INCLUDES)\
+ /I$(MePlatformPolicy_DIR)\
+ /I$(PROJECT_DIR)\
+ /IInclude\
+
+AmtSmbios131_LIBS=\
+ $(AmtLibDxe_LIB)\
+ $(MeLibDxe_LIB)\
+ $(MeChipsetDxeLib_LIB)\
+ $(EDKPROTOCOLLIB)\
+ $(EFIDRIVERLIB)\
+ $(CPUIA32LIB)\
+ $(VaProtocolLib_LIB)\
+ $(EdkIIGlueDxeReportStatusCodeLib_LIB)\
+ $(EdkIIGlueDxeDebugLibReportStatusCode_LIB)\
+ $(EdkIIGlueBaseLib_LIB)\
+!IF "$(x64_BUILD)"=="1"
+ $(EdkIIGlueBaseLibX64_LIB)\
+!ELSE
+ $(EdkIIGlueBaseLibIA32_LIB)\
+!ENDIF
+ $(EdkIIGlueDxeMemoryAllocationLib_LIB)\
+ $(EdkIIGlueUefiLib_LIB)\
+ $(IntelPlatformProtocolLib_LIB)\
+ $(PchPlatformDxeLib_LIB)\
+
+AmtSmbios131Bin : $(AmtSmbios131_LIBS)
+ $(MAKE) /$(MAKEFLAGS) $(EDK_DEFAULTS)\
+ /f $(BUILD_DIR)\Smbios131.mak all \
+ NAME=Smbios131 \
+ MAKEFILE=$(BUILD_DIR)\Smbios131.mak \
+ "MY_INCLUDES=$(AmtSmbios131_INCLUDES)" \
+ GUID=2b341c7b-0b32-4a65-9d46-e1b3abd4c25c \
+ ENTRY_POINT=AmtSmbios131EntryPoint \
+ DEPEX1=$(Smbios131_DIR)\Smbios131.dxs \
+ DEPEX1_TYPE=EFI_SECTION_DXE_DEPEX \
+ TYPE=BS_DRIVER \
+ 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/Smbios131/Smbios131.sdl b/Board/EM/MeWrapper/Smbios131/Smbios131.sdl
new file mode 100644
index 0000000..c57ae1e
--- /dev/null
+++ b/Board/EM/MeWrapper/Smbios131/Smbios131.sdl
@@ -0,0 +1,33 @@
+TOKEN
+ Name = "Smbios131_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable Smbios type 131 support in Project"
+ TokenType = Boolean
+ TargetMAK = Yes
+ Master = Yes
+End
+
+PATH
+ Name = "Smbios131_DIR"
+ Help = "AMT Smbios file source directory"
+End
+
+MODULE
+ Help = "Includes AmtSmbios.mak to Project"
+ File = "Smbios131.mak"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\Smbios131.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End
+
+TOKEN
+ Name = "SetupSupportItem"
+ Value = "0xF"
+ Help = "Set BIOS Setup Item exist or not. Bit0 = Vt-d, Bit1 = Txt, Bit2 = ME, Bit3 = VTx"
+ TokenType = Integer
+ TargetH = Yes
+ Range = "0 - 2"
+End \ No newline at end of file
diff --git a/Board/EM/MeWrapper/TdtWrapper/TDTSetup.sd b/Board/EM/MeWrapper/TdtWrapper/TDTSetup.sd
new file mode 100644
index 0000000..2f7d21f
--- /dev/null
+++ b/Board/EM/MeWrapper/TdtWrapper/TDTSetup.sd
@@ -0,0 +1,161 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/TdtWrapper/TDTSetup.sd 4 9/27/12 4:56a Klzhan $
+//
+// $Revision: 4 $
+//
+// $Date: 9/27/12 4:56a $
+//
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/TdtWrapper/TDTSetup.sd $
+//
+// 4 9/27/12 4:56a Klzhan
+// [TAG] EIP102254
+// [Category] Spec Update
+// [Severity] Important
+// [Description] Update ME RC 0.7
+// [Files] TDTWrapper.dxs
+// TDTWrapper.c
+// TDTWrapper.mak
+// TDTWrapper.sdl
+// TDTSetup.sd
+// TDTSetup.uni
+// TdtCallback.h
+// TDTWrapper.cif
+//
+// 3 9/19/12 6:31a Klzhan
+// Set AT to default enabled.
+//
+// 2 4/24/12 12:33a Klzhan
+// Update modulepart to latest
+//
+// 1 2/08/12 1:07a Klzhan
+// Initial Check in
+//
+// 2 4/20/11 10:51p Klzhan
+// Improvement : Gray out Suspend item when system is not enroll.
+//
+// 1 2/25/11 1:40a Klzhan
+// Initial Check-in
+//
+// 1 12/03/10 5:09a Klzhan
+// Initial Check-in.
+//
+//
+//**********************************************************************
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: TdtSetup.sd
+//
+// Description: Setup menu for Tdt.
+//
+//----------------------------------------------------------------------------
+//<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 Tdt;
+ UINT8 TdtConfig;
+ UINT8 TdtEnterSuspendState;
+
+#endif
+
+#ifdef ADVANCED_FORM_SET
+ #ifdef FORM_SET_ITEM
+ // Define controls to be added to the main page of the formset
+
+ #endif
+
+#ifdef FORM_SET_TYPEDEF
+
+#include "TdtCallback.h"
+
+#endif
+
+#ifdef FORM_SET_VARSTORE
+ varstore TDT_VOLATILE_SETUP_DATA,
+ key = AUTO_ID(TDT_VOLATILE_SETUP_DATA_VAR),
+ name = TdtAdvancedSetupDataVar,
+ guid = TDT_VOLATILE_SETUP_DATA_GUID;
+
+#endif
+
+ #ifdef FORM_SET_GOTO
+ // Define goto commands for the forms defined in this file
+ goto TDT_FORM_ID,
+
+ prompt = STRING_TOKEN(STR_TDT_FORM),
+ help = STRING_TOKEN(STR_TDT_FORM_HELP);
+ #endif
+
+ #ifdef FORM_SET_FORM
+ // Define forms
+ #ifndef TDT_FORM_SETUP
+ #define TDT_FORM_SETUP
+
+ form formid = AUTO_ID(TDT_FORM_ID),
+ title = STRING_TOKEN(STR_TDT_FORM_TITLE);
+
+ SEPARATOR
+ SUBTITLE(STRING_TOKEN(STR_ITDT_SUBTITLE))
+ SEPARATOR
+
+ grayoutif ideqval TDT_VOLATILE_SETUP_DATA.TdtEnroll == 1 OR ideqval SYSTEM_ACCESS.Access == SYSTEM_PASSWORD_USER;
+ oneof varid = SETUP_DATA.TdtConfig,
+ prompt = STRING_TOKEN(STR_TDT_CONFIG_PROMPT),
+ help = STRING_TOKEN(STR_TDT_CONFIG_HELP),
+ option text = STRING_TOKEN(STR_TDT_DISABLED), value = 0, flags = RESET_REQUIRED, key = 0;
+ option text = STRING_TOKEN(STR_TDT_ENABLED), value = 1, flags = DEFAULT | MANUFACTURING | RESET_REQUIRED, key = 0;
+ endoneof;
+ endif;
+
+ grayoutif ideqval TDT_VOLATILE_SETUP_DATA.TdtEnroll == 0 OR ideqval SYSTEM_ACCESS.Access == SYSTEM_PASSWORD_USER;
+ oneof varid = SETUP_DATA.TdtEnterSuspendState,
+ prompt = STRING_TOKEN(STR_TDT_SUSPEND_PROMPT),
+ help = STRING_TOKEN(STR_TDT_SUSPEND_HELP),
+ option text = STRING_TOKEN(STR_TDT_DISABLED), value = 0, flags = DEFAULT | MANUFACTURING | RESET_REQUIRED, key = 0;
+ option text = STRING_TOKEN(STR_TDT_ENABLED), value = 1, flags = RESET_REQUIRED, key = 0;
+ endoneof;
+ endif;
+
+ endform;
+ #endif // TDT_FORM_SETUP
+ #endif //End FORM_SET_FORM
+
+#endif //End 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/TdtWrapper/TDTSetup.uni b/Board/EM/MeWrapper/TdtWrapper/TDTSetup.uni
new file mode 100644
index 0000000..89c89b3
--- /dev/null
+++ b/Board/EM/MeWrapper/TdtWrapper/TDTSetup.uni
Binary files differ
diff --git a/Board/EM/MeWrapper/TdtWrapper/TDTWrapper.c b/Board/EM/MeWrapper/TdtWrapper/TDTWrapper.c
new file mode 100644
index 0000000..5485043
--- /dev/null
+++ b/Board/EM/MeWrapper/TdtWrapper/TDTWrapper.c
@@ -0,0 +1,521 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/TdtWrapper/TDTWrapper.c 12 6/18/14 3:04a Larryliu $
+//
+// $Revision: 12 $
+//
+// $Date: 6/18/14 3:04a $
+//
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/TdtWrapper/TDTWrapper.c $
+//
+// 12 6/18/14 3:04a Larryliu
+// [TAG] EIP173999
+// [Category] Improvement
+// [Description] [HWR]Remove useless comments from Intel ME
+// component.(except RC)
+// [Files] TDTWrapper.c
+//
+// 10 5/14/14 10:04p Tristinchou
+// [TAG] EIP167030
+// [Category] Improvement
+// [Description] Remove the variable runtime attribute and keep original
+// attributes.
+//
+// 9 12/17/13 9:50p Tristinchou
+// [TAG] EIP146961
+// [Category] Bug Fix
+// [Severity] Normal
+// [Symptom] After Initiated Resume, "Enter Intel AT Suspend Mode"
+// option is still enable in Bios setup menu
+// [RootCause] The conditional expression is never true to clean steup
+// item.
+// [Solution] Use MBP data to check AT status.
+//
+// 8 6/21/13 3:08a Klzhan
+// [TAG] EIP127189
+// [Category] Spec Update
+// [Severity] Important
+// [Description] Update ME RC 1.60
+//
+// 7 6/02/13 9:13a Klzhan
+// [TAG] EIPNone
+// [Category] Improvement
+// [Description] Report PBA not support when AT is disabled.
+//
+// 6 4/02/13 1:51a Klzhan
+// [TAG] EIPNone
+// [Category] Bug Fix
+// [Severity] Critical
+// [Symptom] Setup Variable crash
+// [RootCause] Variable not been initialized.
+//
+// 5 9/27/12 4:56a Klzhan
+// [TAG] EIP102254
+// [Category] Spec Update
+// [Severity] Important
+// [Description] Update ME RC 0.7
+// [Files] TDTWrapper.dxs
+// TDTWrapper.c
+// TDTWrapper.mak
+// TDTWrapper.sdl
+// TDTSetup.sd
+// TDTSetup.uni
+// TdtCallback.h
+// TDTWrapper.cif
+//
+// 4 8/30/12 2:57a Klzhan
+//
+// 3 4/24/12 3:33a Klzhan
+//
+// 2 4/24/12 12:33a Klzhan
+// Update modulepart to latest
+//
+// 1 2/08/12 1:07a Klzhan
+// Initial Check in
+//
+// 3 9/20/11 9:40a Klzhan
+// Check TdtConfig by Wrapper not SetupData.
+//
+// 2 4/21/11 2:58a Klzhan
+//
+// 1 2/25/11 1:40a Klzhan
+// Initial Check-in
+//
+// 1 12/03/10 5:09a Klzhan
+// Initial Check-in.
+//
+//
+//**********************************************************************
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: TdtSetup.c
+//
+// Description: Setup Hooks for Tdt.
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+/*++
+
+Copyright (c) 2004-2006 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:
+
+ TDTPlatformPolicy.c
+
+Abstract:
+
+ TDTPlatformPolicy to check and set TDT Platform Policy.
+
+--*/
+/*++
+ This file contains an 'Intel Peripheral Driver' and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+
+//This needs to be merged with AMT Platform Policy.
+
+//
+// Statements that include other files
+//
+//#include "Efi.h"
+
+
+#include <EFI.h>
+#include <AmiDxeLib.h>
+#include <Protocol\SMBios.h>
+#include <Include\Protocol\SmbiosGetFlashDataProtocol.h>
+#if (defined(CSM_SUPPORT) && (CSM_SUPPORT != 0))
+#include <Include\Protocol\LegacyRegion.h>
+#endif
+#include "Setup.h"
+#include "ReferenceCode\ME\Protocol\AtPlatformPolicy\AtPlatformPolicy.h"
+#include "MkhiMsgs.h"
+#include "Protocol\MeBiosPayloadData\MeBiosPayloadData.h"
+#include "TdtCallback.h"
+#define BDS_ALL_DRIVERS_CONNECTED_PROTOCOL_GUID \
+ { 0xdbc9fd21, 0xfad8, 0x45b0, 0x9e, 0x78, 0x27, 0x15, 0x88, 0x67, 0xcc, 0x93 }
+
+#define ME_ALERT_AT_HANDLER_GUID {0xb441df87, 0x8d94, 0x4811, 0x85, 0xf7, 0xf, 0x9a, 0x7b, 0xf8, 0x9d, 0x2a}
+
+#define SMB131_IDENTIFIER_OFFSET 0x38
+#define SMB131_ME_CAPS_OFFSET 0x18
+#define SMB131_AT_ENROLL_OFFSET 0x24
+#define SMB131_BIOS_SEC_CAPS_OFFSET 0x34
+
+EFI_GUID gSetupGuid = SETUP_GUID;
+EFI_GUID gDxePlatformTdtPolicyGuid = DXE_PLATFORM_AT_POLICY_GUID;
+EFI_GUID gEfiSmbiosProtocolGuid = EFI_SMBIOS_PROTOCOL_GUID;
+#if (defined(CSM_SUPPORT) && (CSM_SUPPORT != 0))
+EFI_GUID gEfiLegacyRegionProtocol = EFI_LEGACY_REGION_PROTOCOL_GUID;
+#endif
+EFI_GUID gBdsAllDriversConnectedProtocolGuid = \
+ BDS_ALL_DRIVERS_CONNECTED_PROTOCOL_GUID;
+EFI_GUID gMEAlertATHandlerGuid = ME_ALERT_AT_HANDLER_GUID;
+EFI_EVENT mReady2BootEvent;
+EFI_RUNTIME_SERVICES *gRT;
+EFI_BOOT_SERVICES *gBS;
+
+DXE_AT_POLICY_PROTOCOL *TDTPlatformPolicyInstance;
+
+#define EFI_TPL_DRIVER 6
+#define EFI_TPL_APPLICATION 4
+#define EFI_TPL_CALLBACK 8
+#define EFI_TPL_NOTIFY 16
+#define EFI_TPL_HIGH_LEVEL 31
+
+VOID
+EFIAPI
+TDTEventModSmbiosType131 (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+);
+
+DXE_MBP_DATA_PROTOCOL *mBIOSPayLoad;
+VOID NullFunction(
+ EFI_EVENT Event,
+ VOID *ParentImageHandle
+)
+{
+ return;
+}
+
+//
+// Function implementations
+//
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+//
+// Procedure: TxtExitSetupEvent
+//
+// Description: This routine for reset the TPM Establishment flag.
+//
+// Input: EFI_EVENT - Efi event.
+// VOID* - Image handle.
+//
+// Output: None.
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS
+TdtAllDriverConnectEvent (
+ IN EFI_EVENT Event,
+ IN VOID *ParentImageHandle
+)
+{
+ EFI_STATUS Status;
+ EFI_EVENT MEAlertAT;
+ UINT32 SetupVarAttr;
+ EFI_GUID TdtSetupDataGuid = TDT_VOLATILE_SETUP_DATA_GUID;
+ TDT_VOLATILE_SETUP_DATA TdtSetupData;
+ SETUP_DATA SetupData;
+ UINTN VariableSize = sizeof(SETUP_DATA);
+
+ // Get current Setup Data.
+ Status = gRT->GetVariable( L"Setup",
+ &gSetupGuid,
+ &SetupVarAttr,
+ &VariableSize,
+ &SetupData );
+ if( !EFI_ERROR(Status) )
+ {
+ if( (mBIOSPayLoad->MeBiosPayload.AtState.State == AT_STATE_INACTIVE) &&
+ (SetupData.TdtEnterSuspendState != 0) )
+ {
+ SetupData.TdtEnterSuspendState = 0;
+ Status = gRT->SetVariable ( L"Setup",
+ &gSetupGuid,
+ SetupVarAttr,
+ VariableSize,
+ &SetupData );
+ }
+ }
+
+ TdtSetupData.TdtEnroll = 0;
+ if (mBIOSPayLoad->MeBiosPayload.AtState.State != 0) TdtSetupData.TdtEnroll = 1;
+ Status = gRT->SetVariable ( TDT_VOLATILE_SETUP_DATA_C_NAME, \
+ &TdtSetupDataGuid, \
+ EFI_VARIABLE_NON_VOLATILE | \
+ EFI_VARIABLE_BOOTSERVICE_ACCESS, \
+ sizeof(TDT_VOLATILE_SETUP_DATA), \
+ &TdtSetupData );
+ // Signal Event To support New AT AM module.
+ Status = gBS->CreateEventEx(
+ EFI_EVENT_NOTIFY_SIGNAL,
+ EFI_TPL_NOTIFY,
+ NullFunction,
+ NULL,
+ &gMEAlertATHandlerGuid,
+ &MEAlertAT);
+ gBS->SignalEvent(MEAlertAT);
+ gBS->CloseEvent(MEAlertAT);
+ return EFI_SUCCESS;
+}
+VOID LocateMBP(IN EFI_EVENT Event, IN VOID *Context)
+{
+ pBS->LocateProtocol (&gMeBiosPayloadDataProtocolGuid, NULL, &mBIOSPayLoad);
+}
+EFI_STATUS
+EFIAPI
+TdtWrapperEntryPoint (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+)
+/*++
+
+Routine Description:
+
+ Entry point for the TDTPlatformPolicy Driver.
+
+Arguments:
+
+ ImageHandle Image handle of this driver.
+ SystemTable Global system service table.
+
+Returns:
+
+ EFI_SUCCESS Initialization complete.
+ EFI_UNSUPPORTED The chipset is unsupported by this driver.
+ EFI_OUT_OF_RESOURCES Do not have enough resources to initialize the driver.
+ EFI_DEVICE_ERROR Device error, driver exits abnormally.
+
+--*/
+{
+ EFI_STATUS Status;
+ EFI_GUID gSetupGuid = SETUP_GUID;
+ UINT32 SetupVarAttr;
+ UINTN VariableSize = 0;
+ SETUP_DATA SetupDataBuffer;
+ SETUP_DATA* SetupData = &SetupDataBuffer;
+ EFI_EVENT AllDriverConnectEvent;
+ VOID *Registration;
+ EFI_GUID TdtSetupDataGuid = TDT_VOLATILE_SETUP_DATA_GUID;
+ TDT_VOLATILE_SETUP_DATA TdtSetupData;
+ //
+ // Initialize the EFI Driver Library
+ //
+
+ VariableSize = sizeof (SETUP_DATA);
+ InitAmiLib(ImageHandle, SystemTable);
+ gBS = SystemTable->BootServices;
+ gRT = SystemTable->RuntimeServices;
+
+ Status = gBS->LocateProtocol(&gMeBiosPayloadDataProtocolGuid, NULL, &mBIOSPayLoad);
+ if (EFI_ERROR (Status))
+ {
+ EFI_EVENT AmiCpuInfoEvt;
+ VOID *CpuNotifyReg;
+
+ Status = RegisterProtocolCallback(
+ &gMeBiosPayloadDataProtocolGuid,
+ LocateMBP,
+ NULL,
+ &AmiCpuInfoEvt,
+ &CpuNotifyReg
+ );
+ }
+ //
+ // Allocate Ide private data structure
+ //
+ Status = gBS->AllocatePool (
+ EfiBootServicesData,
+ sizeof (DXE_AT_POLICY_PROTOCOL),
+ (VOID**)&TDTPlatformPolicyInstance
+ );
+ if (EFI_ERROR(Status))
+ return EFI_OUT_OF_RESOURCES;
+
+ //
+ // Get TDT BIOS Setup
+ //
+ Status = gRT->GetVariable (
+ L"Setup",
+ &gSetupGuid,
+ &SetupVarAttr,
+ &VariableSize,
+ &SetupDataBuffer
+ );
+ VariableSize = sizeof(TDT_VOLATILE_SETUP_DATA);
+ Status = gRT->GetVariable ( TDT_VOLATILE_SETUP_DATA_C_NAME, \
+ &TdtSetupDataGuid, \
+ NULL, \
+ &VariableSize, \
+ &TdtSetupData );
+ // If Tdt is in Enroll state, Set Tdt config to Enable.
+ if((!EFI_ERROR(Status)) && (TdtSetupData.TdtEnroll == 1))
+ {
+ SetupData->TdtConfig = 1;
+ Status = gRT->SetVariable ( L"Setup", \
+ &gSetupGuid, \
+ SetupVarAttr, \
+ sizeof(SETUP_DATA), \
+ &SetupDataBuffer );
+ }
+ if (EFI_ERROR(Status)){
+ TDTPlatformPolicyInstance->At.AtAmBypass = 1;
+ TDTPlatformPolicyInstance->At.AtEnterSuspendState = 0;
+ TDTPlatformPolicyInstance->At.AtSupported = 1;
+ TDTPlatformPolicyInstance->At.AtPba = 1;
+ } else {
+ TDTPlatformPolicyInstance->At.AtAmBypass = SetupData->TdtConfig == 1 ? 0 : 1;
+ TDTPlatformPolicyInstance->At.AtEnterSuspendState = SetupData->TdtEnterSuspendState;
+ TDTPlatformPolicyInstance->At.AtSupported = 1;
+ TDTPlatformPolicyInstance->At.AtPba = 1;
+ }
+ TDTPlatformPolicyInstance->Revision = DXE_PLATFORM_AT_POLICY_PROTOCOL_REVISION_2;
+
+ //
+ // Install the TDT Platform Policy PROTOCOL interface
+ //
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &ImageHandle,
+ &gDxePlatformTdtPolicyGuid, TDTPlatformPolicyInstance,
+ NULL
+ );
+ // If TDT support is disabled in BIOS SETUP, clear the AT support flag of
+ // SMBIOS TYPE131 to avoid that system can be enrolled.
+ Status = RegisterProtocolCallback ( &gBdsAllDriversConnectedProtocolGuid, \
+ TdtAllDriverConnectEvent, \
+ NULL, \
+ &AllDriverConnectEvent, \
+ &Registration );
+
+ // If TDT support is disabled in BIOS SETUP, clear the AT support flag of
+ // SMBIOS TYPE131 to avoid that system can be enrolled.
+ Status = CreateReadyToBootEvent ( TPL_CALLBACK - 1, \
+ TDTEventModSmbiosType131, \
+ NULL, \
+ &mReady2BootEvent );
+
+ return Status;
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+//
+// Procedure: TDTEventModSmbiosType131
+//
+// Description: This routine clear the AT support flag of Type 131.
+//
+// Input:
+// IN EFI_EVENT Event - signalled event
+// IN VOID *Context - event context
+//
+// Output: None
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID
+EFIAPI
+TDTEventModSmbiosType131 (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+)
+{
+ EFI_STATUS Status;
+ EFI_SMBIOS_PROTOCOL *mSmbiosProtocol;
+ SMBIOS_TABLE_ENTRY_POINT *SmbTblEntry;
+#if (defined(CSM_SUPPORT) && (CSM_SUPPORT != 0))
+ EFI_LEGACY_REGION_PROTOCOL* iRegion;
+#endif
+ UINT16 i, MeCaps, AtEnroll, BiosSecurityCaps;
+ UINT8* pStrucPtr;
+ UINTN VariableSize = sizeof(TDT_VOLATILE_SETUP_DATA);
+ EFI_GUID TdtSetupDataGuid = TDT_VOLATILE_SETUP_DATA_GUID;
+ TDT_VOLATILE_SETUP_DATA TdtSetupData;
+
+ Status = gBS->LocateProtocol ( &gEfiSmbiosProtocolGuid, \
+ NULL, \
+ &mSmbiosProtocol );
+ if (EFI_ERROR(Status)) return ;
+
+ Status = gRT->GetVariable ( TDT_VOLATILE_SETUP_DATA_C_NAME, \
+ &TdtSetupDataGuid, \
+ NULL, \
+ &VariableSize, \
+ &TdtSetupData );
+ if (EFI_ERROR(Status)) return ;
+
+ // Get SMBIOS Table Entry Point.
+ SmbTblEntry = mSmbiosProtocol->SmbiosGetTableEntryPoint ();
+
+ // Search SMBIOS Type 131.
+ for ( pStrucPtr = (UINT8*)SmbTblEntry->TableAddress, i = 0; \
+ i < SmbTblEntry->TableLength; i++ ) {
+ // search SMBIOS Type 131 structure identifier - vPro
+ if ( *(UINT32*)(pStrucPtr + i) != 0x6f725076 ) continue;
+ // Pointer to ME Capabilities field.
+ MeCaps = i - (SMB131_IDENTIFIER_OFFSET - SMB131_ME_CAPS_OFFSET);
+ AtEnroll = i - (SMB131_IDENTIFIER_OFFSET - SMB131_AT_ENROLL_OFFSET);
+ BiosSecurityCaps = i - (SMB131_IDENTIFIER_OFFSET - SMB131_BIOS_SEC_CAPS_OFFSET);
+ if (*(UINT32*)(pStrucPtr + MeCaps) & BIT13) {
+#if (defined(CSM_SUPPORT) && (CSM_SUPPORT != 0))
+ Status = pBS->LocateProtocol ( &gEfiLegacyRegionProtocol, \
+ NULL, \
+ &iRegion );
+ if (EFI_ERROR(Status)) return ;
+ // Unlock Shadow ram.
+ iRegion->UnLock ( iRegion, 0xE0000, 0x20000, NULL );
+#endif
+ // AT-P is disabled in SETUP, clear the AT-p support flag to avoid
+ // that system can be enrolled.
+ if (TDTPlatformPolicyInstance->At.AtAmBypass == 1)
+ {
+ *(UINT32*)(pStrucPtr + MeCaps) &= ~BIT13;
+ *(UINT32*)(pStrucPtr + BiosSecurityCaps) &= ~BIT6;
+ }
+ // Set AT is configured if AT is enrolled.
+ if (TdtSetupData.TdtEnroll != 0)
+ *(UINT8*)(pStrucPtr + AtEnroll) |= BIT5;
+ // Lock Shadow ram.
+#if (defined(CSM_SUPPORT) && (CSM_SUPPORT != 0))
+ iRegion->Lock ( iRegion, 0xE0000, 0x20000, NULL );
+#endif
+ }
+ break;
+ }
+ return ;
+}
+
+
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/TdtWrapper/TDTWrapper.cif b/Board/EM/MeWrapper/TdtWrapper/TDTWrapper.cif
new file mode 100644
index 0000000..b72653d
--- /dev/null
+++ b/Board/EM/MeWrapper/TdtWrapper/TDTWrapper.cif
@@ -0,0 +1,15 @@
+<component>
+ name = "TdtWrapper"
+ category = ModulePart
+ LocalRoot = "Board\EM\MeWrapper\TdtWrapper\"
+ RefName = "TdtWrapper"
+[files]
+"TDTWrapper.dxs"
+"TDTWrapper.c"
+"TDTWrapper.mak"
+"TDTWrapper.sdl"
+"TDTSetup.sd"
+"TDTSetup.uni"
+"TdtCallback.h"
+"TdtOfbd.c"
+<endComponent>
diff --git a/Board/EM/MeWrapper/TdtWrapper/TDTWrapper.dxs b/Board/EM/MeWrapper/TdtWrapper/TDTWrapper.dxs
new file mode 100644
index 0000000..6226366
--- /dev/null
+++ b/Board/EM/MeWrapper/TdtWrapper/TDTWrapper.dxs
@@ -0,0 +1,93 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/TdtWrapper/TDTWrapper.dxs 1 2/08/12 1:07a Klzhan $
+//
+// $Revision: 1 $
+//
+// $Date: 2/08/12 1:07a $
+//
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/TdtWrapper/TDTWrapper.dxs $
+//
+// 1 2/08/12 1:07a Klzhan
+// Initial Check in
+//
+// 1 2/25/11 1:40a Klzhan
+// Initial Check-in
+//
+// 1 12/03/10 5:09a Klzhan
+// Initial Check-in.
+//
+//
+//**********************************************************************
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: TdtSetup.dxs
+//
+// Description: Dependency expression file.
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+/*++
+
+Copyright (c) 2004-2006 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:
+
+ TDTPlatformPolicy.h
+
+Abstract:
+
+ Dependency expression file for TDTPlatformPolicy Invocation Driver.
+
+--*/
+/*++
+ This file contains an 'Intel Peripheral Driver' and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+DEPENDENCY_START
+ TRUE
+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/TdtWrapper/TDTWrapper.mak b/Board/EM/MeWrapper/TdtWrapper/TDTWrapper.mak
new file mode 100644
index 0000000..8436e78
--- /dev/null
+++ b/Board/EM/MeWrapper/TdtWrapper/TDTWrapper.mak
@@ -0,0 +1,158 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/TdtWrapper/TDTWrapper.mak 3 2/23/13 6:33a Klzhan $
+#
+# $Revision: 3 $
+#
+# $Date: 2/23/13 6:33a $
+#
+#**********************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/TdtWrapper/TDTWrapper.mak $
+#
+# 3 2/23/13 6:33a Klzhan
+# [TAG] EIPNone
+# [Category] Improvement
+# [Description] Fix build error when OFDB disabled
+#
+# 2 1/24/13 3:51a Klzhan
+# [TAG] EIP113197
+# [Category] Improvement
+# [Description] Block AFU when DTimer is running out.
+# [Files] TDTWrapper.dxs
+# TDTWrapper.c
+# TDTWrapper.mak
+# TDTWrapper.sdl
+# TDTSetup.sd
+# TDTSetup.uni
+# TdtCallback.h
+# TDTWrapper.cif
+#
+# 1 2/08/12 1:07a Klzhan
+# Initial Check in
+#
+# 1 2/25/11 1:40a Klzhan
+# Initial Check-in
+#
+# 2 12/03/10 5:56a Klzhan
+# Fix Build error.
+#
+# 1 12/03/10 5:09a Klzhan
+# Initial Check-in.
+#
+#
+#**********************************************************************
+#<AMI_FHDR_START>
+#
+# Name: TDTDxe.mak
+#
+# Description:
+#
+#<AMI_FHDR_END>
+#**********************************************************************
+# MAK file for the ModulePart:TDTPlatformPolicy
+!IFDEF OFBD_SUPPORT
+
+!IF $(OFBD_SUPPORT) == 1
+all : TdtWrapper TdtOfbd
+!ELSE #!IF $(OFBD_SUPPORT) == 1
+all : TdtWrapper
+!ENDIF
+
+!ELSE #!IFDEF OFBD_SUPPORT
+all : TdtWrapper
+!ENDIF
+
+BUILD_TDTWRAPPER_DIR = $(BUILD_DIR)\$(TdtWrapper_DIR)
+
+TdtWrapper : $(BUILD_DIR)\TdtWrapper.mak TdtWrapperBin
+
+$(BUILD_DIR)\TdtWrapper.mak : $(TdtWrapper_DIR)\$(@B).cif $(TdtWrapper_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(TdtWrapper_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+
+# MAK file for the eModule:TdtWrapper
+TdtAm_INCLUDES =\
+ $(TDT_INCLUDES)\
+ $(ME_INCLUDES)
+
+TdtWrapper_OBJECTS = $(BUILD_TDTWRAPPER_DIR)\TdtWrapper.obj
+
+TdtWrapper_CFLAGS = $(CFLAGS)
+
+TdtWrapperBin : $(AMIDXELIB) $(AMICSPLib) $(MeLibDxe_LIB)
+ $(MAKE) /$(MAKEFLAGS) $(BUILD_DEFAULTS)\
+ /f $(BUILD_DIR)\TdtWrapper.mak all\
+ "MY_INCLUDES=$(TdtAm_INCLUDES)"\
+ NAME=TdtWrapper\
+ MAKEFILE=$(BUILD_DIR)\TdtWrapper.mak \
+ "CFLAGS=$(TdtWrapper_CFLAGS) /I$(TdtWrapper_DIR)"\
+ GUID=CA5E3DF0-940A-48f1-8C14-DB2FB5998B36\
+ OBJECTS="$(TdtWrapper_OBJECTS)" \
+ ENTRY_POINT=TdtWrapperEntryPoint\
+ TYPE=BS_DRIVER \
+ DEPEX1=$(TdtWrapper_DIR)\TdtWrapper.dxs\
+ DEPEX1_TYPE=EFI_SECTION_DXE_DEPEX\
+ COMPRESS=1
+
+#---------------------------------------------------------------------------
+# Create TDT OFBD Library
+#---------------------------------------------------------------------------
+TdtOfbd : $(BUILD_DIR)\TdtWrapper.mak TdtOfbdLibBin
+
+TDT_OFBD_INCLUDES =\
+/I$(OFBD_DIR)\
+/I$(MeProtocolLib_DIR)\
+/I$(AtAmDxe_DIR)\
+$(ME_INCLUDES)
+
+TdtOfbd_OBJECTS = $(BUILD_TDTWRAPPER_DIR)\TdtOfbd.obj
+
+TdtOfbdLibBin : $(AMIDXELIB)
+ @set INCLUDE=%%INCLUDE%%
+ $(MAKE) /$(MAKEFLAGS) $(BUILD_DEFAULTS)\
+ /f $(BUILD_DIR)\TdtWrapper.mak all\
+ "MY_INCLUDES=$(TDT_OFBD_INCLUDES)" \
+ "CFLAGS=$(CFLAGS:/W4=/W3)" \
+ OBJECTS="$(TdtOfbd_OBJECTS)" \
+ TYPE=LIBRARY LIBRARY_NAME=$(TDTOFBDLIB)
+
+$(TDTOFBDLIB) : TdtOfbd
+#---------------------------------------------------------------------------
+# Create Intel TDT Setup Screens
+#---------------------------------------------------------------------------
+SetupSdbs : $(BUILD_DIR)\TdtWrapper.mak TDTSetupSDB
+
+TDTSetupSDB :
+ $(MAKE) /$(MAKEFLAGS) $(BUILD_DEFAULTS)\
+ /f $(BUILD_DIR)\TdtWrapper.mak all \
+ TYPE=SDB NAME=TdtWrapper STRING_CONSUMERS=$(TdtWrapper_DIR)\TDTSetup.sd
+
+
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/TdtWrapper/TDTWrapper.sdl b/Board/EM/MeWrapper/TdtWrapper/TDTWrapper.sdl
new file mode 100644
index 0000000..cebc89e
--- /dev/null
+++ b/Board/EM/MeWrapper/TdtWrapper/TDTWrapper.sdl
@@ -0,0 +1,98 @@
+TOKEN
+ Name = "TdtWrapper_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable TdtWrapper support in Project"
+ TokenType = Boolean
+ TargetMAK = Yes
+ TargetH = Yes
+ Master = Yes
+ Token = "AT_SUPPORT" "=" "1"
+End
+
+
+PATH
+ Name = "TdtWrapper_DIR"
+End
+
+MODULE
+ Help = "Includes TdtWrapper.mak to Project"
+ File = "TdtWrapper.mak"
+End
+ELINK
+ Name = "$(BUILD_DIR)\TdtWrapper.sdb"
+ Parent = "SETUP_SDBS"
+ Priority = 30
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "$(TdtWrapper_DIR)\TdtSetup.sd"
+ Parent = "SETUP_DEFINITIONS"
+ Priority = 30
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\TdtWrapper.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End
+
+
+TOKEN
+ Name = "EXPECTED_FLASH_UPDATE_TIME"
+ Value = "300"
+ Help = "Expected Flash update time in seconds. 0 - Disable"
+ TokenType = Integer
+ Token = "OFBD_SUPPORT" "=" "1"
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "TDT_FLASH_UPDATE_ERROR_MESSAGE_1"
+ Value = "DTimer of Anti-Theft Technology is less than the expected time to perform the flash update."
+ TokenType = Expression
+ TargetH = Yes
+ Token = "EXPECTED_FLASH_UPDATE_TIME" "!=" "0"
+ Token = "OFBD_SUPPORT" "=" "1"
+End
+
+TOKEN
+ Name = "TDT_FLASH_UPDATE_ERROR_MESSAGE_2"
+ Value = "BIOS can not be updated at this time and please reconnect to Internet."
+ TokenType = Expression
+ TargetH = Yes
+ Token = "EXPECTED_FLASH_UPDATE_TIME" "!=" "0"
+ Token = "OFBD_SUPPORT" "=" "1"
+End
+
+TOKEN
+ Name = "TDTOFBDLIB"
+ Value = "$(BUILD_DIR)\TDTOFBDLIB.lib"
+ TokenType = Expression
+ TargetMAK = Yes
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\TDTOFBDLIB.lib"
+ Parent = "OFBDLISTLIB"
+ Token = "EXPECTED_FLASH_UPDATE_TIME" "!=" "0"
+ InvokeOrder = AfterParent
+ Token = "OFBD_SUPPORT" "=" "1"
+End
+
+ELINK
+ Name = "TDTOfbdEntry,"
+ Parent = "OFBDPartsList"
+ Token = "EXPECTED_FLASH_UPDATE_TIME" "!=" "0"
+ Token = "OFBD_SUPPORT" "=" "1"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "TDTOfbdInSmmEntry,"
+ Parent = "OFBDInSmmFuncList"
+ Token = "EXPECTED_FLASH_UPDATE_TIME" "!=" "0"
+ Token = "OFBD_SUPPORT" "=" "1"
+ InvokeOrder = AfterParent
+End
diff --git a/Board/EM/MeWrapper/TdtWrapper/TdtCallback.h b/Board/EM/MeWrapper/TdtWrapper/TdtCallback.h
new file mode 100644
index 0000000..61b29b9
--- /dev/null
+++ b/Board/EM/MeWrapper/TdtWrapper/TdtCallback.h
@@ -0,0 +1,69 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/TdtWrapper/TdtCallback.h 1 2/08/12 1:07a Klzhan $
+//
+// $Revision: 1 $
+//
+// $Date: 2/08/12 1:07a $
+//
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/TdtWrapper/TdtCallback.h $
+//
+// 1 2/08/12 1:07a Klzhan
+// Initial Check in
+//
+// 1 2/25/11 1:40a Klzhan
+// Initial Check-in
+//
+// 1 12/03/10 5:09a Klzhan
+// Initial Check-in.
+//
+//
+//**********************************************************************
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: TdtCallBack.h
+//
+// Description: Setup Var definetion.
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+#define TDT_VOLATILE_SETUP_DATA_GUID \
+{0x7b77fb8b, 0x1e0d, 0x4d7e, 0x95, 0x3f, 0x39, 0x80, 0xa2, 0x61, 0xe0, 0x76}
+
+#define TDT_VOLATILE_SETUP_DATA_C_NAME L"TdtAdvancedSetupDataVar"
+
+typedef struct _TDT_VOLATILE_SETUP_DATA {
+ UINT8 TdtEnroll;
+} TDT_VOLATILE_SETUP_DATA;
+
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/TdtWrapper/TdtOfbd.c b/Board/EM/MeWrapper/TdtWrapper/TdtOfbd.c
new file mode 100644
index 0000000..b64b09e
--- /dev/null
+++ b/Board/EM/MeWrapper/TdtWrapper/TdtOfbd.c
@@ -0,0 +1,296 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (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/TdtWrapper/TdtOfbd.c 7 4/30/13 7:59a Tristinchou $
+//
+// $Revision: 7 $
+//
+// $Date: 4/30/13 7:59a $
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeWrapper/TdtWrapper/TdtOfbd.c $
+//
+// 7 4/30/13 7:59a Tristinchou
+// [TAG] EIPNone
+// [Category] Bug Fix
+// [Severity] Normal
+// [RootCause] Pointer may be destroyed in smm.
+// [Solution] Get value instead of using pointer.
+// [Files] TdtOfbd.c
+//
+// 6 3/26/13 8:09a Calvinchen
+// [TAG] EIP119036.2
+// [Category] Bug Fix
+// [Severity] Important
+// [Symptom] SecureFlash fail with ME "AT disable"
+// [RootCause] SMM HECI not installed if ME is disabled by FDO Jumper.
+// [Solution] Added check SmmHeci protocol before AtGetTimerInfo call.
+//
+// 5 3/26/13 4:49a Calvinchen
+// [TAG] EIP119036.1
+// [Category] Bug Fix
+// [Severity] Important
+// [Symptom] SecureFlash fail with ME ¡§AT disable¡¨
+// [RootCause] HECI returns "UNSUPPORTED" not "TIMEOUT" if ME is
+// disabled.
+// [Solution] Added check ME Mode and AT state before AtGetTimeInfo
+// call.
+// [Files] TdtOfbd.c
+//
+// 4 3/25/13 10:17a Calvinchen
+// [TAG] EIP119036
+// [Category] Bug Fix
+// [Severity] Important
+// [Symptom] SecureFlash fail with ME "AT disable"
+// [RootCause] HECI Timeout if AtGetTimeInfo call.
+// [Solution] To Skip AtGetTimeInfo call if HECI Timeout at first call.
+// [Files] TdtOfbd.c
+//
+// 3 3/12/13 8:01a Klzhan
+// [TAG] EIPNone
+// [Category] Improvement
+// [Description] Fix AFU can update after frist time enrolled
+//
+// 2 3/04/13 4:48a Klzhan
+// [TAG] EIPNone
+// [Category] Improvement
+// [Description] Update for get timer fail in windows.
+//
+// 1 1/24/13 3:52a Klzhan
+// [TAG] EIP113197
+// [Category] Improvement
+// [Description] Block AFU when AT DTimer is running out
+//
+//
+//**********************************************************************
+//<AMI_FHDR_START>
+//
+// Name: TDTOfbd.c
+//
+// Description:
+//
+//<AMI_FHDR_END>
+//**********************************************************************
+#include <AmiLib.h>
+#include <AmiDxeLib.h>
+#include <Setup.h>
+#include "token.h"
+#include "OFBD.h"
+#include "HeciSmm\HeciSmm.h"
+#include "MkhiMsgs.h"
+#define _ME_LIB_H_
+#include "AtHi.h"
+#include "MeBiosPayloadData\MeBiosPayloadData.h"
+
+EFI_GUID gSetupGuid = SETUP_GUID;
+SMM_HECI_PROTOCOL *mHeci;
+EFI_GUID gSmmHeciProtocolGuid = SMM_HECI_PROTOCOL_GUID;
+DXE_MBP_DATA_PROTOCOL *MbpData;
+EFI_GUID gMeBiosPayloadDataProtocolGuid = ME_BIOS_PAYLOAD_DATA_PROTOCOL_GUID;
+BOOLEAN gIntelAT;
+
+//<AMI_PHDR_START>
+//---------------------------------------------------------------------------
+//
+// Procedure: AsciiStrLen
+//
+// Description:
+//
+// Input:
+//
+//
+// Output:
+//
+//---------------------------------------------------------------------------
+//<AMI_PHDR_END>
+UINTN
+EFIAPI
+AsciiStrLen (
+ IN CONST CHAR8 *String
+ )
+{
+ UINTN Length;
+
+ for (Length = 0; *String != '\0'; String++, Length++) {}
+ return Length;
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------
+// Procedure: HMRFPO_ENABLE_MSG
+//
+// Description: Send Enable HECI message to ME FW.
+//
+// Input: NONE
+//
+// Output: EFI_STATUS
+//
+// Returns:
+//
+//----------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS AtGetTimerInfo (
+ IN OUT UINT32 *Interval,
+ IN OUT UINT32 *TimeLeft
+)
+{
+ UINT32 HeciLength;
+ EFI_STATUS Status;
+
+ ATHI_GET_TIMER_INFO_CMD AtGetTimerInfoCmd;
+ ATHI_GET_TIMER_INFO_RSP AtGetTimerInfoRsp;
+
+ MemSet ((VOID *)&AtGetTimerInfoCmd, sizeof (ATHI_GET_TIMER_INFO_CMD), 0);
+ MemSet ((VOID *)&AtGetTimerInfoRsp, sizeof (ATHI_GET_TIMER_INFO_RSP), 0);
+
+ AtGetTimerInfoCmd.Header.Version.Minor = ATHI_PROTOCOL_VERSION_MINOR;
+ AtGetTimerInfoCmd.Header.Version.Major = ATHI_PROTOCOL_VERSION_MAJOR;
+ AtGetTimerInfoCmd.Header.Command.Category = ATHI_CMD_GROUP_THEFT_DETECTION;
+ AtGetTimerInfoCmd.Header.Command.IsResponse = AT_COMMAND;
+ AtGetTimerInfoCmd.Header.Command.Code = ATHI_THEFT_DETECT_GRP_GET_TIMER_INFO_CMD;
+ //
+ // 0- Length 0 only header with command is send as message
+ //
+ AtGetTimerInfoCmd.Header.Length = sizeof (ATHI_GET_TIMER_INFO_CMD) - sizeof (ATHI_HEADER);
+ AtGetTimerInfoCmd.TimerId = AT_TID_DISABLE_TIMER;
+
+
+ HeciLength = sizeof (ATHI_GET_TIMER_INFO_CMD);
+ Status = mHeci->ResetHeci();
+ Status = mHeci->SendMsg (
+ (UINT32 *) &AtGetTimerInfoCmd,
+ HeciLength,
+ BIOS_FIXED_HOST_ADDR,
+ HECI_AT_MESSAGE_ADDR
+ );
+
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ HeciLength = sizeof (ATHI_GET_TIMER_INFO_RSP);
+
+
+ Status = mHeci->ReadMsg (
+ BLOCKING,
+ (UINT32 *) &AtGetTimerInfoRsp,
+ &HeciLength
+ );
+
+ if (EFI_ERROR (Status)) {
+
+ return Status;
+ }
+
+ *Interval = AtGetTimerInfoRsp.TimerInfo.Interval;
+ *TimeLeft = AtGetTimerInfoRsp.TimerInfo.TimeLeft;
+
+ return EFI_SUCCESS;
+
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: TDTOfbdEntry
+//
+// Description:
+//
+// Input:
+// IN VOID *Buffer
+// IN OUT UINT8 *pOFBDDataHandled
+// Output:
+// VOID
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID TDTOfbdEntry (
+ IN VOID *Buffer,
+ IN OUT UINT8 *pOFBDDataHandled )
+{
+ UINTN VariableSize;
+ UINT32 TimeLeft, Interval;
+ EFI_STATUS Status = EFI_SUCCESS;
+ OFBD_HDR *pOFBDHdr = (OFBD_HDR*)Buffer;
+ char *TDTErrorMsg_1 = \
+ CONVERT_TO_STRING(TDT_FLASH_UPDATE_ERROR_MESSAGE_1);
+ char *TDTErrorMsg_2 = \
+ CONVERT_TO_STRING(TDT_FLASH_UPDATE_ERROR_MESSAGE_2);
+ OFBD_EXT_HDR *pOFBDExtHdr = (OFBD_EXT_HDR*)((UINT8 *)Buffer + pOFBDHdr->OFBD_HDR_SIZE);
+ UINT32 MeMode;
+
+ // Check AT timer one time when AFU is checking OFBD version.
+ if ((pOFBDHdr->OFBD_FS != 0) || (pOFBDExtHdr->TypeCodeID != 0)) return;
+ if ((mHeci == NULL)) return;
+ // Check AT timer if ME is normal state.
+ Status = mHeci->GetMeMode(&MeMode);
+ if (EFI_ERROR(Status) || (MeMode != ME_MODE_NORMAL)) return;
+ // Check AT timer if AT is enabled in FITC.
+ if (!gIntelAT) return;
+ Status = AtGetTimerInfo(&Interval, &TimeLeft);
+ // If not enrolled, TimeLeft will be 0
+ if (EFI_ERROR(Status) || (TimeLeft == 0)) return ;
+ if (TimeLeft > EXPECTED_FLASH_UPDATE_TIME) return ;
+ // Set the AFU Force Exit +>>>
+ VariableSize = AsciiStrLen(TDTErrorMsg_1);
+ (UINT8*)Buffer += pOFBDHdr->OFBD_Size;
+ MemSet ((UINT8*)Buffer + pOFBDHdr->OFBD_Size, VariableSize + 1, 0);
+ MemCpy ((UINT8*)Buffer , TDTErrorMsg_1, VariableSize);
+ (UINT8*)Buffer += VariableSize;
+ VariableSize = AsciiStrLen(TDTErrorMsg_2);
+ MemSet ((UINT8*)Buffer, VariableSize + 1, 0);
+ MemCpy ((UINT8*)Buffer, TDTErrorMsg_2, VariableSize);
+ pOFBDHdr->OFBD_RS |= (OFBD_RS_ERR_OUT + OFBD_RS_DIS_OEMSTR); // Tell the AFU display the OEM Message
+ // Set the AFU Force Exit <<<+
+ return;
+}
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: TDTOfbdInSmmEntry
+//
+// Description:
+//
+// Input:
+// IN VOID *Buffer
+// IN OUT UINT8 *pOFBDDataHandled
+// Output:
+// VOID
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID TDTOfbdInSmmEntry (VOID)
+{
+
+ EFI_STATUS Status;
+
+ Status = pBS->LocateProtocol (&gSmmHeciProtocolGuid, NULL, &mHeci);
+ if (EFI_ERROR (Status)) mHeci = NULL;
+ Status = pBS->LocateProtocol (&gMeBiosPayloadDataProtocolGuid, NULL, (VOID **) &MbpData);
+ if (EFI_ERROR (Status)) gIntelAT = FALSE;
+ else gIntelAT = (BOOLEAN)MbpData->MeBiosPayload.FwCapsSku.FwCapabilities.Fields.IntelAT;
+
+ return ;
+}
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (C)Copyright 1985-2009, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//*************************************************************************
+//*************************************************************************