/** @file\r
Debug Port Library implementation based on usb3 debug port.\r
\r
- Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2014 - 2018, Intel Corporation. All rights reserved.<BR>\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
#include <Library/TimerLib.h>\r
#include <Library/DebugCommunicationLib.h>\r
#include <Library/PciLib.h>\r
-#include <Library/SerialPortLib.h> // Todo: remove in future\r
-\r
-//\r
-// Internal serial debug - remove finally\r
-//\r
-#include <Library/SerialPortLib.h>\r
-#include <Library/PrintLib.h>\r
\r
//\r
// USB Debug GUID value\r
#define USB3DBG_ENABLED 2 // The XHCI debug device is enabled\r
#define USB3DBG_NOT_ENABLED 4 // The XHCI debug device is not enabled\r
\r
-#define USB3_DEBUG_PORT_MAX_PACKET_SIZE 0x08\r
+#define USB3_DEBUG_PORT_WRITE_MAX_PACKET_SIZE 0x08\r
+\r
+//\r
+// MaxPacketSize for DbC Endpoint Descriptor IN and OUT\r
+//\r
+#define XHCI_DEBUG_DEVICE_MAX_PACKET_SIZE 0x400\r
\r
#define XHCI_DEBUG_DEVICE_VENDOR_ID 0x0525\r
#define XHCI_DEBUG_DEVICE_PRODUCT_ID 0x127A\r
\r
#define XHC_USBSTS_HALT BIT0\r
\r
-//\r
-// Transfer the data of 8 bytes each time\r
-//\r
-#define XHC_DEBUG_PORT_DATA_LENGTH 8\r
-\r
//\r
// Indicate the timeout when data is transferred in microsecond. 0 means infinite timeout.\r
//\r
#define DATA_TRANSFER_WRITE_TIMEOUT 0\r
#define DATA_TRANSFER_READ_TIMEOUT 50000\r
#define DATA_TRANSFER_POLL_TIMEOUT 1000\r
-\r
+#define XHC_DEBUG_PORT_1_MILLISECOND 1000\r
//\r
// XHCI port power off/on delay\r
//\r
//\r
UINT8 DataCount;\r
//\r
- // The data buffer. Maximum length is 8 bytes.\r
- //\r
- UINT8 Data[8];\r
+ // The data buffer address for data read and poll.\r
//\r
- // Timter settings\r
- //\r
- UINT64 TimerFrequency;\r
- UINT64 TimerCycle;\r
- BOOLEAN TimerCountDown;\r
-\r
+ EFI_PHYSICAL_ADDRESS Data;\r
} USB3_DEBUG_PORT_HANDLE;\r
\r
#pragma pack()\r
UINT32\r
XhcReadDebugReg (\r
IN USB3_DEBUG_PORT_HANDLE *Handle,\r
- IN UINT32 Offset\r
+ IN UINT32 Offset\r
);\r
\r
/**\r
VOID\r
XhcSetDebugRegBit (\r
IN USB3_DEBUG_PORT_HANDLE *Handle,\r
- IN UINT32 Offset,\r
- IN UINT32 Bit\r
+ IN UINT32 Offset,\r
+ IN UINT32 Bit\r
);\r
\r
/**\r
IN UINT32 Data\r
);\r
\r
-/**\r
- Discover the USB3 debug device.\r
- \r
- @param Handle Debug port handle.\r
- \r
- @retval RETURN_SUCCESS The serial device was initialized.\r
- @retval RETURN_DEVICE_ERROR The serial device could not be initialized.\r
-\r
-**/\r
-RETURN_STATUS\r
-DiscoverUsb3DebugPort(\r
- USB3_DEBUG_PORT_HANDLE *Handle\r
- );\r
- \r
-/**\r
- Initialize the Serial Device hardware.\r
- \r
- @param Handle Debug port handle.\r
-\r
- @retval RETURN_SUCCESS The serial device was initialized successfully.\r
- @retval !RETURN_SUCCESS Error.\r
-\r
-**/\r
-RETURN_STATUS\r
-InitializeUsb3DebugPort (\r
- USB3_DEBUG_PORT_HANDLE *Handle\r
- );\r
-\r
-/**\r
- Return XHCI MMIO base address.\r
-\r
-**/\r
-EFI_PHYSICAL_ADDRESS\r
-GetXhciBaseAddress (\r
- VOID\r
- );\r
-\r
/**\r
Verifies if the bit positions specified by a mask are set in a register.\r
\r
IN UINTN Timeout\r
);\r
\r
-/**\r
- Check if the timer is timeout.\r
- \r
- @param[in] UsbDebugPortHandle Pointer to USB Debug port handle\r
- @param[in] Timer The start timer from the begin.\r
- @param[in] TimeoutTicker Ticker number need time out.\r
-\r
- @return TRUE Timer time out occurs.\r
- @retval FALSE Timer does not time out.\r
-\r
-**/\r
-BOOLEAN\r
-IsTimerTimeout (\r
- IN USB3_DEBUG_PORT_HANDLE *UsbDebugPortHandle,\r
- IN UINT64 Timer,\r
- IN UINT64 TimeoutTicker\r
- );\r
-\r
-#endif //__SERIAL_PORT_LIB_USB__\r
+#endif //__USB3_DEBUG_PORT_LIB_INTERNAL__\r