SourceLevelDebugPkg DebugUsb3: Support IOMMU

For PEI, allocate granted DMA buffer from IOMMU PPI.
For DXE, map DMA buffer by PciIo.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Hao Wu <hao.a.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
(cherry picked from commit de8373fa07)
This commit is contained in:
Star Zeng
2018-01-31 15:17:05 +08:00
parent 7b49d5f26b
commit de761fb41c
6 changed files with 843 additions and 130 deletions

View File

@ -1,7 +1,7 @@
/** @file
Debug Port Library implementation based on usb3 debug port.
Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2014 - 2018, Intel Corporation. All rights reserved.<BR>
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
@ -46,6 +46,7 @@
#define USB3DBG_DBG_CAB 1 // The XHCI host controller supports debug capability
#define USB3DBG_ENABLED 2 // The XHCI debug device is enabled
#define USB3DBG_NOT_ENABLED 4 // The XHCI debug device is not enabled
#define USB3DBG_UNINITIALIZED 255 // The XHCI debug device is uninitialized
#define USB3_DEBUG_PORT_WRITE_MAX_PACKET_SIZE 0x08
@ -456,7 +457,7 @@ typedef struct _USB3_DEBUG_PORT_INSTANCE {
UINT8 Initialized;
//
// The flag indicates debug device is ready
// The flag indicates debug capability is supported
//
BOOLEAN DebugSupport;
@ -465,6 +466,26 @@ typedef struct _USB3_DEBUG_PORT_INSTANCE {
//
BOOLEAN Ready;
//
// The flag indicates the instance is from HOB
//
BOOLEAN FromHob;
//
// IOMMU PPI Notify registered
//
BOOLEAN PpiNotifyRegistered;
//
// Prevent notification being interrupted by debug timer
//
BOOLEAN InNotify;
//
// PciIo protocol event
//
EFI_PHYSICAL_ADDRESS PciIoEvent;
//
// The flag indicates if USB 3.0 ports has been turn off/on power
//
@ -728,4 +749,39 @@ XhcDataTransfer (
IN UINTN Timeout
);
/**
Initialize usb debug port hardware.
@param Handle Debug port handle.
@retval TRUE The usb debug port hardware configuration is changed.
@retval FALSE The usb debug port hardware configuration is not changed.
**/
RETURN_STATUS
EFIAPI
InitializeUsbDebugHardware (
IN USB3_DEBUG_PORT_HANDLE *Handle
);
/**
Discover and initialize usb debug port.
@param Handle Debug port handle.
**/
VOID
DiscoverInitializeUsbDebugPort (
IN USB3_DEBUG_PORT_HANDLE *Handle
);
/**
Return USB3 debug instance address.
**/
USB3_DEBUG_PORT_HANDLE *
GetUsb3DebugPortInstance (
VOID
);
#endif //__SERIAL_PORT_LIB_USB__