|
iPXE
|
Universal Serial Bus (USB) More...
#include <byteswap.h>#include <ipxe/list.h>#include <ipxe/device.h>#include <ipxe/process.h>#include <ipxe/iobuf.h>#include <ipxe/tables.h>Go to the source code of this file.
Data Structures | |
| struct | usb_setup_packet |
| A USB setup data packet. More... | |
| struct | usb_class |
| A USB class code tuple. More... | |
| struct | usb_descriptor_header |
| A USB descriptor header. More... | |
| struct | usb_device_descriptor |
| A USB device descriptor. More... | |
| struct | usb_configuration_descriptor |
| A USB configuration descriptor. More... | |
| struct | usb_string_descriptor |
| A USB string descriptor. More... | |
| struct | usb_interface_descriptor |
| A USB interface descriptor. More... | |
| struct | usb_endpoint_descriptor |
| A USB endpoint descriptor. More... | |
| struct | usb_endpoint_companion_descriptor |
| A USB endpoint companion descriptor. More... | |
| struct | usb_interface_association_descriptor |
| A USB interface association descriptor. More... | |
| struct | usb_endpoint |
| A USB endpoint. More... | |
| struct | usb_endpoint_host_operations |
| USB endpoint host controller operations. More... | |
| struct | usb_endpoint_driver_operations |
| USB endpoint driver operations. More... | |
| union | usb_class_descriptor |
| A USB class descriptor. More... | |
| struct | usb_function_descriptor |
| A USB function descriptor. More... | |
| struct | usb_function |
| A USB function. More... | |
| struct | usb_device |
| A USB device. More... | |
| struct | usb_device_host_operations |
| USB device host controller operations. More... | |
| struct | usb_port |
| A USB port. More... | |
| struct | usb_hub |
| A USB hub. More... | |
| struct | usb_hub_host_operations |
| USB hub host controller operations. More... | |
| struct | usb_hub_driver_operations |
| USB hub driver operations. More... | |
| struct | usb_bus |
| A USB bus. More... | |
| struct | usb_bus_host_operations |
| USB bus host controller operations. More... | |
| struct | usb_host_operations |
| USB host controller operations. More... | |
| struct | usb_device_id |
| A USB device ID. More... | |
| struct | usb_class_id |
| A USB class ID. More... | |
| struct | usb_driver |
| A USB driver. More... | |
Macros | |
| #define | USB_SPEED(mantissa, exponent) |
| Define a USB speed. | |
| #define | USB_SPEED_MANTISSA(speed) |
| Extract USB speed mantissa. | |
| #define | USB_SPEED_EXPONENT(speed) |
| Extract USB speed exponent. | |
| #define | USB_BUSDEV(bus, dev) |
| Define a USB bus:device address. | |
| #define | USB_BUS(busdev) |
| Extract USB bus address. | |
| #define | USB_DEV(busdev) |
| Extract USB device address. | |
| #define | USB_DIR_OUT ( 0 << 7 ) |
| Data transfer is from host to device. | |
| #define | USB_DIR_IN ( 1 << 7 ) |
| Data transfer is from device to host. | |
| #define | USB_TYPE_STANDARD ( 0 << 5 ) |
| Standard request type. | |
| #define | USB_TYPE_CLASS ( 1 << 5 ) |
| Class-specific request type. | |
| #define | USB_TYPE_VENDOR ( 2 << 5 ) |
| Vendor-specific request type. | |
| #define | USB_RECIP_MASK ( 0x1f << 0 ) |
| Request recipient mask. | |
| #define | USB_RECIP_DEVICE ( 0 << 0 ) |
| Request recipient is the device. | |
| #define | USB_RECIP_INTERFACE ( 1 << 0 ) |
| Request recipient is an interface. | |
| #define | USB_RECIP_ENDPOINT ( 2 << 0 ) |
| Request recipient is an endpoint. | |
| #define | USB_REQUEST_TYPE(type) |
| Construct USB request type. | |
| #define | USB_GET_STATUS ( USB_DIR_IN | USB_REQUEST_TYPE ( 0 ) ) |
| Get status. | |
| #define | USB_CLEAR_FEATURE ( USB_DIR_OUT | USB_REQUEST_TYPE ( 1 ) ) |
| Clear feature. | |
| #define | USB_SET_FEATURE ( USB_DIR_OUT | USB_REQUEST_TYPE ( 3 ) ) |
| Set feature. | |
| #define | USB_SET_ADDRESS ( USB_DIR_OUT | USB_REQUEST_TYPE ( 5 ) ) |
| Set address. | |
| #define | USB_GET_DESCRIPTOR ( USB_DIR_IN | USB_REQUEST_TYPE ( 6 ) ) |
| Get descriptor. | |
| #define | USB_SET_DESCRIPTOR ( USB_DIR_OUT | USB_REQUEST_TYPE ( 7 ) ) |
| Set descriptor. | |
| #define | USB_GET_CONFIGURATION ( USB_DIR_IN | USB_REQUEST_TYPE ( 8 ) ) |
| Get configuration. | |
| #define | USB_SET_CONFIGURATION ( USB_DIR_OUT | USB_REQUEST_TYPE ( 9 ) ) |
| Set configuration. | |
| #define | USB_GET_INTERFACE ( USB_DIR_IN | USB_RECIP_INTERFACE | USB_REQUEST_TYPE ( 10 ) ) |
| Get interface. | |
| #define | USB_SET_INTERFACE ( USB_DIR_OUT | USB_RECIP_INTERFACE | USB_REQUEST_TYPE ( 11 ) ) |
| Set interface. | |
| #define | USB_ENDPOINT_HALT 0 |
| Endpoint halt feature. | |
| #define | USB_CLASS_HUB 9 |
| Class code for USB hubs. | |
| #define | USB_DEVICE_DESCRIPTOR 1 |
| A USB device descriptor. | |
| #define | USB_CONFIGURATION_DESCRIPTOR 2 |
| A USB configuration descriptor. | |
| #define | USB_STRING_DESCRIPTOR 3 |
| A USB string descriptor. | |
| #define | USB_LANG_ENGLISH 0x0409 |
| Language ID for English. | |
| #define | USB_INTERFACE_DESCRIPTOR 4 |
| A USB interface descriptor. | |
| #define | USB_ENDPOINT_DESCRIPTOR 5 |
| A USB endpoint descriptor. | |
| #define | USB_ENDPOINT_ATTR_TYPE_MASK 0x03 |
| Endpoint attribute transfer type mask. | |
| #define | USB_ENDPOINT_ATTR_PERIODIC 0x01 |
| Endpoint periodic type. | |
| #define | USB_ENDPOINT_ATTR_CONTROL 0x00 |
| Control endpoint transfer type. | |
| #define | USB_ENDPOINT_ATTR_BULK 0x02 |
| Bulk endpoint transfer type. | |
| #define | USB_ENDPOINT_ATTR_INTERRUPT 0x03 |
| Interrupt endpoint transfer type. | |
| #define | USB_BULK_OUT ( USB_ENDPOINT_ATTR_BULK | USB_DIR_OUT ) |
| Bulk OUT endpoint (internal) type. | |
| #define | USB_BULK_IN ( USB_ENDPOINT_ATTR_BULK | USB_DIR_IN ) |
| Bulk IN endpoint (internal) type. | |
| #define | USB_INTERRUPT_IN ( USB_ENDPOINT_ATTR_INTERRUPT | USB_DIR_IN ) |
| Interrupt IN endpoint (internal) type. | |
| #define | USB_INTERRUPT_OUT ( USB_ENDPOINT_ATTR_INTERRUPT | USB_DIR_OUT ) |
| Interrupt OUT endpoint (internal) type. | |
| #define | USB_ENDPOINT_MTU(sizes) |
| USB endpoint MTU. | |
| #define | USB_ENDPOINT_BURST(sizes) |
| USB endpoint maximum burst size. | |
| #define | USB_ENDPOINT_COMPANION_DESCRIPTOR 48 |
| A USB endpoint companion descriptor. | |
| #define | USB_INTERFACE_ASSOCIATION_DESCRIPTOR 11 |
| A USB interface association descriptor. | |
| #define | USB_CS_INTERFACE_DESCRIPTOR 36 |
| A class-specific interface descriptor. | |
| #define | USB_CS_ENDPOINT_DESCRIPTOR 37 |
| A class-specific endpoint descriptor. | |
| #define | for_each_config_descriptor(desc, config) |
| Iterate over all configuration descriptors. | |
| #define | for_each_interface_descriptor(desc, config, interface) |
| Iterate over all configuration descriptors within an interface descriptor. | |
| #define | USB_EP0_ADDRESS 0x00 |
| Control endpoint address. | |
| #define | USB_EP0_ATTRIBUTES 0x00 |
| Control endpoint attributes. | |
| #define | USB_EP0_DEFAULT_MTU(speed) |
| Calculate default MTU based on device speed. | |
| #define | USB_EP0_BURST 0 |
| Control endpoint maximum burst size. | |
| #define | USB_EP0_INTERVAL 0 |
| Control endpoint interval. | |
| #define | USB_ENDPOINT_MAX 0x0f |
| Maximum endpoint number. | |
| #define | USB_ENDPOINT_IN 0x80 |
| Endpoint direction is in. | |
| #define | USB_ENDPOINT_IDX(address) |
| Construct endpoint index from endpoint address. | |
| #define | for_each_usb_bus(bus) |
| Iterate over all USB buses. | |
| #define | USB_RESET_DELAY_MS 50 |
| Minimum reset time. | |
| #define | USB_RESET_RECOVER_DELAY_MS 10 |
| Reset recovery time. | |
| #define | USB_CONTROL_MAX_WAIT_MS 5000 |
| Maximum time to wait for a control transaction to complete. | |
| #define | USB_SET_ADDRESS_RECOVER_DELAY_MS 2 |
| Set address recovery time. | |
| #define | USB_PORT_DELAY_MS 200 |
| Time to wait for ports to stabilise. | |
| #define | USB_ID(_vendor, _product, _name, _description, _data) |
| #define | USB_ROM(_vendor, _product, _name, _description, _data) |
| #define | USB_ANY_ID 0xffff |
| Match-anything ID. | |
| #define | USB_CLASS_ID(base, subclass, protocol) |
| Construct USB class ID. | |
| #define | USB_DRIVERS __table ( struct usb_driver, "usb_drivers" ) |
| USB driver table. | |
| #define | __usb_driver __table_entry ( USB_DRIVERS, 01 ) |
| Declare a USB driver. | |
| #define | __usb_fallback_driver __table_entry ( USB_DRIVERS, 02 ) |
| Declare a USB fallback driver. | |
Enumerations | |
| enum | usb_protocol { USB_PROTO_2_0 = 0x0200 , USB_PROTO_3_0 = 0x0300 , USB_PROTO_3_1 = 0x0301 } |
| USB protocols. More... | |
| enum | usb_speed { USB_SPEED_NONE = 0 , USB_SPEED_LOW = USB_SPEED ( 1500, 1 ) , USB_SPEED_FULL = USB_SPEED ( 12, 2 ) , USB_SPEED_HIGH = USB_SPEED ( 480, 2 ) , USB_SPEED_SUPER = USB_SPEED ( 5, 3 ) } |
| USB device speeds. More... | |
| enum | usb_pid { USB_PID_IN = 0x69 , USB_PID_OUT = 0xe1 , USB_PID_SETUP = 0x2d } |
| USB packet IDs. More... | |
| enum | usb_driver_score { USB_SCORE_FALLBACK = 0 , USB_SCORE_DEPRECATED = 1 , USB_SCORE_NORMAL = 2 } |
| USB driver scores. More... | |
Functions | |
| FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
| FILE_SECBOOT (PERMITTED) | |
| static struct usb_descriptor_header * | usb_next_descriptor (struct usb_descriptor_header *desc) |
| Get next USB descriptor. | |
| static int | usb_is_within_config (struct usb_configuration_descriptor *config, struct usb_descriptor_header *desc) |
| Check that descriptor lies within a configuration descriptor. | |
| static void | usb_endpoint_init (struct usb_endpoint *ep, struct usb_device *usb, struct usb_endpoint_driver_operations *driver) |
| Initialise USB endpoint. | |
| static void | usb_endpoint_describe (struct usb_endpoint *ep, unsigned int address, unsigned int attributes, size_t mtu, unsigned int burst, unsigned int interval) |
| Describe USB endpoint. | |
| static void | usb_endpoint_set_hostdata (struct usb_endpoint *ep, void *priv) |
| Set USB endpoint host controller private data. | |
| static void * | usb_endpoint_get_hostdata (struct usb_endpoint *ep) |
| Get USB endpoint host controller private data. | |
| const char * | usb_endpoint_name (struct usb_endpoint *ep) |
| Get USB endpoint name (for debugging) | |
| int | usb_endpoint_described (struct usb_endpoint *ep, struct usb_configuration_descriptor *config, struct usb_interface_descriptor *interface, unsigned int type, unsigned int index) |
| Describe USB endpoint from device configuration. | |
| int | usb_endpoint_open (struct usb_endpoint *ep) |
| Open USB endpoint. | |
| int | usb_endpoint_clear_halt (struct usb_endpoint *ep) |
| Clear endpoint halt (if applicable) | |
| void | usb_endpoint_close (struct usb_endpoint *ep) |
| Close USB endpoint. | |
| int | usb_message (struct usb_endpoint *ep, unsigned int request, unsigned int value, unsigned int index, struct io_buffer *iobuf) |
| Enqueue USB message transfer. | |
| int | usb_stream (struct usb_endpoint *ep, struct io_buffer *iobuf, int terminate) |
| Enqueue USB stream transfer. | |
| void | usb_complete_err (struct usb_endpoint *ep, struct io_buffer *iobuf, int rc) |
| Complete transfer (possibly with error) | |
| static void | usb_refill_init (struct usb_endpoint *ep, size_t reserve, size_t len, unsigned int max) |
| Initialise USB endpoint refill. | |
| static void | usb_recycle (struct usb_endpoint *ep, struct io_buffer *iobuf) |
| Recycle I/O buffer. | |
| int | usb_prefill (struct usb_endpoint *ep) |
| Prefill endpoint recycled buffer list. | |
| int | usb_refill_limit (struct usb_endpoint *ep, unsigned int max) |
| Refill endpoint up to specified limit. | |
| int | usb_refill (struct usb_endpoint *ep) |
| Refill endpoint. | |
| void | usb_flush (struct usb_endpoint *ep) |
| Discard endpoint recycled buffer list. | |
| static void | usb_func_set_drvdata (struct usb_function *func, void *priv) |
| Set USB function driver private data. | |
| static void * | usb_func_get_drvdata (struct usb_function *func) |
| Get USB function driver private data. | |
| static void | usb_set_hostdata (struct usb_device *usb, void *priv) |
| Set USB device host controller private data. | |
| static void * | usb_get_hostdata (struct usb_device *usb) |
| Get USB device host controller private data. | |
| static struct usb_endpoint * | usb_endpoint (struct usb_device *usb, unsigned int address) |
| Get USB endpoint. | |
| static void | usb_hub_set_drvdata (struct usb_hub *hub, void *priv) |
| Set USB hub driver private data. | |
| static void * | usb_hub_get_drvdata (struct usb_hub *hub) |
| Get USB hub driver private data. | |
| static struct usb_port * | usb_port (struct usb_hub *hub, unsigned int address) |
| Get USB port. | |
| static void | usb_bus_set_hostdata (struct usb_bus *bus, void *priv) |
| Set USB bus host controller private data. | |
| static void * | usb_bus_get_hostdata (struct usb_bus *bus) |
| Get USB bus host controller private data. | |
| static void | usb_poll (struct usb_bus *bus) |
| Poll USB bus. | |
| static void | usb_complete (struct usb_endpoint *ep, struct io_buffer *iobuf) |
| Complete transfer (without error) | |
| int | usb_control (struct usb_device *usb, unsigned int request, unsigned int value, unsigned int index, void *data, size_t len) |
| Issue USB control transaction. | |
| int | usb_get_string_descriptor (struct usb_device *usb, unsigned int index, unsigned int language, char *buf, size_t len) |
| Get USB string descriptor. | |
| static int | usb_get_status (struct usb_device *usb, unsigned int type, unsigned int index, void *data, size_t len) |
| Get status. | |
| static int | usb_clear_feature (struct usb_device *usb, unsigned int type, unsigned int feature, unsigned int index) |
| Clear feature. | |
| static int | usb_set_feature (struct usb_device *usb, unsigned int type, unsigned int feature, unsigned int index) |
| Set feature. | |
| static int | usb_set_address (struct usb_device *usb, unsigned int address) |
| Set address. | |
| static int | usb_get_descriptor (struct usb_device *usb, unsigned int type, unsigned int desc, unsigned int index, unsigned int language, struct usb_descriptor_header *data, size_t len) |
| Get USB descriptor. | |
| static int | usb_get_mtu (struct usb_device *usb, struct usb_device_descriptor *data) |
| Get first part of USB device descriptor (up to and including MTU) | |
| static int | usb_get_device_descriptor (struct usb_device *usb, struct usb_device_descriptor *data) |
| Get USB device descriptor. | |
| static int | usb_get_config_descriptor (struct usb_device *usb, unsigned int index, struct usb_configuration_descriptor *data, size_t len) |
| Get USB configuration descriptor. | |
| static int | usb_set_configuration (struct usb_device *usb, unsigned int index) |
| Set USB configuration. | |
| static int | usb_set_interface (struct usb_device *usb, unsigned int interface, unsigned int alternate) |
| Set USB interface alternate setting. | |
| static unsigned int | usb_depth (struct usb_device *usb) |
| Get USB depth. | |
| struct usb_interface_descriptor * | usb_interface_descriptor (struct usb_configuration_descriptor *config, unsigned int interface, unsigned int alternate) |
| Locate USB interface descriptor. | |
| struct usb_endpoint_descriptor * | usb_endpoint_descriptor (struct usb_configuration_descriptor *config, struct usb_interface_descriptor *interface, unsigned int type, unsigned int index) |
| Locate USB endpoint descriptor. | |
| struct usb_endpoint_companion_descriptor * | usb_endpoint_companion_descriptor (struct usb_configuration_descriptor *config, struct usb_endpoint_descriptor *desc) |
| Locate USB endpoint companion descriptor. | |
| struct usb_device * | find_usb (struct usb_bus *bus, unsigned int address) |
| Find USB device by address. | |
| struct usb_hub * | alloc_usb_hub (struct usb_bus *bus, struct usb_device *usb, unsigned int ports, struct usb_hub_driver_operations *op) |
| Allocate USB hub. | |
| int | register_usb_hub (struct usb_hub *hub) |
| Register USB hub. | |
| void | unregister_usb_hub (struct usb_hub *hub) |
| Unregister USB hub. | |
| void | free_usb_hub (struct usb_hub *hub) |
| Free USB hub. | |
| void | usb_port_changed (struct usb_port *port) |
| Report port status change. | |
| struct usb_bus * | alloc_usb_bus (struct device *dev, unsigned int ports, size_t mtu, struct usb_host_operations *op) |
| Allocate USB bus. | |
| int | register_usb_bus (struct usb_bus *bus) |
| Register USB bus. | |
| void | unregister_usb_bus (struct usb_bus *bus) |
| Unregister USB bus. | |
| void | free_usb_bus (struct usb_bus *bus) |
| Free USB bus. | |
| struct usb_bus * | find_usb_bus (unsigned int address) |
| Find USB bus by address. | |
| struct usb_bus * | find_usb_bus_by_location (unsigned int bus_type, unsigned int location) |
| Find USB bus by device location. | |
| int | usb_alloc_address (struct usb_bus *bus) |
| Allocate device address. | |
| void | usb_free_address (struct usb_bus *bus, unsigned int address) |
| Free device address. | |
| int | usb_find_next (struct usb_device **usb, uint16_t *busdev) |
| Find next USB device. | |
| unsigned int | usb_route_string (struct usb_device *usb) |
| Get USB route string. | |
| struct usb_port * | usb_root_hub_port (struct usb_device *usb) |
| Get USB root hub port. | |
| struct usb_port * | usb_transaction_translator (struct usb_device *usb) |
| Get USB transaction translator. | |
| struct usb_driver * | usb_find_driver (struct usb_function_descriptor *desc, struct usb_device_id **id) |
| Find USB device driver. | |
Variables | |
| struct list_head | usb_buses |
| List of USB buses. | |
Universal Serial Bus (USB)
Definition in file usb.h.
| #define USB_SPEED | ( | mantissa, | |
| exponent ) |
Define a USB speed.
| mantissa | Mantissa |
| exponent | Exponent (in engineering terms: 1=k, 2=M, 3=G) |
| speed | USB speed |
Definition at line 36 of file usb.h.
Referenced by xhci_port_psiv(), and xhci_port_speed().
| #define USB_SPEED_MANTISSA | ( | speed | ) |
Extract USB speed mantissa.
Definition at line 39 of file usb.h.
Referenced by usb_speed_name().
| #define USB_SPEED_EXPONENT | ( | speed | ) |
Extract USB speed exponent.
Definition at line 42 of file usb.h.
Referenced by usb_speed_name().
| #define USB_BUSDEV | ( | bus, | |
| dev ) |
| #define USB_BUS | ( | busdev | ) |
Extract USB bus address.
Definition at line 67 of file usb.h.
Referenced by usb_find_next(), and usb_settings_fetch().
| #define USB_DEV | ( | busdev | ) |
Extract USB device address.
Definition at line 70 of file usb.h.
Referenced by usb_find_next(), and usb_settings_fetch().
| #define USB_DIR_OUT ( 0 << 7 ) |
| #define USB_DIR_IN ( 1 << 7 ) |
Data transfer is from device to host.
Definition at line 98 of file usb.h.
Referenced by ehci_endpoint_message(), ehci_endpoint_stream(), uhci_endpoint_message(), uhci_endpoint_stream(), usb_control(), usb_endpoint_descriptor(), usb_message(), usbblk_out_command(), usbio_control_poll(), usbio_endpoint_open(), xhci_endpoint_message(), xhci_endpoint_open(), and xhci_endpoint_stream().
| #define USB_TYPE_CLASS ( 1 << 5 ) |
Class-specific request type.
Definition at line 104 of file usb.h.
Referenced by usb_hub_clear_port_feature(), usb_hub_get_descriptor(), usb_hub_get_port_status(), and usb_hub_set_port_feature().
| #define USB_TYPE_VENDOR ( 2 << 5 ) |
| #define USB_RECIP_MASK ( 0x1f << 0 ) |
| #define USB_RECIP_DEVICE ( 0 << 0 ) |
| #define USB_RECIP_INTERFACE ( 1 << 0 ) |
Request recipient is an interface.
Definition at line 116 of file usb.h.
Referenced by usbio_control_poll().
| #define USB_RECIP_ENDPOINT ( 2 << 0 ) |
Request recipient is an endpoint.
Definition at line 119 of file usb.h.
Referenced by usb_endpoint_clear_halt().
| #define USB_REQUEST_TYPE | ( | type | ) |
| #define USB_GET_STATUS ( USB_DIR_IN | USB_REQUEST_TYPE ( 0 ) ) |
| #define USB_CLEAR_FEATURE ( USB_DIR_OUT | USB_REQUEST_TYPE ( 1 ) ) |
| #define USB_SET_FEATURE ( USB_DIR_OUT | USB_REQUEST_TYPE ( 3 ) ) |
| #define USB_SET_ADDRESS ( USB_DIR_OUT | USB_REQUEST_TYPE ( 5 ) ) |
| #define USB_GET_DESCRIPTOR ( USB_DIR_IN | USB_REQUEST_TYPE ( 6 ) ) |
Get descriptor.
Definition at line 137 of file usb.h.
Referenced by usb_get_descriptor(), and usbio_config().
| #define USB_SET_DESCRIPTOR ( USB_DIR_OUT | USB_REQUEST_TYPE ( 7 ) ) |
| #define USB_GET_CONFIGURATION ( USB_DIR_IN | USB_REQUEST_TYPE ( 8 ) ) |
| #define USB_SET_CONFIGURATION ( USB_DIR_OUT | USB_REQUEST_TYPE ( 9 ) ) |
Set configuration.
Definition at line 146 of file usb.h.
Referenced by efi_usb_control_transfer(), usb_set_configuration(), and usbio_control_poll().
| #define USB_GET_INTERFACE ( USB_DIR_IN | USB_RECIP_INTERFACE | USB_REQUEST_TYPE ( 10 ) ) |
| #define USB_SET_INTERFACE ( USB_DIR_OUT | USB_RECIP_INTERFACE | USB_REQUEST_TYPE ( 11 ) ) |
Set interface.
Definition at line 153 of file usb.h.
Referenced by efi_usb_control_transfer(), and usb_set_interface().
| #define USB_ENDPOINT_HALT 0 |
Endpoint halt feature.
Definition at line 157 of file usb.h.
Referenced by usb_endpoint_clear_halt().
| #define USB_DEVICE_DESCRIPTOR 1 |
A USB device descriptor.
Definition at line 207 of file usb.h.
Referenced by usb_get_device_descriptor(), and usb_get_mtu().
| #define USB_CONFIGURATION_DESCRIPTOR 2 |
A USB configuration descriptor.
Definition at line 228 of file usb.h.
Referenced by usb_get_config_descriptor(), and usbio_config().
| #define USB_STRING_DESCRIPTOR 3 |
A USB string descriptor.
Definition at line 239 of file usb.h.
Referenced by efi_usb_get_string_descriptor(), efi_usb_probe(), usb_get_default_language(), and usb_get_string_descriptor().
| #define USB_LANG_ENGLISH 0x0409 |
Language ID for English.
Definition at line 242 of file usb.h.
Referenced by usb_get_default_language().
| #define USB_INTERFACE_DESCRIPTOR 4 |
A USB interface descriptor.
Definition at line 261 of file usb.h.
Referenced by usb_interface_descriptor(), and usbio_interface().
| #define USB_ENDPOINT_DESCRIPTOR 5 |
A USB endpoint descriptor.
Definition at line 278 of file usb.h.
Referenced by efi_usb_get_endpoint_descriptor(), efi_usb_mtu(), usb_endpoint_descriptor(), and usbio_interface().
| #define USB_ENDPOINT_ATTR_TYPE_MASK 0x03 |
Endpoint attribute transfer type mask.
Definition at line 281 of file usb.h.
Referenced by ehci_endpoint_capabilities(), ehci_endpoint_characteristics(), ehci_schedule_add(), ehci_schedule_del(), uhci_schedule_add(), uhci_schedule_del(), usb_endpoint_clear_halt(), usb_endpoint_described(), usb_endpoint_descriptor(), usb_hub_clear_tt_buffer(), usbio_endpoint_open(), and xhci_endpoint_open().
| #define USB_ENDPOINT_ATTR_PERIODIC 0x01 |
Endpoint periodic type.
Definition at line 284 of file usb.h.
Referenced by usb_endpoint_clear_tt().
| #define USB_ENDPOINT_ATTR_CONTROL 0x00 |
Control endpoint transfer type.
Definition at line 287 of file usb.h.
Referenced by ehci_endpoint_characteristics(), usb_endpoint_clear_halt(), usbio_endpoint_open(), and xhci_endpoint_open().
| #define USB_ENDPOINT_ATTR_BULK 0x02 |
Bulk endpoint transfer type.
Definition at line 290 of file usb.h.
Referenced by efi_usb_bulk_transfer(), and usbio_endpoint_open().
| #define USB_ENDPOINT_ATTR_INTERRUPT 0x03 |
Interrupt endpoint transfer type.
Definition at line 293 of file usb.h.
Referenced by efi_usb_async_start(), efi_usb_sync_interrupt_transfer(), ehci_endpoint_capabilities(), ehci_schedule_add(), ehci_schedule_del(), uhci_schedule_add(), uhci_schedule_del(), usb_endpoint_described(), and usbio_endpoint_open().
| #define USB_BULK_OUT ( USB_ENDPOINT_ATTR_BULK | USB_DIR_OUT ) |
Bulk OUT endpoint (internal) type.
Definition at line 296 of file usb.h.
Referenced by usbblk_probe(), and usbnet_data_describe().
| #define USB_BULK_IN ( USB_ENDPOINT_ATTR_BULK | USB_DIR_IN ) |
Bulk IN endpoint (internal) type.
Definition at line 299 of file usb.h.
Referenced by usbblk_probe(), and usbnet_data_describe().
| #define USB_INTERRUPT_IN ( USB_ENDPOINT_ATTR_INTERRUPT | USB_DIR_IN ) |
Interrupt IN endpoint (internal) type.
Definition at line 302 of file usb.h.
Referenced by hub_probe(), usbhid_describe(), and usbnet_comms_describe().
| #define USB_INTERRUPT_OUT ( USB_ENDPOINT_ATTR_INTERRUPT | USB_DIR_OUT ) |
Interrupt OUT endpoint (internal) type.
Definition at line 305 of file usb.h.
Referenced by usbhid_describe().
| #define USB_ENDPOINT_MTU | ( | sizes | ) |
USB endpoint MTU.
Definition at line 308 of file usb.h.
Referenced by efi_usb_mtu(), and usb_endpoint_described().
| #define USB_ENDPOINT_BURST | ( | sizes | ) |
USB endpoint maximum burst size.
Definition at line 311 of file usb.h.
Referenced by usb_endpoint_described().
| #define USB_ENDPOINT_COMPANION_DESCRIPTOR 48 |
A USB endpoint companion descriptor.
Definition at line 326 of file usb.h.
Referenced by usb_endpoint_companion_descriptor().
| #define USB_INTERFACE_ASSOCIATION_DESCRIPTOR 11 |
A USB interface association descriptor.
Definition at line 343 of file usb.h.
Referenced by usb_interface_association_descriptor().
| #define USB_CS_INTERFACE_DESCRIPTOR 36 |
A class-specific interface descriptor.
Definition at line 346 of file usb.h.
Referenced by cdc_union_descriptor(), and ecm_ethernet_descriptor().
| #define USB_CS_ENDPOINT_DESCRIPTOR 37 |
| #define for_each_config_descriptor | ( | desc, | |
| config ) |
Iterate over all configuration descriptors.
Definition at line 386 of file usb.h.
Referenced by usb_interface_association_descriptor(), usb_interface_descriptor(), and usbio_interface().
Iterate over all configuration descriptors within an interface descriptor.
Definition at line 394 of file usb.h.
Referenced by cdc_union_descriptor(), ecm_ethernet_descriptor(), efi_usb_get_endpoint_descriptor(), efi_usb_mtu(), usb_endpoint_descriptor(), and usbio_interface().
| #define USB_EP0_ADDRESS 0x00 |
Control endpoint address.
Definition at line 501 of file usb.h.
Referenced by ehci_device_address(), register_usb(), uhci_device_address(), usb_deconfigure(), and usbio_interface().
| #define USB_EP0_ATTRIBUTES 0x00 |
| #define USB_EP0_DEFAULT_MTU | ( | speed | ) |
Calculate default MTU based on device speed.
| speed | Device speed |
| mtu | Default MTU |
Definition at line 511 of file usb.h.
Referenced by register_usb().
| #define USB_EP0_BURST 0 |
Control endpoint maximum burst size.
Definition at line 516 of file usb.h.
Referenced by register_usb().
| #define USB_EP0_INTERVAL 0 |
| #define USB_ENDPOINT_MAX 0x0f |
Maximum endpoint number.
Definition at line 522 of file usb.h.
Referenced by usb_endpoint_name(), and usb_hub_clear_tt_buffer().
| #define USB_ENDPOINT_IN 0x80 |
Endpoint direction is in.
Definition at line 525 of file usb.h.
Referenced by efi_usb_async_interrupt_transfer(), efi_usb_async_isochronous_transfer(), efi_usb_bulk_transfer(), efi_usb_isochronous_transfer(), efi_usb_sync_interrupt_transfer(), efi_usb_sync_transfer(), usb_endpoint_name(), and usb_hub_clear_tt_buffer().
| #define USB_ENDPOINT_IDX | ( | address | ) |
Construct endpoint index from endpoint address.
Definition at line 528 of file usb.h.
Referenced by efi_usb_async_start(), efi_usb_async_stop(), efi_usb_close(), efi_usb_is_open(), efi_usb_open(), efi_usb_sync_transfer(), usb_deconfigure(), usb_endpoint(), usb_endpoint_close(), and usb_endpoint_open().
| #define for_each_usb_bus | ( | bus | ) |
Iterate over all USB buses.
Definition at line 1077 of file usb.h.
Referenced by ehci_poll_companions(), find_usb_bus(), find_usb_bus_by_location(), and usb_step().
| #define USB_RESET_DELAY_MS 50 |
Minimum reset time.
Section 7.1.7.5 of the USB2 specification states that root hub ports should assert reset signalling for at least 50ms.
Definition at line 1328 of file usb.h.
Referenced by ehci_root_enable(), and uhci_root_enable().
| #define USB_RESET_RECOVER_DELAY_MS 10 |
Reset recovery time.
Section 9.2.6.2 of the USB2 specification states that the "recovery" interval after a port reset is 10ms.
Definition at line 1335 of file usb.h.
Referenced by register_usb(), and uhci_root_enable().
| #define USB_CONTROL_MAX_WAIT_MS 5000 |
Maximum time to wait for a control transaction to complete.
Section 9.2.6.1 of the USB2 specification states that the upper limit for commands to be processed is 5 seconds.
Definition at line 1342 of file usb.h.
Referenced by usb_control().
| #define USB_SET_ADDRESS_RECOVER_DELAY_MS 2 |
Set address recovery time.
Section 9.2.6.3 of the USB2 specification states that devices are allowed a 2ms recovery interval after receiving a new address.
Definition at line 1349 of file usb.h.
Referenced by register_usb().
| #define USB_PORT_DELAY_MS 200 |
Time to wait for ports to stabilise.
Section 7.1.7.3 of the USB specification states that we must allow 100ms for devices to signal attachment, and an additional 100ms for connection debouncing. (This delay is parallelised across all ports on a hub; we do not delay separately for each port.)
Definition at line 1358 of file usb.h.
Referenced by register_usb_hub().
| #define USB_ID | ( | _vendor, | |
| _product, | |||
| _name, | |||
| _description, | |||
| _data ) |
Definition at line 1373 of file usb.h.
| #define USB_ROM | ( | _vendor, | |
| _product, | |||
| _name, | |||
| _description, | |||
| _data ) |
| #define USB_ANY_ID 0xffff |
Construct USB class ID.
| base | Base class code (or USB_ANY_ID) |
| subclass | Subclass code (or USB_ANY_ID) |
| protocol | Protocol code (or USB_ANY_ID) |
Definition at line 1401 of file usb.h.
| #define USB_DRIVERS __table ( struct usb_driver, "usb_drivers" ) |
| struct usb_driver iphone_driver __usb_driver __table_entry ( USB_DRIVERS, 01 ) |
| #define __usb_fallback_driver __table_entry ( USB_DRIVERS, 02 ) |
| enum usb_protocol |
USB protocols.
| Enumerator | |
|---|---|
| USB_PROTO_2_0 | USB 2.0. |
| USB_PROTO_3_0 | USB 3.0. |
| USB_PROTO_3_1 | USB 3.1. |
Definition at line 21 of file usb.h.
| enum usb_speed |
USB device speeds.
| Enumerator | |
|---|---|
| USB_SPEED_NONE | Not connected. |
| USB_SPEED_LOW | Low speed (1.5Mbps) |
| USB_SPEED_FULL | Full speed (12Mbps) |
| USB_SPEED_HIGH | High speed (480Mbps) |
| USB_SPEED_SUPER | Super speed (5Gbps) |
Definition at line 45 of file usb.h.
| enum usb_pid |
USB packet IDs.
| Enumerator | |
|---|---|
| USB_PID_IN | IN PID. |
| USB_PID_OUT | OUT PID. |
| USB_PID_SETUP | SETUP PID. |
Definition at line 73 of file usb.h.
| enum usb_driver_score |
USB driver scores.
| Enumerator | |
|---|---|
| USB_SCORE_FALLBACK | Fallback driver (has no effect on overall score) |
| USB_SCORE_DEPRECATED | Deprecated driver. |
| USB_SCORE_NORMAL | Normal driver. |
Definition at line 1459 of file usb.h.
| FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
| FILE_SECBOOT | ( | PERMITTED | ) |
|
inlinestatic |
Get next USB descriptor.
| desc | USB descriptor header |
| next | Next USB descriptor header |
Definition at line 358 of file usb.h.
References desc.
Referenced by usb_endpoint_companion_descriptor(), and usb_is_within_config().
|
inlinestatic |
Check that descriptor lies within a configuration descriptor.
| config | Configuration descriptor |
| desc | Descriptor header |
| is_within | Descriptor is within the configuration descriptor |
Definition at line 371 of file usb.h.
References desc, end, le16_to_cpu, usb_configuration_descriptor::len, and usb_next_descriptor().
Referenced by usb_endpoint_companion_descriptor().
|
inlinestatic |
Initialise USB endpoint.
| ep | USB endpoint |
| usb | USB device |
| driver | Driver operations |
Definition at line 540 of file usb.h.
References usb_endpoint::driver, and usb_endpoint::usb.
Referenced by alloc_usb(), efi_usb_open(), hub_probe(), usbblk_probe(), usbhid_init(), and usbnet_init().
|
inlinestatic |
Describe USB endpoint.
| ep | USB endpoint |
| address | Endpoint address |
| attributes | Attributes |
| mtu | Maximum packet size |
| burst | Maximum burst size |
| interval | Interval (in microframes) |
Definition at line 558 of file usb.h.
References address, usb_endpoint::address, usb_endpoint::attributes, burst, usb_endpoint::burst, usb_endpoint::interval, mtu, and usb_endpoint::mtu.
Referenced by efi_usb_open(), register_usb(), and usb_endpoint_described().
|
inlinestatic |
Set USB endpoint host controller private data.
| ep | USB endpoint |
| priv | Host controller private data |
Definition at line 576 of file usb.h.
References priv, and usb_endpoint::priv.
Referenced by ehci_endpoint_open(), uhci_endpoint_open(), usbio_endpoint_open(), and xhci_endpoint_open().
|
inlinestatic |
Get USB endpoint host controller private data.
| ep | USB endpoint |
| priv | Host controller private data |
Definition at line 587 of file usb.h.
References usb_endpoint::priv.
Referenced by ehci_endpoint_close(), ehci_endpoint_message(), ehci_endpoint_reset(), ehci_endpoint_stream(), ehci_endpoint_update(), uhci_device_address(), uhci_endpoint_close(), uhci_endpoint_message(), uhci_endpoint_mtu(), uhci_endpoint_reset(), uhci_endpoint_stream(), usbio_endpoint_close(), usbio_endpoint_enqueue(), xhci_endpoint_close(), xhci_endpoint_message(), xhci_endpoint_mtu(), xhci_endpoint_reset(), and xhci_endpoint_stream().
|
extern |
Get USB endpoint name (for debugging)
| ep | USB endpoint |
| name | Endpoint name |
Definition at line 221 of file usb.c.
References address, usb_endpoint::address, snprintf(), USB_ENDPOINT_IN, and USB_ENDPOINT_MAX.
Referenced by efi_usb_async_start(), efi_usb_close(), efi_usb_open(), efi_usb_sync_transfer(), ehci_endpoint_close(), ehci_endpoint_poll(), ehci_root_clear_tt(), uhci_endpoint_poll(), uhci_root_clear_tt(), usb_complete_err(), usb_endpoint_clear_halt(), usb_endpoint_clear_tt(), usb_endpoint_mtu(), usb_endpoint_open(), usb_endpoint_reset(), usb_message(), usb_stream(), usbio_bulk_in_poll(), usbio_bulk_out_poll(), usbio_control_poll(), usbio_endpoint_open(), usbio_interface(), usbio_interrupt_callback(), usbio_interrupt_open(), usbkbd_probe(), and xhci_root_clear_tt().
|
extern |
Describe USB endpoint from device configuration.
| ep | USB endpoint |
| config | Configuration descriptor |
| interface | Interface descriptor |
| type | Endpoint (internal) type |
| index | Endpoint index |
| rc | Return status code |
Definition at line 242 of file usb.c.
References burst, usb_endpoint_companion_descriptor::burst, desc, ENOENT, usb_device::ep, index, le16_to_cpu, mtu, usb_device::speed, type, usb_endpoint::usb, USB_ENDPOINT_ATTR_INTERRUPT, USB_ENDPOINT_ATTR_TYPE_MASK, USB_ENDPOINT_BURST, usb_endpoint_companion_descriptor(), usb_endpoint_describe(), usb_endpoint_descriptor(), USB_ENDPOINT_MTU, and USB_SPEED_HIGH.
Referenced by hub_probe(), usbblk_probe(), usbhid_describe(), usbnet_comms_describe(), and usbnet_data_describe().
|
extern |
Open USB endpoint.
| ep | USB endpoint |
| rc | Return status code |
Definition at line 294 of file usb.c.
References usb_endpoint::address, usb_endpoint::burst, usb_hub::bus, usb_endpoint_host_operations::close, DBGC, DBGC2, EALREADY, usb_host_operations::endpoint, usb_device::ep, usb_endpoint::halted, usb_endpoint::host, usb_port::hub, INIT_LIST_HEAD, usb_endpoint::interval, usb_endpoint::max, usb_endpoint::mtu, usb_device::name, NULL, usb_bus::op, usb_endpoint::open, usb_endpoint_host_operations::open, usb_device::port, rc, strerror(), usb_endpoint::usb, USB_ENDPOINT_IDX, usb_endpoint_name(), and usb_flush().
Referenced by efi_usb_open(), hub_open(), register_usb(), usbblk_open(), usbhid_open(), and usbnet_open().
|
extern |
Clear endpoint halt (if applicable)
| ep | USB endpoint |
| rc | Return status code |
Definition at line 372 of file usb.c.
References usb_endpoint::address, usb_endpoint::attributes, DBGC, usb_device::ep, usb_device::name, rc, strerror(), type, usb_endpoint::usb, usb_clear_feature(), USB_ENDPOINT_ATTR_CONTROL, USB_ENDPOINT_ATTR_TYPE_MASK, usb_endpoint_clear_tt(), USB_ENDPOINT_HALT, usb_endpoint_name(), and USB_RECIP_ENDPOINT.
Referenced by usb_endpoint_reset(), and usbblk_open().
|
extern |
Close USB endpoint.
| ep | USB endpoint |
Definition at line 400 of file usb.c.
References usb_endpoint::address, assert, usb_endpoint_host_operations::close, usb_device::ep, usb_endpoint::fill, usb_endpoint::halted, usb_endpoint::host, list_del, usb_endpoint::max, NULL, usb_endpoint::open, usb_endpoint::usb, usb_endpoint_clear_tt(), USB_ENDPOINT_IDX, and usb_flush().
Referenced by efi_usb_close(), efi_usb_open(), hub_close(), hub_open(), register_usb(), unregister_usb(), usbblk_close(), usbblk_open(), usbhid_close(), usbhid_open(), usbnet_close(), and usbnet_open().
|
extern |
Enqueue USB message transfer.
| ep | USB endpoint |
| request | Request |
| value | Value parameter |
| index | Index parameter |
| iobuf | I/O buffer |
| rc | Return status code |
The I/O buffer must have sufficient headroom to contain a setup packet.
Definition at line 492 of file usb.c.
References assert, cpu_to_le16, io_buffer::data, DBGC, ENODEV, usb_device::ep, usb_endpoint::fill, usb_endpoint::halted, usb_endpoint::host, index, usb_setup_packet::index, iob_headroom(), iob_len(), iob_push, len, usb_setup_packet::len, list_empty, memset(), usb_endpoint_host_operations::message, usb_device::name, port, usb_device::port, rc, request, usb_setup_packet::request, strerror(), usb_endpoint::usb, usb_port::usb, USB_DIR_IN, usb_endpoint_name(), usb_endpoint_reset(), usb_setup_packet::value, and value.
Referenced by usb_control().
|
extern |
Enqueue USB stream transfer.
| ep | USB endpoint |
| iobuf | I/O buffer |
| terminate | Terminate using a short packet |
| rc | Return status code |
Definition at line 546 of file usb.c.
References DBGC, ENODEV, usb_device::ep, usb_endpoint::fill, usb_endpoint::halted, usb_endpoint::host, iob_len(), list_empty, usb_endpoint::mtu, usb_device::name, port, usb_device::port, rc, usb_endpoint_host_operations::stream, strerror(), usb_endpoint::usb, usb_port::usb, usb_endpoint_name(), and usb_endpoint_reset().
Referenced by acm_out_transmit(), axge_out_transmit(), dm96xx_out_transmit(), ecm_out_transmit(), efi_usb_sync_transfer(), imux_tx(), iphone_out_transmit(), ncm_out_transmit(), smsc75xx_out_transmit(), smsc95xx_out_transmit(), usb_refill_limit(), usbblk_out_command(), and usbblk_out_data().
|
extern |
Complete transfer (possibly with error)
| ep | USB endpoint |
| iobuf | I/O buffer |
| rc | Completion status code |
Definition at line 587 of file usb.c.
References assert, usb_endpoint_driver_operations::complete, DBGC, usb_endpoint::driver, usb_device::ep, usb_endpoint::fill, usb_endpoint::halted, list_add_tail, list_del, usb_device::name, usb_endpoint::open, rc, strerror(), usb_endpoint::usb, usb_endpoint_name(), and usb_halted.
Referenced by ehci_endpoint_close(), ehci_endpoint_poll(), uhci_endpoint_close(), uhci_endpoint_poll(), usb_complete(), usbio_bulk_in_poll(), usbio_bulk_out_poll(), usbio_control_poll(), usbio_endpoint_close(), xhci_endpoint_close(), and xhci_transfer().
|
inlinestatic |
Initialise USB endpoint refill.
| ep | USB endpoint |
| reserve | Refill buffer reserved header length |
| len | Refill buffer payload length (zero for endpoint's MTU) |
| max | Maximum fill level |
Definition at line 617 of file usb.h.
References INIT_LIST_HEAD, len, usb_endpoint::len, max, usb_endpoint::max, usb_endpoint::recycled, and usb_endpoint::reserve.
Referenced by acm_probe(), axge_probe(), dm96xx_probe(), ecm_probe(), efi_usb_async_start(), hub_probe(), imux_probe(), iphone_probe(), lan78xx_probe(), ncm_in_prefill(), ncm_probe(), smsc75xx_probe(), smsc95xx_probe(), smscusb_init(), usbblk_probe(), and usbkbd_probe().
|
inlinestatic |
Recycle I/O buffer.
| ep | USB endpoint |
| iobuf | I/O buffer |
Definition at line 633 of file usb.h.
References io_buffer::list, list_add_tail, and usb_endpoint::recycled.
Referenced by efi_usb_async_complete(), hub_complete(), ncm_in_complete(), and usbkbd_complete().
|
extern |
Prefill endpoint recycled buffer list.
| ep | USB endpoint |
| rc | Return status code |
Definition at line 620 of file usb.c.
References alloc_iob(), assert, ENOMEM, fill, usb_endpoint::fill, iob_reserve, len, usb_endpoint::len, io_buffer::list, list_add_tail, list_empty, usb_endpoint::max, usb_endpoint::mtu, rc, usb_endpoint::recycled, usb_endpoint::reserve, and usb_flush().
Referenced by efi_usb_async_start(), and ncm_in_prefill().
|
extern |
Refill endpoint up to specified limit.
| ep | USB endpoint |
| max | Fill limit |
| rc | Return status code |
Definition at line 661 of file usb.c.
References alloc_iob(), assert, ENOMEM, usb_endpoint::fill, iob_len(), iob_put, iob_reserve, len, usb_endpoint::len, io_buffer::list, list_add, list_del, list_empty, list_first_entry, max, usb_endpoint::max, usb_endpoint::mtu, NULL, usb_endpoint::open, rc, usb_endpoint::recycled, usb_endpoint::reserve, and usb_stream().
Referenced by usb_refill(), and usbblk_in_refill().
|
extern |
Refill endpoint.
| ep | USB endpoint |
| rc | Return status code |
Definition at line 711 of file usb.c.
References usb_endpoint::max, and usb_refill_limit().
Referenced by efi_usb_timer(), hub_refill(), usbhid_open(), usbhid_refill(), usbkbd_iskey(), usbnet_open(), and usbnet_refill().
|
extern |
Discard endpoint recycled buffer list.
| ep | USB endpoint |
Definition at line 720 of file usb.c.
References assert, free_iob(), io_buffer::list, list_del, list_for_each_entry_safe, usb_endpoint::max, usb_endpoint::open, usb_endpoint::recycled, and tmp.
Referenced by ncm_open(), usb_endpoint_close(), usb_endpoint_open(), and usb_prefill().
|
inlinestatic |
Set USB function driver private data.
| func | USB function |
| priv | Driver private data |
Definition at line 707 of file usb.h.
References priv, and usb_function::priv.
Referenced by acm_probe(), axge_probe(), dm96xx_probe(), ecm_probe(), efi_usb_probe(), hub_probe(), imux_probe(), iphone_probe(), lan78xx_probe(), ncm_probe(), smsc75xx_probe(), smsc95xx_probe(), usbblk_probe(), and usbkbd_probe().
|
inlinestatic |
Get USB function driver private data.
| function | USB function |
| priv | Driver private data |
Definition at line 718 of file usb.h.
References usb_function::priv.
Referenced by acm_remove(), axge_remove(), dm96xx_remove(), ecm_remove(), efi_usb_remove(), hub_remove(), imux_remove(), iphone_remove(), lan78xx_remove(), ncm_remove(), smsc75xx_remove(), smsc95xx_remove(), usbblk_remove(), and usbkbd_remove().
|
inlinestatic |
Set USB device host controller private data.
| usb | USB device |
| priv | Host controller private data |
Definition at line 784 of file usb.h.
References priv, and usb_device::priv.
Referenced by ehci_device_open(), uhci_device_open(), usbio_device_open(), and xhci_device_open().
|
inlinestatic |
Get USB device host controller private data.
| usb | USB device |
| priv | Host controller private data |
Definition at line 795 of file usb.h.
References usb_device::priv.
Referenced by ehci_device_address(), ehci_device_close(), ehci_endpoint_open(), uhci_device_address(), uhci_device_close(), uhci_endpoint_open(), xhci_device_address(), xhci_device_close(), xhci_device_open(), xhci_endpoint_open(), and xhci_hub_open().
|
inlinestatic |
Get USB endpoint.
| usb | USB device |
| address | Endpoint address |
| ep | USB endpoint, or NULL if not opened |
Definition at line 806 of file usb.h.
References address, usb_device::ep, usb_endpoint::usb, and USB_ENDPOINT_IDX.
Referenced by ehci_device_address(), and uhci_device_address().
|
inlinestatic |
Set USB hub driver private data.
| hub | USB hub |
| priv | Driver private data |
Definition at line 937 of file usb.h.
References priv, and usb_hub::priv.
Referenced by ehci_probe(), hub_probe(), uhci_probe(), usbio_start(), and xhci_register().
|
inlinestatic |
Get USB hub driver private data.
| hub | USB hub |
| priv | Driver private data |
Definition at line 948 of file usb.h.
References usb_hub::priv.
Referenced by ehci_root_clear_tt(), ehci_root_close(), ehci_root_disable(), ehci_root_enable(), ehci_root_open(), ehci_root_poll(), ehci_root_speed(), hub_clear_tt(), hub_close(), hub_disable(), hub_enable(), hub_open(), hub_speed(), uhci_root_clear_tt(), uhci_root_disable(), uhci_root_enable(), uhci_root_poll(), uhci_root_speed(), xhci_root_clear_tt(), xhci_root_disable(), xhci_root_enable(), xhci_root_open(), and xhci_root_speed().
|
inlinestatic |
Get USB port.
| hub | USB hub |
| address | Port address |
| port | USB port |
Definition at line 960 of file usb.h.
References address, usb_port::hub, and usb_hub::port.
Referenced by alloc_usb_hub(), ehci_probe(), free_usb_hub(), hub_remove(), register_usb_hub(), uhci_probe(), unregister_usb_hub(), usbio_start(), xhci_port_status(), xhci_register(), and xhci_root_open().
|
inlinestatic |
Set USB bus host controller private data.
| bus | USB bus |
| priv | Host controller private data |
Definition at line 1051 of file usb.h.
Referenced by ehci_probe(), uhci_probe(), usbio_start(), and xhci_register().
|
inlinestatic |
Get USB bus host controller private data.
| bus | USB bus |
| priv | Host controller private data |
Definition at line 1062 of file usb.h.
References bus.
Referenced by ehci_bus_close(), ehci_bus_open(), ehci_bus_poll(), ehci_device_open(), uhci_bus_close(), uhci_bus_open(), uhci_bus_poll(), uhci_device_open(), usbio_bus_poll(), usbio_device_open(), usbio_endpoint_open(), xhci_bus_close(), xhci_bus_open(), xhci_bus_poll(), and xhci_device_open().
|
inlinestatic |
Poll USB bus.
| bus | USB bus |
Definition at line 1072 of file usb.h.
References bus.
Referenced by acm_poll(), axge_poll(), dm96xx_poll(), ecm_poll(), efi_usb_sync_transfer(), efi_usb_timer(), ehci_poll_companions(), imux_step(), iphone_poll(), ncm_poll(), register_usb_hub(), smsc75xx_poll(), smsc95xx_poll(), usb_control(), usb_step(), and usbkbd_iskey().
|
inlinestatic |
Complete transfer (without error)
| ep | USB endpoint |
| iobuf | I/O buffer |
Definition at line 1087 of file usb.h.
References usb_complete_err().
Referenced by ehci_endpoint_poll(), uhci_endpoint_poll(), usbio_bulk_in_poll(), usbio_bulk_out_poll(), usbio_control_poll(), usbio_interrupt_poll(), and xhci_transfer().
|
extern |
Issue USB control transaction.
| usb | USB device |
| request | Request |
| value | Value parameter |
| index | Index parameter |
| data | Data buffer (if any) |
| len | Length of data |
| rc | Return status code |
Definition at line 784 of file usb.c.
References alloc_iob(), assert, bus, usb_hub::bus, usb_device::complete, usb_device::control, data, io_buffer::data, DBGC, DBGC_HDA, ENOMEM, ETIMEDOUT, free_iob(), usb_port::hub, index, iob_len(), iob_pull, iob_put, iob_reserve, len, io_buffer::list, list_del, list_first_entry, mdelay(), memcpy(), memset(), usb_device::name, usb_device::port, rc, usb_control_pseudo_header::rc, request, strerror(), usb_endpoint::usb, USB_CONTROL_MAX_WAIT_MS, USB_DIR_IN, usb_endpoint_reset(), usb_message(), usb_poll(), and value.
Referenced by axge_read_register(), axge_write_register(), cdc_get_encapsulated_response(), cdc_send_encapsulated_command(), dm96xx_read_registers(), dm96xx_write_register(), dm96xx_write_registers(), ecm_open(), efi_usb_control_transfer(), iphone_check_link(), iphone_probe(), ncm_open(), ncm_probe(), smscusb_get_statistics(), smscusb_raw_readl(), smscusb_raw_writel(), usb_clear_feature(), usb_get_descriptor(), usb_get_status(), usb_hub_clear_tt_buffer(), usb_hub_set_hub_depth(), usb_set_address(), usb_set_configuration(), usb_set_feature(), usb_set_interface(), usbblk_open(), usbhid_set_idle(), usbhid_set_protocol(), and usbhid_set_report().
|
extern |
Get USB string descriptor.
| usb | USB device |
| index | String index |
| language | Language ID, or 0 to use default |
| buf | Data buffer |
| len | Length of buffer |
| len | String length (excluding NUL), or negative error |
Definition at line 916 of file usb.c.
References __attribute__, desc, EINVAL, ENOMEM, free, header, index, usb_device::language, le16_to_cpu, len, malloc(), memset(), rc, usb_get_default_language(), usb_get_descriptor(), and USB_STRING_DESCRIPTOR.
Referenced by ecm_fetch_mac(), and usb_settings_fetch().
|
inlinestatic |
Get status.
| usb | USB device |
| type | Request type |
| index | Target index |
| data | Status to fill in |
| len | Length of status descriptor |
| rc | Return status code |
Definition at line 1110 of file usb.h.
References data, index, len, type, usb_control(), and USB_GET_STATUS.
Referenced by usb_hub_get_port_status().
|
inlinestatic |
Clear feature.
| usb | USB device |
| type | Request type |
| feature | Feature selector |
| index | Target index |
| rc | Return status code |
Definition at line 1127 of file usb.h.
References index, NULL, type, USB_CLEAR_FEATURE, and usb_control().
Referenced by usb_endpoint_clear_halt(), and usb_hub_clear_port_feature().
|
inlinestatic |
Set feature.
| usb | USB device |
| type | Request type |
| feature | Feature selector |
| index | Target index |
| rc | Return status code |
Definition at line 1144 of file usb.h.
References index, NULL, type, usb_control(), and USB_SET_FEATURE.
Referenced by usb_hub_set_port_feature().
|
inlinestatic |
Set address.
| usb | USB device |
| address | Device address |
| rc | Return status code |
Definition at line 1159 of file usb.h.
References address, NULL, usb_control(), and USB_SET_ADDRESS.
Referenced by ehci_device_address(), and uhci_device_address().
|
inlinestatic |
Get USB descriptor.
| usb | USB device |
| type | Request type |
| desc | Descriptor type |
| index | Descriptor index |
| language | Language ID (for string descriptors) |
| data | Descriptor to fill in |
| len | Maximum length of descriptor |
| rc | Return status code |
Definition at line 1177 of file usb.h.
References data, desc, index, len, type, usb_control(), and USB_GET_DESCRIPTOR.
Referenced by efi_usb_get_string_descriptor(), efi_usb_probe(), usb_get_config_descriptor(), usb_get_default_language(), usb_get_device_descriptor(), usb_get_mtu(), usb_get_string_descriptor(), and usb_hub_get_descriptor().
|
inlinestatic |
Get first part of USB device descriptor (up to and including MTU)
| usb | USB device |
| data | Device descriptor to (partially) fill in |
| rc | Return status code |
Definition at line 1194 of file usb.h.
References data, mtu, offsetof, typeof(), USB_DEVICE_DESCRIPTOR, and usb_get_descriptor().
Referenced by register_usb().
|
inlinestatic |
Get USB device descriptor.
| usb | USB device |
| data | Device descriptor to fill in |
| rc | Return status code |
Definition at line 1210 of file usb.h.
References data, USB_DEVICE_DESCRIPTOR, and usb_get_descriptor().
Referenced by register_usb().
|
inlinestatic |
Get USB configuration descriptor.
| usb | USB device |
| index | Configuration index |
| data | Configuration descriptor to fill in |
| rc | Return status code |
Definition at line 1226 of file usb.h.
References data, index, len, USB_CONFIGURATION_DESCRIPTOR, and usb_get_descriptor().
Referenced by usb_config_descriptor().
|
inlinestatic |
Set USB configuration.
| usb | USB device |
| index | Configuration index |
| rc | Return status code |
Definition at line 1242 of file usb.h.
References index, NULL, usb_control(), and USB_SET_CONFIGURATION.
Referenced by axge_open(), usb_autoconfigure(), and usb_deconfigure().
|
inlinestatic |
Set USB interface alternate setting.
| usb | USB device |
| interface | Interface number |
| alternate | Alternate setting |
| rc | Return status code |
Definition at line 1256 of file usb.h.
References alternate, NULL, usb_control(), and USB_SET_INTERFACE.
Referenced by usbnet_close(), and usbnet_open().
|
inlinestatic |
Get USB depth.
| usb | USB device |
| depth | Hub depth |
Definition at line 1269 of file usb.h.
References usb_port::hub, usb_device::port, and usb_hub::usb.
Referenced by efi_usb_path(), and hub_probe().
|
extern |
Locate USB interface descriptor.
| config | Configuraton descriptor |
| interface | Interface number |
| alternate | Alternate setting |
| desc | Interface descriptor, or NULL if not found |
Definition at line 144 of file usb.c.
References alternate, desc, for_each_config_descriptor, NULL, and USB_INTERFACE_DESCRIPTOR.
Referenced by ecm_probe(), efi_usb_get_interface_descriptor(), ncm_probe(), usbblk_probe(), usbhid_describe(), usbnet_comms_describe(), and usbnet_data_describe().
|
extern |
Locate USB endpoint descriptor.
| config | Configuration descriptor |
| interface | Interface descriptor |
| type | Endpoint (internal) type |
| index | Endpoint index |
| desc | Descriptor, or NULL if not found |
Definition at line 168 of file usb.c.
References usb_endpoint_descriptor::attributes, desc, direction, for_each_interface_descriptor, index, NULL, type, USB_DIR_IN, USB_ENDPOINT_ATTR_TYPE_MASK, and USB_ENDPOINT_DESCRIPTOR.
Referenced by usb_endpoint_described().
|
extern |
Locate USB endpoint companion descriptor.
| config | Configuration descriptor |
| desc | Endpoint descriptor |
| descx | Companion descriptor, or NULL if not found |
Definition at line 195 of file usb.c.
References container_of, desc, header, usb_endpoint_companion_descriptor::header, NULL, usb_descriptor_header::type, USB_ENDPOINT_COMPANION_DESCRIPTOR, usb_is_within_config(), and usb_next_descriptor().
Referenced by usb_endpoint_described().
|
extern |
Find USB device by address.
| bus | USB bus |
| address | Device address |
| usb | USB device, or NULL if not found |
Definition at line 1735 of file usb.c.
References address, usb_device::address, bus, usb_device::list, list_for_each_entry, and NULL.
Referenced by usb_find_next(), and usb_settings_fetch().
|
extern |
Allocate USB hub.
| bus | USB bus |
| usb | Underlying USB device, if any |
| ports | Number of ports |
| driver | Hub driver operations |
| hub | USB hub, or NULL on allocation failure |
Definition at line 1937 of file usb.c.
References bus, usb_hub::bus, usb_hub::driver, usb_hub::host, usb_port::hub, INIT_LIST_HEAD, usb_device::name, usb_hub::name, NULL, port, usb_device::port, usb_hub::port, usb_hub::ports, usb_hub::protocol, usb_port::protocol, usb_hub::usb, usb_port::usb, usb_port(), and zalloc().
Referenced by alloc_usb_bus(), and hub_probe().
|
extern |
Register USB hub.
| hub | USB hub |
| rc | Return status code |
Definition at line 1976 of file usb.c.
References bus, usb_hub::bus, usb_hub_driver_operations::close, usb_hub_host_operations::close, DBGC, usb_hub::driver, usb_hub::host, usb_bus::hub, usb_port::hub, usb_hub::list, list_add_tail, list_del, mdelay(), usb_hub::name, usb_hub_driver_operations::open, usb_hub_host_operations::open, port, usb_hub::ports, rc, strerror(), usb_poll(), usb_port(), usb_port_changed(), and USB_PORT_DELAY_MS.
Referenced by hub_probe(), and register_usb_bus().
|
extern |
Unregister USB hub.
| hub | USB hub |
Definition at line 2030 of file usb.c.
References usb_hub_driver_operations::close, usb_hub_host_operations::close, usb_hub::driver, usb_hub::host, usb_port::hub, INIT_LIST_HEAD, usb_hub::list, list_del, port, usb_hub::ports, usb_detached(), and usb_port().
Referenced by hub_probe(), hub_remove(), register_usb_bus(), and unregister_usb_bus().
|
extern |
Free USB hub.
| hub | USB hub |
Definition at line 2063 of file usb.c.
References assert, free, usb_port::hub, list_empty, NULL, port, usb_hub::ports, and usb_port().
Referenced by alloc_usb_bus(), free_usb_bus(), hub_probe(), and hub_remove().
|
extern |
Report port status change.
| port | USB port |
Definition at line 1858 of file usb.c.
References list_add_tail, list_del, port, and usb_changed.
Referenced by ehci_root_poll(), hub_complete(), register_usb_hub(), uhci_root_poll(), and xhci_port_status().
|
extern |
Allocate USB bus.
| dev | Underlying hardware device |
| ports | Number of root hub ports |
| mtu | Largest transfer allowed on the bus |
| op | Host controller operations |
| bus | USB bus, or NULL on allocation failure |
Definition at line 2095 of file usb.c.
References alloc_usb_hub(), bus, usb_bus::dev, free, free_usb_hub(), INIT_LIST_HEAD, mtu, device::name, NULL, op, and zalloc().
Referenced by ehci_probe(), uhci_probe(), usbio_start(), and xhci_register().
|
extern |
Register USB bus.
| bus | USB bus |
| rc | Return status code |
Definition at line 2131 of file usb.c.
References assert, bus, find_usb_bus(), list_add_tail, list_del, NULL, rc, register_usb_hub(), unregister_usb_hub(), usb_buses, and usb_hotplug().
Referenced by ehci_probe(), REQUIRING_SYMBOL(), uhci_probe(), usbio_start(), and xhci_register().
|
extern |
Unregister USB bus.
| bus | USB bus |
Definition at line 2171 of file usb.c.
References assert, bus, list_del, list_empty, NULL, and unregister_usb_hub().
Referenced by ehci_probe(), ehci_remove(), uhci_probe(), uhci_remove(), usbio_start(), usbio_stop(), xhci_register(), and xhci_unregister().
|
extern |
Free USB bus.
| bus | USB bus |
Definition at line 2195 of file usb.c.
References assert, bus, usb_hub::bus, usb_port::changed, free, free_usb_hub(), usb_port::hub, list_empty, list_for_each_entry, port, usb_device::port, usb_endpoint::usb, usb_changed, and usb_halted.
Referenced by ehci_probe(), ehci_remove(), uhci_probe(), uhci_remove(), usbio_start(), usbio_stop(), xhci_register(), and xhci_unregister().
|
extern |
Find USB bus by address.
| address | Bus address |
| bus | USB bus, or NULL |
Definition at line 2220 of file usb.c.
References address, bus, for_each_usb_bus, and NULL.
Referenced by register_usb_bus(), usb_find_next(), and usb_settings_fetch().
|
extern |
Find USB bus by device location.
| bus_type | Bus type |
| location | Bus location |
| bus | USB bus, or NULL |
Definition at line 2238 of file usb.c.
References bus, for_each_usb_bus, and NULL.
Referenced by uhci_root_speed().
|
extern |
Allocate device address.
| bus | USB bus |
| address | Device address, or negative error |
Definition at line 2264 of file usb.c.
References address, bus, ENOENT, and ffsll.
Referenced by ehci_device_address(), and uhci_device_address().
|
extern |
Free device address.
| bus | USB bus |
| address | Device address |
Definition at line 2284 of file usb.c.
References address, assert, and bus.
Referenced by ehci_device_address(), ehci_device_close(), uhci_device_address(), and uhci_device_close().
|
extern |
Find next USB device.
| usb | USB device to fill in |
| busdev | Starting bus:dev address |
| busdev | Bus:dev address of next USB device |
| rc | Return status code |
Definition at line 2302 of file usb.c.
References bus, ENODEV, find_usb(), find_usb_bus(), USB_BUS, and USB_DEV.
Referenced by usbscan_exec().
|
extern |
Get USB route string.
| usb | USB device |
| route | USB route string |
Definition at line 2336 of file usb.c.
References usb_port::address, usb_port::hub, usb_device::port, route(), and usb_hub::usb.
Referenced by xhci_device_address().
|
extern |
Get USB root hub port.
| usb | USB device |
| port | Root hub port |
Definition at line 2356 of file usb.c.
References usb_port::hub, usb_device::port, and usb_hub::usb.
Referenced by xhci_device_address(), and xhci_device_open().
|
extern |
Get USB transaction translator.
| usb | USB device |
| port | Transaction translator port, or NULL |
Definition at line 2372 of file usb.c.
References usb_port::hub, NULL, usb_device::port, usb_device::speed, usb_hub::usb, and USB_SPEED_FULL.
Referenced by ehci_endpoint_capabilities(), usb_endpoint_clear_tt(), and xhci_device_open().
|
extern |
Find USB device driver.
| desc | Function descriptor |
| id | USB device ID, or NULL |
| driver | USB device driver, or NULL |
Definition at line 1167 of file usb.c.
References usb_class_id::class, usb_driver::class, desc, for_each_table_entry, usb_driver::id_count, usb_driver::ids, usb_class_id::mask, NULL, usb_class_descriptor::scalar, USB_ANY_ID, and USB_DRIVERS.
Referenced by usb_probe(), usb_score(), and usbio_supported().
|
extern |