summaryrefslogtreecommitdiff
path: root/Core/EM/AMIDebugRx/binaries/PeiAMIDebugRx/INC
diff options
context:
space:
mode:
authorraywu <raywu0301@gmail.com>2018-06-15 00:00:50 +0800
committerraywu <raywu0301@gmail.com>2018-06-15 00:00:50 +0800
commitb7c51c9cf4864df6aabb99a1ae843becd577237c (patch)
treeeebe9b0d0ca03062955223097e57da84dd618b9a /Core/EM/AMIDebugRx/binaries/PeiAMIDebugRx/INC
downloadzprj-b7c51c9cf4864df6aabb99a1ae843becd577237c.tar.xz
init. 1AQQW051HEADmaster
Diffstat (limited to 'Core/EM/AMIDebugRx/binaries/PeiAMIDebugRx/INC')
-rw-r--r--Core/EM/AMIDebugRx/binaries/PeiAMIDebugRx/INC/AMIpeidebug.h469
-rw-r--r--Core/EM/AMIDebugRx/binaries/PeiAMIDebugRx/INC/AMIpeidebugX64.h509
-rw-r--r--Core/EM/AMIDebugRx/binaries/PeiAMIDebugRx/INC/EHCI.h244
-rw-r--r--Core/EM/AMIDebugRx/binaries/PeiAMIDebugRx/INC/INC.cif11
-rw-r--r--Core/EM/AMIDebugRx/binaries/PeiAMIDebugRx/INC/misc.h178
5 files changed, 1411 insertions, 0 deletions
diff --git a/Core/EM/AMIDebugRx/binaries/PeiAMIDebugRx/INC/AMIpeidebug.h b/Core/EM/AMIDebugRx/binaries/PeiAMIDebugRx/INC/AMIpeidebug.h
new file mode 100644
index 0000000..6bdb229
--- /dev/null
+++ b/Core/EM/AMIDebugRx/binaries/PeiAMIDebugRx/INC/AMIpeidebug.h
@@ -0,0 +1,469 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 2009, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **//
+//** **//
+//** Phone (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Header: /Alaska/BIN/Modules/AMIDebugRx/binaries/PeiAMIDebugRx/INC/AMIpeidebug.h 6 3/16/11 4:43p Sudhirv $
+//
+// $Revision: 6 $
+//
+// $Date: 3/16/11 4:43p $
+//*****************************************************************
+//*****************************************************************
+//
+// peidebug.h
+//
+//
+// Revision History
+// ----------------
+// $Log: /Alaska/BIN/Modules/AMIDebugRx/binaries/PeiAMIDebugRx/INC/AMIpeidebug.h $
+//
+// 6 3/16/11 4:43p Sudhirv
+// Changes to Support Older Cores before 4.6.5.0
+//
+// 5 3/09/11 8:22a Sudhirv
+// EIP 53658 - AMIDebugRx\Debugger support for PI 1.1
+//
+// 4 9/22/10 7:09p Sudhirv
+// 4.6.2_AMIDebugRx_2.01.0026_Beta Release
+//
+// 3 9/30/09 8:00p Madhans
+// Updated for 1.31. Refer release notes.
+//
+// 2 7/17/09 7:15p Madhans
+// DebugRx 1.30.0022
+//
+// 2 7/13/09 2:49p Sudhirv
+// Update with Coding Standards
+//
+// 1 7/07/09 4:46p Sudhirv
+// Restructure Binaries Created
+//
+// 1 5/01/09 7:48p Madhans
+// AMIDebug Rx Module. Intial Checkin.
+//
+// 1 4/29/09 7:52a Sudhirv
+// AMI Debug Rx module created
+//
+// 25 3/19/09 3:41p Sudhirv
+// Added After changes for Target Sending Exception Packets
+//
+// 23 1/30/09 12:32p Sudhirv
+// Added after Console Redirection Support
+//
+// 22 9/25/08 4:29p Sudhirv
+// Updated SMM Debugging and Read/Write Mem
+//
+// 21 7/29/08 1:09p Sudhirv
+// Changes made to support SMM debugging in savemem and loadmem
+// extension commands
+//
+// 20 6/26/08 3:30p Sudhirv
+// Uploaded after checking coding standards
+//
+// 19 6/11/08 2:24p Sudhirv
+// After Addibg GP Handling in MSR
+//
+// 18 6/11/08 5:46a Sudhirv
+// Uploaded for Release with Read/WriteMSR restriction, Readio/Writeio
+// restriction, Read/Write IndirectIO, ListModules and PciList
+//
+// 17 12/05/07 8:23a Sudhirv
+// Added to support and Restrict ReadMSR/WriteMSR commands
+//
+// 16 10/24/07 10:31a Madhans
+// Hatdriver Support.
+//
+// 15 8/29/07 3:49p Madhans
+// To resolve AMD Platfrom issues.
+//
+// 14 8/29/07 12:49p Madhans
+// Common code for 4.x and 3.x
+//
+// 13 6/13/07 3:16p Madhans
+// Copyright Year updated.
+//
+// 12 6/13/07 2:37p Madhans
+// To improve the performance in Load FV though Serial.
+//
+// 11 6/05/07 7:10p Natalyak
+// Load FV support
+//
+// 10 4/05/07 6:33p Madhans
+// CAR_BASE_ADJUST_OFFSET removed.
+//
+// 9 3/10/07 1:24p Madhans
+// CAR_BASE_ADJUST_OFFSET allows to have PEI_SERVICES address above IDT
+//
+// 8 2/23/07 5:36p Madhans
+// PeiDbgr_SendPeiLoadImage function added.
+//
+// 7 1/22/07 11:41a Madhans
+// Modification made for Binary Release 1.04.0003.
+//
+// 11 1/05/07 6:15p Madhan
+//
+// 10 1/05/07 1:05p Ashrafj
+// Latest version 1.04.0001 Beta
+// Known issues from previous 1.04.000 Beta release has been fixed.
+//
+// 9 12/26/06 7:07p Ashrafj
+// Support added to support the Aptio 4.5 x64 EFI BIOS (use latest
+// Host.zip).
+// PEI Debugger in FV_MAIN (use new PEIDEBUGFIXUP).
+// Support added for StatusCode redirection without Debug feature enabled
+// (not working if DXE only and x64 is enabled).
+// Plus, some new SDL tokens defined to support the Aptio 4.5 build
+// process in Debug or non-debug mode.
+// All the components of Debugger eModule in source form.
+//
+// 7 6/27/06 11:44a Ashrafj
+// New feature added:
+// To enable the PEI Debug support after system memory is installed, based
+// on build option provided through a new SDL token named
+// "PEI_DEBUG_SUPPORT_AFTER_MEMORY".
+//
+// 6 3/15/06 7:45p Ashrafj
+// Modfication done to provide the Binary integration for Aptio 4
+// projects.
+//
+// 5 12/22/05 12:42p Ashrafj
+// Changes done to support the complete Chipset template porting.
+//
+// To use this changes, make sure to have the latest Board components of
+// CPU, SB and SIO, which have the following ELINKS ported:
+// - SBPEIDBG_Initialize,
+// - CPUPEIDBG_Initialize,
+// - SIOPEIDBG_Initialize,
+// - SBPEIDBG_InitUsbEhci.
+//
+// 4 12/05/05 7:29p Ashrafj
+// Serial Port Debug Support added for PEI - DXE Debugger.
+//
+// Change in Serial Port Communication: Now the data transmission through
+// Serial Port is supported with the hardware Flow control feature of the
+// Serial Port controller.
+//
+// 3 11/29/05 6:07p Markw
+// Change USB interface function parameters.
+//
+// 2 10/25/05 11:38a Ashrafj
+// Minor fix - packed structure alignment and width size of global
+// variable.
+//
+// 1 10/19/05 10:54a Felixp
+//
+// 1 10/19/05 10:44a Felixp
+//
+//
+//
+//*****************************************************************
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: AMIPeiDebug.h
+//
+// Description: Contains 32 bit Pei Debugger prototypes
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+#ifndef _AMI_PEIDEBUG_H_
+#define _AMI_PEIDEBUG_H_
+
+#ifdef USB_DEBUGGER
+#include "EHCI.h"
+#endif
+
+#ifdef ALASKA_SUPPORT
+#include "token.h"
+#else
+#include "tokens.h"
+#endif
+
+#define EFI_PEI_DBG_BASEADDRESS_PPI_GUID \
+ { 0x9bf4e141, 0xa4ec, 0x4d72, {0xbc, 0xc4, 0x94, 0x2, 0x1d, 0x2b, 0x80, 0xbd }}
+
+#if defined (PI_SPECIFICATION_VERSION)
+#if PI_SPECIFICATION_VERSION>=0x00010000
+UINTN GetCARBaseAddress();
+#define PEI_DEBUG_DATASECTION_BASEADDRESS GetCARBaseAddress() //Starting address of PEI debugger data section
+#define PEI_DEBUG_DATASECTION_SIZE 0x2048
+
+#else //if PI_SPECIFICATION_VERSION >= 0x00010000
+#ifdef ALASKA_SUPPORT
+#define PEI_DEBUG_DATASECTION_BASEADDRESS CAR_BASE_ADDRESS //Starting address of PEI debugger data section
+#define PEI_DEBUG_DATASECTION_SIZE CAR_TOTAL_SIZE
+#else //ifdef ALASKA_SUPPORT
+#define PM_BASE_ADDRESS APLIB_PM_BASE_ADDRESS
+#define DATA_STACK_BASEADDRESS APLIB_CAR_BASEADDRESS
+#define PEI_DEBUG_DATASECTION_BASEADDRESS DATA_STACK_BASEADDRESS //Starting address of PEI debugger data section
+#define PEI_DEBUG_DATASECTION_SIZE 0x400
+#endif //ifdef ALASKA_SUPPORT
+
+#endif //if PI_SPECIFICATION_VERSION >= 0x00010000
+
+#else //if not defined (PI_SPECIFICATION_VERSION)
+#ifdef ALASKA_SUPPORT
+#define PEI_DEBUG_DATASECTION_BASEADDRESS CAR_BASE_ADDRESS //Starting address of PEI debugger data section
+#define PEI_DEBUG_DATASECTION_SIZE CAR_TOTAL_SIZE
+#else //ifdef ALASKA_SUPPORT
+#define PM_BASE_ADDRESS APLIB_PM_BASE_ADDRESS
+#define DATA_STACK_BASEADDRESS APLIB_CAR_BASEADDRESS
+#define PEI_DEBUG_DATASECTION_BASEADDRESS DATA_STACK_BASEADDRESS //Starting address of PEI debugger data section
+#define PEI_DEBUG_DATASECTION_SIZE 0x400
+#endif //ifdef ALASKA_SUPPORT
+
+#endif //if defined (PI_SPECIFICATION_VERSION)
+
+#define IRQ_VECTOR_BASE 0x8
+
+typedef struct {
+ UINT8 Signature[4];
+ UINT32 DATABASEADDRESS;
+}PEI_DBG_DATA_SECTION;
+
+#ifdef RELOCATE
+
+#if defined PI_SPECIFICATION_VERSION
+#if (PI_SPECIFICATION_VERSION >= 0x00010000)
+#define PEI_DEBUG_DATA_BASEADDRESS GetCARBaseAddress() //(PeiDbgDataSection.DATABASEADDRESS)
+#else
+extern PEI_DBG_DATA_SECTION PeiDbgDataSection;
+#define PEI_DEBUG_DATA_BASEADDRESS (PeiDbgDataSection.DATABASEADDRESS)
+#endif
+#else
+extern PEI_DBG_DATA_SECTION PeiDbgDataSection;
+#define PEI_DEBUG_DATA_BASEADDRESS (PeiDbgDataSection.DATABASEADDRESS)
+#endif
+
+#else
+#define PEI_DEBUG_DATA_BASEADDRESS PEI_DEBUG_DATASECTION_BASEADDRESS // Fixed Base Address
+#endif
+
+#define IDT_ENTRIES 0x14 // Number of Entries in IDT
+#define IDT_SIZE 0xa0 // Total Size = 160 Bytes
+#define CONTEXT_SIZE 0x74 // Total Size = 116 Bytes
+
+#define XPORTLOCALVAR_SIZE 0x48 // Total Size = 72 Bytes
+
+#define XPORTGLOBALVAR_SIZE 0x18 // Total Size = 24 Bytes
+//#define DBGRLOCALVAR_SIZE 0x2c // Total Size = 44 Bytes
+#define DBGRLOCALVAR_SIZE 0x36 // Total Size = 56 Bytes
+#define XPORTEXPTNBUF_SIZE 0x20 // Total Size = 32 Bytes
+
+//#define GLOBALBUF_SIZE 0x235 // Total Size = 565 Bytes
+#define GLOBALBUF_SIZE 0x210 // Total Size = 528 Bytes
+
+#define ACKBUF_SIZE 0x0a // Total Size = 10 Bytes
+
+
+
+#define PEI_DEBUG_IDTBASEADDR PEI_DEBUG_DATA_BASEADDRESS
+#define PEI_DEBUG_CONTEXTADDR PEI_DEBUG_DATA_BASEADDRESS + IDT_SIZE
+#define PEI_DEBUG_XPORTLOCALVARADDR PEI_DEBUG_CONTEXTADDR + CONTEXT_SIZE
+#define PEI_DEBUG_XPORTGLOBALVARADDR PEI_DEBUG_XPORTLOCALVARADDR + XPORTLOCALVAR_SIZE
+#define PEI_DEBUG_DBGRLOCALVARADDR PEI_DEBUG_XPORTGLOBALVARADDR + XPORTGLOBALVAR_SIZE
+#define PEI_DEBUG_XPORTEXPTNADDR PEI_DEBUG_DBGRLOCALVARADDR + DBGRLOCALVAR_SIZE
+#define PEI_DEBUG_BUFADDR PEI_DEBUG_XPORTEXPTNADDR + XPORTEXPTNBUF_SIZE
+#define PEI_DEBUG_ACKADDR PEI_DEBUG_BUFADDR + GLOBALBUF_SIZE
+
+#define IN_PEI_BEFORE_MEMORY 0
+#define IN_PEI_AFTER_MEMORY 01
+#define IN_DXE_WITH_PEI_DBGR 02
+#define IN_DXE_WITH_DXE_DBGR 03
+
+#pragma pack (push, pei_struct_data_pack, 1)
+
+typedef struct {
+ unsigned char IDTSet[IDT_SIZE];
+ unsigned char ContextReg[CONTEXT_SIZE];
+ unsigned char XportLocalVar[XPORTLOCALVAR_SIZE];
+ unsigned char XportGlobalVar[XPORTGLOBALVAR_SIZE];
+ unsigned char DbgrLocalVar[DBGRLOCALVAR_SIZE];
+ unsigned char XportExptn[XPORTEXPTNBUF_SIZE];
+ unsigned char GlobalBuf[GLOBALBUF_SIZE];
+ unsigned char AckBuf[ACKBUF_SIZE];
+} PEIDebugData_T;
+
+
+#pragma pack (pop, pei_struct_data_pack)
+
+
+typedef struct _AMI_PEI_TRANSPORT_PROTOCOL {
+ UINT8 Signature[4];
+ UINT16 (*Initialize)();
+ UINT16 (*Restore)();
+ UINT16 (*Send)();
+ UINT16 (*Receive)();
+ UINT16 (*SyncPacketNumber)();
+ UINT16 (*RegisterHandler)();
+ VOID (*Callback)();
+ UINT16 (*SendNoAck)();
+ EFI_STATUS (*ConsoleIn)();
+ VOID (*SendExptn)();
+} AMI_PEI_TRANSPORT_PROTOCOL;
+
+typedef struct{
+ UINT8 Signature[4];
+ VOID (*ExceptionCallback)();
+ VOID (*SendMessage)();
+ UINTN (*PeiDbgr_EnableDebugSupport)(UINTN BrkPtAddr);
+ UINTN (*PeiDbgr_SendPeiLoadImage)(UINTN FileHandle,UINTN ImageAddr,UINTN ImageSize,void * PDBFileName);
+ VOID (*DoSpecialBreakPoint)(UINT32 EaxValue,UINT32 EdxValue);
+}AMI_DEBUGGER_INTERFACE;
+
+#pragma pack(1)
+typedef struct {
+ UINT32 m_EIP;
+ UINT16 m_SendPktSize;
+ UINT8 m_CurSendPktNum;
+ UINT16 m_CurIxInRcvPkt;
+ UINT8 m_CurRcvPktNum;
+ UINT32 m_ExptnHndlr;
+ UINT8 m_IsSending;
+ UINT16 m_ExptnType;
+ UINT8 m_PrevByteEsc;
+ UINT8 m_RcvingPkt;
+ UINT8 m_RcvPktReady;
+ UINT16 m_RcvPktSize;
+ UINT8 m_IsPortInListenMode;
+ UINT8 m_IsHostConnected;
+ UINT8 m_IsPeiDbgIsS3;
+#ifndef USB_DEBUGGER
+ UINT16 m_BaseAddr;
+// UINT8 m_IsCOMPortInListenMode;
+// UINT32 m_ReadAttempts; //only for debugging purpose -remove later
+// UINT8 m_CacheRecvFIFO[24];
+// UINT8 m_CacheSize;
+// UINT8 m_CacheIndex;
+
+ //To obtain info from Porting template support, and use it to publish HOB
+ UINT8 m_SIO_LDN_UART; //Logical Device Number for COM port
+#else
+ UINT32 USBBASE;
+ UINT32 USB2_DEBUG_PORT_REGISTER_INTERFACE;
+ UINT8 gDebugUSBAddress;
+ UINT8 gDebugInEndpoint;
+ UINT8 gDebugOutEndpoint;
+ GET_DESCRIPTOR_DEBUG_PORT Descriptor;
+ UINT8 gUSBBulkTransferSetAddr;
+
+ UINT8 gIN_DATAPID;
+ UINT8 gOUT_DATAPID;
+
+ UINT8 gIN_DATABUFFER[8];
+ UINT8 gOUT_DATABUFFER[8];
+
+ UINT8 gCurrentINDataBufferLength;
+ UINT8 gCurrentINDataBufferIndex;
+ UINT8 gCurrentOUTDataBufferIndex;
+
+ UINT8 lastdata;
+
+ UINT8 gIsUsbDebugPortInUse;
+// UINT8 gIsUsbDebugPortInListenMode;
+
+ //To obtain info from Porting template support, and use it to publish HOB
+ UINT16 m_EHCI_MEMORY_SIZE;
+ UINT8 m_PCI_EHCI_BUS_NUMBER;
+ UINT8 m_PCI_EHCI_DEVICE_NUMBER;
+ UINT8 m_PCI_EHCI_FUNCTION_NUMBER;
+ UINT8 m_PCI_EHCI_BAR_OFFSET;
+#endif
+ UINT64 m_PeiDbgRxInitTimerVal;
+}SerXPortGblData_T;
+
+typedef struct {
+ AMI_PEI_TRANSPORT_PROTOCOL *gTransportProtocol;
+ UINT16 (*Handler)();
+
+ //Additional parameters added in order to support DXE phase callback of
+ //IRQ register handlers
+ UINTN InterruptType;
+ UINTN ContextData;
+ VOID (*IRQRegisterHandler)(UINTN,UINTN);
+
+#ifdef USB_DEBUGGER
+ //Additional interface for PeiDbgSIO module to reinit EHCI memory base
+// void (*PeiDbgSIO_Init_USB_EHCI)(UINTN PeiDbgData_BaseAddr,UINTN MMIO_BaseAddr);
+// void (*PeiDbgSIO_Init_USB_EHCI)(UINTN UsbBaseAddress, UINTN *Usb2DebugPortReg);
+ void (*PeiDbgSIO_Init_USB_EHCI)(VOID *);
+#endif
+}SerXPortGblVar_T;
+
+typedef struct {
+ UINT8 m_BrkPtType;
+ UINT16 m_CS;
+ UINT32 m_EIP;
+ UINT16 m_SS;
+ UINT32 m_ESP;
+ UINT32 m_DR2;
+ UINT32 m_DR7;
+ UINT8 m_TargetRunning;
+ UINT8 m_DbgrBusy;
+ UINT8 m_DR2Valid;
+
+ UINT8 m_GPOccrd;
+ UINT8 m_MSRState;
+
+ UINT8 m_NotifyAndBreak;
+
+ UINT16 m_DbgSendBufSize;
+ UINT16 m_DbgRcvBufSize;
+ VOID (*PeiDbgrReportStatusCode)();
+ UINT8 m_FlagToDebugAfterMemory;
+ UINTN (*PeiDbgr_EnableDebugSupport)(UINTN BrkPtAddr);
+ AMI_DEBUGGER_INTERFACE *pPeiDbgDbgrIfc;
+ UINT8 m_TargetState;
+ VOID* m_ppPeiSVC;
+ EFI_STATUS (*UpdateFVHob)();
+}DbgGblData_T;
+
+#pragma pack()
+
+#pragma pack(1)
+typedef struct {
+ UINT16 m_OffLow;
+ UINT16 m_SegSel;
+ UINT16 m_Reserved;
+ UINT16 m_OffHigh;
+}IDTEntry_T;
+
+typedef struct {
+ UINT16 IDTLength;
+ UINTN IDTBaseAddr; //should work for both 32 and 64 mode
+}IDTBASE;
+
+typedef UINT8 (DBG_IS_S3)(void);
+#pragma pack()
+
+void DriverSpecialBreakPoint(UINT32 EaxVal, UINT32 EdxVal);
+
+#endif
+
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 2009, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **//
+//** **//
+//** Phone (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
diff --git a/Core/EM/AMIDebugRx/binaries/PeiAMIDebugRx/INC/AMIpeidebugX64.h b/Core/EM/AMIDebugRx/binaries/PeiAMIDebugRx/INC/AMIpeidebugX64.h
new file mode 100644
index 0000000..d3bc15f
--- /dev/null
+++ b/Core/EM/AMIDebugRx/binaries/PeiAMIDebugRx/INC/AMIpeidebugX64.h
@@ -0,0 +1,509 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 2009, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **//
+//** **//
+//** Phone (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Header: /Alaska/BIN/Modules/AMIDebugRx/binaries/PeiAMIDebugRx/INC/AMIpeidebugX64.h 5 3/09/11 8:22a Sudhirv $
+//
+// $Revision: 5 $
+//
+// $Date: 3/09/11 8:22a $
+//*****************************************************************
+//*****************************************************************
+//
+// peidebug.h
+//
+//
+// Revision History
+// ----------------
+// $Log: /Alaska/BIN/Modules/AMIDebugRx/binaries/PeiAMIDebugRx/INC/AMIpeidebugX64.h $
+//
+// 5 3/09/11 8:22a Sudhirv
+// EIP 53658 - AMIDebugRx\Debugger support for PI 1.1
+//
+// 4 9/22/10 7:09p Sudhirv
+// 4.6.2_AMIDebugRx_2.01.0026_Beta Release
+//
+// 3 9/30/09 8:00p Madhans
+// Updated for 1.31. Refer release notes.
+//
+// 2 7/17/09 7:15p Madhans
+// DebugRx 1.30.0022
+//
+// 2 7/13/09 2:49p Sudhirv
+// Update with Coding Standards
+//
+// 1 7/07/09 4:46p Sudhirv
+// Restructure Binaries Created
+//
+// 1 5/01/09 7:48p Madhans
+// AMIDebug Rx Module. Intial Checkin.
+//
+// 1 4/29/09 7:52a Sudhirv
+// AMI Debug Rx module created
+//
+// 19 3/19/09 3:41p Sudhirv
+// Added After changes for Target Sending Exception Packets
+//
+// 17 1/30/09 12:32p Sudhirv
+// Added after Console Redirection Support
+//
+// 16 6/26/08 3:30p Sudhirv
+// Uploaded after checking coding standards
+//
+// 15 6/11/08 2:24p Sudhirv
+// After Addibg GP Handling in MSR
+//
+// 14 6/11/08 5:46a Sudhirv
+// Uploaded for Release with Read/WriteMSR restriction, Readio/Writeio
+// restriction, Read/Write IndirectIO, ListModules and PciList
+//
+// 13 12/05/07 8:23a Sudhirv
+// Added to support and Restrict ReadMSR/WriteMSR commands
+//
+// 12 10/24/07 10:31a Madhans
+// Hatdriver Support.
+//
+// 11 8/29/07 3:49p Madhans
+// To resolve AMD Platfrom issues.
+//
+// 10 8/29/07 12:49p Madhans
+// Common code for 4.x and 3.x
+//
+// 9 6/13/07 3:16p Madhans
+// Copyright Year updated.
+//
+// 8 6/05/07 7:11p Natalyak
+// Load FV support
+//
+// 7 4/05/07 6:33p Madhans
+// CAR_BASE_ADJUST_OFFSET removed.
+//
+// 6 3/10/07 1:24p Madhans
+// CAR_BASE_ADJUST_OFFSET allows to have PEI_SERVICES address above IDT
+//
+// 5 2/23/07 5:37p Madhans
+// Changes made for LoadImag PPI/Protocol Notifications.
+//
+// 4 1/22/07 11:41a Madhans
+// Modification made for Binary Release 1.04.0003.
+//
+// 3 1/05/07 6:15p Madhan
+//
+// 2 1/05/07 1:05p Ashrafj
+// Latest version 1.04.0001 Beta
+// Known issues from previous 1.04.000 Beta release has been fixed.
+//
+// 1 12/26/06 7:09p Ashrafj
+// Support added to support the Aptio 4.5 x64 EFI BIOS (use latest
+// Host.zip).
+// PEI Debugger in FV_MAIN (use new PEIDEBUGFIXUP).
+// Support added for StatusCode redirection without Debug feature enabled
+// (not working if DXE only and x64 is enabled).
+// Plus, some new SDL tokens defined to support the Aptio 4.5 build
+// process in Debug or non-debug mode.
+// All the components of Debugger eModule in source form.
+//
+// 7 6/27/06 11:44a Ashrafj
+// New feature added:
+// To enable the PEI Debug support after system memory is installed, based
+// on build option provided through a new SDL token named
+// "PEI_DEBUG_SUPPORT_AFTER_MEMORY".
+//
+// 6 3/15/06 7:45p Ashrafj
+// Modfication done to provide the Binary integration for Aptio 4
+// projects.
+//
+// 5 12/22/05 12:42p Ashrafj
+// Changes done to support the complete Chipset template porting.
+//
+// To use this changes, make sure to have the latest Board components of
+// CPU, SB and SIO, which have the following ELINKS ported:
+// - SBPEIDBG_Initialize,
+// - CPUPEIDBG_Initialize,
+// - SIOPEIDBG_Initialize,
+// - SBPEIDBG_InitUsbEhci.
+//
+// 4 12/05/05 7:29p Ashrafj
+// Serial Port Debug Support added for PEI - DXE Debugger.
+//
+// Change in Serial Port Communication: Now the data transmission through
+// Serial Port is supported with the hardware Flow control feature of the
+// Serial Port controller.
+//
+// 3 11/29/05 6:07p Markw
+// Change USB interface function parameters.
+//
+// 2 10/25/05 11:38a Ashrafj
+// Minor fix - packed structure alignment and width size of global
+// variable.
+//
+// 1 10/19/05 10:54a Felixp
+//
+// 1 10/19/05 10:44a Felixp
+//
+//
+//
+//*****************************************************************
+
+//<AMI_FHDR_START>
+//----------------------------------------------------------------------------
+//
+// Name: AmiPeiDebugx64.C
+//
+// Description: Contains X64 Pei Debugger prototypes
+//
+//----------------------------------------------------------------------------
+//<AMI_FHDR_END>
+#ifndef _AMI_PEIDEBUGx64_H_
+#define _AMI_PEIDEBUGx64_H_
+
+#ifdef USB_DEBUGGER
+#include "EHCI.h"
+#endif
+
+#ifdef ALASKA_SUPPORT
+#include "token.h"
+#else
+#include "tokens.h"
+#endif
+
+#ifdef ALASKA_SUPPORT
+#if defined (PI_SPECIFICATION_VERSION) && (PI_SPECIFICATION_VERSION >= 0x00010000)
+//#define PEI_DEBUG_DATASECTION_BASEADDRESS CAR_BASE_ADDRESS //Starting address of PEI debugger data section
+#else
+#define PEI_DEBUG_DATASECTION_BASEADDRESS CAR_BASE_ADDRESS //Starting address of PEI debugger data section
+#endif
+#else
+
+#define PM_BASE_ADDRESS APLIB_PM_BASE_ADDRESS
+#define DATA_STACK_BASEADDRESS APLIB_CAR_BASEADDRESS
+
+#define PEI_DEBUG_DATASECTION_BASEADDRESS DATA_STACK_BASEADDRESS //Starting address of PEI debugger data section
+#endif
+
+
+#define PEI_DEBUG_DATASECTION_SIZEx64 \
+ (IDT_SIZEx64 + CONTEXT_SIZEx64 + XPORTLOCALVAR_SIZEx64 + XPORTGLOBALVAR_SIZEx64\
+ + DBGRLOCALVAR_SIZEx64 + XPORTEXPTNBUF_SIZEx64 + GLOBALBUF_SIZEx64 + ACKBUF_SIZEx64)
+
+#define IRQ_VECTOR_BASE 0x8
+
+typedef struct {
+ UINT8 Signature[4];
+ UINT32 DATABASEADDRESS;
+}PEI_DBG_DATA_SECTIONx64;
+
+#ifdef RELOCATE
+extern PEI_DBG_DATA_SECTIONx64 PeiDbgDataSection;
+#define PEI_DEBUG_DATA_BASEADDRESS (PeiDbgDataSection.DATABASEADDRESS)
+#else
+#define PEI_DEBUG_DATA_BASEADDRESS PEI_DEBUG_DATASECTION_BASEADDRESS // Fixed Base Address
+#endif
+
+#define IDT_ENTRIES 0x14 // Number of Entries in IDT
+#define IDT_SIZEx64 0x160 // Total Size = 352 Bytes
+#define CONTEXT_SIZEx64 0x140 // Total Size = 320 Bytes
+
+#define XPORTLOCALVAR_SIZEx64 0x50 // Total Size = 80 Bytes
+
+#define XPORTGLOBALVAR_SIZEx64 0x30 // Total Size = 48 Bytes
+//#define DBGRLOCALVAR_SIZEx64 0x50 // Total Size = 80 Bytes
+#define DBGRLOCALVAR_SIZEx64 0x62 // Total Size = 98 Bytes
+#define XPORTEXPTNBUF_SIZEx64 0x20 // Total Size = 32 Bytes
+
+#define GLOBALBUF_SIZEx64 0x235 // Total Size = 565 Bytes
+
+#define ACKBUF_SIZEx64 0x0a // Total Size = 10 Bytes
+
+
+
+#define PEI_DEBUG_IDTBASEADDRx64 PEI_DEBUG_DATA_BASEADDRESS
+#define PEI_DEBUG_CONTEXTADDRx64 PEI_DEBUG_DATA_BASEADDRESS + IDT_SIZEx64
+#define PEI_DEBUG_XPORTLOCALVARADDRx64 PEI_DEBUG_CONTEXTADDRx64 + CONTEXT_SIZEx64
+#define PEI_DEBUG_XPORTGLOBALVARADDRx64 PEI_DEBUG_XPORTLOCALVARADDRx64 + XPORTLOCALVAR_SIZEx64
+#define PEI_DEBUG_DBGRLOCALVARADDRx64 PEI_DEBUG_XPORTGLOBALVARADDRx64 + XPORTGLOBALVAR_SIZEx64
+#define PEI_DEBUG_XPORTEXPTNADDRx64 PEI_DEBUG_DBGRLOCALVARADDRx64 + DBGRLOCALVAR_SIZEx64
+#define PEI_DEBUG_BUFADDRx64 PEI_DEBUG_XPORTEXPTNADDRx64 + XPORTEXPTNBUF_SIZEx64
+#define PEI_DEBUG_ACKADDRx64 PEI_DEBUG_BUFADDRx64 + GLOBALBUF_SIZEx64
+
+
+#pragma pack (push, pei_struct_data_pack, 1)
+
+typedef struct {
+ unsigned char IDTSet[IDT_SIZEx64];
+ unsigned char ContextReg[CONTEXT_SIZEx64];
+ unsigned char XportLocalVar[XPORTLOCALVAR_SIZEx64];
+ unsigned char XportGlobalVar[XPORTGLOBALVAR_SIZEx64];
+ unsigned char DbgrLocalVar[DBGRLOCALVAR_SIZEx64];
+ unsigned char XportExptn[XPORTEXPTNBUF_SIZEx64];
+ unsigned char GlobalBuf[GLOBALBUF_SIZEx64];
+ unsigned char AckBuf[ACKBUF_SIZEx64];
+}PEIDebugData_Tx64;
+
+
+#pragma pack (pop, pei_struct_data_pack)
+
+
+#pragma pack(1)
+typedef struct {
+ UINT8 Signature[4];
+ UINT16 (*Initialize)();
+ UINT16 (*Restore)();
+ UINT16 (*Send)();
+ UINT16 (*Receive)();
+ UINT16 (*SyncPacketNumber)();
+ UINT16 (*RegisterHandler)();
+ VOID (*Callback)();
+ UINT16 (*SendNoAck)();
+ EFI_STATUS (*ConsoleIn)();
+ VOID (*SendExptn)();
+ VOID (*IrqHandler)(); //Not to be use as API by any other drivers
+} AMI_PEI_TRANSPORT_PROTOCOLx64;
+
+//typedef UINT32 GET_DESCRIPTOR_DEBUG_PORT;
+
+//#pragma pack(1)
+typedef struct {
+ UINT64 m_EIP;
+ UINT16 m_SendPktSize;
+ UINT8 m_CurSendPktNum;
+ UINT16 m_CurIxInRcvPkt;
+ UINT8 m_CurRcvPktNum;
+ UINT32 m_ExptnHndlr;
+ UINT8 m_IsSending;
+ UINT16 m_ExptnType;
+ UINT8 m_PrevByteEsc;
+ UINT8 m_RcvingPkt;
+ UINT8 m_RcvPktReady;
+ UINT16 m_RcvPktSize;
+ UINT8 m_IsPortInListenMode;
+ UINT8 m_IsHostConnected;
+ UINT8 m_IsPeiDbgIsS3;
+#ifndef USB_DEBUGGER
+ UINT16 m_BaseAddr;
+// UINT8 m_IsCOMPortInListenMode;
+// UINT32 m_ReadAttempts; //only for debugging purpose -remove later
+// UINT8 m_CacheRecvFIFO[24];
+// UINT8 m_CacheSize;
+// UINT8 m_CacheIndex;
+ //To obtain info from Porting template support, and use it to publish HOB
+ UINT8 m_SIO_LDN_UART; //Logical Device Number for COM port
+#else
+ UINT32 USBBASE;
+ UINT32 USB2_DEBUG_PORT_REGISTER_INTERFACE;
+ UINT8 gDebugUSBAddress;
+ UINT8 gDebugInEndpoint;
+ UINT8 gDebugOutEndpoint;
+ GET_DESCRIPTOR_DEBUG_PORT Descriptor;
+ UINT8 gUSBBulkTransferSetAddr;
+
+ UINT8 gIN_DATAPID;
+ UINT8 gOUT_DATAPID;
+
+ UINT8 gIN_DATABUFFER[8];
+ UINT8 gOUT_DATABUFFER[8];
+
+ UINT8 gCurrentINDataBufferLength;
+ UINT8 gCurrentINDataBufferIndex;
+ UINT8 gCurrentOUTDataBufferIndex;
+
+ UINT8 lastdata;
+
+ UINT8 gIsUsbDebugPortInUse;
+// UINT8 gIsUsbDebugPortInListenMode;
+
+ //To obtain info from Porting template support, and use it to publish HOB
+ UINT16 m_EHCI_MEMORY_SIZE;
+ UINT8 m_PCI_EHCI_BUS_NUMBER;
+ UINT8 m_PCI_EHCI_DEVICE_NUMBER;
+ UINT8 m_PCI_EHCI_FUNCTION_NUMBER;
+ UINT8 m_PCI_EHCI_BAR_OFFSET;
+#endif
+ UINT64 m_PeiDbgRxInitTimerVal;
+}SerXPortGblData_Tx64;
+
+typedef struct {
+ AMI_PEI_TRANSPORT_PROTOCOLx64 *gTransportProtocol;
+ UINT16 (*Handler)();
+
+ //Additional parameters added in order to support DXE phase callback of
+ //IRQ register handlers
+ UINTN InterruptType;
+ UINTN ContextData;
+ VOID (*IRQRegisterHandler)(UINTN,UINTN);
+
+#ifdef USB_DEBUGGER
+ //Additional interface for PeiDbgSIO module to reinit EHCI memory base
+// void (*PeiDbgSIO_Init_USB_EHCI)(UINTN PeiDbgData_BaseAddr,UINTN MMIO_BaseAddr);
+// void (*PeiDbgSIO_Init_USB_EHCI)(UINTN UsbBaseAddress, UINTN *Usb2DebugPortReg);
+ void (*PeiDbgSIO_Init_USB_EHCI)(VOID *);
+#endif
+}SerXPortGblVar_Tx64;
+
+typedef struct{
+ UINT8 Signature[4];
+ VOID (*ExceptionCallback)();
+ VOID (*SendMessage)();
+ UINTN (*PeiDbgr_EnableDebugSupport)(UINTN BrkPtAddr);
+ VOID (*INT1ExceptionHandler)(); //not to be use as API
+ VOID (*INT3ExceptionHandler)(); //not to be use as API
+ VOID (*INTnExceptionHandler)(); //not to be use as API
+ UINTN (*PeiDbgr_SendPeiLoadImage)(UINTN FileHandle,UINTN ImageAddr,UINTN ImageSize,void * PDBFileName);
+ VOID (*INTFExceptionHandler)(); //not to be use as API
+}AMI_DEBUGGER_INTERFACEx64;
+
+typedef struct {
+ UINT8 m_BrkPtType;
+ UINT16 m_CS;
+ UINT64 m_EIP;
+ UINT16 m_SS;
+ UINT64 m_ESP;
+ UINT64 m_DR2;
+ UINT64 m_DR7;
+ UINT8 m_TargetRunning;
+
+ UINT8 m_MSRState;
+ UINT8 m_GPOccrd;
+
+ UINT8 m_NotifyAndBreak;
+
+ UINT8 m_DbgrBusy;
+ UINT8 m_DR2Valid;
+ UINT16 m_DbgSendBufSize;
+ UINT16 m_DbgRcvBufSize;
+ UINT64 m_BackupDR7;
+ UINT8 m_PICMask;
+ union{
+ VOID (*PeiDbgrReportStatusCode)();
+ UINT64 res1;
+ };
+ UINT8 m_FlagToDebugAfterMemory;
+ union{
+ UINTN (*PeiDbgr_EnableDebugSupport)(UINTN BrkPtAddr);
+ UINT64 res2;
+ };
+ union{
+ AMI_DEBUGGER_INTERFACEx64 *pPeiDbgDbgrIfc;
+ UINT64 res3;
+ };
+ UINT8 m_TargetState;
+ VOID* m_ppPeiSVC;
+// VOID* m_pFVHob;
+ EFI_STATUS (*UpdateFVHob)();
+}DbgGblData_Tx64;
+//#pragma pack()
+
+//#pragma pack(1)
+typedef struct {
+ UINT16 m_OffLow;
+ UINT16 m_SegSel;
+ UINT16 m_Reserved;
+ UINT16 m_OffHigh;
+ UINT32 m_OffHighExt;
+ UINT32 m_Reserved2;
+}IDTEntry_Tx64;
+
+typedef struct {
+ UINT16 IDTLength;
+ UINT64 IDTBaseAddr; //should work for both 32 and 64 mode
+}IDTBASEx64;
+#pragma pack()
+
+//=========================================================================
+// Prototypes of structure definitions to be used handoff of 32 to 64 PEI
+// Debugger
+//=========================================================================
+#pragma pack(1)
+typedef struct {
+ UINT64 gTransportProtocol; //AMI_PEI_TRANSPORT_PROTOCOL *gTransportProtocol;
+ UINT64 Handler; //UINT16 (*Handler)();
+
+ //Additional parameters added in order to support DXE phase callback of
+ //IRQ register handlers
+ UINTN InterruptType;
+ UINTN ContextData;
+ UINT64 IRQRegisterHandler; //VOID (*IRQRegisterHandler)(UINTN,UINTN);
+
+#ifdef USB_DEBUGGER
+ UINT64 PeiDbgSIO_Init_USB_EHCI; //void (*PeiDbgSIO_Init_USB_EHCI)(VOID *);
+#endif
+}SerXPortGblVar_Tx64_Proto;
+
+typedef struct{
+ UINT8 Signature[4];
+ UINT64 pExceptionCallback; //VOID (*ExceptionCallback)();
+ UINT64 pSendMessage; //VOID (*SendMessage)();
+ UINT64 pPeiDbgr_EnableDebugSupport; //UINTN (*PeiDbgr_EnableDebugSupport)(UINTN BrkPtAddr);
+ UINT64 pINT1ExceptionHandler; //VOID (*INT1ExceptionHandler)();
+ UINT64 pINT3ExceptionHandler; //VOID (*INT3ExceptionHandler)();
+ UINT64 pINTnExceptionHandler; //VOID (*INTnExceptionHandler)();
+ UINT64 pPeiDbgr_SendPeiLoadImage; //UINTN (*PeiDbgr_SendPeiLoadImage)(UINTN FileHandle,UINTN ImageAddr,UINTN ImageSize,void * PDBFileName);
+ UINT64 pINTFExceptionHandler; //VOID (*INTFExceptionHandler)();
+}AMI_DEBUGGER_INTERFACEx64_Proto;
+
+typedef struct {
+ UINT8 Signature[4];
+ UINT64 pInitialize; //UINT16 (*Initialize)();
+ UINT64 pRestore; //UINT16 (*Restore)();
+ UINT64 pSend; //UINT16 (*Send)();
+ UINT64 pReceive; //UINT16 (*Receive)();
+ UINT64 pSyncPacketNumber; //UINT16 (*SyncPacketNumber)();
+ UINT64 pRegisterHandler; //UINT16 (*RegisterHandler)();
+ UINT64 pCallback; //VOID (*Callback)();
+ UINT64 pSendNoAck; //UINT16 (*SendNoAck)();
+ UINT64 pConsoleIn; // EFI_STATUS (*ConsoleIn)();
+ UINT64 pSendExptn; // VOID (*SendExptn)();
+ UINT64 pIrqHandler; //VOID (*IrqHandler)();
+} AMI_PEI_TRANSPORT_PROTOCOLx64__Proto;
+#pragma pack()
+
+#ifdef EFIx64
+typedef PEI_DBG_DATA_SECTIONx64 PEI_DBG_DATA_SECTION;
+typedef DbgGblData_Tx64 DbgGblData_T;
+typedef SerXPortGblData_Tx64 SerXPortGblData_T;
+typedef PEIDebugData_Tx64 PEIDebugData_T;
+typedef AMI_PEI_TRANSPORT_PROTOCOLx64 AMI_PEI_TRANSPORT_PROTOCOL;
+typedef SerXPortGblVar_Tx64 SerXPortGblVar_T;
+typedef AMI_DEBUGGER_INTERFACEx64 AMI_DEBUGGER_INTERFACE;
+typedef IDTEntry_Tx64 IDTEntry_T;
+typedef IDTBASEx64 IDTBASE;
+
+#define PEI_DEBUG_IDTBASEADDR PEI_DEBUG_IDTBASEADDRx64
+#define PEI_DEBUG_CONTEXTADDR PEI_DEBUG_CONTEXTADDRx64
+#define PEI_DEBUG_XPORTLOCALVARADDR PEI_DEBUG_XPORTLOCALVARADDRx64
+#define PEI_DEBUG_XPORTGLOBALVARADDR PEI_DEBUG_XPORTGLOBALVARADDRx64
+#define PEI_DEBUG_DBGRLOCALVARADDR PEI_DEBUG_DBGRLOCALVARADDRx64
+#define PEI_DEBUG_XPORTEXPTNADDR PEI_DEBUG_XPORTEXPTNADDRx64
+#define PEI_DEBUG_BUFADDR PEI_DEBUG_BUFADDRx64
+#define PEI_DEBUG_ACKADDR PEI_DEBUG_ACKADDRx64
+#endif
+
+//=========================================================================
+//#define SET_SWBRKPT _SetBrkPt:0xcc;
+#endif
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 2009, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **//
+//** **//
+//** Phone (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
diff --git a/Core/EM/AMIDebugRx/binaries/PeiAMIDebugRx/INC/EHCI.h b/Core/EM/AMIDebugRx/binaries/PeiAMIDebugRx/INC/EHCI.h
new file mode 100644
index 0000000..65659fb
--- /dev/null
+++ b/Core/EM/AMIDebugRx/binaries/PeiAMIDebugRx/INC/EHCI.h
@@ -0,0 +1,244 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 2009, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **//
+//** **//
+//** Phone (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Header: /Alaska/BIN/Modules/AMIDebugRx/binaries/PeiAMIDebugRx/INC/EHCI.h 2 7/17/09 7:15p Madhans $
+//
+// $Revision: 2 $
+//
+// $Date: 7/17/09 7:15p $
+//*****************************************************************
+//*****************************************************************
+//
+// Revision History
+// ----------------
+// $Log: /Alaska/BIN/Modules/AMIDebugRx/binaries/PeiAMIDebugRx/INC/EHCI.h $
+//
+// 2 7/17/09 7:15p Madhans
+// DebugRx 1.30.0022
+//
+// 2 7/13/09 2:49p Sudhirv
+// Update with Coding Standards
+//
+// 1 7/07/09 4:46p Sudhirv
+// Restructure Binaries Created
+//
+// 1 5/01/09 7:48p Madhans
+// AMIDebug Rx Module. Intial Checkin.
+//
+// 1 4/29/09 7:52a Sudhirv
+// AMI Debug Rx module created
+//
+// 5 6/13/07 3:16p Madhans
+// Copyright Year updated.
+//
+// 4 3/13/07 4:08p Ashrafj
+// !!!Coding standard!!!
+//
+// 3 1/22/07 11:41a Madhans
+// Modification made for Binary Release 1.04.0003.
+//
+// 3 1/05/07 6:15p Madhan
+//
+// 2 1/05/07 1:05p Ashrafj
+// Latest version 1.04.0001 Beta
+// Known issues from previous 1.04.000 Beta release has been fixed.
+//
+//
+//*****************************************************************
+//**********************************************************************
+//<AMI_FHDR_START>
+//
+// Name: ehci.h
+//
+// Description: EHCI controller related declarations and #defines.
+//
+//<AMI_FHDR_END>
+//**********************************************************************
+
+/*
+ USB Debug port resides in EHCI
+ Following is specific to chipset (ICH4,ICH5)
+*/
+#ifndef __EHCI_H__
+#define __EHCI_H__
+
+#define EHCI_BUS_NUMBER 0
+#define EHCI_DEVICE_NUMBER 29
+#define EHCI_FUNCTION_NUMBER 7
+
+#define EHCI_CAPABILITY_REG 0x34
+
+#define EHCI_POWERMGMT_CAP_REG 0x50 //ICH4 & ICH5(i875 MB)
+#define EHCI_DEBUGPORT_CAP_REG 0x58 //ICH4 & ICH5(i875 MB)
+
+#define ICH5_EHCI_BASE_ADDRESS_REGISTER 0x10
+
+#define MEMORYMAP_BASE_ADDR 0xEFFFFFFF //4GB - 256MB
+#define MEMORYMAP_WINDOW_SIZE 0x3FF //1 KB relocateble mem space (ICH4/5)
+
+//
+// Turn off the PWE assertion and put the device into D0 State
+//
+#define ICH5_PMCSR 0x8000
+////////////////////////////////////////////////
+
+#define ICH5_PCI_CAPABILITY_ID_PMI 0x01
+#define ICH5_EHCI_COMMAND_REGISTER 0x04
+
+#define DEBUG_PORT 0x0A
+#define PORTSC_CURRENT_CONNECT_STATUS 1
+#define PORTSC_CONNECT_STATUS_CHANGE 2
+#define PORTSC_PORT_ENABLE 4
+#define PORTSC_PORT_DISABLE 0xFFFFFFFB
+#define PORTSC_PORT_RESET 0x100
+#define PORTSC_PORT_NOT_RESET 0xFFFFFEFF
+
+#define IN_PID 0x69
+#define OUT_PID 0xE1
+#define SETUP_PID 0x2D
+#define DATA0 0xC3
+#define DATA1 0x4B
+
+#define ACK 0xD2
+#define NAK 0x5A
+#define STALL 0x1E
+#define NYET 0x96
+
+#define DEBUG_PORT_DESCRIPTOR_TYPE 0x0A
+
+#define MAX_USBDEBUGPORT_DATASIZE 8
+
+#pragma pack(1)
+typedef struct _CAP_REG_LIST{
+ UINT8 CapID;
+ UINT8 Nxt_Ptr;
+ UINT16 Offset :13;
+ UINT16 BAR :3;
+}CAP_REG_LIST;
+
+typedef struct _DEBUG_PORT_CONTROL_REGISTER{
+ UINT32 DataLength : 4;
+ UINT32 WriteRead : 1;
+ UINT32 Go : 1;
+ UINT32 ErrorGood : 1;
+ UINT32 Exception : 3;
+ UINT32 InUse : 1;
+ UINT32 Reserved1 : 5;
+ UINT32 Done : 1;
+ UINT32 Reserved2 : 11;
+ UINT32 Enabled : 1;
+ UINT32 Reserved3 : 1;
+ UINT32 Owner : 1;
+ UINT32 Reserved4 : 1;
+}DEBUG_PORT_CONTROL_REGISTER;
+
+typedef struct _USB_PID{
+ UINT32 TokenPID : 8;
+ UINT32 SendPID : 8;
+ UINT32 RecievedPID : 8;
+ UINT32 Reserved : 8;
+}USB_PID;
+
+typedef struct _DATA_BUFFER{
+ UINT32 LowDword;
+ UINT32 HighDword;
+}DATA_BUFFER;
+
+typedef struct _DEVICE_ADDR_REGISTER{
+ UINT32 USBEndPoint : 4;
+ UINT32 Reserved1 : 4;
+ UINT32 USBAddress : 7;
+ UINT32 Reserved2 : 17;
+}DEVICE_ADDR_REGISTER;
+
+typedef struct _HCSPARAMS{
+ UINT32 N_PORTS : 4;
+ UINT32 PPC : 1;
+ UINT32 Resrvd : 2;
+ UINT32 PRR : 1;
+ UINT32 N_PCC : 4;
+ UINT32 N_CC : 4;
+ UINT32 P_INDICATOR : 1;
+ UINT32 Resrvd2 : 3;
+ UINT32 DebugPortNum : 4;
+ UINT32 Resrvd3 : 8;
+}HCSPARAMS;
+
+typedef struct _GET_DESCRIPTOR_DEBUG_PORT{
+ UINT8 bLength;
+ UINT8 bDescriptorType;
+ UINT8 bDebugInEndpoint;
+ UINT8 bDebugOutEndpoint;
+}GET_DESCRIPTOR_DEBUG_PORT;
+
+
+typedef struct _USB_CMD{
+ UINT32 RunStop : 1;
+ UINT32 HCRESET : 1;
+ UINT32 FLS : 2;
+ UINT32 PSE : 1;
+ UINT32 ASE : 1;
+ UINT32 IAAD : 1;
+ UINT32 LHCR : 1;
+ UINT32 ASPMC : 3;
+ UINT32 ASPME : 1;
+ UINT32 Resvd1 : 4;
+ UINT32 ITC : 8;
+ UINT32 Resvd2 : 8;
+}USBCMD;
+
+typedef struct _USB_STS{
+ UINT32 USBINTR : 1;
+ UINT32 USBERRINT : 1;
+ UINT32 PCD : 1;
+ UINT32 FLR : 1;
+ UINT32 HSE : 1;
+ UINT32 INTASYNC : 1;
+ UINT32 Resvd1 : 6;
+ UINT32 HCHalted : 1;
+ UINT32 Reclamation : 1;
+ UINT32 PSS : 1;
+ UINT32 ASS : 1;
+ UINT32 Resvd2 : 16;
+}USBSTS;
+
+typedef struct _CONFIG_FLAG{
+ UINT32 CF : 1;
+ UINT32 Reserved : 31;
+}CONFIGFLAG, *PCONFIGFLAG;
+
+typedef struct _OPERATIONAL_REGISTER{
+ USBCMD USBCommandReg;
+ USBSTS USBStatusReg;
+}OPERATIONAL_REGISTER, *POPERATIONAL_REGISTER;
+
+#pragma pack()
+
+#endif // __EHCI_H__
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 2009, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **//
+//** **//
+//** Phone (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
diff --git a/Core/EM/AMIDebugRx/binaries/PeiAMIDebugRx/INC/INC.cif b/Core/EM/AMIDebugRx/binaries/PeiAMIDebugRx/INC/INC.cif
new file mode 100644
index 0000000..520a96b
--- /dev/null
+++ b/Core/EM/AMIDebugRx/binaries/PeiAMIDebugRx/INC/INC.cif
@@ -0,0 +1,11 @@
+<component>
+ name = "INC"
+ category = ModulePart
+ LocalRoot = "Core\em\AMIDebugRx\binaries\PeiAMIDebugRx\INC\"
+ RefName = "INC"
+[files]
+"AMIpeidebug.h"
+"EHCI.h"
+"misc.h"
+"AMIpeidebugX64.h"
+<endComponent>
diff --git a/Core/EM/AMIDebugRx/binaries/PeiAMIDebugRx/INC/misc.h b/Core/EM/AMIDebugRx/binaries/PeiAMIDebugRx/INC/misc.h
new file mode 100644
index 0000000..b486fd9
--- /dev/null
+++ b/Core/EM/AMIDebugRx/binaries/PeiAMIDebugRx/INC/misc.h
@@ -0,0 +1,178 @@
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 2009, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **//
+//** **//
+//** Phone (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+// $Header: /Alaska/BIN/Modules/AMIDebugRx/binaries/PeiAMIDebugRx/INC/misc.h 2 7/17/09 7:15p Madhans $
+//
+// $Revision: 2 $
+//
+// $Date: 7/17/09 7:15p $
+//*****************************************************************
+//*****************************************************************
+//
+// misc.h
+//
+//
+// Revision History
+// ----------------
+// $Log: /Alaska/BIN/Modules/AMIDebugRx/binaries/PeiAMIDebugRx/INC/misc.h $
+//
+// 2 7/17/09 7:15p Madhans
+// DebugRx 1.30.0022
+//
+// 2 7/13/09 2:49p Sudhirv
+// Update with Coding Standards
+//
+// 1 7/07/09 4:46p Sudhirv
+// Restructure Binaries Created
+//
+// 1 5/01/09 7:48p Madhans
+// AMIDebug Rx Module. Intial Checkin.
+//
+// 1 4/29/09 7:52a Sudhirv
+// AMI Debug Rx module created
+//
+// 6 8/29/07 12:49p Madhans
+// Common code for 4.x and 3.x
+//
+// 5 6/13/07 3:17p Madhans
+// Copyright Year updated.
+//
+// 4 3/13/07 4:08p Ashrafj
+// !!!Coding standard!!!
+//
+// 3 1/22/07 11:41a Madhans
+// Modification made for Binary Release 1.04.0003.
+//
+// 5 1/05/07 6:15p Madhan
+//
+// 4 1/05/07 1:05p Ashrafj
+// Latest version 1.04.0001 Beta
+// Known issues from previous 1.04.000 Beta release has been fixed.
+//
+// 3 12/05/05 7:29p Ashrafj
+// Serial Port Debug Support added for PEI - DXE Debugger.
+//
+// Change in Serial Port Communication: Now the data transmission through
+// Serial Port is supported with the hardware Flow control feature of the
+// Serial Port controller.
+//
+// 2 11/29/05 6:08p Markw
+// For Alaska, include efi.h instead of defining new typecasts.
+//
+// 1 10/19/05 10:54a Felixp
+//
+// 1 10/19/05 10:44a Felixp
+//
+//
+//
+//*****************************************************************
+//**********************************************************************
+//<AMI_FHDR_START>
+//
+// Name: misc.h
+//
+// Description: Generic Misc header file.
+//
+//<AMI_FHDR_END>
+//**********************************************************************
+
+#ifdef ALASKA_SUPPORT
+
+#include <efi.h>
+
+#else /* Support for APTIO projects */
+
+#define UINT64 unsigned __int64
+#define UINT32 unsigned long
+#define UINT16 unsigned short
+#define UINT8 unsigned char
+
+#define INT32 signed long
+#define INT8 signed char
+#define INT16 signed short
+
+#define CHAR8 char
+#define CHAR16 unsigned short
+#define BOOLEAN unsigned char
+
+#define UINTN UINT32
+#define INTN INT32
+
+#define VOID void
+
+#ifndef _EFI_TYPES_H_
+
+#define TRUE 1
+
+#define FALSE 0
+
+#define NULL 0
+
+#define IN
+#define OUT
+
+//EFI error types
+
+//typedef UINTN EFI_STATUS;
+#define EFI_STATUS UINTN
+
+#define EFI_ERROR(a) (((INTN) a) < 0)
+
+#define EFIERR(a) (0x80000000 | a)
+
+#define EFI_SUCCESS 0
+#define EFI_LOAD_ERROR EFIERR(1)
+#define EFI_INVALID_PARAMETER EFIERR(2)
+#define EFI_UNSUPPORTED EFIERR(3)
+#define EFI_BAD_BUFFER_SIZE EFIERR(4)
+#define EFI_BUFFER_TOO_SMALL EFIERR(5)
+#define EFI_NOT_READY EFIERR(6)
+#define EFI_DEVICE_ERROR EFIERR(7)
+#define EFI_WRITE_PROTECTED EFIERR(8)
+#define EFI_OUT_OF_RESOURCES EFIERR(9)
+#define EFI_VOLUME_CORRUPTED EFIERR(10)
+#define EFI_VOLUME_FULL EFIERR(11)
+#define EFI_NO_MEDIA EFIERR(12)
+#define EFI_MEDIA_CHANGED EFIERR(13)
+#define EFI_NOT_FOUND EFIERR(14)
+#define EFI_ACCESS_DENIED EFIERR(15)
+#define EFI_NO_RESPONSE EFIERR(16)
+#define EFI_NO_MAPPING EFIERR(17)
+#define EFI_TIMEOUT EFIERR(18)
+#define EFI_NOT_STARTED EFIERR(19)
+#define EFI_ALREADY_STARTED EFIERR(20)
+#define EFI_ABORTED EFIERR(21)
+#define EFI_ICMP_ERROR EFIERR(22)
+#define EFI_TFTP_ERROR EFIERR(23)
+#define EFI_PROTOCOL_ERROR EFIERR(24)
+
+#endif
+
+#endif
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//
+//** **//
+//** (C)Copyright 2009, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **//
+//** **//
+//** Phone (770)-246-8600 **//
+//** **//
+//*****************************************************************//
+//*****************************************************************//
+//*****************************************************************//