1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate  *
4*7c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate  * with the License.
8*7c478bd9Sstevel@tonic-gate  *
9*7c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate  * and limitations under the License.
13*7c478bd9Sstevel@tonic-gate  *
14*7c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate  *
20*7c478bd9Sstevel@tonic-gate  * CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate  *
22*7c478bd9Sstevel@tonic-gate  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
23*7c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
24*7c478bd9Sstevel@tonic-gate  */
25*7c478bd9Sstevel@tonic-gate 
26*7c478bd9Sstevel@tonic-gate #ifndef _SYS_USBA_UGEND_H
27*7c478bd9Sstevel@tonic-gate #define	_SYS_USBA_UGEND_H
28*7c478bd9Sstevel@tonic-gate 
29*7c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
30*7c478bd9Sstevel@tonic-gate 
31*7c478bd9Sstevel@tonic-gate /*
32*7c478bd9Sstevel@tonic-gate  * UGEN - USB Generic Driver Support
33*7c478bd9Sstevel@tonic-gate  * This file contains the UGEN specific data structure definitions
34*7c478bd9Sstevel@tonic-gate  * and UGEN specific macros.
35*7c478bd9Sstevel@tonic-gate  */
36*7c478bd9Sstevel@tonic-gate #include <sys/usb/usba/usbai_private.h>
37*7c478bd9Sstevel@tonic-gate 
38*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
39*7c478bd9Sstevel@tonic-gate extern "C" {
40*7c478bd9Sstevel@tonic-gate #endif
41*7c478bd9Sstevel@tonic-gate 
42*7c478bd9Sstevel@tonic-gate /* ugen handle passed to client drivers as an opaque token */
43*7c478bd9Sstevel@tonic-gate typedef struct {
44*7c478bd9Sstevel@tonic-gate 	dev_info_t	*hdl_dip;
45*7c478bd9Sstevel@tonic-gate 	uint_t		hdl_flags;
46*7c478bd9Sstevel@tonic-gate 	dev_t		hdl_minor_node_ugen_bits_mask;
47*7c478bd9Sstevel@tonic-gate 	uint_t		hdl_minor_node_ugen_bits_shift;
48*7c478bd9Sstevel@tonic-gate 	uint_t		hdl_minor_node_ugen_bits_limit;
49*7c478bd9Sstevel@tonic-gate 
50*7c478bd9Sstevel@tonic-gate 	dev_t		hdl_minor_node_instance_mask;
51*7c478bd9Sstevel@tonic-gate 	uint_t		hdl_minor_node_instance_shift;
52*7c478bd9Sstevel@tonic-gate 	uint_t		hdl_minor_node_instance_limit;
53*7c478bd9Sstevel@tonic-gate 
54*7c478bd9Sstevel@tonic-gate 	struct ugen_state *hdl_ugenp;
55*7c478bd9Sstevel@tonic-gate 	char		*hdl_log_name;
56*7c478bd9Sstevel@tonic-gate 	uint_t		hdl_log_name_length;
57*7c478bd9Sstevel@tonic-gate } usb_ugen_hdl_impl_t;
58*7c478bd9Sstevel@tonic-gate 
59*7c478bd9Sstevel@tonic-gate _NOTE(SCHEME_PROTECTS_DATA("stable data", usb_ugen_hdl_impl_t))
60*7c478bd9Sstevel@tonic-gate 
61*7c478bd9Sstevel@tonic-gate /* devt lookup support */
62*7c478bd9Sstevel@tonic-gate typedef struct ugen_devt_list_entry {
63*7c478bd9Sstevel@tonic-gate 	struct ugen_devt_list_entry	*list_next;
64*7c478bd9Sstevel@tonic-gate 	struct ugen_devt_list_entry	*list_prev;
65*7c478bd9Sstevel@tonic-gate 	dev_t				list_dev;
66*7c478bd9Sstevel@tonic-gate 	struct ugen_state		*list_state;
67*7c478bd9Sstevel@tonic-gate } ugen_devt_list_entry_t;
68*7c478bd9Sstevel@tonic-gate 
69*7c478bd9Sstevel@tonic-gate typedef struct ugen_devt_cache_entry  {
70*7c478bd9Sstevel@tonic-gate 	dev_t				cache_dev;
71*7c478bd9Sstevel@tonic-gate 	struct ugen_state		*cache_state;
72*7c478bd9Sstevel@tonic-gate 	uint_t				cache_hit;
73*7c478bd9Sstevel@tonic-gate } ugen_devt_cache_entry_t;
74*7c478bd9Sstevel@tonic-gate 
75*7c478bd9Sstevel@tonic-gate #define	UGEN_DEVT_CACHE_SIZE 10
76*7c478bd9Sstevel@tonic-gate 
77*7c478bd9Sstevel@tonic-gate /* minor node definition */
78*7c478bd9Sstevel@tonic-gate #ifdef _LP64
79*7c478bd9Sstevel@tonic-gate #define	UGEN_MINOR_NODE_SIZE		32
80*7c478bd9Sstevel@tonic-gate #else
81*7c478bd9Sstevel@tonic-gate #define	UGEN_MINOR_NODE_SIZE		18
82*7c478bd9Sstevel@tonic-gate #endif
83*7c478bd9Sstevel@tonic-gate 
84*7c478bd9Sstevel@tonic-gate #define	UGEN_MINOR_INSTANCE_MASK(ugenp) \
85*7c478bd9Sstevel@tonic-gate 		(ugenp)->ug_hdl->hdl_minor_node_instance_mask
86*7c478bd9Sstevel@tonic-gate #define	UGEN_MINOR_INSTANCE_LIMIT(ugenp) \
87*7c478bd9Sstevel@tonic-gate 		(ugenp)->ug_hdl->hdl_minor_node_instance_limit
88*7c478bd9Sstevel@tonic-gate #define	UGEN_MINOR_INSTANCE_SHIFT(ugenp) \
89*7c478bd9Sstevel@tonic-gate 		(ugenp)->ug_hdl->hdl_minor_node_instance_shift
90*7c478bd9Sstevel@tonic-gate 
91*7c478bd9Sstevel@tonic-gate #define	UGEN_MINOR_IDX_SHIFT(ugenp) \
92*7c478bd9Sstevel@tonic-gate 		(ugenp)->ug_hdl->hdl_minor_node_ugen_bits_shift
93*7c478bd9Sstevel@tonic-gate #define	UGEN_MINOR_IDX_LIMIT(ugenp) \
94*7c478bd9Sstevel@tonic-gate 		(ugenp)->ug_hdl->hdl_minor_node_ugen_bits_limit
95*7c478bd9Sstevel@tonic-gate 
96*7c478bd9Sstevel@tonic-gate #define	UGEN_MINOR_GET_IDX(ugenp, dev) \
97*7c478bd9Sstevel@tonic-gate 		((getminor(dev) >> UGEN_MINOR_IDX_SHIFT(ugenp)) & \
98*7c478bd9Sstevel@tonic-gate 		(ugenp)->ug_hdl->hdl_minor_node_ugen_bits_mask)
99*7c478bd9Sstevel@tonic-gate 
100*7c478bd9Sstevel@tonic-gate #define	UGEN_MINOR_INSTANCE(ugenp, dev) \
101*7c478bd9Sstevel@tonic-gate 	(getminor(dev) & UGEN_MINOR_INSTANCE_MASK(ugenp))
102*7c478bd9Sstevel@tonic-gate 
103*7c478bd9Sstevel@tonic-gate 
104*7c478bd9Sstevel@tonic-gate #define	UGEN_N_ENDPOINTS		32
105*7c478bd9Sstevel@tonic-gate 
106*7c478bd9Sstevel@tonic-gate /* UGEN specific macros */
107*7c478bd9Sstevel@tonic-gate #define	UGEN_SETUP_PKT_SIZE		8	/* Ctrl xfer Setup token sz */
108*7c478bd9Sstevel@tonic-gate 
109*7c478bd9Sstevel@tonic-gate /*
110*7c478bd9Sstevel@tonic-gate  * minor node is contructed as follows for ugen driver (other client
111*7c478bd9Sstevel@tonic-gate  * drivers that export a ugen interface may have a different layout):
112*7c478bd9Sstevel@tonic-gate  *
113*7c478bd9Sstevel@tonic-gate  * 17			 9			0
114*7c478bd9Sstevel@tonic-gate  * +---------------------+----------------------+
115*7c478bd9Sstevel@tonic-gate  * | minor index	 |	instance	|
116*7c478bd9Sstevel@tonic-gate  * +---------------------+----------------------+
117*7c478bd9Sstevel@tonic-gate  *
118*7c478bd9Sstevel@tonic-gate  * Note that only 512 endpoint minor nodes can be supported (each
119*7c478bd9Sstevel@tonic-gate  * endpoint requires a status endpoint as well so we can only support
120*7c478bd9Sstevel@tonic-gate  * 256 endpoints)
121*7c478bd9Sstevel@tonic-gate  *
122*7c478bd9Sstevel@tonic-gate  * the real minor node is:
123*7c478bd9Sstevel@tonic-gate  *
124*7c478bd9Sstevel@tonic-gate  * 47	  40	  32	  24	 16	  8	  0
125*7c478bd9Sstevel@tonic-gate  * +-------+-------+-------+------+-------+-------+
126*7c478bd9Sstevel@tonic-gate  * | cfgval| cfgidx| iface | alt  |epidx  | type  |
127*7c478bd9Sstevel@tonic-gate  * +-------+-------+-------+------+-------+-------+
128*7c478bd9Sstevel@tonic-gate  *
129*7c478bd9Sstevel@tonic-gate  * We get from the minor code to minor number thru ugen_minor_node_table
130*7c478bd9Sstevel@tonic-gate  */
131*7c478bd9Sstevel@tonic-gate typedef uint64_t ugen_minor_t;
132*7c478bd9Sstevel@tonic-gate 
133*7c478bd9Sstevel@tonic-gate #define	UGEN_MINOR_DEV_STAT_NODE	0x00
134*7c478bd9Sstevel@tonic-gate #define	UGEN_MINOR_EP_XFER_NODE		0x01
135*7c478bd9Sstevel@tonic-gate #define	UGEN_MINOR_EP_STAT_NODE		0x02
136*7c478bd9Sstevel@tonic-gate #define	UGEN_OWNS_DEVICE		0x04
137*7c478bd9Sstevel@tonic-gate 
138*7c478bd9Sstevel@tonic-gate #define	UGEN_MINOR_EPIDX_SHIFT		8
139*7c478bd9Sstevel@tonic-gate #define	UGEN_MINOR_ALT_SHIFT		16
140*7c478bd9Sstevel@tonic-gate #define	UGEN_MINOR_IF_SHIFT		24
141*7c478bd9Sstevel@tonic-gate #define	UGEN_MINOR_CFGIDX_SHIFT		32
142*7c478bd9Sstevel@tonic-gate #define	UGEN_MINOR_CFGVAL_SHIFT		40
143*7c478bd9Sstevel@tonic-gate 
144*7c478bd9Sstevel@tonic-gate #define	UGEN_MINOR_TYPE(ugenp, dev) \
145*7c478bd9Sstevel@tonic-gate 	(ugen_devt2minor((ugenp), (dev)) & 0x3)
146*7c478bd9Sstevel@tonic-gate #define	UGEN_MINOR_EPIDX(ugenp, dev) \
147*7c478bd9Sstevel@tonic-gate 	((ugen_devt2minor((ugenp), (dev)) >> UGEN_MINOR_EPIDX_SHIFT) & 0xFF)
148*7c478bd9Sstevel@tonic-gate 
149*7c478bd9Sstevel@tonic-gate #define	UGEN_MINOR_ALT(ugenp, dev) \
150*7c478bd9Sstevel@tonic-gate 	((ugen_devt2minor((ugenp), (dev)) >> UGEN_MINOR_ALT_SHIFT) & 0xFF)
151*7c478bd9Sstevel@tonic-gate 
152*7c478bd9Sstevel@tonic-gate #define	UGEN_MINOR_IF(ugenp, dev) \
153*7c478bd9Sstevel@tonic-gate 	((ugen_devt2minor((ugenp), (dev)) >> UGEN_MINOR_IF_SHIFT) & 0xFF)
154*7c478bd9Sstevel@tonic-gate 
155*7c478bd9Sstevel@tonic-gate #define	UGEN_MINOR_CFGIDX(ugenp, dev) \
156*7c478bd9Sstevel@tonic-gate 	((ugen_devt2minor((ugenp), (dev)) >> UGEN_MINOR_CFGIDX_SHIFT) & 0xFF)
157*7c478bd9Sstevel@tonic-gate 
158*7c478bd9Sstevel@tonic-gate #define	UGEN_MINOR_CFGVAL(ugenp, dev) \
159*7c478bd9Sstevel@tonic-gate 	((ugen_devt2minor((ugenp), (dev)) >> UGEN_MINOR_CFGVAL_SHIFT) & 0xFF)
160*7c478bd9Sstevel@tonic-gate 
161*7c478bd9Sstevel@tonic-gate 
162*7c478bd9Sstevel@tonic-gate /*
163*7c478bd9Sstevel@tonic-gate  * Endpoint structure
164*7c478bd9Sstevel@tonic-gate  * Holds all the information needed to manage the endpoint
165*7c478bd9Sstevel@tonic-gate  */
166*7c478bd9Sstevel@tonic-gate typedef struct ugen_ep {
167*7c478bd9Sstevel@tonic-gate 	uint_t		ep_state;	/* Endpoint state, see below */
168*7c478bd9Sstevel@tonic-gate 	usb_ep_descr_t	ep_descr;	/* Endpoint descriptor */
169*7c478bd9Sstevel@tonic-gate 	uchar_t		ep_cfgidx;	/* cfg index */
170*7c478bd9Sstevel@tonic-gate 	uchar_t		ep_if;		/* Interface # */
171*7c478bd9Sstevel@tonic-gate 	uchar_t		ep_alt;		/* alternate # */
172*7c478bd9Sstevel@tonic-gate 	uchar_t		ep_done;	/* cmd is done */
173*7c478bd9Sstevel@tonic-gate 	boolean_t	ep_one_xfer;	/* use one xfer on intr IN eps */
174*7c478bd9Sstevel@tonic-gate 	uint_t		ep_lcmd_status;	/* last cmd status */
175*7c478bd9Sstevel@tonic-gate 	int		ep_xfer_oflag;	/* open flag */
176*7c478bd9Sstevel@tonic-gate 	int		ep_stat_oflag;	/* open flag */
177*7c478bd9Sstevel@tonic-gate 	size_t		ep_buf_limit;	/* one second of data */
178*7c478bd9Sstevel@tonic-gate 	usb_pipe_handle_t ep_ph;	/* Endpoint pipe handle */
179*7c478bd9Sstevel@tonic-gate 	usb_pipe_policy_t ep_pipe_policy;
180*7c478bd9Sstevel@tonic-gate 	kmutex_t	ep_mutex;	/* Mutex protecting ugen_ep */
181*7c478bd9Sstevel@tonic-gate 	kcondvar_t	ep_wait_cv;	/* block for completion */
182*7c478bd9Sstevel@tonic-gate 	usb_serialization_t ep_ser_cookie;	/* one xfer at the time */
183*7c478bd9Sstevel@tonic-gate 	mblk_t		*ep_data;	/* IN data (ctrl & intr) */
184*7c478bd9Sstevel@tonic-gate 	struct buf	*ep_bp;		/* save current buf ptr */
185*7c478bd9Sstevel@tonic-gate 	struct pollhead	ep_pollhead;	/* for polling	*/
186*7c478bd9Sstevel@tonic-gate } ugen_ep_t;
187*7c478bd9Sstevel@tonic-gate 
188*7c478bd9Sstevel@tonic-gate _NOTE(MUTEX_PROTECTS_DATA(ugen_ep::ep_mutex, ugen_ep))
189*7c478bd9Sstevel@tonic-gate 
190*7c478bd9Sstevel@tonic-gate /* endpoints descriptor access */
191*7c478bd9Sstevel@tonic-gate #define	UGEN_XFER_TYPE(epp) ((epp)->ep_descr.bmAttributes & USB_EP_ATTR_MASK)
192*7c478bd9Sstevel@tonic-gate #define	UGEN_XFER_DIR(epp) ((epp)->ep_descr.bEndpointAddress & USB_EP_DIR_IN)
193*7c478bd9Sstevel@tonic-gate #define	UGEN_XFER_ADDR(epp) ((epp)->ep_descr.bEndpointAddress)
194*7c478bd9Sstevel@tonic-gate 
195*7c478bd9Sstevel@tonic-gate #define	UGEN_INTR_BUF_LIMIT	4096
196*7c478bd9Sstevel@tonic-gate 
197*7c478bd9Sstevel@tonic-gate /* endpoint xfer/stat states */
198*7c478bd9Sstevel@tonic-gate #define	UGEN_EP_STATE_NONE		0x00
199*7c478bd9Sstevel@tonic-gate #define	UGEN_EP_STATE_ACTIVE		0x01
200*7c478bd9Sstevel@tonic-gate #define	UGEN_EP_STATE_XFER_OPEN		0x02
201*7c478bd9Sstevel@tonic-gate #define	UGEN_EP_STATE_STAT_OPEN		0x04
202*7c478bd9Sstevel@tonic-gate #define	UGEN_EP_STATE_XS_OPEN		(UGEN_EP_STATE_XFER_OPEN | \
203*7c478bd9Sstevel@tonic-gate 					    UGEN_EP_STATE_STAT_OPEN)
204*7c478bd9Sstevel@tonic-gate #define	UGEN_EP_STATE_INTR_IN_POLLING_ON		0x10
205*7c478bd9Sstevel@tonic-gate #define	UGEN_EP_STATE_INTR_IN_POLLING_IS_STOPPED	0x20
206*7c478bd9Sstevel@tonic-gate #define	UGEN_EP_STATE_INTR_IN_POLL_PENDING		0x40
207*7c478bd9Sstevel@tonic-gate 
208*7c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(ugen_ep::ep_ph))
209*7c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(ugen_ep::ep_descr))
210*7c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(ugen_ep::ep_ser_cookie))
211*7c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(ugen_ep::ep_if))
212*7c478bd9Sstevel@tonic-gate 
213*7c478bd9Sstevel@tonic-gate _NOTE(SCHEME_PROTECTS_DATA("USBA", usb_ctrl_req))
214*7c478bd9Sstevel@tonic-gate _NOTE(SCHEME_PROTECTS_DATA("USBA", usb_bulk_req))
215*7c478bd9Sstevel@tonic-gate _NOTE(SCHEME_PROTECTS_DATA("USBA", usb_intr_req))
216*7c478bd9Sstevel@tonic-gate 
217*7c478bd9Sstevel@tonic-gate typedef struct ugen_dev_stat {
218*7c478bd9Sstevel@tonic-gate 	int			dev_oflag;	/* open flag */
219*7c478bd9Sstevel@tonic-gate 	uint_t			dev_stat;	/* internal status */
220*7c478bd9Sstevel@tonic-gate 	uint_t			dev_state;	/* exported state */
221*7c478bd9Sstevel@tonic-gate 	kcondvar_t		dev_wait_cv;	/* block for change */
222*7c478bd9Sstevel@tonic-gate 	struct pollhead		dev_pollhead;	/* for polling */
223*7c478bd9Sstevel@tonic-gate } ugen_dev_stat_t;
224*7c478bd9Sstevel@tonic-gate 
225*7c478bd9Sstevel@tonic-gate /* dev_stat */
226*7c478bd9Sstevel@tonic-gate #define	UGEN_DEV_STATUS_INACTIVE	0x0
227*7c478bd9Sstevel@tonic-gate #define	UGEN_DEV_STATUS_ACTIVE		0x1
228*7c478bd9Sstevel@tonic-gate #define	UGEN_DEV_STATUS_POLL_PENDING	0x2
229*7c478bd9Sstevel@tonic-gate #define	UGEN_DEV_STATUS_CHANGED		0x4
230*7c478bd9Sstevel@tonic-gate 
231*7c478bd9Sstevel@tonic-gate /* Power Management support */
232*7c478bd9Sstevel@tonic-gate typedef struct ugen_power  {
233*7c478bd9Sstevel@tonic-gate 	uint_t			pwr_states;
234*7c478bd9Sstevel@tonic-gate 	int			pwr_busy;		/* busy accounting */
235*7c478bd9Sstevel@tonic-gate 	uint8_t			pwr_wakeup_enabled;
236*7c478bd9Sstevel@tonic-gate 	uint8_t			pwr_current;
237*7c478bd9Sstevel@tonic-gate } ugen_power_t;
238*7c478bd9Sstevel@tonic-gate 
239*7c478bd9Sstevel@tonic-gate /* UGEN state structure */
240*7c478bd9Sstevel@tonic-gate typedef struct ugen_state {
241*7c478bd9Sstevel@tonic-gate 	usb_ugen_hdl_impl_t	*ug_hdl;		/* pointer to handle */
242*7c478bd9Sstevel@tonic-gate 	dev_info_t		*ug_dip;		/* Dev info */
243*7c478bd9Sstevel@tonic-gate 	uint_t			ug_instance;		/* Instance number */
244*7c478bd9Sstevel@tonic-gate 	uint_t			ug_dev_state;
245*7c478bd9Sstevel@tonic-gate 	uint_t			ug_dev_stat_state;
246*7c478bd9Sstevel@tonic-gate 	uint_t			ug_open_count;
247*7c478bd9Sstevel@tonic-gate 	uint_t			ug_pending_cmds;
248*7c478bd9Sstevel@tonic-gate 	uint_t			ug_initial_cfgidx;
249*7c478bd9Sstevel@tonic-gate 
250*7c478bd9Sstevel@tonic-gate 	/* locks */
251*7c478bd9Sstevel@tonic-gate 	kmutex_t		ug_mutex;		/* Instance mutex */
252*7c478bd9Sstevel@tonic-gate 	usb_serialization_t	ug_ser_cookie;		/* access */
253*7c478bd9Sstevel@tonic-gate 
254*7c478bd9Sstevel@tonic-gate 	/* USB debugging system support */
255*7c478bd9Sstevel@tonic-gate 	usb_log_handle_t	ug_log_hdl;
256*7c478bd9Sstevel@tonic-gate 
257*7c478bd9Sstevel@tonic-gate 	/* registration data */
258*7c478bd9Sstevel@tonic-gate 	usb_client_dev_data_t	*ug_dev_data;
259*7c478bd9Sstevel@tonic-gate 
260*7c478bd9Sstevel@tonic-gate 	/* Endpoint management list */
261*7c478bd9Sstevel@tonic-gate 	ugen_ep_t		ug_ep[UGEN_N_ENDPOINTS];
262*7c478bd9Sstevel@tonic-gate 
263*7c478bd9Sstevel@tonic-gate 	/* encoding minor numbers as we only have 8 bits in the minor # */
264*7c478bd9Sstevel@tonic-gate 	ugen_minor_t		*ug_minor_node_table;
265*7c478bd9Sstevel@tonic-gate 	int			ug_minor_node_table_index;
266*7c478bd9Sstevel@tonic-gate 	size_t			ug_minor_node_table_size;
267*7c478bd9Sstevel@tonic-gate 
268*7c478bd9Sstevel@tonic-gate 	/* device status management */
269*7c478bd9Sstevel@tonic-gate 	ugen_dev_stat_t		ug_ds;
270*7c478bd9Sstevel@tonic-gate 
271*7c478bd9Sstevel@tonic-gate 	/* PM Support */
272*7c478bd9Sstevel@tonic-gate 	ugen_power_t		*ug_pm;
273*7c478bd9Sstevel@tonic-gate 
274*7c478bd9Sstevel@tonic-gate 	/* Maximum transfer size for bulk endpoints */
275*7c478bd9Sstevel@tonic-gate 	size_t			ug_max_bulk_xfer_sz;
276*7c478bd9Sstevel@tonic-gate 
277*7c478bd9Sstevel@tonic-gate 	/* Used to deallocate allocated resources */
278*7c478bd9Sstevel@tonic-gate 	ushort_t		ug_cleanup_flags;
279*7c478bd9Sstevel@tonic-gate } ugen_state_t;
280*7c478bd9Sstevel@tonic-gate 
281*7c478bd9Sstevel@tonic-gate _NOTE(SCHEME_PROTECTS_DATA("unshared", buf))
282*7c478bd9Sstevel@tonic-gate 
283*7c478bd9Sstevel@tonic-gate _NOTE(MUTEX_PROTECTS_DATA(ugen_state::ug_mutex, ugen_state))
284*7c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(ugen_state::ug_log_hdl))
285*7c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(ugen_state::ug_hdl))
286*7c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(ugen_state::ug_ser_cookie))
287*7c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(ugen_state::ug_dip))
288*7c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(ugen_state::ug_pm))
289*7c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(ugen_state::ug_instance))
290*7c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(ugen_state::ug_minor_node_table))
291*7c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(ugen_state::ug_minor_node_table_index))
292*7c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(ugen_state::ug_max_bulk_xfer_sz))
293*7c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(ugen_state::ug_dev_data))
294*7c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(ugen_state::ug_cleanup_flags))
295*7c478bd9Sstevel@tonic-gate 
296*7c478bd9Sstevel@tonic-gate 
297*7c478bd9Sstevel@tonic-gate /* ugen_cleanup_flags */
298*7c478bd9Sstevel@tonic-gate #define	UGEN_INIT_LOCKS			0x01
299*7c478bd9Sstevel@tonic-gate 
300*7c478bd9Sstevel@tonic-gate /* additional USB device states */
301*7c478bd9Sstevel@tonic-gate #define	USB_UGEN_DEV_UNAVAILABLE_RESUME		0x90
302*7c478bd9Sstevel@tonic-gate #define	USB_UGEN_DEV_UNAVAILABLE_RECONNECT	0x91
303*7c478bd9Sstevel@tonic-gate 
304*7c478bd9Sstevel@tonic-gate /* Debugging information */
305*7c478bd9Sstevel@tonic-gate #define	UGEN_PRINT_ATTA		0x1
306*7c478bd9Sstevel@tonic-gate #define	UGEN_PRINT_CBOPS	0x2
307*7c478bd9Sstevel@tonic-gate #define	UGEN_PRINT_CPR		0x4
308*7c478bd9Sstevel@tonic-gate #define	UGEN_PRINT_POLL		0x8
309*7c478bd9Sstevel@tonic-gate #define	UGEN_PRINT_XFER		0x10
310*7c478bd9Sstevel@tonic-gate #define	UGEN_PRINT_HOTPLUG	0x20
311*7c478bd9Sstevel@tonic-gate #define	UGEN_PRINT_STAT		0x40
312*7c478bd9Sstevel@tonic-gate #define	UGEN_PRINT_PM		0x80
313*7c478bd9Sstevel@tonic-gate #define	UGEN_PRINT_ALL		0xFFFFFFFF
314*7c478bd9Sstevel@tonic-gate 
315*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
316*7c478bd9Sstevel@tonic-gate }
317*7c478bd9Sstevel@tonic-gate #endif
318*7c478bd9Sstevel@tonic-gate 
319*7c478bd9Sstevel@tonic-gate #endif	/* _SYS_USBA_UGEND_H */
320