xref: /onnv-gate/usr/src/uts/common/sys/usb/hubd/hubdvar.h (revision 2651:101d1508d25f)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*2651Ssl147100  * Common Development and Distribution License (the "License").
6*2651Ssl147100  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
210Sstevel@tonic-gate /*
22*2651Ssl147100  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
230Sstevel@tonic-gate  * Use is subject to license terms.
240Sstevel@tonic-gate  */
250Sstevel@tonic-gate 
260Sstevel@tonic-gate #ifndef	_SYS_USB_HUBDVAR_H
270Sstevel@tonic-gate #define	_SYS_USB_HUBDVAR_H
280Sstevel@tonic-gate 
290Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
300Sstevel@tonic-gate 
310Sstevel@tonic-gate #ifdef	__cplusplus
320Sstevel@tonic-gate extern "C" {
330Sstevel@tonic-gate #endif
340Sstevel@tonic-gate 
350Sstevel@tonic-gate #include <sys/sunndi.h>
360Sstevel@tonic-gate #include <sys/ndi_impldefs.h>
370Sstevel@tonic-gate #include <sys/usb/usba/usba_types.h>
380Sstevel@tonic-gate #include <sys/callb.h>
390Sstevel@tonic-gate 
400Sstevel@tonic-gate /*
410Sstevel@tonic-gate  * HUB USB device state management :
420Sstevel@tonic-gate  *
430Sstevel@tonic-gate  *                          CHILD PWRLVL---1>--------+
440Sstevel@tonic-gate  *                               ^                   |
450Sstevel@tonic-gate  *                               8                   |
460Sstevel@tonic-gate  *                               |                   |
470Sstevel@tonic-gate  *                               9                   |
480Sstevel@tonic-gate  *                               v                   |
490Sstevel@tonic-gate  *	PWRED_DWN---<3----4>--ONLINE---<2-----1>-DISCONNECTED
500Sstevel@tonic-gate  *          |                  |  ^                |  |
510Sstevel@tonic-gate  *          |                  |  10               |  |
520Sstevel@tonic-gate  *          |                  |  |                |  |
530Sstevel@tonic-gate  *          |                  |  RECOVER-<2-------+  |
540Sstevel@tonic-gate  *          |                  |  ^                   |
550Sstevel@tonic-gate  *          |                  5  6                   |
560Sstevel@tonic-gate  *          |                  |  |                   |
570Sstevel@tonic-gate  *          |                  v  |                   |
580Sstevel@tonic-gate  *          +----5>----------SUSPENDED----<5----7>----+
590Sstevel@tonic-gate  *
600Sstevel@tonic-gate  *	1 = Device Unplug
610Sstevel@tonic-gate  *	2 = Original Device reconnected and after hub driver restores its own
620Sstevel@tonic-gate  *	    device state.
630Sstevel@tonic-gate  *	3 = Device idles for time T & transitions to low power state
640Sstevel@tonic-gate  *	4 = Remote wakeup by device OR Application kicking off IO to device
650Sstevel@tonic-gate  *	5 = Notification to save state prior to DDI_SUSPEND
660Sstevel@tonic-gate  *	6 = Notification to restore state after DDI_RESUME with correct device
670Sstevel@tonic-gate  *          and after hub driver restores its own device state.
680Sstevel@tonic-gate  *	7 = Notification to restore state after DDI_RESUME with device
690Sstevel@tonic-gate  *	    disconnected or a wrong device
700Sstevel@tonic-gate  *	8 = Hub detect child doing remote wakeup and request the PM
710Sstevel@tonic-gate  *	    framework to bring it to full power
720Sstevel@tonic-gate  *      9 = PM framework has compeleted call power entry point of the child
730Sstevel@tonic-gate  *	    and bus ctls of hub
740Sstevel@tonic-gate  *     10 = Restoring states of its children i.e. set addrs & config.
750Sstevel@tonic-gate  *
760Sstevel@tonic-gate  */
770Sstevel@tonic-gate 
780Sstevel@tonic-gate #define	HUBD_INITIAL_SOFT_SPACE	4
790Sstevel@tonic-gate 
800Sstevel@tonic-gate typedef struct hub_power_struct {
810Sstevel@tonic-gate 	void		*hubp_hubd;	/* points back to hubd_t */
820Sstevel@tonic-gate 
830Sstevel@tonic-gate 	uint8_t		hubp_wakeup_enabled;	/* remote wakeup enabled? */
840Sstevel@tonic-gate 
850Sstevel@tonic-gate 	/* this is the bit mask of the power states that device has */
860Sstevel@tonic-gate 	uint8_t		hubp_pwr_states;
870Sstevel@tonic-gate 
880Sstevel@tonic-gate 	int		hubp_busy_pm;	/* device busy accounting */
890Sstevel@tonic-gate 
900Sstevel@tonic-gate 	/* wakeup and power transition capabilities of an interface */
910Sstevel@tonic-gate 	uint8_t		hubp_pm_capabilities;
920Sstevel@tonic-gate 
930Sstevel@tonic-gate 	uint8_t		hubp_current_power;	/* current power level */
940Sstevel@tonic-gate 
950Sstevel@tonic-gate 	time_t		hubp_time_at_full_power;	/* timestamp 0->3 */
960Sstevel@tonic-gate 
970Sstevel@tonic-gate 	uint8_t		hubp_min_pm_threshold;		/* in seconds */
980Sstevel@tonic-gate 
990Sstevel@tonic-gate 	/* power state of all children are tracked here */
1000Sstevel@tonic-gate 	uint8_t		*hubp_child_pwrstate;
1010Sstevel@tonic-gate 
1020Sstevel@tonic-gate 	/* pm-components properties are stored here */
1030Sstevel@tonic-gate 	char		*hubp_pmcomp[5];
1040Sstevel@tonic-gate 
1050Sstevel@tonic-gate 	usba_cfg_pwr_descr_t	hubp_confpwr_descr; /* config pwr descr */
1060Sstevel@tonic-gate } hub_power_t;
1070Sstevel@tonic-gate 
1080Sstevel@tonic-gate /* warlock directives, stable data */
1090Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(hub_power_t::hubp_hubd))
1100Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(hub_power_t::hubp_wakeup_enabled))
1110Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(hub_power_t::hubp_pwr_states))
1120Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(hub_power_t::hubp_time_at_full_power))
1130Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(hub_power_t::hubp_min_pm_threshold))
1140Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(hub_power_t::hubp_pm_capabilities))
1150Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(hub_power_t::hubp_pmcomp))
1160Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(hub_power_t::hubp_confpwr_descr))
1170Sstevel@tonic-gate 
1180Sstevel@tonic-gate 
1190Sstevel@tonic-gate #define	HUBD_APID_NAMELEN	32		/* max len in cfgadm display */
1200Sstevel@tonic-gate 
1210Sstevel@tonic-gate /*
1220Sstevel@tonic-gate  * hubd cpr data structure used for callback before kernel threads are
1230Sstevel@tonic-gate  * suspended
1240Sstevel@tonic-gate  */
1250Sstevel@tonic-gate typedef struct hubd_cpr {
1260Sstevel@tonic-gate 	callb_cpr_t		cpr;		/* for cpr related info */
1270Sstevel@tonic-gate 	struct hubd		*statep;	/* ohci soft state struct */
1280Sstevel@tonic-gate 	kmutex_t		lockp;
1290Sstevel@tonic-gate } hubd_cpr_t;
1300Sstevel@tonic-gate 
1310Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(hubd_cpr_t::cpr))
1320Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(hubd_cpr_t::statep))
1330Sstevel@tonic-gate 
1340Sstevel@tonic-gate 
1350Sstevel@tonic-gate /*
1360Sstevel@tonic-gate  * soft	state information for this hubd
1370Sstevel@tonic-gate  */
1380Sstevel@tonic-gate typedef struct hubd {
1390Sstevel@tonic-gate 	int			h_instance;
1400Sstevel@tonic-gate 	uint_t			h_init_state;
1410Sstevel@tonic-gate 	uint_t			h_dev_state;
1420Sstevel@tonic-gate 	int8_t			h_bus_ctls;
1430Sstevel@tonic-gate 	int8_t			h_bus_pwr;
1440Sstevel@tonic-gate 	hub_power_t		*h_hubpm; /* pointer to power struct */
1450Sstevel@tonic-gate 	dev_info_t		*h_dip;
1460Sstevel@tonic-gate 
1470Sstevel@tonic-gate 	/*
1480Sstevel@tonic-gate 	 * mutex to protect softstate and hw regs
1490Sstevel@tonic-gate 	 */
1500Sstevel@tonic-gate 	kmutex_t		h_mutex;
1510Sstevel@tonic-gate 
1520Sstevel@tonic-gate 	/*
1530Sstevel@tonic-gate 	 * save the usba_device pointer
1540Sstevel@tonic-gate 	 */
1550Sstevel@tonic-gate 	usba_device_t		*h_usba_device;
1560Sstevel@tonic-gate 
1570Sstevel@tonic-gate 	int			h_softstate;
1580Sstevel@tonic-gate 
1590Sstevel@tonic-gate 	/*
1600Sstevel@tonic-gate 	 * default pipe handle
1610Sstevel@tonic-gate 	 */
1620Sstevel@tonic-gate 	usb_pipe_handle_t	h_default_pipe;
1630Sstevel@tonic-gate 
1640Sstevel@tonic-gate 	/*
1650Sstevel@tonic-gate 	 * pipe handle for ep1
1660Sstevel@tonic-gate 	 */
1670Sstevel@tonic-gate 	usb_pipe_handle_t	h_ep1_ph;
1680Sstevel@tonic-gate 	usb_ep_descr_t		h_ep1_descr;
1690Sstevel@tonic-gate 	usb_pipe_policy_t	h_pipe_policy;
1700Sstevel@tonic-gate 	uint_t			h_intr_pipe_state;
1710Sstevel@tonic-gate 
1720Sstevel@tonic-gate 	/*
1730Sstevel@tonic-gate 	 * root hub descriptor
1740Sstevel@tonic-gate 	 */
1750Sstevel@tonic-gate 	struct usb_hub_descr	h_hub_descr;
1760Sstevel@tonic-gate 
1770Sstevel@tonic-gate 	/*
1780Sstevel@tonic-gate 	 * hotplug handling
1790Sstevel@tonic-gate 	 */
1800Sstevel@tonic-gate 	uint_t			h_hotplug_thread;
1810Sstevel@tonic-gate 
1820Sstevel@tonic-gate 	/*
1830Sstevel@tonic-gate 	 * h_children_dips is a  array for holding
1840Sstevel@tonic-gate 	 * each child dip indexed by port
1850Sstevel@tonic-gate 	 * h_usba_devices is the corresponding usba_device
1860Sstevel@tonic-gate 	 */
1870Sstevel@tonic-gate 	dev_info_t		**h_children_dips;
1880Sstevel@tonic-gate 	size_t			h_cd_list_length;
1890Sstevel@tonic-gate 	usba_device_t		**h_usba_devices;
1900Sstevel@tonic-gate 
1910Sstevel@tonic-gate 	/* change reported by hub, limited to 31 ports */
1920Sstevel@tonic-gate 	usb_port_mask_t		h_port_change;
1930Sstevel@tonic-gate 
1940Sstevel@tonic-gate 	/* waiting for reset completion callback */
1950Sstevel@tonic-gate 	usb_port_mask_t		h_port_reset_wait;
1960Sstevel@tonic-gate 
1970Sstevel@tonic-gate 	/* track transitions of child on each port */
1980Sstevel@tonic-gate 	uint16_t		h_port_state[MAX_PORTS + 1];
1990Sstevel@tonic-gate 
2000Sstevel@tonic-gate 	/* track event registration of children */
2010Sstevel@tonic-gate 	uint8_t			h_child_events[MAX_PORTS + 1];
2020Sstevel@tonic-gate 
2030Sstevel@tonic-gate 	kcondvar_t		h_cv_reset_port;
2040Sstevel@tonic-gate 	uint_t			h_intr_completion_reason;
2050Sstevel@tonic-gate 	usb_log_handle_t	h_log_handle;	/* for logging msgs */
2060Sstevel@tonic-gate 
2070Sstevel@tonic-gate 	ndi_event_hdl_t		h_ndi_event_hdl;
2080Sstevel@tonic-gate 	hubd_cpr_t		*h_cpr_cb;
2090Sstevel@tonic-gate 
2100Sstevel@tonic-gate 	/*
2110Sstevel@tonic-gate 	 * Hotplug event statistics since hub was attached
2120Sstevel@tonic-gate 	 */
2130Sstevel@tonic-gate 	ulong_t			h_total_hotplug_success;
2140Sstevel@tonic-gate 	ulong_t			h_total_hotplug_failure;
2150Sstevel@tonic-gate 
2160Sstevel@tonic-gate 	/* for minor node */
2170Sstevel@tonic-gate 	char			*h_ancestry_str;
2180Sstevel@tonic-gate 
2190Sstevel@tonic-gate 	/* registration data */
2200Sstevel@tonic-gate 	usb_client_dev_data_t	*h_dev_data;
2210Sstevel@tonic-gate 
2220Sstevel@tonic-gate 	/* for deathrow implementation */
2230Sstevel@tonic-gate 	boolean_t		h_cleanup_enabled;
2240Sstevel@tonic-gate 	boolean_t		h_cleanup_needed;
2250Sstevel@tonic-gate 	boolean_t		h_cleanup_active;
2261001Ssl147100 
2271001Ssl147100 	/*
2281001Ssl147100 	 * for power budget support
2291001Ssl147100 	 * h_pwr_limit and h_pwr_left are expressed
2301001Ssl147100 	 * in 2mA units
2311001Ssl147100 	 */
2321001Ssl147100 	boolean_t		h_local_pwr_capable;
2331001Ssl147100 	boolean_t		h_local_pwr_on;
2341001Ssl147100 	uint16_t		h_pwr_limit; /* per port pwr limit */
2351001Ssl147100 	int16_t			h_pwr_left; /* limit on the whole hub */
2361001Ssl147100 
2371001Ssl147100 	/*
2381001Ssl147100 	 * conf file override to power budget property
2391001Ssl147100 	 * if 1, power budget is disabled
2401001Ssl147100 	 */
2411001Ssl147100 	boolean_t		h_ignore_pwr_budget;
2420Sstevel@tonic-gate } hubd_t;
2430Sstevel@tonic-gate 
2440Sstevel@tonic-gate _NOTE(MUTEX_PROTECTS_DATA(hubd::h_mutex, hubd))
2450Sstevel@tonic-gate _NOTE(MUTEX_PROTECTS_DATA(hubd::h_mutex, hub_power_t))
2460Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(hubd::h_default_pipe
2470Sstevel@tonic-gate 		hubd::h_usba_device
2480Sstevel@tonic-gate 		hubd::h_dev_data
2490Sstevel@tonic-gate 		hubd::h_ndi_event_hdl
2500Sstevel@tonic-gate 		hubd::h_cpr_cb
2510Sstevel@tonic-gate 		hubd::h_log_handle
2520Sstevel@tonic-gate 		hubd::h_ep1_ph
2530Sstevel@tonic-gate 		hubd::h_instance
2540Sstevel@tonic-gate 		hubd::h_hubpm
2550Sstevel@tonic-gate 		hubd::h_dip
2561001Ssl147100 		hubd::h_ignore_pwr_budget
2570Sstevel@tonic-gate ))
2580Sstevel@tonic-gate 
2590Sstevel@tonic-gate _NOTE(SCHEME_PROTECTS_DATA("stable data", usb_ep_descr))
2600Sstevel@tonic-gate 
261*2651Ssl147100 /*
262*2651Ssl147100  * hubd hotplug thread argument data structure
263*2651Ssl147100  */
264*2651Ssl147100 typedef struct hubd_hotplug_arg {
265*2651Ssl147100 	hubd_t		*hubd;
266*2651Ssl147100 
267*2651Ssl147100 	/*
268*2651Ssl147100 	 * flag to indicate if a hotplug thread is started
269*2651Ssl147100 	 * during hubd attach time, if true, it means the
270*2651Ssl147100 	 * connected devices need to be enumerated regardless
271*2651Ssl147100 	 * of the connect status change bit
272*2651Ssl147100 	 */
273*2651Ssl147100 	boolean_t	hotplug_during_attach;
274*2651Ssl147100 } hubd_hotplug_arg_t;
275*2651Ssl147100 
276*2651Ssl147100 _NOTE(SCHEME_PROTECTS_DATA("unshared", hubd_hotplug_arg))
277*2651Ssl147100 
2780Sstevel@tonic-gate #define	HUBD_UNIT(dev)		(getminor((dev)))
2790Sstevel@tonic-gate #define	HUBD_MUTEX(hubd)	(&((hubd)->h_mutex))
2800Sstevel@tonic-gate #define	HUBD_SS_ISOPEN		0x0001
2810Sstevel@tonic-gate #define	HUBD_ACK_ALL_CHANGES	PORT_CHANGE_MASK
2820Sstevel@tonic-gate 
2830Sstevel@tonic-gate /* init state */
2840Sstevel@tonic-gate #define	HUBD_LOCKS_DONE		0x0001
2850Sstevel@tonic-gate #define	HUBD_HUBDI_REGISTERED	0x0002
2860Sstevel@tonic-gate #define	HUBD_MINOR_NODE_CREATED 0x0004
2871001Ssl147100 #define	HUBD_CHILDREN_CREATED	0x0008
2880Sstevel@tonic-gate #define	HUBD_EVENTS_REGISTERED	0x0020
2890Sstevel@tonic-gate 
2900Sstevel@tonic-gate /*
2910Sstevel@tonic-gate  * port flags : These are essentially extensions of  Port Status Field Bits
2920Sstevel@tonic-gate  * as in USB 2.0 spec Table 11-21 and #defined in hubd.h file. We make use
2930Sstevel@tonic-gate  * of the unused bits (5-7,13-15) here to track states of the hub's child.
2940Sstevel@tonic-gate  */
2950Sstevel@tonic-gate #define	HUBD_CHILD_ATTACHING		0x0020
2960Sstevel@tonic-gate #define	HUBD_CHILD_DETACHING		0x0040
2970Sstevel@tonic-gate #define	HUBD_CHILD_PWRLVL_CHNG		0x0080
2980Sstevel@tonic-gate #define	HUBD_CHILD_RAISE_POWER		0x2000
2990Sstevel@tonic-gate #define	HUBD_CHILD_ZAP			0x4000
3000Sstevel@tonic-gate 
3010Sstevel@tonic-gate /* Tracking events registered by children */
3020Sstevel@tonic-gate #define	HUBD_CHILD_EVENT_DISCONNECT	0x01
3030Sstevel@tonic-gate #define	HUBD_CHILD_EVENT_PRESUSPEND	0x02
3040Sstevel@tonic-gate 
3050Sstevel@tonic-gate /* This dev state is used exclusively by hub to change port suspend/resume */
3060Sstevel@tonic-gate #define	USB_DEV_HUB_CHILD_PWRLVL	0x80
3070Sstevel@tonic-gate #define	USB_DEV_HUB_STATE_RECOVER	0x81
3080Sstevel@tonic-gate 
3090Sstevel@tonic-gate /*
3100Sstevel@tonic-gate  * hubd interrupt pipe management :
3110Sstevel@tonic-gate  *
3120Sstevel@tonic-gate  * Following are the states of the interrupt pipe
3130Sstevel@tonic-gate  *
3140Sstevel@tonic-gate  * IDLE:
3150Sstevel@tonic-gate  *	initial state and after closing of the interrupt pipe
3160Sstevel@tonic-gate  *
3170Sstevel@tonic-gate  * OPENING:
3180Sstevel@tonic-gate  *	Set when the pipe is being opened
3190Sstevel@tonic-gate  *
3200Sstevel@tonic-gate  * ACTIVE:
3210Sstevel@tonic-gate  *	Set when the pipe has been opened in hubd_open_intr_pipe. This is
3220Sstevel@tonic-gate  *	typically after a hub has got enumerated and initialized.
3230Sstevel@tonic-gate  *
3240Sstevel@tonic-gate  * CLOSING :
3250Sstevel@tonic-gate  *	Set when the pipe is closed by calling hubd_close_intr_pipe(). This is
3260Sstevel@tonic-gate  *	typically called on hub disconnect via hubd_cleanup.
3270Sstevel@tonic-gate  */
3280Sstevel@tonic-gate #define	HUBD_INTR_PIPE_IDLE		0
3290Sstevel@tonic-gate #define	HUBD_INTR_PIPE_OPENING		1
3300Sstevel@tonic-gate #define	HUBD_INTR_PIPE_ACTIVE		2
3310Sstevel@tonic-gate #define	HUBD_INTR_PIPE_STOPPED		3
3320Sstevel@tonic-gate #define	HUBD_INTR_PIPE_CLOSING		4
3330Sstevel@tonic-gate 
3340Sstevel@tonic-gate 
3350Sstevel@tonic-gate /* request structure for putting dips on deathrow list */
3360Sstevel@tonic-gate typedef struct hubd_offline_req {
3370Sstevel@tonic-gate 	usba_list_entry_t	or_queue; /* DO NOT MOVE! */
3380Sstevel@tonic-gate 	hubd_t			*or_hubd;
3390Sstevel@tonic-gate 	usb_port_t		or_port;
3400Sstevel@tonic-gate 	dev_info_t		*or_dip;
3410Sstevel@tonic-gate 	uint_t			or_flag;
3420Sstevel@tonic-gate } hubd_offline_req_t;
3430Sstevel@tonic-gate 
3440Sstevel@tonic-gate _NOTE(SCHEME_PROTECTS_DATA("unshared", hubd_offline_req))
3450Sstevel@tonic-gate 
3460Sstevel@tonic-gate 
3470Sstevel@tonic-gate /*
3480Sstevel@tonic-gate  * cfgadm state values
3490Sstevel@tonic-gate  */
3500Sstevel@tonic-gate #define	HUBD_CFGADM_NORMAL		0	/* normal state */
3510Sstevel@tonic-gate #define	HUBD_CFGADM_DISCONNECTED	1	/* logically disconnected */
3520Sstevel@tonic-gate #define	HUBD_CFGADM_UNCONFIGURED	2	/* port is unconfigured */
3530Sstevel@tonic-gate #define	HUBD_CFGADM_EMPTY		3	/* port is empty */
3540Sstevel@tonic-gate #define	HUBD_CFGADM_STILL_REFERENCED	4	/* ndi_devi_offline failed */
3550Sstevel@tonic-gate #define	HUBD_CFGADM_CONFIGURED		5	/* port is configured */
3560Sstevel@tonic-gate 
3570Sstevel@tonic-gate /*
3580Sstevel@tonic-gate  * Debug printing
3590Sstevel@tonic-gate  * Masks
3600Sstevel@tonic-gate  */
3610Sstevel@tonic-gate #define	DPRINT_MASK_ATTA	0x00000001
3620Sstevel@tonic-gate #define	DPRINT_MASK_CBOPS	0x00000002
3630Sstevel@tonic-gate #define	DPRINT_MASK_CALLBACK	0x00000004
3640Sstevel@tonic-gate #define	DPRINT_MASK_PORT	0x00000008
3650Sstevel@tonic-gate #define	DPRINT_MASK_HUB 	0x00000010
3660Sstevel@tonic-gate #define	DPRINT_MASK_HOTPLUG	0x00000020
3670Sstevel@tonic-gate #define	DPRINT_MASK_EVENTS	0x00000040
3680Sstevel@tonic-gate #define	DPRINT_MASK_PM		0x00000080
3690Sstevel@tonic-gate #define	DPRINT_MASK_ALL 	0xFFFFFFFF
3700Sstevel@tonic-gate 
3710Sstevel@tonic-gate 
3720Sstevel@tonic-gate /* status length used in getting hub status */
3730Sstevel@tonic-gate #define	GET_STATUS_LENGTH	0x04		/* length of get status req */
3740Sstevel@tonic-gate 
3750Sstevel@tonic-gate /* flag for hubd_start_polling */
3760Sstevel@tonic-gate #define	HUBD_ALWAYS_START_POLLING	1
3770Sstevel@tonic-gate 
3780Sstevel@tonic-gate /* enumeration timeout */
3790Sstevel@tonic-gate #define	HUBDI_ENUM_TIMEOUT	1	/* 1 second */
3800Sstevel@tonic-gate 
3811001Ssl147100 /* power budget unit in mA */
3821001Ssl147100 #define	USB_PWR_UNIT_LOAD	100
3831001Ssl147100 
3841001Ssl147100 /* power values in 100mA units */
3851001Ssl147100 #define	USB_HIGH_PWR_VALUE	5
3861001Ssl147100 #define	USB_LOW_PWR_VALUE	1
3871001Ssl147100 
3881001Ssl147100 /*
3891001Ssl147100  * According to section 9.6.3 of USB 2.0 spec,
3901001Ssl147100  * bMaxPower in the device configuration descriptor
3911001Ssl147100  * is expressed in 2mA units
3921001Ssl147100  */
3931001Ssl147100 #define	USB_CFG_DESCR_PWR_UNIT	2
3941001Ssl147100 
3950Sstevel@tonic-gate #ifdef	__cplusplus
3960Sstevel@tonic-gate }
3970Sstevel@tonic-gate #endif
3980Sstevel@tonic-gate 
3990Sstevel@tonic-gate #endif	/* _SYS_USB_HUBDVAR_H */
400