--- /dev/null
+/** @file\r
+ EFI Usb I/O Protocol\r
+\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: UsbIo.h\r
+\r
+**/\r
+\r
+#ifndef __USB_IO_H__\r
+#define __USB_IO_H__\r
+\r
+//\r
+// Global ID for the USB I/O Protocol\r
+//\r
+#define EFI_USB_IO_PROTOCOL_GUID \\r
+ { \\r
+ 0x2B2F68D6, 0x0CD2, 0x44cf, {0x8E, 0x8B, 0xBB, 0xA2, 0x0B, 0x1B, 0x5B, 0x75 } \\r
+ }\r
+\r
+typedef struct _EFI_USB_IO_PROTOCOL EFI_USB_IO_PROTOCOL;\r
+\r
+/** \r
+ Async USB transfer callback routine.\r
+ \r
+ @param Data Data received or sent via the USB Asynchronous Transfer, if the\r
+ transfer completed successfully. \r
+ @param DataLength The length of Data received or sent via the Asynchronous\r
+ Transfer, if transfer successfully completes. \r
+ @param Context Data passed from UsbAsyncInterruptTransfer() request.\r
+ @param Status Indicates the result of the asynchronous transfer.\r
+ \r
+ @retval EFI_SUCCESS The asynchronous USB transfer request has been successfully executed. \r
+ @retval EFI_DEVICE_ERROR The asynchronous USB transfer request failed.\r
+ \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_ASYNC_USB_TRANSFER_CALLBACK) (\r
+ IN VOID *Data,\r
+ IN UINTN DataLength,\r
+ IN VOID *Context,\r
+ IN UINT32 Status\r
+ );\r
+\r
+//\r
+// Prototype for EFI USB I/O protocol\r
+//\r
+\r
+\r
+/** \r
+ This function is used to manage a USB device with a control transfer pipe. A control transfer is\r
+ typically used to perform device initialization and configuration. \r
+ \r
+ @param This A pointer to the EFI_USB_IO_PROTOCOL instance. \r
+ @param Request A pointer to the USB device request that will be sent to the USB\r
+ device. \r
+ @param Direction Indicates the data direction.\r
+ @param Data A pointer to the buffer of data that will be transmitted to USB\r
+ device or received from USB device. \r
+ @param Timeout Indicating the transfer should be completed within this time frame.\r
+ The units are in milliseconds. \r
+ @param DataLength The size, in bytes, of the data buffer specified by Data.\r
+ @param Status A pointer to the result of the USB transfer.\r
+ \r
+ @retval EFI_SUCCESS The control transfer has been successfully executed.\r
+ @retval EFI_DEVICE_ERROR The transfer failed. The transfer status is returned in Status.\r
+ @retval EFI_INVALID_PARAMETE One or more parameters are invalid.\r
+ @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.\r
+ @retval EFI_TIMEOUT The control transfer fails due to timeout.\r
+ \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_USB_IO_CONTROL_TRANSFER) (\r
+ IN EFI_USB_IO_PROTOCOL *This,\r
+ IN EFI_USB_DEVICE_REQUEST *Request,\r
+ IN EFI_USB_DATA_DIRECTION Direction,\r
+ IN UINT32 Timeout,\r
+ IN OUT VOID *Data OPTIONAL,\r
+ IN UINTN DataLength OPTIONAL,\r
+ OUT UINT32 *Status\r
+ );\r
+\r
+/** \r
+ This function is used to manage a USB device with the bulk transfer pipe. Bulk Transfers are\r
+ typically used to transfer large amounts of data to/from USB devices.\r
+ \r
+ @param This A pointer to the EFI_USB_IO_PROTOCOL instance. \r
+ @param DeviceEndpoint A pointer to the USB device request that will be sent to the USB\r
+ device. \r
+ @param Data A pointer to the buffer of data that will be transmitted to USB\r
+ device or received from USB device. \r
+ @param DataLength The size, in bytes, of the data buffer specified by Data.\r
+ @param Timeout Indicating the transfer should be completed within this time frame.\r
+ The units are in milliseconds. \r
+ @param Status This parameter indicates the USB transfer status.\r
+ \r
+ @retval EFI_SUCCESS The bulk transfer has been successfully executed.\r
+ @retval EFI_DEVICE_ERROR The transfer failed. The transfer status is returned in Status.\r
+ @retval EFI_INVALID_PARAMETE One or more parameters are invalid.\r
+ @retval EFI_OUT_OF_RESOURCES The request could not be submitted due to a lack of resources.\r
+ @retval EFI_TIMEOUT The control transfer fails due to timeout.\r
+ \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_USB_IO_BULK_TRANSFER) (\r
+ IN EFI_USB_IO_PROTOCOL *This,\r
+ IN UINT8 DeviceEndpoint,\r
+ IN OUT VOID *Data,\r
+ IN OUT UINTN *DataLength,\r
+ IN UINTN Timeout,\r
+ OUT UINT32 *Status\r
+ );\r
+\r
+/** \r
+ This function is used to manage a USB device with an interrupt transfer pipe. An Asynchronous \r
+ Interrupt Transfer is typically used to query a device's status at a fixed rate. For example, \r
+ keyboard, mouse, and hub devices use this type of transfer to query their interrupt endpoints at\r
+ a fixed rate. \r
+ \r
+ @param This A pointer to the EFI_USB_IO_PROTOCOL instance. \r
+ @param DeviceEndpoint A pointer to the USB device request that will be sent to the USB\r
+ device. \r
+ @param IsNewTransfer If TRUE, a new transfer will be submitted to USB controller. If \r
+ FALSE, the interrupt transfer is deleted from the device's interrupt\r
+ transfer queue. \r
+ @param PollingInterval Indicates the periodic rate, in milliseconds, that the transfer is to be \r
+ executed. \r
+ @param DataLength Specifies the length, in bytes, of the data to be received from the\r
+ USB device. \r
+ @param Context Data passed to the InterruptCallback function.\r
+ @param InterruptCallback The Callback function. This function is called if the asynchronous\r
+ interrupt transfer is completed.\r
+ \r
+ @retval EFI_SUCCESS The asynchronous USB transfer request transfer has been successfully executed.\r
+ @retval EFI_DEVICE_ERROR The asynchronous USB transfer request failed. \r
+ \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_USB_IO_ASYNC_INTERRUPT_TRANSFER) (\r
+ IN EFI_USB_IO_PROTOCOL *This,\r
+ IN UINT8 DeviceEndpoint,\r
+ IN BOOLEAN IsNewTransfer,\r
+ IN UINTN PollingInterval OPTIONAL,\r
+ IN UINTN DataLength OPTIONAL,\r
+ IN EFI_ASYNC_USB_TRANSFER_CALLBACK InterruptCallBack OPTIONAL,\r
+ IN VOID *Context OPTIONAL\r
+ );\r
+\r
+/** \r
+ This function is used to manage a USB device with an interrupt transfer pipe.\r
+ \r
+ @param This A pointer to the EFI_USB_IO_PROTOCOL instance. \r
+ @param DeviceEndpoint A pointer to the USB device request that will be sent to the USB\r
+ device. \r
+ @param Data A pointer to the buffer of data that will be transmitted to USB\r
+ device or received from USB device. \r
+ @param DataLength On input, then size, in bytes, of the buffer Data. On output, the\r
+ amount of data actually transferred. \r
+ @param Timeout The time out, in seconds, for this transfer.\r
+ @param Status This parameter indicates the USB transfer status. \r
+ \r
+ @retval EFI_SUCCESS The sync interrupt transfer has been successfully executed.\r
+ @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
+ @retval EFI_DEVICE_ERROR The sync interrupt transfer request failed. \r
+ @retval EFI_OUT_OF_RESOURCES The request could not be submitted due to a lack of resources.\r
+ @retval EFI_TIMEOUT The transfer fails due to timeout. \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_USB_IO_SYNC_INTERRUPT_TRANSFER) (\r
+ IN EFI_USB_IO_PROTOCOL *This,\r
+ IN UINT8 DeviceEndpoint,\r
+ IN OUT VOID *Data,\r
+ IN OUT UINTN *DataLength,\r
+ IN UINTN Timeout,\r
+ OUT UINT32 *Status\r
+ );\r
+\r
+/** \r
+ This function is used to manage a USB device with an isochronous transfer pipe. An Isochronous\r
+ transfer is typically used to transfer streaming data.\r
+ \r
+ @param This A pointer to the EFI_USB_IO_PROTOCOL instance. \r
+ @param DeviceEndpoint A pointer to the USB device request that will be sent to the USB\r
+ device. \r
+ @param Data A pointer to the buffer of data that will be transmitted to USB\r
+ device or received from USB device. \r
+ @param DataLength The size, in bytes, of the data buffer specified by Data. \r
+ @param Status This parameter indicates the USB transfer status. \r
+ \r
+ @retval EFI_SUCCESS The isochronous transfer has been successfully executed.\r
+ @retval EFI_INVALID_PARAMETER The parameter DeviceEndpoint is not valid.\r
+ @retval EFI_DEVICE_ERROR The transfer failed due to the reason other than timeout, The error status\r
+ is returned in Status. \r
+ @retval EFI_OUT_OF_RESOURCES The request could not be submitted due to a lack of resources.\r
+ @retval EFI_TIMEOUT The transfer fails due to timeout. \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_USB_IO_ISOCHRONOUS_TRANSFER) (\r
+ IN EFI_USB_IO_PROTOCOL *This,\r
+ IN UINT8 DeviceEndpoint,\r
+ IN OUT VOID *Data,\r
+ IN UINTN DataLength,\r
+ OUT UINT32 *Status\r
+ );\r
+\r
+/** \r
+ This function is used to manage a USB device with an isochronous transfer pipe. An Isochronous\r
+ transfer is typically used to transfer streaming data. \r
+ \r
+ @param This A pointer to the EFI_USB_IO_PROTOCOL instance. \r
+ @param DeviceEndpoint A pointer to the USB device request that will be sent to the USB\r
+ device. \r
+ @param Data A pointer to the buffer of data that will be transmitted to USB\r
+ device or received from USB device. \r
+ @param DataLength The size, in bytes, of the data buffer specified by Data. \r
+ @param Context Data passed to the IsochronousCallback() function.\r
+ @param IsochronousCallback The IsochronousCallback() function.\r
+ \r
+ @retval EFI_SUCCESS The asynchronous isochronous transfer has been successfully submitted\r
+ to the system.\r
+ @retval EFI_INVALID_PARAMETER The parameter DeviceEndpoint is not valid.\r
+ @retval EFI_OUT_OF_RESOURCES The request could not be submitted due to a lack of resources.\r
+ \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_USB_IO_ASYNC_ISOCHRONOUS_TRANSFER) (\r
+ IN EFI_USB_IO_PROTOCOL *This,\r
+ IN UINT8 DeviceEndpoint,\r
+ IN OUT VOID *Data,\r
+ IN UINTN DataLength,\r
+ IN EFI_ASYNC_USB_TRANSFER_CALLBACK IsochronousCallBack,\r
+ IN VOID *Context OPTIONAL\r
+ );\r
+\r
+/** \r
+ Resets and reconfigures the USB controller. This function will work for all USB devices except\r
+ USB Hub Controllers. \r
+ \r
+ @param This A pointer to the EFI_USB_IO_PROTOCOL instance. \r
+ \r
+ @retval EFI_SUCCESS The USB controller was reset. \r
+ @retval EFI_INVALID_PARAMETER If the controller specified by This is a USB hub.\r
+ @retval EFI_DEVICE_ERROR An error occurred during the reconfiguration process.\r
+ \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_USB_IO_PORT_RESET) (\r
+ IN EFI_USB_IO_PROTOCOL *This\r
+ );\r
+\r
+/** \r
+ Retrieves the USB Device Descriptor.\r
+ \r
+ @param This A pointer to the EFI_USB_IO_PROTOCOL instance. \r
+ @param DeviceDescriptor A pointer to the caller allocated USB Device Descriptor.\r
+ \r
+ @retval EFI_SUCCESS The device descriptor was retrieved successfully.\r
+ @retval EFI_INVALID_PARAMETER DeviceDescriptor is NULL.\r
+ @retval EFI_NOT_FOUND The device descriptor was not found. The device may not be configured.\r
+ \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_USB_IO_GET_DEVICE_DESCRIPTOR) (\r
+ IN EFI_USB_IO_PROTOCOL *This,\r
+ OUT EFI_USB_DEVICE_DESCRIPTOR *DeviceDescriptor\r
+ );\r
+\r
+/** \r
+ Retrieves the USB Device Descriptor.\r
+ \r
+ @param This A pointer to the EFI_USB_IO_PROTOCOL instance. \r
+ @param ConfigurationDescriptor A pointer to the caller allocated USB Active Configuration\r
+ Descriptor. \r
+ @retval EFI_SUCCESS The active configuration descriptor was retrieved successfully.\r
+ @retval EFI_INVALID_PARAMETER ConfigurationDescriptor is NULL.\r
+ @retval EFI_NOT_FOUND An active configuration descriptor cannot be found. The device may not\r
+ be configured. \r
+ \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_USB_IO_GET_CONFIG_DESCRIPTOR) (\r
+ IN EFI_USB_IO_PROTOCOL *This,\r
+ OUT EFI_USB_CONFIG_DESCRIPTOR *ConfigurationDescriptor\r
+ );\r
+\r
+/** \r
+ Retrieves the Interface Descriptor for a USB Device Controller. As stated earlier, an interface\r
+ within a USB device is equivalently to a USB Controller within the current configuration. \r
+ \r
+ @param This A pointer to the EFI_USB_IO_PROTOCOL instance. \r
+ @param InterfaceDescriptor A pointer to the caller allocated USB Interface Descriptor within\r
+ the configuration setting. \r
+ @retval EFI_SUCCESS The interface descriptor retrieved successfully.\r
+ @retval EFI_INVALID_PARAMETER InterfaceDescriptor is NULL.\r
+ @retval EFI_NOT_FOUND The interface descriptor cannot be found. The device may not be\r
+ correctly configured. \r
+ \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_USB_IO_GET_INTERFACE_DESCRIPTOR) (\r
+ IN EFI_USB_IO_PROTOCOL *This,\r
+ OUT EFI_USB_INTERFACE_DESCRIPTOR *InterfaceDescriptor\r
+ );\r
+\r
+/** \r
+ Retrieves an Endpoint Descriptor within a USB Controller.\r
+ \r
+ @param This A pointer to the EFI_USB_IO_PROTOCOL instance. \r
+ @param EndpointIndex Indicates which endpoint descriptor to retrieve.\r
+ @param EndpointDescriptor A pointer to the caller allocated USB Endpoint Descriptor of\r
+ a USB controller. \r
+ \r
+ @retval EFI_SUCCESS The endpoint descriptor was retrieved successfully.\r
+ @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
+ @retval EFI_NOT_FOUND The endpoint descriptor cannot be found. The device may not be\r
+ correctly configured. \r
+ \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_USB_IO_GET_ENDPOINT_DESCRIPTOR) (\r
+ IN EFI_USB_IO_PROTOCOL *This,\r
+ IN UINT8 EndpointIndex,\r
+ OUT EFI_USB_ENDPOINT_DESCRIPTOR *EndpointDescriptor\r
+ );\r
+\r
+/** \r
+ Retrieves a Unicode string stored in a USB Device.\r
+ \r
+ @param This A pointer to the EFI_USB_IO_PROTOCOL instance. \r
+ @param LangID The Language ID for the string being retrieved.\r
+ @param StringID The ID of the string being retrieved. \r
+ @param String A pointer to a buffer allocated by this function with \r
+ AllocatePool() to store the string.\r
+ \r
+ @retval EFI_SUCCESS The string was retrieved successfully. \r
+ @retval EFI_NOT_FOUND The string specified by LangID and StringID was not found. \r
+ @retval EFI_OUT_OF_RESOURCES There are not enough resources to allocate the return buffer String.\r
+ \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_USB_IO_GET_STRING_DESCRIPTOR) (\r
+ IN EFI_USB_IO_PROTOCOL *This,\r
+ IN UINT16 LangID,\r
+ IN UINT8 StringID,\r
+ OUT CHAR16 **String\r
+ );\r
+\r
+/** \r
+ Retrieves all the language ID codes that the USB device supports.\r
+ \r
+ @param This A pointer to the EFI_USB_IO_PROTOCOL instance. \r
+ @param LangIDTable Language ID for the string the caller wants to get.\r
+ @param TableSize The size, in bytes, of the table LangIDTable.\r
+ \r
+ @retval EFI_SUCCESS The support languages were retrieved successfully. \r
+ \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_USB_IO_GET_SUPPORTED_LANGUAGE) (\r
+ IN EFI_USB_IO_PROTOCOL *This,\r
+ OUT UINT16 **LangIDTable,\r
+ OUT UINT16 *TableSize\r
+ );\r
+\r
+//\r
+// Protocol Interface Structure\r
+//\r
+struct _EFI_USB_IO_PROTOCOL {\r
+ //\r
+ // IO transfer\r
+ //\r
+ EFI_USB_IO_CONTROL_TRANSFER UsbControlTransfer;\r
+ EFI_USB_IO_BULK_TRANSFER UsbBulkTransfer;\r
+ EFI_USB_IO_ASYNC_INTERRUPT_TRANSFER UsbAsyncInterruptTransfer;\r
+ EFI_USB_IO_SYNC_INTERRUPT_TRANSFER UsbSyncInterruptTransfer;\r
+ EFI_USB_IO_ISOCHRONOUS_TRANSFER UsbIsochronousTransfer;\r
+ EFI_USB_IO_ASYNC_ISOCHRONOUS_TRANSFER UsbAsyncIsochronousTransfer;\r
+\r
+ //\r
+ // Common device request\r
+ //\r
+ EFI_USB_IO_GET_DEVICE_DESCRIPTOR UsbGetDeviceDescriptor;\r
+ EFI_USB_IO_GET_CONFIG_DESCRIPTOR UsbGetConfigDescriptor;\r
+ EFI_USB_IO_GET_INTERFACE_DESCRIPTOR UsbGetInterfaceDescriptor;\r
+ EFI_USB_IO_GET_ENDPOINT_DESCRIPTOR UsbGetEndpointDescriptor;\r
+ EFI_USB_IO_GET_STRING_DESCRIPTOR UsbGetStringDescriptor;\r
+ EFI_USB_IO_GET_SUPPORTED_LANGUAGE UsbGetSupportedLanguages;\r
+\r
+ //\r
+ // Reset controller's parent port\r
+ //\r
+ EFI_USB_IO_PORT_RESET UsbPortReset;\r
+};\r
+\r
+extern EFI_GUID gEfiUsbIoProtocolGuid;\r
+\r
+#endif\r