xref: /illumos-gate/usr/src/uts/common/sys/usb/hcd/ehci/ehci_hub.h (revision 355b4669e025ff377602b6fc7caaf30dbc218371)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _SYS_USB_EHCI_HUB_H
28 #define	_SYS_USB_EHCI_HUB_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 /*
37  * Enchanced Host Controller Driver (EHCI)
38  *
39  * The EHCI driver is a software driver which interfaces to the Universal
40  * Serial Bus layer (USBA) and the Host Controller (HC). The interface to
41  * the Host Controller is defined by the EHCI Host Controller Interface.
42  *
43  * This header file describes the data structures required by the EHCI
44  * Driver for the root hub operations.
45  */
46 
47 /*
48  * Root hub information structure
49  *
50  * The Root hub is a Universal Serial Bus hub attached directly to the
51  * Host Controller (HC) and all the internal registers of the root hub
52  * are exposed to the Host Controller Driver (HCD) which is responsible
53  * for providing the proper hub-class protocol with the  USB driver and
54  * proper control of the root hub. This structure contains information
55  * about the root hub and its ports.
56  */
57 typedef struct ehci_root_hub {
58 	/* Copy of the Root Hub descriptor */
59 	usb_hub_descr_t		rh_descr;
60 
61 	/* Number of Companion Controllers */
62 	uint_t			rh_companion_controllers;
63 
64 	/* Last state & status for each root hub port */
65 	uint_t			rh_port_status[EHCI_MAX_RH_PORTS];
66 	uint_t			rh_port_state[EHCI_MAX_RH_PORTS];
67 
68 	/* Root hub control pipe handle */
69 	usba_pipe_handle_data_t	*rh_ctrl_pipe_handle;
70 
71 	/* Current control request pointer */
72 	usb_ctrl_req_t		*rh_curr_ctrl_reqp;
73 
74 	/* Root hub control pipe state */
75 	uint_t			rh_ctrl_pipe_state;
76 
77 	/* Root hub interrupt pipe handle */
78 	usba_pipe_handle_data_t	*rh_intr_pipe_handle;
79 
80 	/* Current interrupt request pointer */
81 	usb_intr_req_t		*rh_curr_intr_reqp;
82 
83 	/* Saved original interrupt request pointer */
84 	usb_intr_req_t		*rh_client_intr_reqp;
85 
86 	/* Root hub interrupt pipe state and timer-id */
87 	uint_t			rh_intr_pipe_state;
88 	usb_port_mask_t		rh_intr_pending_status;
89 	timeout_id_t		rh_intr_pipe_timer_id;
90 } ehci_root_hub_t;
91 
92 /* Port States */
93 #define	UNINIT		0x00	/* Uninitialized port */
94 #define	POWERED_OFF	0x01	/* Port has no power */
95 #define	DISCONNECTED	0x02	/* Port has power, no dev */
96 #define	DISABLED	0x03	/* Dev connected, no data */
97 #define	ENABLED		0x04	/* Downstream data is enabled */
98 #define	SUSPEND		0x05	/* Suspended port */
99 
100 /*
101  * Time waits for the different EHCI Root Hub specific operations.
102  * These timeout values are specified in terms of microseconds.
103  */
104 #define	EHCI_RH_POLL_TIME		30000	/* RH polling interval */
105 #define	EHCI_PORT_RESET_TIMEWAIT	10000	/* RH port reset time */
106 #define	EHCI_PORT_RESET_COMP_TIMEWAIT	2000	/* RH port reset complete */
107 #define	EHCI_PORT_SUSPEND_TIMEWAIT	10000	/* RH port suspend time */
108 #define	EHCI_PORT_RESUME_TIMEWAIT	20000	/* RH port resume time */
109 #define	EHCI_PORT_RESUME_COMP_TIMEWAIT	2000	/* RH port resume complete */
110 
111 #ifdef __cplusplus
112 }
113 #endif
114 
115 #endif /* _SYS_USB_EHCI_HUB_H */
116