SourceLevelDebugPkg DebugUsb3: Re-Support IOMMU
de8373fa07
could not handle two cases. 1. For the case that the USB3 debug port instance and DMA buffers are from PEI HOB with IOMMU enabled, it was to reallocate the DMA buffers by AllocateAddress with the memory type accessible by SMM environment. But reallocating the DMA buffers by AllocateAddress may fail. 2. At S3 resume, after the code is transferred to PiSmmCpuDxeSmm from S3Resume2Pei, HOB is still needed to be used for DMA operation, but PiSmmCpuDxeSmm has no way to get the HOB at S3 resume. The patch is to re-support IOMMU. For PEI, allocate granted DMA buffer from IOMMU PPI, register IOMMU PPI notification to reinitialize hardware with granted DMA buffer if IOMMU PPI is not present yet. For DXE, map DMA buffer by PciIo in PciIo notification for early DXE, and register DxeSmmReadyToLock notification to reinitialize hardware with granted DXE DMA buffer accessible by SMM environment for late DXE. DebugAgentLib has been managing the instance as Handle in HOB/SystemTable. The Handle(instance) from DebugAgentLib can be used directly in DebugCommunicationLibUsb3. Then DebugCommunicationLibUsb3 could get consistent Handle(instance) from DebugAgentLib. 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> Reviewed-by: Hao Wu <hao.a.wu@intel.com> (cherry picked from commit75787f6580
)
This commit is contained in:
@ -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,21 @@ typedef struct _USB3_DEBUG_PORT_INSTANCE {
|
||||
//
|
||||
BOOLEAN Ready;
|
||||
|
||||
//
|
||||
// The flag indicates the instance is from HOB
|
||||
//
|
||||
BOOLEAN FromHob;
|
||||
|
||||
//
|
||||
// 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
|
||||
//
|
||||
@ -691,4 +707,37 @@ XhcDataTransfer (
|
||||
IN UINTN Timeout
|
||||
);
|
||||
|
||||
#endif //__USB3_DEBUG_PORT_LIB_INTERNAL__
|
||||
/**
|
||||
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
|
||||
);
|
||||
|
||||
/**
|
||||
Return USB3 debug instance address pointer.
|
||||
|
||||
**/
|
||||
EFI_PHYSICAL_ADDRESS *
|
||||
GetUsb3DebugPortInstanceAddrPtr (
|
||||
VOID
|
||||
);
|
||||
|
||||
/**
|
||||
Return USB3 debug instance address.
|
||||
|
||||
**/
|
||||
USB3_DEBUG_PORT_HANDLE *
|
||||
GetUsb3DebugPortInstance (
|
||||
VOID
|
||||
);
|
||||
|
||||
#endif //__SERIAL_PORT_LIB_USB__
|
||||
|
Reference in New Issue
Block a user