From b7c51c9cf4864df6aabb99a1ae843becd577237c Mon Sep 17 00:00:00 2001 From: raywu Date: Fri, 15 Jun 2018 00:00:50 +0800 Subject: init. 1AQQW051 --- .../PeiAMIDebugRx/XPORT/DBGR/UsbDebugPort.obj | Bin 0 -> 11962 bytes .../PeiAMIDebugRx/XPORT/DBGR/transport.obj | Bin 0 -> 3723 bytes .../binaries/PeiAMIDebugRx/XPORT/DBGR/usb_acc.obj | Bin 0 -> 1826 bytes .../binaries/PeiAMIDebugRx/XPORT/DBGR/usb_xp.obj | Bin 0 -> 5159 bytes .../binaries/PeiAMIDebugRx/XPORT/DBGR/xp_layer.obj | Bin 0 -> 8805 bytes .../binaries/PeiAMIDebugRx/XPORT/PeiXportDbgr.cif | 12 + .../binaries/PeiAMIDebugRx/XPORT/PeiXportRedir.cif | 12 + .../PeiAMIDebugRx/XPORT/REDIR/UsbDebugPort.obj | Bin 0 -> 11966 bytes .../PeiAMIDebugRx/XPORT/REDIR/transport.obj | Bin 0 -> 3683 bytes .../binaries/PeiAMIDebugRx/XPORT/REDIR/usb_acc.obj | Bin 0 -> 1830 bytes .../binaries/PeiAMIDebugRx/XPORT/REDIR/usb_xp.obj | Bin 0 -> 4310 bytes .../PeiAMIDebugRx/XPORT/REDIR/xp_layer.obj | Bin 0 -> 8290 bytes .../binaries/PeiAMIDebugRx/XPORT/XportHdr.c | 454 +++++++++++++++++++++ 13 files changed, 478 insertions(+) create mode 100644 Core/EM/AMIDebugRx/binaries/PeiAMIDebugRx/XPORT/DBGR/UsbDebugPort.obj create mode 100644 Core/EM/AMIDebugRx/binaries/PeiAMIDebugRx/XPORT/DBGR/transport.obj create mode 100644 Core/EM/AMIDebugRx/binaries/PeiAMIDebugRx/XPORT/DBGR/usb_acc.obj create mode 100644 Core/EM/AMIDebugRx/binaries/PeiAMIDebugRx/XPORT/DBGR/usb_xp.obj create mode 100644 Core/EM/AMIDebugRx/binaries/PeiAMIDebugRx/XPORT/DBGR/xp_layer.obj create mode 100644 Core/EM/AMIDebugRx/binaries/PeiAMIDebugRx/XPORT/PeiXportDbgr.cif create mode 100644 Core/EM/AMIDebugRx/binaries/PeiAMIDebugRx/XPORT/PeiXportRedir.cif create mode 100644 Core/EM/AMIDebugRx/binaries/PeiAMIDebugRx/XPORT/REDIR/UsbDebugPort.obj create mode 100644 Core/EM/AMIDebugRx/binaries/PeiAMIDebugRx/XPORT/REDIR/transport.obj create mode 100644 Core/EM/AMIDebugRx/binaries/PeiAMIDebugRx/XPORT/REDIR/usb_acc.obj create mode 100644 Core/EM/AMIDebugRx/binaries/PeiAMIDebugRx/XPORT/REDIR/usb_xp.obj create mode 100644 Core/EM/AMIDebugRx/binaries/PeiAMIDebugRx/XPORT/REDIR/xp_layer.obj create mode 100644 Core/EM/AMIDebugRx/binaries/PeiAMIDebugRx/XPORT/XportHdr.c (limited to 'Core/EM/AMIDebugRx/binaries/PeiAMIDebugRx/XPORT') diff --git a/Core/EM/AMIDebugRx/binaries/PeiAMIDebugRx/XPORT/DBGR/UsbDebugPort.obj b/Core/EM/AMIDebugRx/binaries/PeiAMIDebugRx/XPORT/DBGR/UsbDebugPort.obj new file mode 100644 index 0000000..291e959 Binary files /dev/null and b/Core/EM/AMIDebugRx/binaries/PeiAMIDebugRx/XPORT/DBGR/UsbDebugPort.obj differ diff --git a/Core/EM/AMIDebugRx/binaries/PeiAMIDebugRx/XPORT/DBGR/transport.obj b/Core/EM/AMIDebugRx/binaries/PeiAMIDebugRx/XPORT/DBGR/transport.obj new file mode 100644 index 0000000..966529a Binary files /dev/null and b/Core/EM/AMIDebugRx/binaries/PeiAMIDebugRx/XPORT/DBGR/transport.obj differ diff --git a/Core/EM/AMIDebugRx/binaries/PeiAMIDebugRx/XPORT/DBGR/usb_acc.obj b/Core/EM/AMIDebugRx/binaries/PeiAMIDebugRx/XPORT/DBGR/usb_acc.obj new file mode 100644 index 0000000..2be39d9 Binary files /dev/null and b/Core/EM/AMIDebugRx/binaries/PeiAMIDebugRx/XPORT/DBGR/usb_acc.obj differ diff --git a/Core/EM/AMIDebugRx/binaries/PeiAMIDebugRx/XPORT/DBGR/usb_xp.obj b/Core/EM/AMIDebugRx/binaries/PeiAMIDebugRx/XPORT/DBGR/usb_xp.obj new file mode 100644 index 0000000..6f39d73 Binary files /dev/null and b/Core/EM/AMIDebugRx/binaries/PeiAMIDebugRx/XPORT/DBGR/usb_xp.obj differ diff --git a/Core/EM/AMIDebugRx/binaries/PeiAMIDebugRx/XPORT/DBGR/xp_layer.obj b/Core/EM/AMIDebugRx/binaries/PeiAMIDebugRx/XPORT/DBGR/xp_layer.obj new file mode 100644 index 0000000..2a532d9 Binary files /dev/null and b/Core/EM/AMIDebugRx/binaries/PeiAMIDebugRx/XPORT/DBGR/xp_layer.obj differ diff --git a/Core/EM/AMIDebugRx/binaries/PeiAMIDebugRx/XPORT/PeiXportDbgr.cif b/Core/EM/AMIDebugRx/binaries/PeiAMIDebugRx/XPORT/PeiXportDbgr.cif new file mode 100644 index 0000000..1ec1cf0 --- /dev/null +++ b/Core/EM/AMIDebugRx/binaries/PeiAMIDebugRx/XPORT/PeiXportDbgr.cif @@ -0,0 +1,12 @@ + + name = "PeiXportDbgr" + category = ModulePart + LocalRoot = "Core\em\AMIDebugRx\binaries\PeiAMIDebugRx\XPORT" + RefName = "PeiXportDbgr" +[files] +"DBGR\xp_layer.obj" +"DBGR\transport.obj" +"DBGR\usb_acc.obj" +"DBGR\usb_xp.obj" +"DBGR\UsbDebugPort.obj" + diff --git a/Core/EM/AMIDebugRx/binaries/PeiAMIDebugRx/XPORT/PeiXportRedir.cif b/Core/EM/AMIDebugRx/binaries/PeiAMIDebugRx/XPORT/PeiXportRedir.cif new file mode 100644 index 0000000..0d80331 --- /dev/null +++ b/Core/EM/AMIDebugRx/binaries/PeiAMIDebugRx/XPORT/PeiXportRedir.cif @@ -0,0 +1,12 @@ + + name = "PeiXportRedir" + category = ModulePart + LocalRoot = "Core\em\AMIDebugRx\binaries\PeiAMIDebugRx\XPORT" + RefName = "PeiXportRedir" +[files] +"REDIR\xp_layer.obj" +"REDIR\transport.obj" +"REDIR\usb_acc.obj" +"REDIR\usb_xp.obj" +"REDIR\UsbDebugPort.obj" + diff --git a/Core/EM/AMIDebugRx/binaries/PeiAMIDebugRx/XPORT/REDIR/UsbDebugPort.obj b/Core/EM/AMIDebugRx/binaries/PeiAMIDebugRx/XPORT/REDIR/UsbDebugPort.obj new file mode 100644 index 0000000..6600831 Binary files /dev/null and b/Core/EM/AMIDebugRx/binaries/PeiAMIDebugRx/XPORT/REDIR/UsbDebugPort.obj differ diff --git a/Core/EM/AMIDebugRx/binaries/PeiAMIDebugRx/XPORT/REDIR/transport.obj b/Core/EM/AMIDebugRx/binaries/PeiAMIDebugRx/XPORT/REDIR/transport.obj new file mode 100644 index 0000000..95a8db8 Binary files /dev/null and b/Core/EM/AMIDebugRx/binaries/PeiAMIDebugRx/XPORT/REDIR/transport.obj differ diff --git a/Core/EM/AMIDebugRx/binaries/PeiAMIDebugRx/XPORT/REDIR/usb_acc.obj b/Core/EM/AMIDebugRx/binaries/PeiAMIDebugRx/XPORT/REDIR/usb_acc.obj new file mode 100644 index 0000000..989438e Binary files /dev/null and b/Core/EM/AMIDebugRx/binaries/PeiAMIDebugRx/XPORT/REDIR/usb_acc.obj differ diff --git a/Core/EM/AMIDebugRx/binaries/PeiAMIDebugRx/XPORT/REDIR/usb_xp.obj b/Core/EM/AMIDebugRx/binaries/PeiAMIDebugRx/XPORT/REDIR/usb_xp.obj new file mode 100644 index 0000000..bfb1726 Binary files /dev/null and b/Core/EM/AMIDebugRx/binaries/PeiAMIDebugRx/XPORT/REDIR/usb_xp.obj differ diff --git a/Core/EM/AMIDebugRx/binaries/PeiAMIDebugRx/XPORT/REDIR/xp_layer.obj b/Core/EM/AMIDebugRx/binaries/PeiAMIDebugRx/XPORT/REDIR/xp_layer.obj new file mode 100644 index 0000000..2552aed Binary files /dev/null and b/Core/EM/AMIDebugRx/binaries/PeiAMIDebugRx/XPORT/REDIR/xp_layer.obj differ diff --git a/Core/EM/AMIDebugRx/binaries/PeiAMIDebugRx/XPORT/XportHdr.c b/Core/EM/AMIDebugRx/binaries/PeiAMIDebugRx/XPORT/XportHdr.c new file mode 100644 index 0000000..56c2ad7 --- /dev/null +++ b/Core/EM/AMIDebugRx/binaries/PeiAMIDebugRx/XPORT/XportHdr.c @@ -0,0 +1,454 @@ +//*****************************************************************// +//*****************************************************************// +//*****************************************************************// +//** **// +//** (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/XPORT/XportHdr.c 9 4/04/12 4:57p Sudhirv $ +// +// $Revision: 9 $ +// +// $Date: 4/04/12 4:57p $ +//***************************************************************** +//***************************************************************** +// +// Revision History +// ---------------- +// $Log: /Alaska/BIN/Modules/AMIDebugRx/binaries/PeiAMIDebugRx/XPORT/XportHdr.c $ +// +// 9 4/04/12 4:57p Sudhirv +// To Avoid Build errors in special cases. +// +// 8 3/13/12 10:47a Sudhirv +// [TAG] EIP60224 +// [Category] Improvement +// [Description] Function implement When broken in SMM, show the register +// context for 'outside' SMM. +// +// [TAG] EIP80406 +// [Category] Improvement +// [Description] Debugger support for Dynamic pci express base token +// +// [TAG] EIP81423 +// [Category] Improvement +// [Description] VeB Debugger - Improve the EFI tab's Handle Display +// feature +// +// [TAG] EIP84201 +// [Category] Improvement +// [Description] AMIDebugRx\Debugger Target modules usage of the Port 80 +// must be controlable +// +// 7 7/12/11 5:27p Sudhirv +// [TAG] EIP62342 +// [Category] Bug Fix +// [Severity] Normal +// [Symptom] Target Crashes when Debugger enabled and AMIDebugRx is in +// Checkpoint mode +// [RootCause] Debugger is Enabled and AMIDebugRx device is connected in +// checkpoint mode. Target MAchine is unaware of the type of host +// connected in DXE phase. +// [Solution] Support to not crash when Debugger enabled and Rx switch +// in Checkpoint Mode. +// +// 6 3/17/11 8:09a Sudhirv +// Support to Boot with S3 Resume in Core_4.6.5.0 +// +// 5 3/09/11 8:27a Sudhirv +// EIP 53658 - AMIDebugRx\Debugger support for PI 1.1 +// +// 4 2/15/10 8:05a Mallikarjunanv +// Updated after fix for EIP 35101 - Binary Debug Rx module doesn't report +// BIOS TAG correctly. +// +// 3 9/30/09 3:03p Sudhirv +// For Debugger 1.31.0023_PreAlpha +// +// 2 7/13/09 2:53p Sudhirv +// Updated with Coding Standards +// +// 1 7/07/09 4:47p Sudhirv +// Restructure Binaries Created +// +// 2 5/05/09 8:05p Madhans +// Use the timestamp.h instead of timstamp.mak to avoid the octal issues. +// +// 1 5/01/09 7:48p Madhans +// AMIDebug Rx Module. Intial Checkin. +// +// 1 4/29/09 7:52a Sudhirv +// AMI Debug Rx module created +// +// 8 3/27/09 8:43a Sudhirv +// Updated Coding Standards. +// +// 7 8/29/07 12:59p Madhans +// Common code for 4.x and 3.x +// +// 6 6/13/07 3:17p Madhans +// Copyright Year updated. +// +// 5 3/12/07 6:19p Madhans +// !!!coding standards!!!! +// +// 4 1/22/07 11:43a Madhans +// Modification made for Binary Release 1.04.0003. +// +// 4 1/05/07 6:15p Madhan +// +// 3 1/05/07 1:05p Ashrafj +// Latest version 1.04.0001 Beta +// Known issues from previous 1.04.000 Beta release has been fixed. +// +// +//***************************************************************** +//***************************************************************** + +//********************************************************************** +// +// +// Name: XportHdr.c +// +// Description: File containing the globals for CAR base address & size. +// Also the code which make use of this so that it can be +// integrated as it is Debugger eModule of binary. +// +// +//********************************************************************** +#include "efi.h" +#include "Pei.h" + +#include "misc.h" +#ifndef EFIx64 +#include "AMIPeiDebug.h" +#else +#include "AMIPeiDebugX64.h" +#include "AsmDbgrx64Libs.h" +#endif +#include "timestamp.h" + +#define CONVERT_TO_STRING(a) #a +#define STR(a) CONVERT_TO_STRING(a) +#ifndef DBG_WRITE_IO_80_SUPPORT +#define DBG_WRITE_IO_80_SUPPORT 0 +#endif + +const char *sTargetProjectTag= STR(TARGET_PROJECT_TAG); + +//EIP 62342 - Support to not crash when Debugger enabled and Rx switch in Checkpoint Mode. +UINTN gAMIDebuggerEnabled = REDIRECTION_ONLY_MODE; + +volatile UINTN gDbgWriteIO80Support = DBG_WRITE_IO_80_SUPPORT; + +typedef struct { + UINT16 Year; + UINT8 Month; + UINT8 Day; + UINT8 Hour; + UINT8 Minute; + UINT8 Second; +} DateTime_T; + +VOID AddExtDelay(); + +//********************************************************************** +// +// +// Name: PeiDbgDataSection of type PEI_DBG_DATA_SECTION +// +// Description: The following global data structure is for relocation purpose +// in order to support debugging after the debugger data section +// is relocated. This second parameter of the data structure has +// to be updated by the debugger service PEIM to point to relocated +// data section into memory.The code section has this module +// has to relocated before the update of second parameter. +// +// +//********************************************************************** + +#if defined (PI_SPECIFICATION_VERSION) && (PI_SPECIFICATION_VERSION >= 0x00010000) +PEI_DBG_DATA_SECTION PeiDbgDataSection = { + "XPRT", + NULL +}; +#else +PEI_DBG_DATA_SECTION PeiDbgDataSection = { + "XPRT", + PEI_DEBUG_DATASECTION_BASEADDRESS +}; + +#endif + +UINTN GetCARBaseAddress() +{ + EFI_PEI_SERVICES **PeiServices; + VOID *PeiDbgData; + EFI_GUID mPeiDbgBasePpiGuid = EFI_PEI_DBG_BASEADDRESS_PPI_GUID; + EFI_STATUS Status; + + if((PeiDbgDataSection.DATABASEADDRESS)==NULL) + { + IDTBASE Idtr; +#ifndef EFIx64 + _asm{ + sidt fword ptr Idtr + } +#else + GetIdtr(&Idtr); +#endif + PeiServices = (EFI_PEI_SERVICES **) (*(UINTN*)(Idtr.IDTBaseAddr - sizeof (UINTN))); + + if (PeiServices == NULL) + return (Idtr.IDTBaseAddr); //Point to the area after PEI Services + else + { + Status = (**PeiServices).LocatePpi( + PeiServices, + &mPeiDbgBasePpiGuid, // GUID + 0, // INSTANCE + NULL, // EFI_PEI_PPI_DESCRIPTOR + &PeiDbgData // PPI + ); + if (!EFI_ERROR(Status)) + return *((UINTN*)PeiDbgData); + else + return (Idtr.IDTBaseAddr); + } + } + else { + return((UINTN)PeiDbgDataSection.DATABASEADDRESS); + } +} + +// +//-------------------------------------------------------------------- +// Procedure: IsDbgrInCAR +// +// Description: Internal Helper function. +// +// Input: none +// +// Output: 1 for yes & 0 for no (UINT32) +// +//-------------------------------------------------------------------- +// +UINT32 IsDbgrInCAR() +{ +#if defined (PI_SPECIFICATION_VERSION) && (PI_SPECIFICATION_VERSION >= 0x00010000) + if((PeiDbgDataSection.DATABASEADDRESS)==NULL) +#else + if(PEI_DEBUG_DATA_BASEADDRESS == PEI_DEBUG_DATASECTION_BASEADDRESS) +#endif + return 1; //yes + else + return 0; //no +} + +// +//-------------------------------------------------------------------- +// Procedure: IoRead32 +// +// Description: Internal Helper function. Reads 32-bit value from IO port +// +// Input: UINT16 Port +// +// Output: UINT32 - port data +// +//-------------------------------------------------------------------- +// +UINT32 IoRead32(UINT16 Port) +{ +#ifdef EFIx64 + return IoReadDword(Port); +#else + _asm { + mov dx, Port + in eax, dx + } +#endif +} + +// +//-------------------------------------------------------------------- +// Procedure: Stall +// +// Description: Internal Helper function. +// +// Input: UINTN Usec (microseconds) +// +// Output: void +// +//-------------------------------------------------------------------- +// +VOID Stall (UINTN Usec) +{ + UINTN Counter = (Usec * 7)/2; // 3.58 count per microsec + UINTN i; + UINT32 Data32; + UINT32 PrevData; + + PrevData = IoRead32(PM_BASE_ADDRESS + 8); + for (i=0; i < Counter; ) { + Data32 = IoRead32(PM_BASE_ADDRESS + 8); + if (Data32 < PrevData) { // Reset if there is a overlap + PrevData=Data32; + continue; + } + i += (Data32 - PrevData); + PrevData=Data32; // FIX need to find out the real diff betweek different count. + } +} + +// +//-------------------------------------------------------------------- +// Procedure: AddDelay +// +// Description: Internal Helper function. +// +// Input: is currently designed to provide either software delay +// or through ACPI timer who has fixed frequency. +// +// Output: void +// +//-------------------------------------------------------------------- +// +void AddDelay() +{ + Stall(10*1000); //for 10 milliseconds + return; +} + +// +//-------------------------------------------------------------------- +// Procedure: AddUsbDelay +// +// Description: Internal Helper function. +// +// Input: is currently designed to provide either software delay +// or through ACPI timer who has fixed frequency. +// +// Output: void +// +//-------------------------------------------------------------------- +// +void AddUsbDelay() +{ + Stall(2*1000); //for 2 milliseconds + return; +} + +// +//-------------------------------------------------------------------- +// Procedure: AddSpecialDelay() +// +// Description: Internal Helper function. +// +// Input: void +// +// Output: void +// +//-------------------------------------------------------------------- +// +void AddSpecialDelay() +{ +#if !PEI_CACHE_ENABLED + if(IsDbgrInCAR()) + AddExtDelay(); + else{ + UINTN CriticalDelay = 60; + while(CriticalDelay--) + AddExtDelay(); + } +#else + UINTN CriticalDelay = 60; + +CriticalDelay = 1; // TESTING... + while(CriticalDelay--) + AddExtDelay(); +#endif +} + +// +//-------------------------------------------------------------------- +// Procedure: AddExtDelay() +// +// Description: Internal Helper function. +// +// Input: void +// +// Output: void +// +//-------------------------------------------------------------------- +// +void AddExtDelay() +{ +// UINT8 i = 35; //providing 250 ms delay + UINT8 i = 25; + i =1; // TESTING... + while(i--) + AddDelay(); + return; +} + +// +//-------------------------------------------------------------------- +// Procedure: GetBuildTime() +// +// Description: Sends the Build Time Details +// +// Input: void* +// +// Output: void +// +//-------------------------------------------------------------------- +// + +#define Str2No(A) (A - '0') + +#define TwoDigitStr2BCD(String) (Str2No(String[0])*0x10+Str2No(String[1])) + +VOID GetBuildTime(void *Buffer) +{ + UINT8 *strYear = FOUR_DIGIT_YEAR; + UINT8 *strMonth = TWO_DIGIT_MONTH; + UINT8 *strDay = TWO_DIGIT_DAY; + UINT8 *strHour = TWO_DIGIT_HOUR; + UINT8 *strMin = TWO_DIGIT_MINUTE; + UINT8 *strSec = TWO_DIGIT_SECOND; + + + ((DateTime_T*)Buffer)->Year=(Str2No(strYear[0])*0x1000+Str2No(strYear[1])*0x100+Str2No(strYear[2])*0x10+Str2No(strYear[3])); + ((DateTime_T*)Buffer)->Month=TwoDigitStr2BCD(strMonth); + ((DateTime_T*)Buffer)->Day=TwoDigitStr2BCD(strDay); + ((DateTime_T*)Buffer)->Hour=TwoDigitStr2BCD(strHour); + ((DateTime_T*)Buffer)->Minute=TwoDigitStr2BCD(strMin); + ((DateTime_T*)Buffer)->Second=TwoDigitStr2BCD(strSec); + return; +} + + +//#endif +//*****************************************************************// +//*****************************************************************// +//*****************************************************************// +//** **// +//** (C)Copyright 2009, American Megatrends, Inc. **// +//** **// +//** All Rights Reserved. **// +//** **// +//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **// +//** **// +//** Phone (770)-246-8600 **// +//** **// +//*****************************************************************// +//*****************************************************************// +//*****************************************************************// -- cgit v1.2.3