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 (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef _SYS_USB_OHCI_HUB_H
27 #define	_SYS_USB_OHCI_HUB_H
28 
29 
30 #ifdef	__cplusplus
31 extern "C" {
32 #endif
33 
34 /*
35  * Open Host Controller Driver (OHCI)
36  *
37  * The USB Open Host Controller driver is a software driver which interfaces
38  * to the Universal Serial Bus layer (USBA) and the USB Open Host Controller.
39  * The interface to USB Open Host Controller is defined by the OpenHCI  Host
40  * Controller Interface.
41  *
42  * This header file describes the data structures required for the USB Open
43  * Host Controller Driver to maintain state of USB Open Host Controller, to
44  * perform different USB transfers and for the bandwidth allocations.
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 ohci_root_hub {
58 	usb_hub_descr_t	rh_descr;	/* Copy of rh descriptor */
59 	uint_t		rh_des_A;	/* Descriptor reg A value */
60 	uint_t		rh_des_B;	/* Descriptor reg B value */
61 	uint_t		rh_status;	/* Last root hub status */
62 
63 	/* Last state & status for each root hub port */
64 	uint_t		rh_port_status[OHCI_MAX_RH_PORTS];
65 	uint_t		rh_port_state[OHCI_MAX_RH_PORTS];
66 
67 	/* Root hub control pipe handle */
68 	usba_pipe_handle_data_t *rh_ctrl_pipe_handle;
69 
70 	/* Current control request pointer */
71 	usb_ctrl_req_t	*rh_curr_ctrl_reqp;
72 
73 	/* Root hub control pipe state */
74 	uint_t		rh_ctrl_pipe_state;
75 
76 	/* Root hub interrupt pipe handle */
77 	usba_pipe_handle_data_t *rh_intr_pipe_handle;
78 
79 	/* Current interrupt request pointer */
80 	usb_intr_req_t	*rh_curr_intr_reqp;
81 
82 	/* Saved original interrupt request pointer */
83 	usb_intr_req_t	*rh_client_intr_reqp;
84 
85 	/* Root hub interrupt pipe state and timer-id */
86 	uint_t		rh_intr_pipe_state;
87 	timeout_id_t	rh_intr_pipe_timer_id;
88 } ohci_root_hub_t;
89 
90 /* Port States */
91 #define	UNINIT		0x00		/* Uninitialized port */
92 #define	POWERED_OFF	0x01		/* Port has no power */
93 #define	DISCONNECTED	0x02		/* Port has power, no dev */
94 #define	DISABLED	0x03		/* Dev connected, no downstream data */
95 #define	ENABLED		0x04		/* Downstream data is enabled */
96 #define	SUSPEND		0x05		/* Suspended port */
97 
98 /*
99  * Time waits for the different OHCI specific operations.
100  * These timeout values are specified in terms of microseconds.
101  */
102 #define	OHCI_RH_POLL_TIME	30000	/* Root hub polling interval */
103 
104 #ifdef __cplusplus
105 }
106 #endif
107 
108 #endif /* _SYS_USB_OHCI_HUB_H */
109