51 DBGC ( hubdev,
"HUB %s could not refill interrupt: %s\n",
87 DBGC ( hubdev,
"HUB %s interrupt failed: %s\n",
94 for ( i = 1 ; i <= hub->
ports ; i++ ) {
98 DBGC ( hubdev,
"HUB %s underlength interrupt:\n",
105 if (
data[ i / 8 ] & ( 1 << ( i % 8 ) ) ) {
106 DBGC2 ( hubdev,
"HUB %s port %d status changed\n",
139 for ( i = 1 ; i <= hub->
ports ; i++ ) {
143 DBGC ( hubdev,
"HUB %s port %d could not apply power: " 151 DBGC ( hubdev,
"HUB %s could not register interrupt: %s\n",
208 DBGC ( hubdev,
"HUB %s port %d could not initiate reset: %s\n",
219 DBGC ( hubdev,
"HUB %s port %d could not get status: " 220 "%s\n", hubdev->
name,
port->address,
232 DBGC ( hubdev,
"HUB %s port %d timed out waiting for enable\n",
254 DBGC ( hubdev,
"HUB %s port %d could not disable: %s\n",
281 if ( ! ( changed & ( 1 <<
bit ) ) )
292 DBGC ( hubdev,
"HUB %s port %d could not clear feature " 320 DBGC ( hubdev,
"HUB %s port %d could not get status: %s\n",
326 DBGC2 ( hubdev,
"HUB %s port %d status is %04x:%04x\n",
375 DBGC ( hubdev,
"HUB %s port %d could not clear TT buffer: %s\n",
413 hubdev =
zalloc (
sizeof ( *hubdev ) );
431 DBGC ( hubdev,
"HUB %s has no interface descriptor\n",
440 DBGC ( hubdev,
"HUB %s could not describe interrupt endpoint: " 449 DBGC ( hubdev,
"HUB %s could not set hub depth to %d: " 451 goto err_set_hub_depth;
457 DBGC ( hubdev,
"HUB %s could not get hub descriptor: %s\n",
459 goto err_hub_descriptor;
461 ports =
desc.basic.ports;
462 DBGC ( hubdev,
"HUB %s has %d ports at depth %d%s\n", hubdev->
name,
463 ports, depth, ( enhanced ?
" (enhanced)" :
"" ) );
467 if ( ! hubdev->
hub ) {
475 DBGC ( hubdev,
"HUB %s could not register: %s\n",
477 goto err_register_hub;
511 for ( i = 1 ; i <=
hub->
ports ; i++ ) {
513 port->disconnected = 1;
532 .
name =
"avocent-hub",
#define USB_HUB_PORT_ENABLE
Port enabled/disabled feature.
#define EINVAL
Invalid argument.
static void hub_close(struct usb_hub *hub)
Close hub.
struct arbelprm_rc_send_wqe rc
void(* complete)(struct usb_endpoint *ep, struct io_buffer *iobuf, int rc)
Complete transfer.
static void * usb_func_get_drvdata(struct usb_function *func)
Get USB function driver private data.
int disconnected
Port disconnection has been detected.
static int usb_hub_get_descriptor(struct usb_device *usb, int enhanced, union usb_hub_descriptor *data)
Get hub descriptor.
#define USB_HUB_SLOW_START_DELAY_MS
Additional setting delay for out-of-spec hubs.
unsigned int features
Features.
void unregister_usb_hub(struct usb_hub *hub)
Unregister USB hub.
static int hub_clear_changes(struct usb_hub_device *hubdev, unsigned int port, uint16_t changed)
Clear port status change bits.
struct usb_endpoint intr
Interrupt endpoint.
uint64_t desc
Microcode descriptor list physical address.
struct usb_device * usb
Currently attached device (if in use)
int usb_endpoint_open(struct usb_endpoint *ep)
Open USB endpoint.
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.
#define USB_HUB_PORT_HIGH_SPEED
High-speed device attached.
unsigned int protocol
Port protocol.
#define USB_HUB_INTR_FILL
Interrupt ring fill level.
struct usb_hub_descriptor_enhanced enhanced
Enhanced hub descriptor.
static unsigned int unsigned int bit
#define USB_INTERRUPT_IN
Interrupt IN endpoint (internal) type.
static int usb_hub_get_port_status(struct usb_device *usb, unsigned int port, struct usb_hub_port_status *status)
Get port status.
void usb_endpoint_close(struct usb_endpoint *ep)
Close USB endpoint.
int open
Endpoint is open.
struct usb_device * usb
USB device.
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.
void process_del(struct process *process)
Remove process from process list.
struct process refill
Interrupt endpoint refill process.
USB hub driver operations.
int usb_refill(struct usb_endpoint *ep)
Refill endpoint.
unsigned int address
Device address, if assigned.
static struct usb_device_id hub_ids[]
USB hub device IDs.
static int hub_enable(struct usb_hub *hub, struct usb_port *port)
Enable port.
void usb_port_changed(struct usb_port *port)
Report port status change.
union ena_feature feature
Feature.
static int usb_hub_set_hub_depth(struct usb_device *usb, unsigned int depth)
Set hub depth.
static int hub_clear_tt(struct usb_hub *hub, struct usb_port *port, struct usb_endpoint *ep)
Clear transaction translator buffer.
struct usb_device_id * id
Driver device ID.
#define USB_HUB_ENABLE_MAX_WAIT_MS
Maximum time to wait for port to become enabled.
#define USB_HUB_PORT_POWER
Port power feature.
#define ENOMEM
Not enough space.
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
A USB interface descriptor.
static int hub_open(struct usb_hub *hub)
Open hub.
struct usb_port * port
USB port.
static void usb_recycle(struct usb_endpoint *ep, struct io_buffer *iobuf)
Recycle I/O buffer.
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
#define container_of(ptr, type, field)
Get containing structure.
uint8_t intr
Interrupts enabled.
static void usb_refill_init(struct usb_endpoint *ep, size_t reserve, size_t len, unsigned int max)
Initialise USB endpoint refill.
struct usb_hub * hub
USB hub.
#define USB_HUB_TT_SINGLE
Transaction translator port value for single-TT hubs.
static int usb_hub_clear_port_feature(struct usb_device *usb, unsigned int port, unsigned int feature, unsigned int index)
Clear port feature.
static void usb_func_set_drvdata(struct usb_function *func, void *priv)
Set USB function driver private data.
unsigned int ports
Number of ports.
#define USB_HUB_C_FEATURE(bit)
Calculate feature from change bit number.
static unsigned int usb_depth(struct usb_device *usb)
Get USB depth.
void process_add(struct process *process)
Add process to process list.
static void hub_refill(struct usb_hub_device *hubdev)
Refill interrupt ring.
char * strerror(int errno)
Retrieve string representation of error number.
static void(* free)(struct refcnt *refcnt))
void * zalloc(size_t size)
Allocate cleared memory.
static size_t iob_len(struct io_buffer *iobuf)
Calculate length of data in an I/O buffer.
static struct usb_hub_driver_operations hub_operations
USB hub operations.
#define USB_CLASS_ID(base, subclass, protocol)
Construct USB class ID.
static void process_init_stopped(struct process *process, struct process_descriptor *desc, struct refcnt *refcnt)
Initialise process without adding to process list.
struct usb_device * usb
USB device.
static void usb_endpoint_init(struct usb_endpoint *ep, struct usb_device *usb, struct usb_endpoint_driver_operations *driver)
Initialise USB endpoint.
#define le16_to_cpu(value)
static struct usb_endpoint_driver_operations usb_hub_intr_operations
Interrupt endpoint operations.
#define USB_HUB_PORT_CONNECTION
Current connect status feature.
unsigned long driver_data
Arbitrary driver data.
static int process_running(struct process *process)
Check if process is running.
#define USB_CLASS_HUB
Class code for USB hubs.
static int hub_disable(struct usb_hub *hub, struct usb_port *port)
Disable port.
void free_usb_hub(struct usb_hub *hub)
Free USB hub.
uint16_t changed
Changed status.
void mdelay(unsigned long msecs)
Delay for a fixed number of milliseconds.
A USB configuration descriptor.
#define USB_HUB_PORT_LOW_SPEED
Low-speed device attached.
#define USB_HUB_FEATURES
USB features.
static volatile void * bits
#define USB_ANY_ID
Match-anything ID.
Universal Serial Bus (USB)
void * data
Start of data.
#define PROC_DESC(object_type, process, _step)
Define a process descriptor.
struct usb_hub * hub
USB hub.
struct usb_endpoint * ep[32]
Endpoint list.
static void hub_complete(struct usb_endpoint *ep, struct io_buffer *iobuf, int rc)
Complete interrupt transfer.
uint8_t data[48]
Additional event data.
static int usb_hub_set_port_feature(struct usb_device *usb, unsigned int port, unsigned int feature, unsigned int index)
Set port feature.
#define USB_HUB_PORT_RESET
Port reset feature.
int register_usb_hub(struct usb_hub *hub)
Register USB hub.
static void usb_hub_set_drvdata(struct usb_hub *hub, void *priv)
Set USB hub driver private data.
struct usb_device * usb
USB device.
#define USB_HUB_FEATURES_ENHANCED
USB features for enhanced hubs.
static struct usb_port * usb_port(struct usb_hub *hub, unsigned int address)
Get USB port.
#define USB_HUB_SLOW_START
Hub requires additional settling delay.
static void hub_remove(struct usb_function *func)
Remove USB hub.
unsigned int protocol
Hub protocol.
USB endpoint driver operations.
static int hub_speed(struct usb_hub *hub, struct usb_port *port)
Update port speed.
struct usb_bus * bus
USB bus.
uint16_t current
Current status.
#define NULL
NULL pointer (VOID *)
#define ETIMEDOUT
Connection timed out.
struct usb_driver usb_hub_driver __usb_driver
USB hub driver.
unsigned int attributes
Attributes.
uint8_t interface
Interface number.
struct bofm_section_header done
static struct process_descriptor hub_refill_desc
Refill process descriptor.
unsigned int address
Endpoint address.
static int hub_probe(struct usb_function *func, struct usb_configuration_descriptor *config)
Probe USB hub.
static void * usb_hub_get_drvdata(struct usb_hub *hub)
Get USB hub driver private data.
int(* open)(struct usb_hub *hub)
Open hub.
struct usb_device_id * ids
USB ID table.
struct usb_hub * alloc_usb_hub(struct usb_bus *bus, struct usb_device *usb, unsigned int ports, struct usb_hub_driver_operations *driver)
Allocate USB hub.