TianoCore EDK2 master
|
#include "DebugCommunicationLibUsb3Internal.h"
Go to the source code of this file.
Variables | |
UINT16 | mString0Desc [] |
UINT16 | mManufacturerStrDesc [] |
UINT16 | mProductStrDesc [] |
UINT16 | mSerialNumberStrDesc [] |
Debug Port Library implementation based on usb3 debug port.
Copyright (c) 2014 - 2018, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file DebugCommunicationLibUsb3Common.c.
RETURN_STATUS EFIAPI CalculateUsbDebugPortMmioBase | ( | USB3_DEBUG_PORT_HANDLE * | Handle | ) |
Calculate the usb debug port bar address.
Handle | Debug port handle. |
RETURN_UNSUPPORTED | The usb host controller does not support usb debug port capability. |
RETURN_SUCCESS | Get bar and offset successfully. |
Definition at line 236 of file DebugCommunicationLibUsb3Common.c.
EFI_STATUS CreateDebugCapabilityContext | ( | IN USB3_DEBUG_PORT_HANDLE * | Handle | ) |
Create debug capability context for XHC debug device.
Handle | Debug port handle. |
EFI_SUCCESS | The bit successfully changed by host controller. |
EFI_TIMEOUT | The time out occurred. |
Definition at line 512 of file DebugCommunicationLibUsb3Common.c.
EFI_STATUS CreateEventRing | ( | IN USB3_DEBUG_PORT_HANDLE * | Handle, |
OUT EVENT_RING * | EventRing | ||
) |
Create XHCI event ring.
Handle | Debug port handle. |
EventRing | The created event ring. |
Definition at line 367 of file DebugCommunicationLibUsb3Common.c.
VOID CreateTransferRing | ( | IN USB3_DEBUG_PORT_HANDLE * | Handle, |
IN UINT32 | TrbNum, | ||
OUT TRANSFER_RING * | TransferRing | ||
) |
Create XHCI transfer ring.
Handle | Debug port handle. |
TrbNum | The number of TRB in the ring. |
TransferRing | The created transfer ring. |
Definition at line 464 of file DebugCommunicationLibUsb3Common.c.
DEBUG_PORT_HANDLE EFIAPI DebugPortInitialize | ( | IN VOID * | Context, |
IN DEBUG_PORT_CONTINUE | Function | ||
) |
Initialize the debug port.
If Function is not NULL, Debug Communication Library will call this function by passing in the Context to be the first parameter. If needed, Debug Communication Library will create one debug port handle to be the second argument passing in calling the Function, otherwise it will pass NULL to be the second argument of Function.
If Function is NULL, and Context is not NULL, the Debug Communication Library could a) Return the same handle as passed in (as Context parameter). b) Ignore the input Context parameter and create new handle to be returned.
If parameter Function is NULL and Context is NULL, Debug Communication Library could created a new handle if needed and return it, otherwise it will return NULL.
[in] | Context | Context needed by callback function; it was optional. |
[in] | Function | Continue function called by Debug Communication library; it was optional. |
Definition at line 1122 of file DebugCommunicationLibUsb3Common.c.
BOOLEAN EFIAPI DebugPortPollBuffer | ( | IN DEBUG_PORT_HANDLE | Handle | ) |
Polls a debug device to see if there is any data waiting to be read.
Polls a debug device to see if there is any data waiting to be read. If there is data waiting to be read from the debug device, then TRUE is returned. If there is no data waiting to be read from the debug device, then FALSE is returned.
Handle | Debug port handle. |
TRUE | Data is waiting to be read from the debug device. |
FALSE | There is no data waiting to be read from the debug device. |
Definition at line 1035 of file DebugCommunicationLibUsb3Common.c.
UINTN EFIAPI DebugPortReadBuffer | ( | IN DEBUG_PORT_HANDLE | Handle, |
IN UINT8 * | Buffer, | ||
IN UINTN | NumberOfBytes, | ||
IN UINTN | Timeout | ||
) |
Read data from debug device and save the data in buffer.
Reads NumberOfBytes data bytes from a debug device into the buffer specified by Buffer. The number of bytes actually read is returned. If the return value is less than NumberOfBytes, then the rest operation failed. If NumberOfBytes is zero, then return 0.
Handle | Debug port handle. |
Buffer | Pointer to the data buffer to store the data read from the debug device. |
NumberOfBytes | Number of bytes which will be read. |
Timeout | Timeout value for reading from debug device. Its unit is Microsecond. |
0 | Read data failed, no data is to be read. |
>0 | Actual number of bytes read from debug device. |
Definition at line 876 of file DebugCommunicationLibUsb3Common.c.
UINTN EFIAPI DebugPortWriteBuffer | ( | IN DEBUG_PORT_HANDLE | Handle, |
IN UINT8 * | Buffer, | ||
IN UINTN | NumberOfBytes | ||
) |
Write data from buffer to debug device.
Writes NumberOfBytes data bytes from Buffer to the debug device. The number of bytes actually written to the debug device is returned. If the return value is less than NumberOfBytes, then the write operation failed. If NumberOfBytes is zero, then return 0.
Handle | Debug port handle. |
Buffer | Pointer to the data buffer to be written. |
NumberOfBytes | Number of bytes to written to the debug device. |
0 | NumberOfBytes is 0. |
>0 | The number of bytes written to the debug device. If this value is less than NumberOfBytes, then the write operation failed. |
Definition at line 958 of file DebugCommunicationLibUsb3Common.c.
VOID DiscoverInitializeUsbDebugPort | ( | IN USB3_DEBUG_PORT_HANDLE * | Handle | ) |
Discover and initialize usb debug port.
Handle | Debug port handle. |
Definition at line 797 of file DebugCommunicationLibUsb3Common.c.
USB3_DEBUG_PORT_HANDLE * GetUsb3DebugPortInstance | ( | VOID | ) |
Return USB3 debug instance address.
Definition at line 842 of file DebugCommunicationLibUsb3Common.c.
RETURN_STATUS EFIAPI InitializeUsbDebugHardware | ( | IN USB3_DEBUG_PORT_HANDLE * | Handle | ) |
Initialize usb debug port hardware.
Handle | Debug port handle. |
TRUE | The usb debug port hardware configuration is changed. |
FALSE | The usb debug port hardware configuration is not changed. |
Definition at line 664 of file DebugCommunicationLibUsb3Common.c.
BOOLEAN EFIAPI NeedReinitializeHardware | ( | IN USB3_DEBUG_PORT_HANDLE * | Handle | ) |
Check if it needs to re-initialize usb debug port hardware.
During different phases switch, such as SEC to PEI or PEI to DXE or DXE to SMM, we should check whether the usb debug port hardware configuration is changed. Such case can be triggered by Pci bus resource allocation and so on.
Handle | Debug port handle. |
TRUE | The usb debug port hardware configuration is changed. |
FALSE | The usb debug port hardware configuration is not changed. |
Definition at line 336 of file DebugCommunicationLibUsb3Common.c.
EFI_PHYSICAL_ADDRESS ProgramXhciBaseAddress | ( | VOID | ) |
Program and enable XHCI MMIO base address.
Definition at line 171 of file DebugCommunicationLibUsb3Common.c.
VOID SetUsb3DebugPortInstance | ( | IN USB3_DEBUG_PORT_HANDLE * | Instance | ) |
Set USB3 debug instance address.
[in] | Instance | Debug port instance. |
Definition at line 826 of file DebugCommunicationLibUsb3Common.c.
VOID UpdateXhcResource | ( | IN OUT USB3_DEBUG_PORT_HANDLE * | Handle, |
IN EFI_PHYSICAL_ADDRESS | XhciMmioBase | ||
) |
Update XHC MMIO base address when MMIO base address is changed.
Handle | Debug port handle. |
XhciMmioBase | XHCI MMIO base address. |
Definition at line 208 of file DebugCommunicationLibUsb3Common.c.
VOID XhcClearDebugRegBit | ( | IN USB3_DEBUG_PORT_HANDLE * | Handle, |
IN UINT32 | Offset, | ||
IN UINT32 | Bit | ||
) |
Clear one bit of the debug register while keeping other bits.
Handle | Debug port handle. |
Offset | The offset of the debug register. |
Bit | The bit mask of the register to clear. |
Definition at line 151 of file DebugCommunicationLibUsb3Common.c.
Clears bits as per the enabled bit positions in the mask.
[in,out] | Register | UINTN register |
[in] | BitMask | 32-bit mask |
Definition at line 61 of file DebugCommunicationLibUsb3Common.c.
VOID XhcDetectDebugCapabilityReady | ( | IN USB3_DEBUG_PORT_HANDLE * | Handle | ) |
Check if debug device is running.
Handle | Debug port handle. |
Definition at line 618 of file DebugCommunicationLibUsb3Common.c.
UINT32 XhcReadDebugReg | ( | IN USB3_DEBUG_PORT_HANDLE * | Handle, |
IN UINT32 | Offset | ||
) |
Read XHCI debug register.
Handle | Debug port handle. |
Offset | The offset of the runtime register. |
Definition at line 106 of file DebugCommunicationLibUsb3Common.c.
VOID XhcSetDebugRegBit | ( | IN USB3_DEBUG_PORT_HANDLE * | Handle, |
IN UINT32 | Offset, | ||
IN UINT32 | Bit | ||
) |
Set one bit of the debug register while keeping other bits.
Handle | Debug port handle. |
Offset | The offset of the debug register. |
Bit | The bit mask of the register to set. |
Definition at line 129 of file DebugCommunicationLibUsb3Common.c.
Sets bits as per the enabled bit positions in the mask.
[in,out] | Register | UINTN register |
[in] | BitMask | 32-bit mask |
Definition at line 42 of file DebugCommunicationLibUsb3Common.c.
VOID XhcWriteDebugReg | ( | IN USB3_DEBUG_PORT_HANDLE * | Handle, |
IN UINT32 | Offset, | ||
IN UINT32 | Data | ||
) |
Write the data to the XHCI debug register.
Handle | Debug port handle. |
Offset | The offset of the debug register. |
Data | The data to write. |
Definition at line 82 of file DebugCommunicationLibUsb3Common.c.
UINT16 mManufacturerStrDesc[] |
Definition at line 17 of file DebugCommunicationLibUsb3Common.c.
UINT16 mProductStrDesc[] |
Definition at line 23 of file DebugCommunicationLibUsb3Common.c.
UINT16 mSerialNumberStrDesc[] |
Definition at line 29 of file DebugCommunicationLibUsb3Common.c.
UINT16 mString0Desc[] |
Definition at line 11 of file DebugCommunicationLibUsb3Common.c.