1) remove wrong global variable usage because it will bring data corrupt if there are multiple XHCI host controllers.
2) coding style clean up. Signed-off-by: erictian Reviewed-by: ydong10 Reviewed-by: jshi19 git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12351 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@@ -29,42 +29,41 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
#include <Library/UefiBootServicesTableLib.h>
|
||||
#include <Library/MemoryAllocationLib.h>
|
||||
#include <Library/UefiLib.h>
|
||||
#include <Library/PcdLib.h>
|
||||
#include <Library/DebugLib.h>
|
||||
|
||||
#include <IndustryStandard/Pci.h>
|
||||
|
||||
typedef struct _USB_XHCI_DEV USB_XHCI_DEV;
|
||||
typedef struct _USB_DEV_CONTEXT USB_DEV_CONTEXT;
|
||||
typedef struct _USB_XHCI_INSTANCE USB_XHCI_INSTANCE;
|
||||
typedef struct _USB_DEV_CONTEXT USB_DEV_CONTEXT;
|
||||
|
||||
#include "XhciReg.h"
|
||||
#include "XhciSched.h"
|
||||
#include "ComponentName.h"
|
||||
|
||||
//
|
||||
// XHC timeout experience values
|
||||
// Convert millisecond to microsecond.
|
||||
//
|
||||
#define XHC_1_MICROSECOND 1
|
||||
#define XHC_1_MILLISECOND (1000 * XHC_1_MICROSECOND)
|
||||
#define XHC_1_SECOND (1000 * XHC_1_MILLISECOND)
|
||||
|
||||
#define XHC_1_MILLISECOND (1000)
|
||||
//
|
||||
// XHCI register operation timeout, set by experience
|
||||
// XHC generic timeout experience values.
|
||||
// The unit is microsecond, setting it as 10ms.
|
||||
//
|
||||
#define XHC_RESET_TIMEOUT (1 * XHC_1_SECOND)
|
||||
#define XHC_GENERIC_TIMEOUT (10 * XHC_1_MILLISECOND)
|
||||
|
||||
#define XHC_GENERIC_TIMEOUT (10 * 1000)
|
||||
//
|
||||
// Wait for roothub port power stable, refers to Spec[XHCI1.0-2.3.9]
|
||||
// XHC reset timeout experience values.
|
||||
// The unit is microsecond, setting it as 1s.
|
||||
//
|
||||
#define XHC_ROOT_PORT_RECOVERY_STALL (20 * XHC_1_MILLISECOND)
|
||||
|
||||
#define XHC_RESET_TIMEOUT (1000 * 1000)
|
||||
//
|
||||
// Sync and Async transfer polling interval, set by experience,
|
||||
// and the unit of Async is 100us, means 50ms as interval.
|
||||
// XHC delay experience value for polling operation.
|
||||
// The unit is microsecond, set it as 1ms.
|
||||
//
|
||||
#define XHC_SYNC_POLL_INTERVAL (20 * XHC_1_MILLISECOND)
|
||||
#define XHC_ASYNC_POLL_INTERVAL (50 * 10000U)
|
||||
#define XHC_POLL_DELAY (1000)
|
||||
//
|
||||
// XHC async transfer timer interval, set by experience.
|
||||
// The unit is 100us, takes 50ms as interval.
|
||||
//
|
||||
#define XHC_ASYNC_TIMER_INTERVAL EFI_TIMER_PERIOD_MILLISECONDS(50)
|
||||
|
||||
//
|
||||
// XHC raises TPL to TPL_NOTIFY to serialize all its operations
|
||||
@@ -93,21 +92,29 @@ typedef struct _USB_DEV_CONTEXT USB_DEV_CONTEXT;
|
||||
|
||||
#define EFI_LIST_CONTAINER(Entry, Type, Field) BASE_CR(Entry, Type, Field)
|
||||
|
||||
#define XHC_LOW_32BIT(Addr64) ((UINT32)(((UINTN)(Addr64)) & 0xFFFFFFFF))
|
||||
#define XHC_HIGH_32BIT(Addr64) ((UINT32)(RShiftU64((UINTN)(Addr64), 32) & 0xFFFFFFFF))
|
||||
#define XHC_BIT_IS_SET(Data, Bit) ((BOOLEAN)(((Data) & (Bit)) == (Bit)))
|
||||
#define XHC_LOW_32BIT(Addr64) ((UINT32)(((UINTN)(Addr64)) & 0xFFFFFFFF))
|
||||
#define XHC_HIGH_32BIT(Addr64) ((UINT32)(RShiftU64((UINTN)(Addr64), 32) & 0xFFFFFFFF))
|
||||
#define XHC_BIT_IS_SET(Data, Bit) ((BOOLEAN)(((Data) & (Bit)) == (Bit)))
|
||||
|
||||
#define XHC_REG_BIT_IS_SET(Xhc, Offset, Bit) \
|
||||
(XHC_BIT_IS_SET(XhcReadOpReg ((Xhc), (Offset)), (Bit)))
|
||||
|
||||
#define XHCI_IS_DATAIN(EndpointAddr) XHC_BIT_IS_SET((EndpointAddr), 0x80)
|
||||
#define XHCI_IS_DATAIN(EndpointAddr) XHC_BIT_IS_SET((EndpointAddr), 0x80)
|
||||
|
||||
#define USB_XHCI_DEV_SIGNATURE SIGNATURE_32 ('x', 'h', 'c', 'i')
|
||||
#define XHC_FROM_THIS(a) CR(a, USB_XHCI_DEV, Usb2Hc, USB_XHCI_DEV_SIGNATURE)
|
||||
#define XHCI_INSTANCE_SIG SIGNATURE_32 ('x', 'h', 'c', 'i')
|
||||
#define XHC_FROM_THIS(a) CR(a, USB_XHCI_INSTANCE, Usb2Hc, XHCI_INSTANCE_SIG)
|
||||
|
||||
#define USB_DESC_TYPE_HUB 0x29
|
||||
#define USB_DESC_TYPE_HUB_SUPER_SPEED 0x2a
|
||||
|
||||
//
|
||||
// The RequestType in EFI_USB_DEVICE_REQUEST is composed of
|
||||
// three fields: One bit direction, 2 bit type, and 5 bit
|
||||
// target.
|
||||
//
|
||||
#define USB_REQUEST_TYPE(Dir, Type, Target) \
|
||||
((UINT8)((((Dir) == EfiUsbDataIn ? 0x01 : 0) << 7) | (Type) | (Target)))
|
||||
|
||||
//
|
||||
// Xhci Data and Ctrl Structures
|
||||
//
|
||||
@@ -129,7 +136,63 @@ typedef struct {
|
||||
} EFI_USB_HUB_DESCRIPTOR;
|
||||
#pragma pack()
|
||||
|
||||
struct _USB_XHCI_DEV {
|
||||
struct _USB_DEV_CONTEXT {
|
||||
//
|
||||
// Whether this entry in UsbDevContext array is used or not.
|
||||
//
|
||||
BOOLEAN Enabled;
|
||||
//
|
||||
// The slot id assigned to the new device through XHCI's Enable_Slot cmd.
|
||||
//
|
||||
UINT8 SlotId;
|
||||
//
|
||||
// The route string presented an attached usb device.
|
||||
//
|
||||
USB_DEV_ROUTE RouteString;
|
||||
//
|
||||
// The route string of parent device if it exists. Otherwise it's zero.
|
||||
//
|
||||
USB_DEV_ROUTE ParentRouteString;
|
||||
//
|
||||
// The actual device address assigned by XHCI through Address_Device command.
|
||||
//
|
||||
UINT8 XhciDevAddr;
|
||||
//
|
||||
// The requested device address from UsbBus driver through Set_Address standard usb request.
|
||||
// As XHCI spec replaces this request with Address_Device command, we have to record the
|
||||
// requested device address and establish a mapping relationship with the actual device address.
|
||||
// Then UsbBus driver just need to be aware of the requested device address to access usb device
|
||||
// through EFI_USB2_HC_PROTOCOL. Xhci driver would be responsible for translating it to actual
|
||||
// device address and access the actual device.
|
||||
//
|
||||
UINT8 BusDevAddr;
|
||||
//
|
||||
// The pointer to the input device context.
|
||||
//
|
||||
VOID *InputContext;
|
||||
//
|
||||
// The pointer to the output device context.
|
||||
//
|
||||
VOID *OutputContext;
|
||||
//
|
||||
// The transfer queue for every endpoint.
|
||||
//
|
||||
VOID *EndpointTransferRing[31];
|
||||
//
|
||||
// The device descriptor which is stored to support XHCI's Evaluate_Context cmd.
|
||||
//
|
||||
EFI_USB_DEVICE_DESCRIPTOR DevDesc;
|
||||
//
|
||||
// As a usb device may include multiple configuration descriptors, we dynamically allocate an array
|
||||
// to store them.
|
||||
// Note that every configuration descriptor stored here includes those lower level descriptors,
|
||||
// such as Interface descriptor, Endpoint descriptor, and so on.
|
||||
// These information is used to support XHCI's Config_Endpoint cmd.
|
||||
//
|
||||
EFI_USB_CONFIG_DESCRIPTOR **ConfDesc;
|
||||
};
|
||||
|
||||
struct _USB_XHCI_INSTANCE {
|
||||
UINT32 Signature;
|
||||
EFI_PCI_IO_PROTOCOL *PciIo;
|
||||
UINT64 OriginalPciAttributes;
|
||||
@@ -189,68 +252,17 @@ struct _USB_XHCI_DEV {
|
||||
//
|
||||
EFI_UNICODE_STRING_TABLE *ControllerNameTable;
|
||||
|
||||
//
|
||||
// Store device contexts managed by XHCI instance
|
||||
// The array supports up to 255 devices, entry 0 is reserved and should not be used.
|
||||
//
|
||||
USB_DEV_CONTEXT UsbDevContext[256];
|
||||
};
|
||||
|
||||
struct _USB_DEV_CONTEXT {
|
||||
//
|
||||
// Whether this entry in UsbDevContext array is used or not.
|
||||
//
|
||||
BOOLEAN Enabled;
|
||||
//
|
||||
// The slot id assigned to the new device through XHCI's Enable_Slot cmd.
|
||||
//
|
||||
UINT8 SlotId;
|
||||
//
|
||||
// The route string presented an attached usb device.
|
||||
//
|
||||
USB_DEV_ROUTE RouteString;
|
||||
//
|
||||
// The route string of parent device if it exists. Otherwise it's zero.
|
||||
//
|
||||
USB_DEV_ROUTE ParentRouteString;
|
||||
//
|
||||
// The actual device address assigned by XHCI through Address_Device command.
|
||||
//
|
||||
UINT8 XhciDevAddr;
|
||||
//
|
||||
// The requested device address from UsbBus driver through Set_Address standard usb request.
|
||||
// As XHCI spec replaces this request with Address_Device command, we have to record the
|
||||
// requested device address and establish a mapping relationship with the actual device address.
|
||||
// Then UsbBus driver just need to be aware of the requested device address to access usb device
|
||||
// through EFI_USB2_HC_PROTOCOL. Xhci driver would be responsible for translating it to actual
|
||||
// device address and access the actual device.
|
||||
//
|
||||
UINT8 BusDevAddr;
|
||||
//
|
||||
// The pointer to the input device context.
|
||||
//
|
||||
VOID *InputContext;
|
||||
//
|
||||
// The pointer to the output device context.
|
||||
//
|
||||
VOID *OutputDevContxt;
|
||||
//
|
||||
// The transfer queue for every endpoint.
|
||||
//
|
||||
VOID *EndpointTransferRing[31];
|
||||
//
|
||||
// The device descriptor which is stored to support XHCI's Evaluate_Context cmd.
|
||||
//
|
||||
EFI_USB_DEVICE_DESCRIPTOR DevDesc;
|
||||
//
|
||||
// As a usb device may include multiple configuration descriptors, we dynamically allocate an array
|
||||
// to store them.
|
||||
// Note that every configuration descriptor stored here includes those lower level descriptors,
|
||||
// such as Interface descriptor, Endpoint descriptor, and so on.
|
||||
// These information is used to support XHCI's Config_Endpoint cmd.
|
||||
//
|
||||
EFI_USB_CONFIG_DESCRIPTOR **ConfDesc;
|
||||
};
|
||||
|
||||
extern EFI_DRIVER_BINDING_PROTOCOL gXhciDriverBinding;
|
||||
extern EFI_COMPONENT_NAME_PROTOCOL gXhciComponentName;
|
||||
extern EFI_COMPONENT_NAME2_PROTOCOL gXhciComponentName2;
|
||||
extern USB_DEV_CONTEXT UsbDevContext[];
|
||||
|
||||
/**
|
||||
Test to see if this driver supports ControllerHandle. Any
|
||||
@@ -316,6 +328,109 @@ XhcDriverBindingStop (
|
||||
IN EFI_HANDLE *ChildHandleBuffer
|
||||
);
|
||||
|
||||
/**
|
||||
Retrieves the capability of root hub ports.
|
||||
|
||||
@param This The EFI_USB2_HC_PROTOCOL instance.
|
||||
@param MaxSpeed Max speed supported by the controller.
|
||||
@param PortNumber Number of the root hub ports.
|
||||
@param Is64BitCapable Whether the controller supports 64-bit memory
|
||||
addressing.
|
||||
|
||||
@retval EFI_SUCCESS Host controller capability were retrieved successfully.
|
||||
@retval EFI_INVALID_PARAMETER Either of the three capability pointer is NULL.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
XhcGetCapability (
|
||||
IN EFI_USB2_HC_PROTOCOL *This,
|
||||
OUT UINT8 *MaxSpeed,
|
||||
OUT UINT8 *PortNumber,
|
||||
OUT UINT8 *Is64BitCapable
|
||||
);
|
||||
|
||||
/**
|
||||
Provides software reset for the USB host controller.
|
||||
|
||||
@param This This EFI_USB2_HC_PROTOCOL instance.
|
||||
@param Attributes A bit mask of the reset operation to perform.
|
||||
|
||||
@retval EFI_SUCCESS The reset operation succeeded.
|
||||
@retval EFI_INVALID_PARAMETER Attributes is not valid.
|
||||
@retval EFI_UNSUPPOURTED The type of reset specified by Attributes is
|
||||
not currently supported by the host controller.
|
||||
@retval EFI_DEVICE_ERROR Host controller isn't halted to reset.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
XhcReset (
|
||||
IN EFI_USB2_HC_PROTOCOL *This,
|
||||
IN UINT16 Attributes
|
||||
);
|
||||
|
||||
/**
|
||||
Retrieve the current state of the USB host controller.
|
||||
|
||||
@param This This EFI_USB2_HC_PROTOCOL instance.
|
||||
@param State Variable to return the current host controller
|
||||
state.
|
||||
|
||||
@retval EFI_SUCCESS Host controller state was returned in State.
|
||||
@retval EFI_INVALID_PARAMETER State is NULL.
|
||||
@retval EFI_DEVICE_ERROR An error was encountered while attempting to
|
||||
retrieve the host controller's current state.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
XhcGetState (
|
||||
IN EFI_USB2_HC_PROTOCOL *This,
|
||||
OUT EFI_USB_HC_STATE *State
|
||||
);
|
||||
|
||||
/**
|
||||
Sets the USB host controller to a specific state.
|
||||
|
||||
@param This This EFI_USB2_HC_PROTOCOL instance.
|
||||
@param State The state of the host controller that will be set.
|
||||
|
||||
@retval EFI_SUCCESS The USB host controller was successfully placed
|
||||
in the state specified by State.
|
||||
@retval EFI_INVALID_PARAMETER State is invalid.
|
||||
@retval EFI_DEVICE_ERROR Failed to set the state due to device error.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
XhcSetState (
|
||||
IN EFI_USB2_HC_PROTOCOL *This,
|
||||
IN EFI_USB_HC_STATE State
|
||||
);
|
||||
|
||||
/**
|
||||
Retrieves the current status of a USB root hub port.
|
||||
|
||||
@param This This EFI_USB2_HC_PROTOCOL instance.
|
||||
@param PortNumber The root hub port to retrieve the state from.
|
||||
This value is zero-based.
|
||||
@param PortStatus Variable to receive the port state.
|
||||
|
||||
@retval EFI_SUCCESS The status of the USB root hub port specified.
|
||||
by PortNumber was returned in PortStatus.
|
||||
@retval EFI_INVALID_PARAMETER PortNumber is invalid.
|
||||
@retval EFI_DEVICE_ERROR Can't read register.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
XhcGetRootHubPortStatus (
|
||||
IN EFI_USB2_HC_PROTOCOL *This,
|
||||
IN UINT8 PortNumber,
|
||||
OUT EFI_USB_PORT_STATUS *PortStatus
|
||||
);
|
||||
|
||||
/**
|
||||
Sets a feature for the specified root hub port.
|
||||
|
||||
@@ -359,4 +474,255 @@ XhcClearRootHubPortFeature (
|
||||
IN EFI_USB_PORT_FEATURE PortFeature
|
||||
);
|
||||
|
||||
/**
|
||||
Submits control transfer to a target USB device.
|
||||
|
||||
@param This This EFI_USB2_HC_PROTOCOL instance.
|
||||
@param DeviceAddress The target device address.
|
||||
@param DeviceSpeed Target device speed.
|
||||
@param MaximumPacketLength Maximum packet size the default control transfer
|
||||
endpoint is capable of sending or receiving.
|
||||
@param Request USB device request to send.
|
||||
@param TransferDirection Specifies the data direction for the data stage
|
||||
@param Data Data buffer to be transmitted or received from USB
|
||||
device.
|
||||
@param DataLength The size (in bytes) of the data buffer.
|
||||
@param Timeout Indicates the maximum timeout, in millisecond.
|
||||
@param Translator Transaction translator to be used by this device.
|
||||
@param TransferResult Return the result of this control transfer.
|
||||
|
||||
@retval EFI_SUCCESS Transfer was completed successfully.
|
||||
@retval EFI_OUT_OF_RESOURCES The transfer failed due to lack of resources.
|
||||
@retval EFI_INVALID_PARAMETER Some parameters are invalid.
|
||||
@retval EFI_TIMEOUT Transfer failed due to timeout.
|
||||
@retval EFI_DEVICE_ERROR Transfer failed due to host controller or device error.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
XhcControlTransfer (
|
||||
IN EFI_USB2_HC_PROTOCOL *This,
|
||||
IN UINT8 DeviceAddress,
|
||||
IN UINT8 DeviceSpeed,
|
||||
IN UINTN MaximumPacketLength,
|
||||
IN EFI_USB_DEVICE_REQUEST *Request,
|
||||
IN EFI_USB_DATA_DIRECTION TransferDirection,
|
||||
IN OUT VOID *Data,
|
||||
IN OUT UINTN *DataLength,
|
||||
IN UINTN Timeout,
|
||||
IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
|
||||
OUT UINT32 *TransferResult
|
||||
);
|
||||
|
||||
/**
|
||||
Submits bulk transfer to a bulk endpoint of a USB device.
|
||||
|
||||
@param This This EFI_USB2_HC_PROTOCOL instance.
|
||||
@param DeviceAddress Target device address.
|
||||
@param EndPointAddress Endpoint number and its direction in bit 7.
|
||||
@param DeviceSpeed Device speed, Low speed device doesn't support bulk
|
||||
transfer.
|
||||
@param MaximumPacketLength Maximum packet size the endpoint is capable of
|
||||
sending or receiving.
|
||||
@param DataBuffersNumber Number of data buffers prepared for the transfer.
|
||||
@param Data Array of pointers to the buffers of data to transmit
|
||||
from or receive into.
|
||||
@param DataLength The lenght of the data buffer.
|
||||
@param DataToggle On input, the initial data toggle for the transfer;
|
||||
On output, it is updated to to next data toggle to
|
||||
use of the subsequent bulk transfer.
|
||||
@param Timeout Indicates the maximum time, in millisecond, which
|
||||
the transfer is allowed to complete.
|
||||
@param Translator A pointr to the transaction translator data.
|
||||
@param TransferResult A pointer to the detailed result information of the
|
||||
bulk transfer.
|
||||
|
||||
@retval EFI_SUCCESS The transfer was completed successfully.
|
||||
@retval EFI_OUT_OF_RESOURCES The transfer failed due to lack of resource.
|
||||
@retval EFI_INVALID_PARAMETER Some parameters are invalid.
|
||||
@retval EFI_TIMEOUT The transfer failed due to timeout.
|
||||
@retval EFI_DEVICE_ERROR The transfer failed due to host controller error.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
XhcBulkTransfer (
|
||||
IN EFI_USB2_HC_PROTOCOL *This,
|
||||
IN UINT8 DeviceAddress,
|
||||
IN UINT8 EndPointAddress,
|
||||
IN UINT8 DeviceSpeed,
|
||||
IN UINTN MaximumPacketLength,
|
||||
IN UINT8 DataBuffersNumber,
|
||||
IN OUT VOID *Data[EFI_USB_MAX_BULK_BUFFER_NUM],
|
||||
IN OUT UINTN *DataLength,
|
||||
IN OUT UINT8 *DataToggle,
|
||||
IN UINTN Timeout,
|
||||
IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
|
||||
OUT UINT32 *TransferResult
|
||||
);
|
||||
|
||||
/**
|
||||
Submits an asynchronous interrupt transfer to an
|
||||
interrupt endpoint of a USB device.
|
||||
|
||||
@param This This EFI_USB2_HC_PROTOCOL instance.
|
||||
@param DeviceAddress Target device address.
|
||||
@param EndPointAddress Endpoint number and its direction encoded in bit 7
|
||||
@param DeviceSpeed Indicates device speed.
|
||||
@param MaximumPacketLength Maximum packet size the target endpoint is capable
|
||||
@param IsNewTransfer If TRUE, to submit an new asynchronous interrupt
|
||||
transfer If FALSE, to remove the specified
|
||||
asynchronous interrupt.
|
||||
@param DataToggle On input, the initial data toggle to use; on output,
|
||||
it is updated to indicate the next data toggle.
|
||||
@param PollingInterval The he interval, in milliseconds, that the transfer
|
||||
is polled.
|
||||
@param DataLength The length of data to receive at the rate specified
|
||||
by PollingInterval.
|
||||
@param Translator Transaction translator to use.
|
||||
@param CallBackFunction Function to call at the rate specified by
|
||||
PollingInterval.
|
||||
@param Context Context to CallBackFunction.
|
||||
|
||||
@retval EFI_SUCCESS The request has been successfully submitted or canceled.
|
||||
@retval EFI_INVALID_PARAMETER Some parameters are invalid.
|
||||
@retval EFI_OUT_OF_RESOURCES The request failed due to a lack of resources.
|
||||
@retval EFI_DEVICE_ERROR The transfer failed due to host controller error.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
XhcAsyncInterruptTransfer (
|
||||
IN EFI_USB2_HC_PROTOCOL *This,
|
||||
IN UINT8 DeviceAddress,
|
||||
IN UINT8 EndPointAddress,
|
||||
IN UINT8 DeviceSpeed,
|
||||
IN UINTN MaximumPacketLength,
|
||||
IN BOOLEAN IsNewTransfer,
|
||||
IN OUT UINT8 *DataToggle,
|
||||
IN UINTN PollingInterval,
|
||||
IN UINTN DataLength,
|
||||
IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
|
||||
IN EFI_ASYNC_USB_TRANSFER_CALLBACK CallBackFunction,
|
||||
IN VOID *Context OPTIONAL
|
||||
);
|
||||
|
||||
/**
|
||||
Submits synchronous interrupt transfer to an interrupt endpoint
|
||||
of a USB device.
|
||||
|
||||
@param This This EFI_USB2_HC_PROTOCOL instance.
|
||||
@param DeviceAddress Target device address.
|
||||
@param EndPointAddress Endpoint number and its direction encoded in bit 7
|
||||
@param DeviceSpeed Indicates device speed.
|
||||
@param MaximumPacketLength Maximum packet size the target endpoint is capable
|
||||
of sending or receiving.
|
||||
@param Data Buffer of data that will be transmitted to USB
|
||||
device or received from USB device.
|
||||
@param DataLength On input, the size, in bytes, of the data buffer; On
|
||||
output, the number of bytes transferred.
|
||||
@param DataToggle On input, the initial data toggle to use; on output,
|
||||
it is updated to indicate the next data toggle.
|
||||
@param Timeout Maximum time, in second, to complete.
|
||||
@param Translator Transaction translator to use.
|
||||
@param TransferResult Variable to receive the transfer result.
|
||||
|
||||
@return EFI_SUCCESS The transfer was completed successfully.
|
||||
@return EFI_OUT_OF_RESOURCES The transfer failed due to lack of resource.
|
||||
@return EFI_INVALID_PARAMETER Some parameters are invalid.
|
||||
@return EFI_TIMEOUT The transfer failed due to timeout.
|
||||
@return EFI_DEVICE_ERROR The failed due to host controller or device error
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
XhcSyncInterruptTransfer (
|
||||
IN EFI_USB2_HC_PROTOCOL *This,
|
||||
IN UINT8 DeviceAddress,
|
||||
IN UINT8 EndPointAddress,
|
||||
IN UINT8 DeviceSpeed,
|
||||
IN UINTN MaximumPacketLength,
|
||||
IN OUT VOID *Data,
|
||||
IN OUT UINTN *DataLength,
|
||||
IN OUT UINT8 *DataToggle,
|
||||
IN UINTN Timeout,
|
||||
IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
|
||||
OUT UINT32 *TransferResult
|
||||
);
|
||||
|
||||
/**
|
||||
Submits isochronous transfer to a target USB device.
|
||||
|
||||
@param This This EFI_USB2_HC_PROTOCOL instance.
|
||||
@param DeviceAddress Target device address.
|
||||
@param EndPointAddress End point address with its direction.
|
||||
@param DeviceSpeed Device speed, Low speed device doesn't support this
|
||||
type.
|
||||
@param MaximumPacketLength Maximum packet size that the endpoint is capable of
|
||||
sending or receiving.
|
||||
@param DataBuffersNumber Number of data buffers prepared for the transfer.
|
||||
@param Data Array of pointers to the buffers of data that will
|
||||
be transmitted to USB device or received from USB
|
||||
device.
|
||||
@param DataLength The size, in bytes, of the data buffer.
|
||||
@param Translator Transaction translator to use.
|
||||
@param TransferResult Variable to receive the transfer result.
|
||||
|
||||
@return EFI_UNSUPPORTED Isochronous transfer is unsupported.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
XhcIsochronousTransfer (
|
||||
IN EFI_USB2_HC_PROTOCOL *This,
|
||||
IN UINT8 DeviceAddress,
|
||||
IN UINT8 EndPointAddress,
|
||||
IN UINT8 DeviceSpeed,
|
||||
IN UINTN MaximumPacketLength,
|
||||
IN UINT8 DataBuffersNumber,
|
||||
IN OUT VOID *Data[EFI_USB_MAX_ISO_BUFFER_NUM],
|
||||
IN UINTN DataLength,
|
||||
IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
|
||||
OUT UINT32 *TransferResult
|
||||
);
|
||||
|
||||
/**
|
||||
Submits Async isochronous transfer to a target USB device.
|
||||
|
||||
@param This This EFI_USB2_HC_PROTOCOL instance.
|
||||
@param DeviceAddress Target device address.
|
||||
@param EndPointAddress End point address with its direction.
|
||||
@param DeviceSpeed Device speed, Low speed device doesn't support this
|
||||
type.
|
||||
@param MaximumPacketLength Maximum packet size that the endpoint is capable of
|
||||
sending or receiving.
|
||||
@param DataBuffersNumber Number of data buffers prepared for the transfer.
|
||||
@param Data Array of pointers to the buffers of data that will
|
||||
be transmitted to USB device or received from USB
|
||||
device.
|
||||
@param DataLength The size, in bytes, of the data buffer.
|
||||
@param Translator Transaction translator to use.
|
||||
@param IsochronousCallBack Function to be called when the transfer complete.
|
||||
@param Context Context passed to the call back function as
|
||||
parameter.
|
||||
|
||||
@return EFI_UNSUPPORTED Isochronous transfer isn't supported.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
XhcAsyncIsochronousTransfer (
|
||||
IN EFI_USB2_HC_PROTOCOL *This,
|
||||
IN UINT8 DeviceAddress,
|
||||
IN UINT8 EndPointAddress,
|
||||
IN UINT8 DeviceSpeed,
|
||||
IN UINTN MaximumPacketLength,
|
||||
IN UINT8 DataBuffersNumber,
|
||||
IN OUT VOID *Data[EFI_USB_MAX_ISO_BUFFER_NUM],
|
||||
IN UINTN DataLength,
|
||||
IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
|
||||
IN EFI_ASYNC_USB_TRANSFER_CALLBACK IsochronousCallBack,
|
||||
IN VOID *Context
|
||||
);
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user