18#define USB_HUB_RECIP_PORT ( 3 << 0 )
35#define USB_HUB_DESCRIPTOR 41
50#define USB_HUB_DESCRIPTOR_ENHANCED 42
71#define USB_HUB_PORT_CONNECTION 0
74#define USB_HUB_PORT_ENABLE 1
77#define USB_HUB_PORT_RESET 4
80#define USB_HUB_PORT_POWER 8
83#define USB_HUB_PORT_LOW_SPEED 9
86#define USB_HUB_PORT_HIGH_SPEED 10
89#define USB_HUB_C_PORT_CONNECTION 16
92#define USB_HUB_C_PORT_ENABLE 17
95#define USB_HUB_C_PORT_SUSPEND 18
98#define USB_HUB_C_PORT_OVER_CURRENT 19
101#define USB_HUB_C_PORT_RESET 20
104#define USB_HUB_C_PORT_LINK_STATE 25
107#define USB_HUB_C_PORT_CONFIG_ERROR 26
110#define USB_HUB_C_FEATURE( bit ) ( 16 + (bit) )
113#define USB_HUB_FEATURES \
114 ( ( 1 << USB_HUB_C_PORT_CONNECTION ) | \
115 ( 1 << USB_HUB_C_PORT_ENABLE ) | \
116 ( 1 << USB_HUB_C_PORT_SUSPEND ) | \
117 ( 1 << USB_HUB_C_PORT_OVER_CURRENT ) | \
118 ( 1 << USB_HUB_C_PORT_RESET ) )
121#define USB_HUB_FEATURES_ENHANCED \
122 ( ( 1 << USB_HUB_C_PORT_CONNECTION ) | \
123 ( 1 << USB_HUB_C_PORT_OVER_CURRENT ) | \
124 ( 1 << USB_HUB_C_PORT_RESET ) | \
125 ( 1 << USB_HUB_C_PORT_LINK_STATE ) | \
126 ( 1 << USB_HUB_C_PORT_CONFIG_ERROR ) )
129#define USB_HUB_SET_HUB_DEPTH \
130 ( USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_DEVICE | \
131 USB_REQUEST_TYPE ( 12 ) )
134#define USB_HUB_CLEAR_TT_BUFFER \
135 ( USB_DIR_OUT | USB_TYPE_CLASS | USB_HUB_RECIP_PORT | \
136 USB_REQUEST_TYPE ( 8 ) )
154 len = ( enhanced ?
sizeof (
data->enhanced ) :
sizeof (
data->basic ) );
235 unsigned int endpoint,
unsigned int attributes,
236 unsigned int tt_port ) {
249#define USB_HUB_TT_SINGLE 1
271#define USB_HUB_SLOW_START 0x0001
274#define USB_HUB_SLOW_START_DELAY_MS 500
280#define USB_HUB_INTR_FILL 4
286#define USB_HUB_ENABLE_MAX_WAIT_MS 100
#define NULL
NULL pointer (VOID *)
pseudo_bit_t value[0x00020]
uint8_t data[48]
Additional event data.
struct ena_llq_option desc
Descriptor counts.
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
#define FILE_SECBOOT(_status)
Declare a file's UEFI Secure Boot permission status.
Universal Serial Bus (USB)
#define USB_ENDPOINT_MAX
Maximum endpoint number.
static int usb_clear_feature(struct usb_device *usb, unsigned int type, unsigned int feature, unsigned int index)
Clear feature.
#define USB_ENDPOINT_IN
Endpoint direction is in.
static int usb_set_feature(struct usb_device *usb, unsigned int type, unsigned int feature, unsigned int index)
Set feature.
#define USB_ENDPOINT_ATTR_TYPE_MASK
Endpoint attribute transfer type mask.
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_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.
#define USB_TYPE_CLASS
Class-specific request type.
A basic USB hub descriptor.
uint8_t current
Controller current (in mA)
uint8_t delay
Power-on delay (in 2ms intervals.
struct usb_descriptor_header header
Descriptor header.
uint8_t ports
Number of ports.
uint16_t characteristics
Characteristics.
An enhanced USB hub descriptor.
uint16_t removable
Removable device bitmask.
uint8_t latency
Header decode latency.
uint16_t delay
Maximum delay.
struct usb_hub_descriptor_basic basic
Basic USB hub descriptor.
struct usb_endpoint intr
Interrupt endpoint.
struct process refill
Interrupt endpoint refill process.
struct usb_hub * hub
USB hub.
struct usb_device * usb
USB device.
unsigned int features
Features.
uint16_t current
Current status.
uint16_t changed
Changed status.
struct usb_hub_descriptor_enhanced enhanced
Enhanced hub descriptor.
struct usb_descriptor_header header
Descriptor header.
struct usb_hub_descriptor_basic basic
Basic hub descriptor.
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.
#define USB_HUB_SET_HUB_DEPTH
Set hub depth.
static int usb_hub_set_hub_depth(struct usb_device *usb, unsigned int depth)
Set hub depth.
static int usb_hub_set_port_feature(struct usb_device *usb, unsigned int port, unsigned int feature, unsigned int index)
Set port feature.
static int usb_hub_clear_port_feature(struct usb_device *usb, unsigned int port, unsigned int feature, unsigned int index)
Clear port feature.
static int usb_hub_get_port_status(struct usb_device *usb, unsigned int port, struct usb_hub_port_status *status)
Get port status.
static int usb_hub_get_descriptor(struct usb_device *usb, int enhanced, union usb_hub_descriptor *data)
Get hub descriptor.
#define USB_HUB_CLEAR_TT_BUFFER
Clear transaction translator buffer.
#define USB_HUB_DESCRIPTOR
A basic USB hub descriptor.
#define USB_HUB_RECIP_PORT
Request recipient is a port.
#define USB_HUB_DESCRIPTOR_ENHANCED
An enhanced USB hub descriptor.
static int usb_hub_clear_tt_buffer(struct usb_device *usb, unsigned int device, unsigned int endpoint, unsigned int attributes, unsigned int tt_port)
Clear transaction translator buffer.