ehci_hub.h revision 2340:03a76252b501
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 2006 Sun Microsystems, Inc.  All rights reserved.
23 * Use is subject to license terms.
24 */
25
26#ifndef _SYS_USB_EHCI_HUB_H
27#define	_SYS_USB_EHCI_HUB_H
28
29#pragma ident	"%Z%%M%	%I%	%E% SMI"
30
31#ifdef	__cplusplus
32extern "C" {
33#endif
34
35/*
36 * Enchanced Host Controller Driver (EHCI)
37 *
38 * The EHCI driver is a software driver which interfaces to the Universal
39 * Serial Bus layer (USBA) and the Host Controller (HC). The interface to
40 * the Host Controller is defined by the EHCI Host Controller Interface.
41 *
42 * This header file describes the data structures required by the EHCI
43 * Driver for the root hub operations.
44 */
45
46/*
47 * Root hub information structure
48 *
49 * The Root hub is a Universal Serial Bus hub attached directly to the
50 * Host Controller (HC) and all the internal registers of the root hub
51 * are exposed to the Host Controller Driver (HCD) which is responsible
52 * for providing the proper hub-class protocol with the  USB driver and
53 * proper control of the root hub. This structure contains information
54 * about the root hub and its ports.
55 */
56typedef struct ehci_root_hub {
57	/* Copy of the Root Hub descriptor */
58	usb_hub_descr_t		rh_descr;
59
60	/* Number of Companion Controllers */
61	uint_t			rh_companion_controllers;
62
63	/* Last state & status for each root hub port */
64	uint_t			rh_port_status[EHCI_MAX_RH_PORTS];
65	uint_t			rh_port_state[EHCI_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	usb_port_mask_t		rh_intr_pending_status;
88	timeout_id_t		rh_intr_pipe_timer_id;
89} ehci_root_hub_t;
90
91/* Port States */
92#define	UNINIT		0x00	/* Uninitialized port */
93#define	POWERED_OFF	0x01	/* Port has no power */
94#define	DISCONNECTED	0x02	/* Port has power, no dev */
95#define	DISABLED	0x03	/* Dev connected, no data */
96#define	ENABLED		0x04	/* Downstream data is enabled */
97#define	SUSPEND		0x05	/* Suspended port */
98
99/*
100 * Time waits for the different EHCI Root Hub specific operations.
101 * These timeout values are specified in terms of microseconds.
102 */
103#define	EHCI_RH_POLL_TIME		30000	/* RH polling interval */
104#define	EHCI_PORT_RESET_TIMEWAIT	20000	/* RH port reset time */
105#define	EHCI_PORT_RESET_COMP_TIMEWAIT	2000	/* RH port reset complete */
106#define	EHCI_PORT_SUSPEND_TIMEWAIT	10000	/* RH port suspend time */
107#define	EHCI_PORT_RESUME_TIMEWAIT	20000	/* RH port resume time */
108#define	EHCI_PORT_RESUME_COMP_TIMEWAIT	2000	/* RH port resume complete */
109
110#ifdef __cplusplus
111}
112#endif
113
114#endif /* _SYS_USB_EHCI_HUB_H */
115