ohci_polled.h revision 7492:2387323b838f
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_POLLED_H
27#define	_SYS_USB_OHCI_POLLED_H
28
29
30#ifdef __cplusplus
31extern "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 work in POLLED mode which will be either OBP
44 * mode for Sparc architecture or PC PROM mode for X86 architecture
45 */
46
47#define	POLLED_RAW_BUF_SIZE	8
48
49/*
50 * These two  flags are used to determine if this structure is already
51 * in use.
52 */
53#define	POLLED_INPUT_MODE		0x01
54
55/*
56 * These two flags are used to determine if this structure is already in
57 * use. We should only save off the controller state information once,
58 * restore it once.  These flags are used for the ohci_polled_flags below.
59 */
60#define	POLLED_INPUT_MODE_INUSE		0x04
61
62/*
63 * For ohci bandwidth of low speed interrupt devices limits,
64 * one host controller can support 6 keyboards only.
65 */
66#define	MAX_NUM_FOR_KEYBOARD		0x6
67/*
68 * State structure for the POLLED switch off
69 */
70typedef struct ohci_polled {
71	/*
72	 * Pointer to the ohcip structure for the device that is to  be
73	 * used as input in polled mode.
74	 */
75	ohci_state_t	*ohci_polled_ohcip;
76
77	/*
78	 * Pipe handle for the pipe that is to be used as input device
79	 * in POLLED mode.
80	 */
81	usba_pipe_handle_data_t  *ohci_polled_input_pipe_handle;
82
83	/* Dummy endpoint descriptor */
84	ohci_ed_t	*ohci_polled_dummy_ed;
85
86	/* Interrupt Endpoint descriptor */
87	ohci_ed_t	*ohci_polled_ed;	/* Interrupt endpoint */
88
89	/*
90	 * The buffer that the usb scancodes are copied into.
91	 */
92	uchar_t		*ohci_polled_buf;
93
94	/*
95	 * This flag is used to determine if the state of the controller
96	 * has already been saved (enter) or doesn't need to be restored
97	 * yet (exit).
98	 */
99	uint_t		ohci_polled_flags;
100
101	/*
102	 * The read or write routines may take TD's of the done head that
103	 * are not intended for them.
104	 */
105	ohci_td_t	*ohci_polled_input_done_head;
106
107	/*
108	 * This is the tail for the above ohci_polled_input_done_head;
109	 */
110	ohci_td_t	*ohci_polled_input_done_tail;
111
112	/*
113	 * ohci_hcdi_polled_input_enter() may be called
114	 * multiple times before the ohci_hcdi_polled_input_exit() is called.
115	 * For example, the system may:
116	 *	- go down to kmdb (ohci_hcdi_polled_input_enter())
117	 *	- down to the ok prompt, $q (ohci_hcdi_polled_input_enter())
118	 *	- back to kmdb, "go" (ohci_hcdi_polled_input_exit())
119	 *	- back to the OS, :c at kmdb (ohci_hcdi_polled_input_exit())
120	 *
121	 * polled_entry keeps track of how  many times
122	 * ohci_polled_input_enter/ohci_polled_input_exit have been
123	 * called so that the host controller isn't switched back to OS mode
124	 * prematurely.
125	 */
126	uint_t		ohci_polled_entry;
127
128	/*
129	 * Save the pointer usb device structure and the endpoint number
130	 * during the polled initilization.
131	 */
132	usba_device_t	*ohci_polled_usb_dev;	/* USB device */
133
134	uint8_t		ohci_polled_ep_addr;
135
136	boolean_t	ohci_polled_no_sync_flag; /* For schizo bug */
137} ohci_polled_t;
138
139_NOTE(SCHEME_PROTECTS_DATA("Only accessed in POLLED mode",
140	ohci_polled_t::ohci_polled_flags))
141_NOTE(DATA_READABLE_WITHOUT_LOCK(ohci_polled_t::ohci_polled_ohcip))
142_NOTE(SCHEME_PROTECTS_DATA("Only accessed in POLLED mode",
143	ohci_polled_t::ohci_polled_entry))
144
145
146#ifdef __cplusplus
147}
148#endif
149
150#endif	/* _SYS_USB_OHCI_POLLED_H */
151