17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
50a05e705Slc  * Common Development and Distribution License (the "License").
60a05e705Slc  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  *
21d29f5a71Szhigang lu - Sun Microsystems - Beijing China  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
227c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
237c478bd9Sstevel@tonic-gate  */
247c478bd9Sstevel@tonic-gate 
257c478bd9Sstevel@tonic-gate #ifndef _SYS_USBA_UGEND_H
267c478bd9Sstevel@tonic-gate #define	_SYS_USBA_UGEND_H
277c478bd9Sstevel@tonic-gate 
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate /*
307c478bd9Sstevel@tonic-gate  * UGEN - USB Generic Driver Support
317c478bd9Sstevel@tonic-gate  * This file contains the UGEN specific data structure definitions
327c478bd9Sstevel@tonic-gate  * and UGEN specific macros.
337c478bd9Sstevel@tonic-gate  */
347c478bd9Sstevel@tonic-gate #include <sys/usb/usba/usbai_private.h>
357c478bd9Sstevel@tonic-gate 
367c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
377c478bd9Sstevel@tonic-gate extern "C" {
387c478bd9Sstevel@tonic-gate #endif
397c478bd9Sstevel@tonic-gate 
407c478bd9Sstevel@tonic-gate /* ugen handle passed to client drivers as an opaque token */
417c478bd9Sstevel@tonic-gate typedef struct {
427c478bd9Sstevel@tonic-gate 	dev_info_t	*hdl_dip;
437c478bd9Sstevel@tonic-gate 	uint_t		hdl_flags;
447c478bd9Sstevel@tonic-gate 	dev_t		hdl_minor_node_ugen_bits_mask;
457c478bd9Sstevel@tonic-gate 	uint_t		hdl_minor_node_ugen_bits_shift;
467c478bd9Sstevel@tonic-gate 	uint_t		hdl_minor_node_ugen_bits_limit;
477c478bd9Sstevel@tonic-gate 
487c478bd9Sstevel@tonic-gate 	dev_t		hdl_minor_node_instance_mask;
497c478bd9Sstevel@tonic-gate 	uint_t		hdl_minor_node_instance_shift;
507c478bd9Sstevel@tonic-gate 	uint_t		hdl_minor_node_instance_limit;
517c478bd9Sstevel@tonic-gate 
527c478bd9Sstevel@tonic-gate 	struct ugen_state *hdl_ugenp;
537c478bd9Sstevel@tonic-gate 	char		*hdl_log_name;
547c478bd9Sstevel@tonic-gate 	uint_t		hdl_log_name_length;
557c478bd9Sstevel@tonic-gate } usb_ugen_hdl_impl_t;
567c478bd9Sstevel@tonic-gate 
577c478bd9Sstevel@tonic-gate _NOTE(SCHEME_PROTECTS_DATA("stable data", usb_ugen_hdl_impl_t))
587c478bd9Sstevel@tonic-gate 
597c478bd9Sstevel@tonic-gate /* devt lookup support */
607c478bd9Sstevel@tonic-gate typedef struct ugen_devt_list_entry {
617c478bd9Sstevel@tonic-gate 	struct ugen_devt_list_entry	*list_next;
627c478bd9Sstevel@tonic-gate 	struct ugen_devt_list_entry	*list_prev;
637c478bd9Sstevel@tonic-gate 	dev_t				list_dev;
647c478bd9Sstevel@tonic-gate 	struct ugen_state		*list_state;
657c478bd9Sstevel@tonic-gate } ugen_devt_list_entry_t;
667c478bd9Sstevel@tonic-gate 
677c478bd9Sstevel@tonic-gate typedef struct ugen_devt_cache_entry  {
687c478bd9Sstevel@tonic-gate 	dev_t				cache_dev;
697c478bd9Sstevel@tonic-gate 	struct ugen_state		*cache_state;
707c478bd9Sstevel@tonic-gate 	uint_t				cache_hit;
717c478bd9Sstevel@tonic-gate } ugen_devt_cache_entry_t;
727c478bd9Sstevel@tonic-gate 
737c478bd9Sstevel@tonic-gate #define	UGEN_DEVT_CACHE_SIZE 10
747c478bd9Sstevel@tonic-gate 
757c478bd9Sstevel@tonic-gate /* minor node definition */
767c478bd9Sstevel@tonic-gate #ifdef _LP64
777c478bd9Sstevel@tonic-gate #define	UGEN_MINOR_NODE_SIZE		32
787c478bd9Sstevel@tonic-gate #else
797c478bd9Sstevel@tonic-gate #define	UGEN_MINOR_NODE_SIZE		18
807c478bd9Sstevel@tonic-gate #endif
817c478bd9Sstevel@tonic-gate 
827c478bd9Sstevel@tonic-gate #define	UGEN_MINOR_INSTANCE_MASK(ugenp) \
837c478bd9Sstevel@tonic-gate 		(ugenp)->ug_hdl->hdl_minor_node_instance_mask
847c478bd9Sstevel@tonic-gate #define	UGEN_MINOR_INSTANCE_LIMIT(ugenp) \
857c478bd9Sstevel@tonic-gate 		(ugenp)->ug_hdl->hdl_minor_node_instance_limit
867c478bd9Sstevel@tonic-gate #define	UGEN_MINOR_INSTANCE_SHIFT(ugenp) \
877c478bd9Sstevel@tonic-gate 		(ugenp)->ug_hdl->hdl_minor_node_instance_shift
887c478bd9Sstevel@tonic-gate 
897c478bd9Sstevel@tonic-gate #define	UGEN_MINOR_IDX_SHIFT(ugenp) \
907c478bd9Sstevel@tonic-gate 		(ugenp)->ug_hdl->hdl_minor_node_ugen_bits_shift
917c478bd9Sstevel@tonic-gate #define	UGEN_MINOR_IDX_LIMIT(ugenp) \
927c478bd9Sstevel@tonic-gate 		(ugenp)->ug_hdl->hdl_minor_node_ugen_bits_limit
937c478bd9Sstevel@tonic-gate 
947c478bd9Sstevel@tonic-gate #define	UGEN_MINOR_GET_IDX(ugenp, dev) \
957c478bd9Sstevel@tonic-gate 		((getminor(dev) >> UGEN_MINOR_IDX_SHIFT(ugenp)) & \
967c478bd9Sstevel@tonic-gate 		(ugenp)->ug_hdl->hdl_minor_node_ugen_bits_mask)
977c478bd9Sstevel@tonic-gate 
987c478bd9Sstevel@tonic-gate #define	UGEN_MINOR_INSTANCE(ugenp, dev) \
997c478bd9Sstevel@tonic-gate 	(getminor(dev) & UGEN_MINOR_INSTANCE_MASK(ugenp))
1007c478bd9Sstevel@tonic-gate 
1017c478bd9Sstevel@tonic-gate 
1027c478bd9Sstevel@tonic-gate #define	UGEN_N_ENDPOINTS		32
1037c478bd9Sstevel@tonic-gate 
1047c478bd9Sstevel@tonic-gate /* UGEN specific macros */
1057c478bd9Sstevel@tonic-gate #define	UGEN_SETUP_PKT_SIZE		8	/* Ctrl xfer Setup token sz */
1067c478bd9Sstevel@tonic-gate 
1077c478bd9Sstevel@tonic-gate /*
1087c478bd9Sstevel@tonic-gate  * minor node is contructed as follows for ugen driver (other client
1097c478bd9Sstevel@tonic-gate  * drivers that export a ugen interface may have a different layout):
1107c478bd9Sstevel@tonic-gate  *
1117c478bd9Sstevel@tonic-gate  * 17			 9			0
1127c478bd9Sstevel@tonic-gate  * +---------------------+----------------------+
1137c478bd9Sstevel@tonic-gate  * | minor index	 |	instance	|
1147c478bd9Sstevel@tonic-gate  * +---------------------+----------------------+
1157c478bd9Sstevel@tonic-gate  *
1167c478bd9Sstevel@tonic-gate  * Note that only 512 endpoint minor nodes can be supported (each
1177c478bd9Sstevel@tonic-gate  * endpoint requires a status endpoint as well so we can only support
1187c478bd9Sstevel@tonic-gate  * 256 endpoints)
1197c478bd9Sstevel@tonic-gate  *
1207c478bd9Sstevel@tonic-gate  * the real minor node is:
1217c478bd9Sstevel@tonic-gate  *
1227c478bd9Sstevel@tonic-gate  * 47	  40	  32	  24	 16	  8	  0
1237c478bd9Sstevel@tonic-gate  * +-------+-------+-------+------+-------+-------+
1247c478bd9Sstevel@tonic-gate  * | cfgval| cfgidx| iface | alt  |epidx  | type  |
1257c478bd9Sstevel@tonic-gate  * +-------+-------+-------+------+-------+-------+
1267c478bd9Sstevel@tonic-gate  *
1277c478bd9Sstevel@tonic-gate  * We get from the minor code to minor number thru ugen_minor_node_table
1287c478bd9Sstevel@tonic-gate  */
1297c478bd9Sstevel@tonic-gate typedef uint64_t ugen_minor_t;
1307c478bd9Sstevel@tonic-gate 
1317c478bd9Sstevel@tonic-gate #define	UGEN_MINOR_DEV_STAT_NODE	0x00
1327c478bd9Sstevel@tonic-gate #define	UGEN_MINOR_EP_XFER_NODE		0x01
1337c478bd9Sstevel@tonic-gate #define	UGEN_MINOR_EP_STAT_NODE		0x02
1347c478bd9Sstevel@tonic-gate #define	UGEN_OWNS_DEVICE		0x04
1357c478bd9Sstevel@tonic-gate 
1367c478bd9Sstevel@tonic-gate #define	UGEN_MINOR_EPIDX_SHIFT		8
1377c478bd9Sstevel@tonic-gate #define	UGEN_MINOR_ALT_SHIFT		16
1387c478bd9Sstevel@tonic-gate #define	UGEN_MINOR_IF_SHIFT		24
1397c478bd9Sstevel@tonic-gate #define	UGEN_MINOR_CFGIDX_SHIFT		32
1407c478bd9Sstevel@tonic-gate #define	UGEN_MINOR_CFGVAL_SHIFT		40
1417c478bd9Sstevel@tonic-gate 
1427c478bd9Sstevel@tonic-gate #define	UGEN_MINOR_TYPE(ugenp, dev) \
1437c478bd9Sstevel@tonic-gate 	(ugen_devt2minor((ugenp), (dev)) & 0x3)
1447c478bd9Sstevel@tonic-gate #define	UGEN_MINOR_EPIDX(ugenp, dev) \
1457c478bd9Sstevel@tonic-gate 	((ugen_devt2minor((ugenp), (dev)) >> UGEN_MINOR_EPIDX_SHIFT) & 0xFF)
1467c478bd9Sstevel@tonic-gate 
1477c478bd9Sstevel@tonic-gate #define	UGEN_MINOR_ALT(ugenp, dev) \
1487c478bd9Sstevel@tonic-gate 	((ugen_devt2minor((ugenp), (dev)) >> UGEN_MINOR_ALT_SHIFT) & 0xFF)
1497c478bd9Sstevel@tonic-gate 
1507c478bd9Sstevel@tonic-gate #define	UGEN_MINOR_IF(ugenp, dev) \
1517c478bd9Sstevel@tonic-gate 	((ugen_devt2minor((ugenp), (dev)) >> UGEN_MINOR_IF_SHIFT) & 0xFF)
1527c478bd9Sstevel@tonic-gate 
1537c478bd9Sstevel@tonic-gate #define	UGEN_MINOR_CFGIDX(ugenp, dev) \
1547c478bd9Sstevel@tonic-gate 	((ugen_devt2minor((ugenp), (dev)) >> UGEN_MINOR_CFGIDX_SHIFT) & 0xFF)
1557c478bd9Sstevel@tonic-gate 
1567c478bd9Sstevel@tonic-gate #define	UGEN_MINOR_CFGVAL(ugenp, dev) \
1577c478bd9Sstevel@tonic-gate 	((ugen_devt2minor((ugenp), (dev)) >> UGEN_MINOR_CFGVAL_SHIFT) & 0xFF)
1587c478bd9Sstevel@tonic-gate 
1597c478bd9Sstevel@tonic-gate 
1600a05e705Slc /*
1610a05e705Slc  * According to usb2.0 spec (table 9-13), for all ep, bits 10..0 specify the
1620a05e705Slc  * max pkt size; for high speed ISOC/INTR ep, bits 12..11 specify the number of
1630a05e705Slc  * additional transaction opportunities per microframe.
1640a05e705Slc  */
1650a05e705Slc #define	UGEN_PKT_SIZE(pktsize)	(pktsize & 0x07ff) * (1 + ((pktsize >> 11) & 3))
1660a05e705Slc 
1670a05e705Slc 
1680a05e705Slc /*
1690a05e705Slc  * Structure for holding isoc data packets information
1700a05e705Slc  */
1710a05e705Slc typedef struct ugen_isoc_pkt_info {
1720a05e705Slc 	ushort_t	isoc_pkts_count;
1730a05e705Slc 	uint_t		isoc_pkts_length;
1740a05e705Slc 	ugen_isoc_pkt_descr_t    *isoc_pkt_descr; /* array of pkt descr */
1750a05e705Slc } ugen_isoc_pkt_info_t;
1760a05e705Slc 
1777c478bd9Sstevel@tonic-gate /*
1787c478bd9Sstevel@tonic-gate  * Endpoint structure
1797c478bd9Sstevel@tonic-gate  * Holds all the information needed to manage the endpoint
1807c478bd9Sstevel@tonic-gate  */
1817c478bd9Sstevel@tonic-gate typedef struct ugen_ep {
1827c478bd9Sstevel@tonic-gate 	uint_t		ep_state;	/* Endpoint state, see below */
1837c478bd9Sstevel@tonic-gate 	usb_ep_descr_t	ep_descr;	/* Endpoint descriptor */
184*993e3fafSRobert Mustacchi 	usb_ep_xdescr_t	ep_xdescr;	/* Extended endpoint descriptor */
1857c478bd9Sstevel@tonic-gate 	uchar_t		ep_cfgidx;	/* cfg index */
1867c478bd9Sstevel@tonic-gate 	uchar_t		ep_if;		/* Interface # */
1877c478bd9Sstevel@tonic-gate 	uchar_t		ep_alt;		/* alternate # */
1887c478bd9Sstevel@tonic-gate 	uchar_t		ep_done;	/* cmd is done */
1897c478bd9Sstevel@tonic-gate 	boolean_t	ep_one_xfer;	/* use one xfer on intr IN eps */
1907c478bd9Sstevel@tonic-gate 	uint_t		ep_lcmd_status;	/* last cmd status */
1917c478bd9Sstevel@tonic-gate 	int		ep_xfer_oflag;	/* open flag */
1927c478bd9Sstevel@tonic-gate 	int		ep_stat_oflag;	/* open flag */
1937c478bd9Sstevel@tonic-gate 	size_t		ep_buf_limit;	/* one second of data */
1947c478bd9Sstevel@tonic-gate 	usb_pipe_handle_t ep_ph;	/* Endpoint pipe handle */
1957c478bd9Sstevel@tonic-gate 	usb_pipe_policy_t ep_pipe_policy;
1967c478bd9Sstevel@tonic-gate 	kmutex_t	ep_mutex;	/* Mutex protecting ugen_ep */
1977c478bd9Sstevel@tonic-gate 	kcondvar_t	ep_wait_cv;	/* block for completion */
1987c478bd9Sstevel@tonic-gate 	usb_serialization_t ep_ser_cookie;	/* one xfer at the time */
1997c478bd9Sstevel@tonic-gate 	mblk_t		*ep_data;	/* IN data (ctrl & intr) */
2007c478bd9Sstevel@tonic-gate 	struct buf	*ep_bp;		/* save current buf ptr */
2017c478bd9Sstevel@tonic-gate 	struct pollhead	ep_pollhead;	/* for polling	*/
2020a05e705Slc 	ugen_isoc_pkt_info_t ep_isoc_info;	/* for isoc eps */
2030a05e705Slc 	int		ep_isoc_in_inited;	/* isoc IN init flag */
2047c478bd9Sstevel@tonic-gate } ugen_ep_t;
2057c478bd9Sstevel@tonic-gate 
2067c478bd9Sstevel@tonic-gate _NOTE(MUTEX_PROTECTS_DATA(ugen_ep::ep_mutex, ugen_ep))
2077c478bd9Sstevel@tonic-gate 
2087c478bd9Sstevel@tonic-gate /* endpoints descriptor access */
2097c478bd9Sstevel@tonic-gate #define	UGEN_XFER_TYPE(epp) ((epp)->ep_descr.bmAttributes & USB_EP_ATTR_MASK)
2107c478bd9Sstevel@tonic-gate #define	UGEN_XFER_DIR(epp) ((epp)->ep_descr.bEndpointAddress & USB_EP_DIR_IN)
2117c478bd9Sstevel@tonic-gate #define	UGEN_XFER_ADDR(epp) ((epp)->ep_descr.bEndpointAddress)
2127c478bd9Sstevel@tonic-gate 
2137c478bd9Sstevel@tonic-gate #define	UGEN_INTR_BUF_LIMIT	4096
2147c478bd9Sstevel@tonic-gate 
2157c478bd9Sstevel@tonic-gate /* endpoint xfer/stat states */
2167c478bd9Sstevel@tonic-gate #define	UGEN_EP_STATE_NONE		0x00
2177c478bd9Sstevel@tonic-gate #define	UGEN_EP_STATE_ACTIVE		0x01
2187c478bd9Sstevel@tonic-gate #define	UGEN_EP_STATE_XFER_OPEN		0x02
2197c478bd9Sstevel@tonic-gate #define	UGEN_EP_STATE_STAT_OPEN		0x04
2207c478bd9Sstevel@tonic-gate #define	UGEN_EP_STATE_XS_OPEN		(UGEN_EP_STATE_XFER_OPEN | \
2217c478bd9Sstevel@tonic-gate 					    UGEN_EP_STATE_STAT_OPEN)
2227c478bd9Sstevel@tonic-gate #define	UGEN_EP_STATE_INTR_IN_POLLING_ON		0x10
2237c478bd9Sstevel@tonic-gate #define	UGEN_EP_STATE_INTR_IN_POLLING_IS_STOPPED	0x20
2247c478bd9Sstevel@tonic-gate #define	UGEN_EP_STATE_INTR_IN_POLL_PENDING		0x40
2257c478bd9Sstevel@tonic-gate 
2260a05e705Slc #define	UGEN_EP_STATE_ISOC_IN_POLLING_ON	0x100
2270a05e705Slc #define	UGEN_EP_STATE_ISOC_IN_POLLING_IS_STOPPED	0x200
2280a05e705Slc #define	UGEN_EP_STATE_ISOC_IN_POLL_PENDING	0x400
2290a05e705Slc 
2307c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(ugen_ep::ep_ph))
2317c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(ugen_ep::ep_descr))
2327c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(ugen_ep::ep_ser_cookie))
2337c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(ugen_ep::ep_if))
2347c478bd9Sstevel@tonic-gate 
2357c478bd9Sstevel@tonic-gate _NOTE(SCHEME_PROTECTS_DATA("USBA", usb_ctrl_req))
2367c478bd9Sstevel@tonic-gate _NOTE(SCHEME_PROTECTS_DATA("USBA", usb_bulk_req))
2377c478bd9Sstevel@tonic-gate _NOTE(SCHEME_PROTECTS_DATA("USBA", usb_intr_req))
2387c478bd9Sstevel@tonic-gate 
2397c478bd9Sstevel@tonic-gate typedef struct ugen_dev_stat {
2407c478bd9Sstevel@tonic-gate 	int			dev_oflag;	/* open flag */
2417c478bd9Sstevel@tonic-gate 	uint_t			dev_stat;	/* internal status */
2427c478bd9Sstevel@tonic-gate 	uint_t			dev_state;	/* exported state */
2437c478bd9Sstevel@tonic-gate 	kcondvar_t		dev_wait_cv;	/* block for change */
2447c478bd9Sstevel@tonic-gate 	struct pollhead		dev_pollhead;	/* for polling */
2457c478bd9Sstevel@tonic-gate } ugen_dev_stat_t;
2467c478bd9Sstevel@tonic-gate 
2477c478bd9Sstevel@tonic-gate /* dev_stat */
2487c478bd9Sstevel@tonic-gate #define	UGEN_DEV_STATUS_INACTIVE	0x0
2497c478bd9Sstevel@tonic-gate #define	UGEN_DEV_STATUS_ACTIVE		0x1
2507c478bd9Sstevel@tonic-gate #define	UGEN_DEV_STATUS_POLL_PENDING	0x2
2517c478bd9Sstevel@tonic-gate #define	UGEN_DEV_STATUS_CHANGED		0x4
2527c478bd9Sstevel@tonic-gate 
2537c478bd9Sstevel@tonic-gate /* Power Management support */
2547c478bd9Sstevel@tonic-gate typedef struct ugen_power  {
2557c478bd9Sstevel@tonic-gate 	uint_t			pwr_states;
2567c478bd9Sstevel@tonic-gate 	int			pwr_busy;		/* busy accounting */
2577c478bd9Sstevel@tonic-gate 	uint8_t			pwr_wakeup_enabled;
2587c478bd9Sstevel@tonic-gate 	uint8_t			pwr_current;
2597c478bd9Sstevel@tonic-gate } ugen_power_t;
2607c478bd9Sstevel@tonic-gate 
2617c478bd9Sstevel@tonic-gate /* UGEN state structure */
2627c478bd9Sstevel@tonic-gate typedef struct ugen_state {
2637c478bd9Sstevel@tonic-gate 	usb_ugen_hdl_impl_t	*ug_hdl;		/* pointer to handle */
2647c478bd9Sstevel@tonic-gate 	dev_info_t		*ug_dip;		/* Dev info */
2657c478bd9Sstevel@tonic-gate 	uint_t			ug_instance;		/* Instance number */
2667c478bd9Sstevel@tonic-gate 	uint_t			ug_dev_state;
2677c478bd9Sstevel@tonic-gate 	uint_t			ug_dev_stat_state;
2687c478bd9Sstevel@tonic-gate 	uint_t			ug_open_count;
2697c478bd9Sstevel@tonic-gate 	uint_t			ug_pending_cmds;
2707c478bd9Sstevel@tonic-gate 	uint_t			ug_initial_cfgidx;
2717c478bd9Sstevel@tonic-gate 
2727c478bd9Sstevel@tonic-gate 	/* locks */
2737c478bd9Sstevel@tonic-gate 	kmutex_t		ug_mutex;		/* Instance mutex */
2747c478bd9Sstevel@tonic-gate 	usb_serialization_t	ug_ser_cookie;		/* access */
2757c478bd9Sstevel@tonic-gate 
2767c478bd9Sstevel@tonic-gate 	/* USB debugging system support */
2777c478bd9Sstevel@tonic-gate 	usb_log_handle_t	ug_log_hdl;
2787c478bd9Sstevel@tonic-gate 
2797c478bd9Sstevel@tonic-gate 	/* registration data */
2807c478bd9Sstevel@tonic-gate 	usb_client_dev_data_t	*ug_dev_data;
2817c478bd9Sstevel@tonic-gate 
2827c478bd9Sstevel@tonic-gate 	/* Endpoint management list */
2837c478bd9Sstevel@tonic-gate 	ugen_ep_t		ug_ep[UGEN_N_ENDPOINTS];
2847c478bd9Sstevel@tonic-gate 
2857c478bd9Sstevel@tonic-gate 	/* encoding minor numbers as we only have 8 bits in the minor # */
2867c478bd9Sstevel@tonic-gate 	ugen_minor_t		*ug_minor_node_table;
2877c478bd9Sstevel@tonic-gate 	int			ug_minor_node_table_index;
2887c478bd9Sstevel@tonic-gate 	size_t			ug_minor_node_table_size;
2897c478bd9Sstevel@tonic-gate 
2907c478bd9Sstevel@tonic-gate 	/* device status management */
2917c478bd9Sstevel@tonic-gate 	ugen_dev_stat_t		ug_ds;
2927c478bd9Sstevel@tonic-gate 
2937c478bd9Sstevel@tonic-gate 	/* PM Support */
2947c478bd9Sstevel@tonic-gate 	ugen_power_t		*ug_pm;
2957c478bd9Sstevel@tonic-gate 
2967c478bd9Sstevel@tonic-gate 	/* Maximum transfer size for bulk endpoints */
2977c478bd9Sstevel@tonic-gate 	size_t			ug_max_bulk_xfer_sz;
2987c478bd9Sstevel@tonic-gate 
2997c478bd9Sstevel@tonic-gate 	/* Used to deallocate allocated resources */
3007c478bd9Sstevel@tonic-gate 	ushort_t		ug_cleanup_flags;
3017c478bd9Sstevel@tonic-gate } ugen_state_t;
3027c478bd9Sstevel@tonic-gate 
3037c478bd9Sstevel@tonic-gate _NOTE(SCHEME_PROTECTS_DATA("unshared", buf))
3047c478bd9Sstevel@tonic-gate 
3057c478bd9Sstevel@tonic-gate _NOTE(MUTEX_PROTECTS_DATA(ugen_state::ug_mutex, ugen_state))
3067c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(ugen_state::ug_log_hdl))
3077c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(ugen_state::ug_hdl))
3087c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(ugen_state::ug_ser_cookie))
3097c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(ugen_state::ug_dip))
3107c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(ugen_state::ug_pm))
3117c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(ugen_state::ug_instance))
3127c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(ugen_state::ug_minor_node_table))
3137c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(ugen_state::ug_minor_node_table_index))
3147c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(ugen_state::ug_max_bulk_xfer_sz))
3157c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(ugen_state::ug_dev_data))
3167c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(ugen_state::ug_cleanup_flags))
3177c478bd9Sstevel@tonic-gate 
3187c478bd9Sstevel@tonic-gate 
3197c478bd9Sstevel@tonic-gate /* ugen_cleanup_flags */
3207c478bd9Sstevel@tonic-gate #define	UGEN_INIT_LOCKS			0x01
3217c478bd9Sstevel@tonic-gate 
3227c478bd9Sstevel@tonic-gate /* additional USB device states */
3237c478bd9Sstevel@tonic-gate #define	USB_UGEN_DEV_UNAVAILABLE_RESUME		0x90
3247c478bd9Sstevel@tonic-gate #define	USB_UGEN_DEV_UNAVAILABLE_RECONNECT	0x91
3257c478bd9Sstevel@tonic-gate 
3267c478bd9Sstevel@tonic-gate /* Debugging information */
3277c478bd9Sstevel@tonic-gate #define	UGEN_PRINT_ATTA		0x1
3287c478bd9Sstevel@tonic-gate #define	UGEN_PRINT_CBOPS	0x2
3297c478bd9Sstevel@tonic-gate #define	UGEN_PRINT_CPR		0x4
3307c478bd9Sstevel@tonic-gate #define	UGEN_PRINT_POLL		0x8
3317c478bd9Sstevel@tonic-gate #define	UGEN_PRINT_XFER		0x10
3327c478bd9Sstevel@tonic-gate #define	UGEN_PRINT_HOTPLUG	0x20
3337c478bd9Sstevel@tonic-gate #define	UGEN_PRINT_STAT		0x40
3347c478bd9Sstevel@tonic-gate #define	UGEN_PRINT_PM		0x80
3357c478bd9Sstevel@tonic-gate #define	UGEN_PRINT_ALL		0xFFFFFFFF
3367c478bd9Sstevel@tonic-gate 
3377c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
3387c478bd9Sstevel@tonic-gate }
3397c478bd9Sstevel@tonic-gate #endif
3407c478bd9Sstevel@tonic-gate 
3417c478bd9Sstevel@tonic-gate #endif	/* _SYS_USBA_UGEND_H */
342