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 2002 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _SYS_USB_OHCI_HUB_H
28 #define	_SYS_USB_OHCI_HUB_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 /*
37  * Open Host Controller Driver (OHCI)
38  *
39  * The USB Open Host Controller driver is a software driver which interfaces
40  * to the Universal Serial Bus layer (USBA) and the USB Open Host Controller.
41  * The interface to USB Open Host Controller is defined by the OpenHCI  Host
42  * Controller Interface.
43  *
44  * This header file describes the data structures required for the USB Open
45  * Host Controller Driver to maintain state of USB Open Host Controller, to
46  * perform different USB transfers and for the bandwidth allocations.
47  */
48 
49 /*
50  * Root hub information structure
51  *
52  * The Root hub is a Universal Serial Bus hub attached directly to the
53  * Host Controller (HC) and all the internal registers of the root hub
54  * are exposed to the Host Controller Driver (HCD) which is responsible
55  * for providing the proper hub-class protocol with the  USB driver and
56  * proper control of the root hub. This structure contains information
57  * about the root hub and its ports.
58  */
59 typedef struct ohci_root_hub {
60 	usb_hub_descr_t	rh_descr;	/* Copy of rh descriptor */
61 	uint_t		rh_des_A;	/* Descriptor reg A value */
62 	uint_t		rh_des_B;	/* Descriptor reg B value */
63 	uint_t		rh_status;	/* Last root hub status */
64 
65 	/* Last state & status for each root hub port */
66 	uint_t		rh_port_status[OHCI_MAX_RH_PORTS];
67 	uint_t		rh_port_state[OHCI_MAX_RH_PORTS];
68 
69 	/* Root hub control pipe handle */
70 	usba_pipe_handle_data_t *rh_ctrl_pipe_handle;
71 
72 	/* Current control request pointer */
73 	usb_ctrl_req_t	*rh_curr_ctrl_reqp;
74 
75 	/* Root hub control pipe state */
76 	uint_t		rh_ctrl_pipe_state;
77 
78 	/* Root hub interrupt pipe handle */
79 	usba_pipe_handle_data_t *rh_intr_pipe_handle;
80 
81 	/* Current interrupt request pointer */
82 	usb_intr_req_t	*rh_curr_intr_reqp;
83 
84 	/* Saved original interrupt request pointer */
85 	usb_intr_req_t	*rh_client_intr_reqp;
86 
87 	/* Root hub interrupt pipe state and timer-id */
88 	uint_t		rh_intr_pipe_state;
89 	timeout_id_t	rh_intr_pipe_timer_id;
90 } ohci_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 downstream data */
97 #define	ENABLED		0x04		/* Downstream data is enabled */
98 #define	SUSPEND		0x05		/* Suspended port */
99 
100 /*
101  * Time waits for the different OHCI specific operations.
102  * These timeout values are specified in terms of microseconds.
103  */
104 #define	OHCI_RH_POLL_TIME	30000	/* Root hub polling interval */
105 
106 #ifdef __cplusplus
107 }
108 #endif
109 
110 #endif /* _SYS_USB_OHCI_HUB_H */
111