summaryrefslogtreecommitdiff
path: root/Board/EM/MeWrapper/AmtWrapper
diff options
context:
space:
mode:
Diffstat (limited to 'Board/EM/MeWrapper/AmtWrapper')
-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
86 files changed, 17640 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