+++ /dev/null
-/*++\r
-Copyright (c) 2006, Intel Corporation \r
-All rights reserved. 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
-http://opensource.org/licenses/bsd-license.php \r
- \r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
-\r
- Module Name:\r
-\r
- usbbus.h\r
-\r
- Abstract:\r
-\r
- Header file for USB bus driver Interface\r
-\r
- Revision History\r
-\r
-\r
-\r
---*/\r
-\r
-#ifndef _EFI_USB_BUS_H\r
-#define _EFI_USB_BUS_H\r
-\r
-\r
-#include <IndustryStandard/Usb.h>\r
-#include "hub.h"\r
-#include "usbutil.h"\r
-\r
-\r
-extern UINTN gUSBDebugLevel;\r
-extern UINTN gUSBErrorLevel;\r
-\r
-\r
-#define MICROSECOND 10000\r
-#define ONESECOND (1000 * MICROSECOND)\r
-#define BUSPOLLING_PERIOD ONESECOND\r
-//\r
-// We define some maximun value here\r
-//\r
-#define USB_MAXCONFIG 8\r
-#define USB_MAXALTSETTING 4\r
-#define USB_MAXINTERFACES 32\r
-#define USB_MAXENDPOINTS 16\r
-#define USB_MAXSTRINGS 16\r
-#define USB_MAXLANID 16\r
-#define USB_MAXCHILDREN 8\r
-#define USB_MAXCONTROLLERS 4\r
-\r
-#define USB_IO_CONTROLLER_SIGNATURE EFI_SIGNATURE_32 ('u', 's', 'b', 'd')\r
-\r
-typedef struct {\r
- LIST_ENTRY Link;\r
- UINT16 StringIndex;\r
- CHAR16 *String;\r
-} STR_LIST_ENTRY;\r
-\r
-typedef struct {\r
- LIST_ENTRY Link;\r
- UINT16 Toggle;\r
- EFI_USB_ENDPOINT_DESCRIPTOR EndpointDescriptor;\r
-} ENDPOINT_DESC_LIST_ENTRY;\r
-\r
-typedef struct {\r
- LIST_ENTRY Link;\r
- EFI_USB_INTERFACE_DESCRIPTOR InterfaceDescriptor;\r
- LIST_ENTRY EndpointDescListHead;\r
-} INTERFACE_DESC_LIST_ENTRY;\r
-\r
-typedef struct {\r
- LIST_ENTRY Link;\r
- EFI_USB_CONFIG_DESCRIPTOR CongfigDescriptor;\r
- LIST_ENTRY InterfaceDescListHead;\r
- UINTN ActiveInterface;\r
-} CONFIG_DESC_LIST_ENTRY;\r
-\r
-//\r
-// Forward declaring\r
-//\r
-struct usb_io_device;\r
-\r
-//\r
-// This is used to form the USB Controller Handle\r
-//\r
-typedef struct usb_io_controller_device {\r
- UINTN Signature;\r
- EFI_HANDLE Handle;\r
- EFI_USB_IO_PROTOCOL UsbIo;\r
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
- EFI_HANDLE HostController;\r
- UINT8 CurrentConfigValue;\r
- UINT8 InterfaceNumber;\r
- struct usb_io_device *UsbDevice;\r
-\r
- BOOLEAN IsUsbHub;\r
- BOOLEAN IsManagedByDriver;\r
-\r
- //\r
- // Fields specified for USB Hub\r
- //\r
- EFI_EVENT HubNotify;\r
- UINT8 HubEndpointAddress;\r
- UINT8 StatusChangePort;\r
- UINT8 DownstreamPorts;\r
-\r
- UINT8 ParentPort;\r
- struct usb_io_controller_device *Parent;\r
- struct usb_io_device *Children[USB_MAXCHILDREN];\r
-} USB_IO_CONTROLLER_DEVICE;\r
-\r
-#define USB_IO_CONTROLLER_DEVICE_FROM_USB_IO_THIS(a) \\r
- CR(a, USB_IO_CONTROLLER_DEVICE, UsbIo, USB_IO_CONTROLLER_SIGNATURE)\r
-\r
-//\r
-// This is used to keep the topology of USB bus\r
-//\r
-struct _usb_bus_controller_device;\r
-\r
-typedef struct usb_io_device {\r
- UINT8 DeviceAddress;\r
- BOOLEAN IsConfigured;\r
- BOOLEAN IsSlowDevice;\r
- UINT8 DeviceSpeed;\r
- EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator;\r
- EFI_USB_DEVICE_DESCRIPTOR DeviceDescriptor;\r
- LIST_ENTRY ConfigDescListHead;\r
- CONFIG_DESC_LIST_ENTRY *ActiveConfig;\r
- UINT16 LangID[USB_MAXLANID];\r
-\r
- struct _usb_bus_controller_device *BusController;\r
-\r
- //\r
- // Track the controller handle\r
- //\r
- UINT8 NumOfControllers;\r
- USB_IO_CONTROLLER_DEVICE *UsbController[USB_MAXCONTROLLERS];\r
-\r
-} USB_IO_DEVICE;\r
-\r
-//\r
-// Usb Bus Controller device strcuture\r
-//\r
-#define EFI_USB_BUS_PROTOCOL_GUID \\r
- { 0x2B2F68CC, 0x0CD2, 0x44cf, { 0x8E, 0x8B, 0xBB, 0xA2, 0x0B, 0x1B, 0x5B, 0x75 } }\r
-\r
-typedef struct _EFI_USB_BUS_PROTOCOL {\r
- UINT64 Reserved;\r
-} EFI_USB_BUS_PROTOCOL;\r
-\r
-#define USB_BUS_DEVICE_SIGNATURE EFI_SIGNATURE_32 ('u', 'b', 'u', 's')\r
-\r
-typedef struct _usb_bus_controller_device {\r
- UINTN Signature;\r
-\r
- EFI_USB_BUS_PROTOCOL BusIdentify;\r
- EFI_USB2_HC_PROTOCOL *Usb2HCInterface;\r
- EFI_USB_HC_PROTOCOL *UsbHCInterface;\r
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
- UINT8 AddressPool[16];\r
- USB_IO_DEVICE *Root;\r
- BOOLEAN Hc2ProtocolSupported;\r
-} USB_BUS_CONTROLLER_DEVICE;\r
-\r
-#define USB_BUS_CONTROLLER_DEVICE_FROM_THIS(a) \\r
- CR(a, USB_BUS_CONTROLLER_DEVICE, BusIdentify, USB_BUS_DEVICE_SIGNATURE)\r
-\r
-\r
-//\r
-// Global Variables\r
-//\r
-extern EFI_DRIVER_BINDING_PROTOCOL gUsbBusDriverBinding;\r
-extern EFI_COMPONENT_NAME_PROTOCOL gUsbBusComponentName;\r
-\r
-//\r
-// EFI_DRIVER_BINDING_PROTOCOL Protocol Interface\r
-//\r
-EFI_STATUS\r
-EFIAPI\r
-UsbBusControllerDriverSupported (\r
- IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
- IN EFI_HANDLE Controller,\r
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
- );\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-UsbBusControllerDriverStart (\r
- IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
- IN EFI_HANDLE Controller,\r
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
- );\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-UsbBusControllerDriverStop (\r
- IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
- IN EFI_HANDLE Controller,\r
- IN UINTN NumberOfChildren,\r
- IN EFI_HANDLE *ChildHandleBuffer\r
- );\r
-\r
-//\r
-// EFI Component Name Functions\r
-//\r
-EFI_STATUS\r
-EFIAPI\r
-UsbBusComponentNameGetDriverName (\r
- IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
- IN CHAR8 *Language,\r
- OUT CHAR16 **DriverName\r
- );\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-UsbBusComponentNameGetControllerName (\r
- IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
- IN EFI_HANDLE ControllerHandle,\r
- IN EFI_HANDLE ChildHandle, OPTIONAL\r
- IN CHAR8 *Language,\r
- OUT CHAR16 **ControllerName\r
- );\r
-\r
-//\r
-// Usb Device Configuration functions\r
-//\r
-BOOLEAN\r
-IsHub (\r
- IN USB_IO_CONTROLLER_DEVICE *Dev\r
- )\r
-/*++\r
- \r
- Routine Description:\r
- Tell if a usb controller is a hub controller.\r
- \r
- Arguments:\r
- Dev - UsbIoController device structure.\r
- \r
- Returns:\r
- TRUE/FALSE\r
---*/\r
-;\r
-\r
-EFI_STATUS\r
-UsbGetStringtable (\r
- IN USB_IO_DEVICE *UsbIoDevice\r
- )\r
-/*++\r
- \r
- Routine Description:\r
- Get the string table stored in a usb device.\r
- \r
- Arguments:\r
- Dev - UsbIoController device structure.\r
- \r
- Returns:\r
- EFI_SUCCESS\r
- EFI_UNSUPPORTED\r
- EFI_OUT_OF_RESOURCES\r
- \r
---*/\r
-;\r
-\r
-EFI_STATUS\r
-UsbGetAllConfigurations (\r
- IN USB_IO_DEVICE *UsbIoDevice\r
- )\r
-/*++\r
-\r
- Routine Description:\r
- This function is to parse all the configuration descriptor.\r
- \r
- Arguments:\r
- UsbIoDevice - USB_IO_DEVICE device structure.\r
- \r
- Returns:\r
- EFI_SUCCESS\r
- EFI_DEVICE_ERROR\r
- EFI_OUT_OF_RESOURCES \r
-\r
---*/\r
-;\r
-\r
-EFI_STATUS\r
-UsbSetConfiguration (\r
- IN USB_IO_DEVICE *Dev,\r
- IN UINTN ConfigurationValue\r
- )\r
-/*++\r
-\r
- Routine Description:\r
- Set the device to a configuration value.\r
- \r
- Arguments:\r
- UsbIoDev - USB_IO_DEVICE to be set configuration\r
- ConfigrationValue - The configuration value to be set to that device\r
- \r
- Returns:\r
- EFI_SUCCESS\r
- EFI_DEVICE_ERROR\r
- \r
---*/\r
-;\r
-\r
-EFI_STATUS\r
-UsbSetDefaultConfiguration (\r
- IN USB_IO_DEVICE *Dev\r
- )\r
-/*++\r
-\r
- Routine Description:\r
- Set the device to a default configuration value.\r
- \r
- Arguments:\r
- UsbIoDev - USB_IO_DEVICE to be set configuration\r
- \r
- Returns\r
- EFI_SUCCESS\r
- EFI_DEVICE_ERROR\r
- \r
---*/\r
-;\r
-\r
-//\r
-// Device Deconfiguration functions\r
-//\r
-VOID\r
-UsbDestroyAllConfiguration (\r
- IN USB_IO_DEVICE *UsbIoDevice\r
- )\r
-/*++\r
-\r
- Routine Description:\r
- Delete all configuration data when device is not used.\r
- \r
- Arguments:\r
- UsbIoDevice - USB_IO_DEVICE to be set configuration\r
- \r
- Returns:\r
- VOID\r
- \r
---*/\r
-;\r
-\r
-EFI_STATUS\r
-DoHubConfig (\r
- IN USB_IO_CONTROLLER_DEVICE *HubIoDevice\r
- )\r
-/*++\r
- \r
- Routine Description:\r
- Configure the hub\r
- \r
- Arguments:\r
- HubController - Indicating the hub controller device that\r
- will be configured\r
- \r
- Returns:\r
- EFI_SUCCESS\r
- EFI_DEVICE_ERROR\r
- \r
---*/\r
-\r
-;\r
-\r
-VOID\r
-GetDeviceEndPointMaxPacketLength (\r
- IN EFI_USB_IO_PROTOCOL *UsbIo,\r
- IN UINT8 EndpointAddr,\r
- OUT UINTN *MaxPacketLength\r
- )\r
-/*++\r
-\r
- Routine Description:\r
- Get the Max Packet Length of the speified Endpoint.\r
-\r
- Arguments:\r
- UsbIo - Given Usb Controller device.\r
- EndpointAddr - Given Endpoint address.\r
- MaxPacketLength - The max packet length of that endpoint\r
-\r
- Returns:\r
- N/A\r
-\r
---*/\r
-;\r
-\r
-VOID\r
-GetDataToggleBit (\r
- IN EFI_USB_IO_PROTOCOL *UsbIo,\r
- IN UINT8 EndpointAddr,\r
- OUT UINT8 *DataToggle\r
- )\r
-/*++\r
-\r
- Routine Description:\r
- Get the datatoggle of a specified endpoint.\r
-\r
- Arguments:\r
- UsbIo - Given Usb Controller device.\r
- EndpointAddr - Given Endpoint address.\r
- DataToggle - The current data toggle of that endpoint\r
-\r
- Returns:\r
- VOID\r
- \r
---*/\r
-;\r
-\r
-VOID\r
-SetDataToggleBit (\r
- IN EFI_USB_IO_PROTOCOL *UsbIo,\r
- IN UINT8 EndpointAddr,\r
- IN UINT8 DataToggle\r
- )\r
-/*++\r
-\r
- Routine Description:\r
- Set the datatoggle of a specified endpoint\r
-\r
- Arguments:\r
- UsbIo - Given Usb Controller device.\r
- EndpointAddr - Given Endpoint address.\r
- DataToggle - The current data toggle of that endpoint to be set\r
-\r
- Returns:\r
- VOID\r
-\r
---*/\r
-;\r
-\r
-INTERFACE_DESC_LIST_ENTRY *\r
-FindInterfaceListEntry (\r
- IN EFI_USB_IO_PROTOCOL *This\r
- )\r
-/*++\r
-\r
- Routine Description:\r
- Find Interface ListEntry.\r
-\r
- Arguments:\r
- This - EFI_USB_IO_PROTOCOL \r
- \r
- Returns:\r
- INTERFACE_DESC_LIST_ENTRY pointer\r
-\r
---*/\r
-;\r
-\r
-ENDPOINT_DESC_LIST_ENTRY *\r
-FindEndPointListEntry (\r
- IN EFI_USB_IO_PROTOCOL *This,\r
- IN UINT8 EndPointAddress\r
- )\r
-/*++\r
-\r
- Routine Description:\r
- Find EndPoint ListEntry.\r
-\r
- Arguments:\r
- This - EFI_USB_IO_PROTOCOL \r
- EndpointAddr - Endpoint address.\r
- \r
- Returns:\r
- ENDPOINT_DESC_LIST_ENTRY pointer\r
-\r
---*/\r
-;\r
-\r
-EFI_STATUS\r
-IsDeviceDisconnected (\r
- IN USB_IO_CONTROLLER_DEVICE *UsbIoController,\r
- IN OUT BOOLEAN *Disconnected\r
- )\r
-/*++\r
-\r
- Routine Description:\r
- Reset if the device is disconencted or not\r
-\r
- Arguments:\r
- UsbIoController - Indicating the Usb Controller Device.\r
- Disconnected - Indicate whether the device is disconencted or not\r
-\r
- Returns:\r
- EFI_SUCCESS\r
- EFI_DEVICE_ERROR\r
-\r
---*/\r
-;\r
-\r
-EFI_STATUS\r
-UsbDeviceDeConfiguration (\r
- IN USB_IO_DEVICE *UsbIoDevice\r
- )\r
-/*++\r
-\r
- Routine Description:\r
- Remove Device, Device Handles, Uninstall Protocols.\r
-\r
- Arguments:\r
- UsbIoDevice - The device to be deconfigured.\r
-\r
- Returns: \r
- EFI_SUCCESS\r
- EFI_DEVICE_ERROR\r
-\r
---*/\r
-;\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-UsbVirtualHcGetCapability (\r
- IN USB_BUS_CONTROLLER_DEVICE *UsbBusDev,\r
- OUT UINT8 *MaxSpeed,\r
- OUT UINT8 *PortNumber,\r
- OUT UINT8 *Is64BitCapable\r
- )\r
-/*++\r
- \r
- Routine Description:\r
- \r
- Virtual interface to Retrieves the capablility of root hub ports \r
- for both Hc2 and Hc protocol.\r
- \r
- Arguments:\r
- \r
- UsbBusDev - A pointer to bus controller of the device.\r
- MaxSpeed - A pointer to the number of the host controller.\r
- PortNumber - A pointer to the number of the root hub ports.\r
- Is64BitCapable - A pointer to the flag for whether controller supports \r
- 64-bit memory addressing.\r
- \r
- Returns:\r
- \r
- EFI_SUCCESS \r
- The host controller capability were retrieved successfully.\r
- EFI_INVALID_PARAMETER \r
- MaxSpeed or PortNumber or Is64BitCapable is NULL.\r
- EFI_DEVICE_ERROR \r
- An error was encountered while attempting to retrieve the capabilities. \r
- \r
---*/\r
-;\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-UsbVirtualHcReset (\r
- IN USB_BUS_CONTROLLER_DEVICE *UsbBusDev,\r
- IN UINT16 Attributes\r
- )\r
-/*++\r
- \r
- Routine Description:\r
- \r
- Virtual interface to provides software reset for the USB host controller\r
- for both Hc2 and Hc protocol.\r
- \r
- Arguments:\r
- \r
- UsbBusDev - A pointer to bus controller of the device.\r
- Attributes - A bit mask of the reset operation to perform. \r
- See below for a list of the supported bit mask values.\r
- \r
- #define EFI_USB_HC_RESET_GLOBAL 0x0001 // Hc2 and Hc\r
- #define EFI_USB_HC_RESET_HOST_CONTROLLER 0x0002 // Hc2 and Hc\r
- #define EFI_USB_HC_RESET_GLOBAL_WITH_DEBUG 0x0004 // Hc2\r
- #define EFI_USB_HC_RESET_HOST_WITH_DEBUG 0x0008 // Hc2\r
-\r
- EFI_USB_HC_RESET_GLOBAL \r
- If this bit is set, a global reset signal will be sent to the USB bus.\r
- This resets all of the USB bus logic, including the USB host \r
- controller hardware and all the devices attached on the USB bus.\r
- EFI_USB_HC_RESET_HOST_CONTROLLER \r
- If this bit is set, the USB host controller hardware will be reset. \r
- No reset signal will be sent to the USB bus.\r
- EFI_USB_HC_RESET_GLOBAL_WITH_DEBUG\r
- If this bit is set, a global reset signal will be sent to the USB bus.\r
- This resets all of the USB bus logic, including the USB host \r
- controller hardware and all the devices attached on the USB bus. \r
- If this is an EHCI controller and the debug port has configured, then \r
- this is will still reset the host controller.\r
- EFI_USB_HC_RESET_HOST_WITH_DEBUG\r
- If this bit is set, the USB host controller hardware will be reset. \r
- If this is an EHCI controller and the debug port has been configured,\r
- then this will still reset the host controller.\r
- \r
- Returns:\r
- \r
- EFI_SUCCESS \r
- The reset operation succeeded.\r
- EFI_INVALID_PARAMETER \r
- Attributes is not valid.\r
- EFI_UNSUPPOURTED\r
- The type of reset specified by Attributes is not currently supported by\r
- the host controller hardware.\r
- EFI_ACCESS_DENIED\r
- Reset operation is rejected due to the debug port being configured and \r
- active; only EFI_USB_HC_RESET_GLOBAL_WITH_DEBUG or \r
- EFI_USB_HC_RESET_HOST_WITH_DEBUG reset Atrributes can be used to\r
- perform reset operation for this host controller.\r
- EFI_DEVICE_ERROR \r
- An error was encountered while attempting to perform \r
- the reset operation.\r
- \r
---*/\r
-;\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-UsbVirtualHcGetState (\r
- IN USB_BUS_CONTROLLER_DEVICE *UsbBusDev,\r
- OUT EFI_USB_HC_STATE *State\r
- )\r
-/*++\r
- \r
- Routine Description:\r
- \r
- Virtual interface to retrieves current state of the USB host controller\r
- for both Hc2 and Hc protocol.\r
- \r
- Arguments:\r
- \r
- UsbBusDev - A pointer to bus controller of the device.\r
- State - A pointer to the EFI_USB_HC_STATE data structure that \r
- indicates current state of the USB host controller. \r
- Type EFI_USB_HC_STATE is defined below.\r
- \r
- typedef enum {\r
- EfiUsbHcStateHalt,\r
- EfiUsbHcStateOperational,\r
- EfiUsbHcStateSuspend,\r
- EfiUsbHcStateMaximum\r
- } EFI_USB_HC_STATE;\r
- \r
- Returns:\r
- \r
- EFI_SUCCESS \r
- The state information of the host controller was returned in State.\r
- EFI_INVALID_PARAMETER \r
- State is NULL.\r
- EFI_DEVICE_ERROR \r
- An error was encountered while attempting to retrieve the \r
- host controller's current state. \r
- \r
---*/\r
-;\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-UsbVirtualHcSetState (\r
- IN USB_BUS_CONTROLLER_DEVICE *UsbBusDev,\r
- IN EFI_USB_HC_STATE State\r
- )\r
-/*++\r
- \r
- Routine Description:\r
- \r
- Virtual interface to sets the USB host controller to a specific state\r
- for both Hc2 and Hc protocol.\r
- \r
- Arguments:\r
- \r
- UsbBusDev - A pointer to bus controller of the device.\r
- State - Indicates the state of the host controller that will be set.\r
- \r
- Returns:\r
- \r
- EFI_SUCCESS \r
- The USB host controller was successfully placed in the state \r
- specified by State.\r
- EFI_INVALID_PARAMETER \r
- State is invalid.\r
- EFI_DEVICE_ERROR \r
- Failed to set the state specified by State due to device error. \r
- \r
---*/\r
-;\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-UsbVirtualHcGetRootHubPortStatus (\r
- IN USB_BUS_CONTROLLER_DEVICE *UsbBusDev,\r
- IN UINT8 PortNumber,\r
- OUT EFI_USB_PORT_STATUS *PortStatus\r
- )\r
-/*++\r
- \r
- Routine Description:\r
- \r
- Virtual interface to retrieves the current status of a USB root hub port\r
- both for Hc2 and Hc protocol.\r
- \r
- Arguments:\r
- \r
- UsbBusDev - A pointer to bus controller of the device.\r
- PortNumber - Specifies the root hub port from which the status \r
- is to be retrieved. This value is zero-based. For example, \r
- if a root hub has two ports, then the first port is numbered 0,\r
- and the second port is numbered 1.\r
- PortStatus - A pointer to the current port status bits and \r
- port status change bits. \r
- \r
- Returns:\r
- \r
- EFI_SUCCESS The status of the USB root hub port specified by PortNumber \r
- was returned in PortStatus.\r
- EFI_INVALID_PARAMETER PortNumber is invalid. \r
- EFI_DEVICE_ERROR Can't read register \r
- \r
---*/\r
-;\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-UsbVirtualHcSetRootHubPortFeature (\r
- IN USB_BUS_CONTROLLER_DEVICE *UsbBusDev,\r
- IN UINT8 PortNumber,\r
- IN EFI_USB_PORT_FEATURE PortFeature\r
- )\r
-/*++\r
- \r
- Routine Description:\r
- Virual interface to sets a feature for the specified root hub port\r
- for both Hc2 and Hc protocol.\r
- \r
- Arguments:\r
- \r
- UsbBusDev - A pointer to bus controller of the device.\r
- PortNumber - Specifies the root hub port whose feature \r
- is requested to be set.\r
- PortFeature - Indicates the feature selector associated \r
- with the feature set request. \r
- \r
- Returns:\r
- \r
- EFI_SUCCESS \r
- The feature specified by PortFeature was set for the \r
- USB root hub port specified by PortNumber.\r
- EFI_INVALID_PARAMETER \r
- PortNumber is invalid or PortFeature is invalid.\r
- EFI_DEVICE_ERROR\r
- Can't read register\r
- \r
---*/\r
-;\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-UsbVirtualHcClearRootHubPortFeature (\r
- IN USB_BUS_CONTROLLER_DEVICE *UsbBusDev,\r
- IN UINT8 PortNumber,\r
- IN EFI_USB_PORT_FEATURE PortFeature\r
- )\r
-/*++\r
- \r
- Routine Description:\r
- \r
- Virtual interface to clears a feature for the specified root hub port\r
- for both Hc2 and Hc protocol.\r
- \r
- Arguments:\r
- \r
- UsbBusDev - A pointer to bus controller of the device.\r
- PortNumber - Specifies the root hub port whose feature \r
- is requested to be cleared.\r
- PortFeature - Indicates the feature selector associated with the \r
- feature clear request.\r
- \r
- Returns:\r
- \r
- EFI_SUCCESS \r
- The feature specified by PortFeature was cleared for the \r
- USB root hub port specified by PortNumber.\r
- EFI_INVALID_PARAMETER \r
- PortNumber is invalid or PortFeature is invalid.\r
- EFI_DEVICE_ERROR\r
- Can't read register\r
- \r
---*/\r
-;\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-UsbVirtualHcControlTransfer (\r
- IN USB_BUS_CONTROLLER_DEVICE *UsbBusDev,\r
- IN UINT8 DeviceAddress,\r
- IN UINT8 DeviceSpeed,\r
- IN UINTN MaximumPacketLength,\r
- IN EFI_USB_DEVICE_REQUEST *Request,\r
- IN EFI_USB_DATA_DIRECTION TransferDirection,\r
- IN OUT VOID *Data,\r
- IN OUT UINTN *DataLength,\r
- IN UINTN TimeOut,\r
- IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,\r
- OUT UINT32 *TransferResult\r
- )\r
-/*++\r
- \r
- Routine Description:\r
- \r
- Virtual interface to submits control transfer to a target USB device\r
- for both Hc2 and Hc protocol.\r
- \r
- Arguments:\r
- \r
- UsbBusDev - A pointer to bus controller of the device.\r
- DeviceAddress - Represents the address of the target device on the USB,\r
- which is assigned during USB enumeration.\r
- DeviceSpeed - Indicates target device speed.\r
- MaximumPacketLength - Indicates the maximum packet size that the \r
- default control transfer endpoint is capable of \r
- sending or receiving.\r
- Request - A pointer to the USB device request that will be sent \r
- to the USB device. \r
- TransferDirection - Specifies the data direction for the transfer.\r
- There are three values available, DataIn, DataOut \r
- and NoData.\r
- Data - A pointer to the buffer of data that will be transmitted \r
- to USB device or received from USB device.\r
- DataLength - Indicates the size, in bytes, of the data buffer \r
- specified by Data.\r
- TimeOut - Indicates the maximum time, in microseconds, \r
- which the transfer is allowed to complete.\r
- Translator - A pointr to the transaction translator data.\r
- TransferResult - A pointer to the detailed result information generated \r
- by this control transfer.\r
- \r
- Returns:\r
- \r
- EFI_SUCCESS \r
- The control transfer was completed successfully.\r
- EFI_OUT_OF_RESOURCES \r
- The control transfer could not be completed due to a lack of resources.\r
- EFI_INVALID_PARAMETER \r
- Some parameters are invalid.\r
- EFI_TIMEOUT \r
- The control transfer failed due to timeout.\r
- EFI_DEVICE_ERROR \r
- The control transfer failed due to host controller or device error. \r
- Caller should check TranferResult for detailed error information.\r
-\r
---*/\r
-;\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-UsbVirtualHcBulkTransfer (\r
- IN USB_BUS_CONTROLLER_DEVICE *UsbBusDev,\r
- IN UINT8 DeviceAddress,\r
- IN UINT8 EndPointAddress,\r
- IN UINT8 DeviceSpeed,\r
- IN UINTN MaximumPacketLength,\r
- IN UINT8 DataBuffersNumber,\r
- IN OUT VOID *Data[EFI_USB_MAX_BULK_BUFFER_NUM],\r
- IN OUT UINTN *DataLength,\r
- IN OUT UINT8 *DataToggle,\r
- IN UINTN TimeOut,\r
- IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,\r
- OUT UINT32 *TransferResult\r
- )\r
-/*++\r
- \r
- Routine Description:\r
- \r
- Virtual interface to submits bulk transfer to a bulk endpoint of a USB device\r
- both for Hc2 and Hc protocol.\r
- \r
- Arguments:\r
- \r
- UsbBusDev - A pointer to bus controller of the device.\r
- DeviceAddress - Represents the address of the target device on the USB,\r
- which is assigned during USB enumeration. \r
- EndPointAddress - The combination of an endpoint number and an \r
- endpoint direction of the target USB device. \r
- Each endpoint address supports data transfer in \r
- one direction except the control endpoint \r
- (whose default endpoint address is 0). \r
- It is the caller's responsibility to make sure that \r
- the EndPointAddress represents a bulk endpoint. \r
- DeviceSpeed - Indicates device speed. The supported values are EFI_USB_SPEED_FULL\r
- and EFI_USB_SPEED_HIGH.\r
- MaximumPacketLength - Indicates the maximum packet size the target endpoint\r
- is capable of sending or receiving. \r
- DataBuffersNumber - Number of data buffers prepared for the transfer.\r
- Data - Array of pointers to the buffers of data that will be transmitted \r
- to USB device or received from USB device. \r
- DataLength - When input, indicates the size, in bytes, of the data buffer\r
- specified by Data. When output, indicates the actually \r
- transferred data size. \r
- DataToggle - A pointer to the data toggle value. On input, it indicates \r
- the initial data toggle value the bulk transfer should adopt;\r
- on output, it is updated to indicate the data toggle value \r
- of the subsequent bulk transfer. \r
- Translator - A pointr to the transaction translator data. \r
- TimeOut - Indicates the maximum time, in microseconds, which the \r
- transfer is allowed to complete. \r
- TransferResult - A pointer to the detailed result information of the \r
- bulk transfer.\r
-\r
- Returns:\r
- \r
- EFI_SUCCESS \r
- The bulk transfer was completed successfully.\r
- EFI_OUT_OF_RESOURCES \r
- The bulk transfer could not be submitted due to lack of resource.\r
- EFI_INVALID_PARAMETER \r
- Some parameters are invalid.\r
- EFI_TIMEOUT \r
- The bulk transfer failed due to timeout.\r
- EFI_DEVICE_ERROR \r
- The bulk transfer failed due to host controller or device error.\r
- Caller should check TranferResult for detailed error information.\r
-\r
---*/\r
-;\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-UsbVirtualHcAsyncInterruptTransfer (\r
- IN USB_BUS_CONTROLLER_DEVICE * UsbBusDev,\r
- IN UINT8 DeviceAddress,\r
- IN UINT8 EndPointAddress,\r
- IN UINT8 DeviceSpeed,\r
- IN UINTN MaximumPacketLength,\r
- IN BOOLEAN IsNewTransfer,\r
- IN OUT UINT8 *DataToggle,\r
- IN UINTN PollingInterval,\r
- IN UINTN DataLength,\r
- IN EFI_USB2_HC_TRANSACTION_TRANSLATOR * Translator,\r
- IN EFI_ASYNC_USB_TRANSFER_CALLBACK CallBackFunction,\r
- IN VOID *Context OPTIONAL\r
- )\r
-/*++\r
- \r
- Routine Description:\r
- \r
- Virtual interface to submits an asynchronous interrupt transfer to an \r
- interrupt endpoint of a USB device for both Hc2 and Hc protocol.\r
- \r
- Arguments:\r
- \r
- UsbBusDev - A pointer to bus controller of the device.\r
- DeviceAddress - Represents the address of the target device on the USB,\r
- which is assigned during USB enumeration. \r
- EndPointAddress - The combination of an endpoint number and an endpoint \r
- direction of the target USB device. Each endpoint address \r
- supports data transfer in one direction except the \r
- control endpoint (whose default endpoint address is 0). \r
- It is the caller's responsibility to make sure that \r
- the EndPointAddress represents an interrupt endpoint. \r
- DeviceSpeed - Indicates device speed.\r
- MaximumPacketLength - Indicates the maximum packet size the target endpoint\r
- is capable of sending or receiving. \r
- IsNewTransfer - If TRUE, an asynchronous interrupt pipe is built between\r
- the host and the target interrupt endpoint. \r
- If FALSE, the specified asynchronous interrupt pipe \r
- is canceled. \r
- DataToggle - A pointer to the data toggle value. On input, it is valid \r
- when IsNewTransfer is TRUE, and it indicates the initial \r
- data toggle value the asynchronous interrupt transfer \r
- should adopt. \r
- On output, it is valid when IsNewTransfer is FALSE, \r
- and it is updated to indicate the data toggle value of \r
- the subsequent asynchronous interrupt transfer. \r
- PollingInterval - Indicates the interval, in milliseconds, that the \r
- asynchronous interrupt transfer is polled. \r
- This parameter is required when IsNewTransfer is TRUE. \r
- DataLength - Indicates the length of data to be received at the \r
- rate specified by PollingInterval from the target \r
- asynchronous interrupt endpoint. This parameter \r
- is only required when IsNewTransfer is TRUE. \r
- Translator - A pointr to the transaction translator data.\r
- CallBackFunction - The Callback function.This function is called at the \r
- rate specified by PollingInterval.This parameter is \r
- only required when IsNewTransfer is TRUE. \r
- Context - The context that is passed to the CallBackFunction.\r
- - This is an optional parameter and may be NULL.\r
- \r
- Returns:\r
- \r
- EFI_SUCCESS \r
- The asynchronous interrupt transfer request has been successfully \r
- submitted or canceled.\r
- EFI_INVALID_PARAMETER \r
- Some parameters are invalid.\r
- EFI_OUT_OF_RESOURCES \r
- The request could not be completed due to a lack of resources. \r
- EFI_DEVICE_ERROR\r
- Can't read register\r
- \r
---*/\r
-;\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-UsbVirtualHcSyncInterruptTransfer (\r
- IN USB_BUS_CONTROLLER_DEVICE *UsbBusDev,\r
- IN UINT8 DeviceAddress,\r
- IN UINT8 EndPointAddress,\r
- IN UINT8 DeviceSpeed,\r
- IN UINTN MaximumPacketLength,\r
- IN OUT VOID *Data,\r
- IN OUT UINTN *DataLength,\r
- IN OUT UINT8 *DataToggle,\r
- IN UINTN TimeOut,\r
- IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,\r
- OUT UINT32 *TransferResult\r
- )\r
-/*++\r
- \r
- Routine Description:\r
- \r
- Vitual interface to submits synchronous interrupt transfer to an interrupt endpoint \r
- of a USB device for both Hc2 and Hc protocol.\r
- \r
- Arguments:\r
- \r
- UsbBusDev - A pointer to bus controller of the device.\r
- DeviceAddress - Represents the address of the target device on the USB, \r
- which is assigned during USB enumeration.\r
- EndPointAddress - The combination of an endpoint number and an endpoint \r
- direction of the target USB device. Each endpoint \r
- address supports data transfer in one direction \r
- except the control endpoint (whose default \r
- endpoint address is 0). It is the caller's responsibility\r
- to make sure that the EndPointAddress represents \r
- an interrupt endpoint. \r
- DeviceSpeed - Indicates device speed.\r
- MaximumPacketLength - Indicates the maximum packet size the target endpoint \r
- is capable of sending or receiving.\r
- Data - A pointer to the buffer of data that will be transmitted \r
- to USB device or received from USB device.\r
- DataLength - On input, the size, in bytes, of the data buffer specified \r
- by Data. On output, the number of bytes transferred.\r
- DataToggle - A pointer to the data toggle value. On input, it indicates\r
- the initial data toggle value the synchronous interrupt \r
- transfer should adopt; \r
- on output, it is updated to indicate the data toggle value \r
- of the subsequent synchronous interrupt transfer. \r
- TimeOut - Indicates the maximum time, in microseconds, which the \r
- transfer is allowed to complete.\r
- Translator - A pointr to the transaction translator data.\r
- TransferResult - A pointer to the detailed result information from \r
- the synchronous interrupt transfer. \r
-\r
- Returns:\r
- \r
- EFI_SUCCESS \r
- The synchronous interrupt transfer was completed successfully.\r
- EFI_OUT_OF_RESOURCES \r
- The synchronous interrupt transfer could not be submitted due \r
- to lack of resource.\r
- EFI_INVALID_PARAMETER \r
- Some parameters are invalid.\r
- EFI_TIMEOUT \r
- The synchronous interrupt transfer failed due to timeout.\r
- EFI_DEVICE_ERROR \r
- The synchronous interrupt transfer failed due to host controller \r
- or device error. Caller should check TranferResult for detailed \r
- error information. \r
- \r
---*/\r
-;\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-UsbVirtualHcIsochronousTransfer (\r
- IN USB_BUS_CONTROLLER_DEVICE *UsbBusDev,\r
- IN UINT8 DeviceAddress,\r
- IN UINT8 EndPointAddress,\r
- IN UINT8 DeviceSpeed,\r
- IN UINTN MaximumPacketLength,\r
- IN UINT8 DataBuffersNumber,\r
- IN OUT VOID *Data[EFI_USB_MAX_ISO_BUFFER_NUM],\r
- IN UINTN DataLength,\r
- IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,\r
- OUT UINT32 *TransferResult\r
- )\r
-/*++\r
- \r
- Routine Description:\r
- \r
- Virtual interface to submits isochronous transfer to a target USB device\r
- for both Hc2 and Hc protocol.\r
- \r
- Arguments:\r
- \r
- UsbBusDev - A pointer to bus controller of the device.\r
- DeviceAddress - Represents the address of the target device on the USB,\r
- which is assigned during USB enumeration.\r
- EndPointAddress - End point address\r
- DeviceSpeed - Indicates device speed.\r
- MaximumPacketLength - Indicates the maximum packet size that the \r
- default control transfer endpoint is capable of \r
- sending or receiving.\r
- DataBuffersNumber - Number of data buffers prepared for the transfer.\r
- Data - Array of pointers to the buffers of data that will be \r
- transmitted to USB device or received from USB device.\r
- DataLength - Indicates the size, in bytes, of the data buffer \r
- specified by Data.\r
- Translator - A pointr to the transaction translator data.\r
- TransferResult - A pointer to the detailed result information generated \r
- by this control transfer. \r
- \r
- Returns:\r
- \r
- EFI_UNSUPPORTED \r
-\r
---*/\r
-;\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-UsbVirtualHcAsyncIsochronousTransfer (\r
- IN USB_BUS_CONTROLLER_DEVICE *UsbBusDev,\r
- IN UINT8 DeviceAddress,\r
- IN UINT8 EndPointAddress,\r
- IN UINT8 DeviceSpeed,\r
- IN UINTN MaximumPacketLength,\r
- IN UINT8 DataBuffersNumber,\r
- IN OUT VOID *Data[EFI_USB_MAX_ISO_BUFFER_NUM],\r
- IN UINTN DataLength,\r
- IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,\r
- IN EFI_ASYNC_USB_TRANSFER_CALLBACK IsochronousCallBack,\r
- IN VOID *Context\r
- )\r
-/*++\r
- \r
- Routine Description:\r
- \r
- Vitual interface to submits Async isochronous transfer to a target USB device\r
- for both Hc2 and Hc protocol.\r
- \r
- Arguments:\r
- \r
- UsbBusDev - A pointer to bus controller of the device.\r
- DeviceAddress - Represents the address of the target device on the USB,\r
- which is assigned during USB enumeration.\r
- EndPointAddress - End point address\r
- DeviceSpeed - Indicates device speed.\r
- MaximumPacketLength - Indicates the maximum packet size that the \r
- default control transfer endpoint is capable of \r
- sending or receiving.\r
- DataBuffersNumber - Number of data buffers prepared for the transfer.\r
- Data - Array of pointers to the buffers of data that will be transmitted \r
- to USB device or received from USB device.\r
- DataLength - Indicates the size, in bytes, of the data buffer \r
- specified by Data.\r
- Translator - A pointr to the transaction translator data.\r
- IsochronousCallBack - When the transfer complete, the call back function will be called\r
- Context - Pass to the call back function as parameter\r
- \r
- Returns:\r
- \r
- EFI_UNSUPPORTED \r
-\r
---*/\r
-;\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-UsbPortReset (\r
- IN EFI_USB_IO_PROTOCOL *This\r
- )\r
-/*++\r
-\r
- Routine Description:\r
- Resets and reconfigures the USB controller. This function will\r
- work for all USB devices except USB Hub Controllers.\r
-\r
- Arguments:\r
- This - Indicates the calling context.\r
-\r
- Returns:\r
- EFI_SUCCESS\r
- EFI_INVALID_PARAMETER\r
- EFI_DEVICE_ERROR\r
-\r
---*/\r
-;\r
-\r
-VOID\r
-InitializeUsbIoInstance (\r
- IN USB_IO_CONTROLLER_DEVICE *UsbIoController\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Initialize the instance of UsbIo controller\r
-\r
-Arguments:\r
-\r
- UsbIoController - A pointer to controller structure of UsbIo\r
-\r
-Returns:\r
-\r
---*/\r
-;\r
-\r
-#endif\r