xref: /onnv-gate/usr/src/uts/common/sys/usb/hubd/hubdvar.h (revision 4844:48fc27657460)
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
52651Ssl147100  * Common Development and Distribution License (the "License").
62651Ssl147100  * 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*4844Slg150142  * Copyright 2007 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 
200*4844Slg150142 	/* track reset state of each port */
201*4844Slg150142 	boolean_t		h_reset_port[MAX_PORTS + 1];
202*4844Slg150142 
2030Sstevel@tonic-gate 	/* track event registration of children */
2040Sstevel@tonic-gate 	uint8_t			h_child_events[MAX_PORTS + 1];
2050Sstevel@tonic-gate 
2060Sstevel@tonic-gate 	kcondvar_t		h_cv_reset_port;
207*4844Slg150142 	kcondvar_t		h_cv_hotplug_dev;
2080Sstevel@tonic-gate 	uint_t			h_intr_completion_reason;
2090Sstevel@tonic-gate 	usb_log_handle_t	h_log_handle;	/* for logging msgs */
2100Sstevel@tonic-gate 
2110Sstevel@tonic-gate 	ndi_event_hdl_t		h_ndi_event_hdl;
2120Sstevel@tonic-gate 	hubd_cpr_t		*h_cpr_cb;
2130Sstevel@tonic-gate 
2140Sstevel@tonic-gate 	/*
2150Sstevel@tonic-gate 	 * Hotplug event statistics since hub was attached
2160Sstevel@tonic-gate 	 */
2170Sstevel@tonic-gate 	ulong_t			h_total_hotplug_success;
2180Sstevel@tonic-gate 	ulong_t			h_total_hotplug_failure;
2190Sstevel@tonic-gate 
2200Sstevel@tonic-gate 	/* for minor node */
2210Sstevel@tonic-gate 	char			*h_ancestry_str;
2220Sstevel@tonic-gate 
2230Sstevel@tonic-gate 	/* registration data */
2240Sstevel@tonic-gate 	usb_client_dev_data_t	*h_dev_data;
2250Sstevel@tonic-gate 
2260Sstevel@tonic-gate 	/* for deathrow implementation */
2270Sstevel@tonic-gate 	boolean_t		h_cleanup_enabled;
2280Sstevel@tonic-gate 	boolean_t		h_cleanup_needed;
2290Sstevel@tonic-gate 	boolean_t		h_cleanup_active;
2301001Ssl147100 
2311001Ssl147100 	/*
2321001Ssl147100 	 * for power budget support
2331001Ssl147100 	 * h_pwr_limit and h_pwr_left are expressed
2341001Ssl147100 	 * in 2mA units
2351001Ssl147100 	 */
2361001Ssl147100 	boolean_t		h_local_pwr_capable;
2371001Ssl147100 	boolean_t		h_local_pwr_on;
2381001Ssl147100 	uint16_t		h_pwr_limit; /* per port pwr limit */
2391001Ssl147100 	int16_t			h_pwr_left; /* limit on the whole hub */
2401001Ssl147100 
2411001Ssl147100 	/*
2421001Ssl147100 	 * conf file override to power budget property
2431001Ssl147100 	 * if 1, power budget is disabled
2441001Ssl147100 	 */
2451001Ssl147100 	boolean_t		h_ignore_pwr_budget;
2460Sstevel@tonic-gate } hubd_t;
2470Sstevel@tonic-gate 
2480Sstevel@tonic-gate _NOTE(MUTEX_PROTECTS_DATA(hubd::h_mutex, hubd))
2490Sstevel@tonic-gate _NOTE(MUTEX_PROTECTS_DATA(hubd::h_mutex, hub_power_t))
2500Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(hubd::h_default_pipe
2510Sstevel@tonic-gate 		hubd::h_usba_device
2520Sstevel@tonic-gate 		hubd::h_dev_data
2530Sstevel@tonic-gate 		hubd::h_ndi_event_hdl
2540Sstevel@tonic-gate 		hubd::h_cpr_cb
2550Sstevel@tonic-gate 		hubd::h_log_handle
2560Sstevel@tonic-gate 		hubd::h_ep1_ph
2570Sstevel@tonic-gate 		hubd::h_instance
2580Sstevel@tonic-gate 		hubd::h_hubpm
2590Sstevel@tonic-gate 		hubd::h_dip
2601001Ssl147100 		hubd::h_ignore_pwr_budget
2610Sstevel@tonic-gate ))
2620Sstevel@tonic-gate 
2630Sstevel@tonic-gate _NOTE(SCHEME_PROTECTS_DATA("stable data", usb_ep_descr))
2640Sstevel@tonic-gate 
2652651Ssl147100 /*
2662651Ssl147100  * hubd hotplug thread argument data structure
2672651Ssl147100  */
2682651Ssl147100 typedef struct hubd_hotplug_arg {
2692651Ssl147100 	hubd_t		*hubd;
2702651Ssl147100 
2712651Ssl147100 	/*
2722651Ssl147100 	 * flag to indicate if a hotplug thread is started
2732651Ssl147100 	 * during hubd attach time, if true, it means the
2742651Ssl147100 	 * connected devices need to be enumerated regardless
2752651Ssl147100 	 * of the connect status change bit
2762651Ssl147100 	 */
2772651Ssl147100 	boolean_t	hotplug_during_attach;
2782651Ssl147100 } hubd_hotplug_arg_t;
2792651Ssl147100 
280*4844Slg150142 /*
281*4844Slg150142  * hubd reset thread argument data structure
282*4844Slg150142  */
283*4844Slg150142 typedef struct hubd_reset_arg {
284*4844Slg150142 	hubd_t		*hubd;
285*4844Slg150142 	/* The port needs to be reset */
286*4844Slg150142 	uint16_t	reset_port;
287*4844Slg150142 } hubd_reset_arg_t;
288*4844Slg150142 
2892651Ssl147100 _NOTE(SCHEME_PROTECTS_DATA("unshared", hubd_hotplug_arg))
290*4844Slg150142 _NOTE(SCHEME_PROTECTS_DATA("unshared", hubd_reset_arg))
2912651Ssl147100 
2920Sstevel@tonic-gate #define	HUBD_UNIT(dev)		(getminor((dev)))
2930Sstevel@tonic-gate #define	HUBD_MUTEX(hubd)	(&((hubd)->h_mutex))
2940Sstevel@tonic-gate #define	HUBD_SS_ISOPEN		0x0001
2950Sstevel@tonic-gate #define	HUBD_ACK_ALL_CHANGES	PORT_CHANGE_MASK
2960Sstevel@tonic-gate 
2970Sstevel@tonic-gate /* init state */
2980Sstevel@tonic-gate #define	HUBD_LOCKS_DONE		0x0001
2990Sstevel@tonic-gate #define	HUBD_HUBDI_REGISTERED	0x0002
3000Sstevel@tonic-gate #define	HUBD_MINOR_NODE_CREATED 0x0004
3011001Ssl147100 #define	HUBD_CHILDREN_CREATED	0x0008
3020Sstevel@tonic-gate #define	HUBD_EVENTS_REGISTERED	0x0020
3030Sstevel@tonic-gate 
3040Sstevel@tonic-gate /*
3050Sstevel@tonic-gate  * port flags : These are essentially extensions of  Port Status Field Bits
3060Sstevel@tonic-gate  * as in USB 2.0 spec Table 11-21 and #defined in hubd.h file. We make use
3070Sstevel@tonic-gate  * of the unused bits (5-7,13-15) here to track states of the hub's child.
3080Sstevel@tonic-gate  */
3090Sstevel@tonic-gate #define	HUBD_CHILD_ATTACHING		0x0020
3100Sstevel@tonic-gate #define	HUBD_CHILD_DETACHING		0x0040
3110Sstevel@tonic-gate #define	HUBD_CHILD_PWRLVL_CHNG		0x0080
3120Sstevel@tonic-gate #define	HUBD_CHILD_RAISE_POWER		0x2000
3130Sstevel@tonic-gate #define	HUBD_CHILD_ZAP			0x4000
3140Sstevel@tonic-gate 
3150Sstevel@tonic-gate /* Tracking events registered by children */
3160Sstevel@tonic-gate #define	HUBD_CHILD_EVENT_DISCONNECT	0x01
3170Sstevel@tonic-gate #define	HUBD_CHILD_EVENT_PRESUSPEND	0x02
3180Sstevel@tonic-gate 
3190Sstevel@tonic-gate /* This dev state is used exclusively by hub to change port suspend/resume */
3200Sstevel@tonic-gate #define	USB_DEV_HUB_CHILD_PWRLVL	0x80
3210Sstevel@tonic-gate #define	USB_DEV_HUB_STATE_RECOVER	0x81
3220Sstevel@tonic-gate 
3230Sstevel@tonic-gate /*
3240Sstevel@tonic-gate  * hubd interrupt pipe management :
3250Sstevel@tonic-gate  *
3260Sstevel@tonic-gate  * Following are the states of the interrupt pipe
3270Sstevel@tonic-gate  *
3280Sstevel@tonic-gate  * IDLE:
3290Sstevel@tonic-gate  *	initial state and after closing of the interrupt pipe
3300Sstevel@tonic-gate  *
3310Sstevel@tonic-gate  * OPENING:
3320Sstevel@tonic-gate  *	Set when the pipe is being opened
3330Sstevel@tonic-gate  *
3340Sstevel@tonic-gate  * ACTIVE:
3350Sstevel@tonic-gate  *	Set when the pipe has been opened in hubd_open_intr_pipe. This is
3360Sstevel@tonic-gate  *	typically after a hub has got enumerated and initialized.
3370Sstevel@tonic-gate  *
3380Sstevel@tonic-gate  * CLOSING :
3390Sstevel@tonic-gate  *	Set when the pipe is closed by calling hubd_close_intr_pipe(). This is
3400Sstevel@tonic-gate  *	typically called on hub disconnect via hubd_cleanup.
3410Sstevel@tonic-gate  */
3420Sstevel@tonic-gate #define	HUBD_INTR_PIPE_IDLE		0
3430Sstevel@tonic-gate #define	HUBD_INTR_PIPE_OPENING		1
3440Sstevel@tonic-gate #define	HUBD_INTR_PIPE_ACTIVE		2
3450Sstevel@tonic-gate #define	HUBD_INTR_PIPE_STOPPED		3
3460Sstevel@tonic-gate #define	HUBD_INTR_PIPE_CLOSING		4
3470Sstevel@tonic-gate 
3480Sstevel@tonic-gate 
3490Sstevel@tonic-gate /* request structure for putting dips on deathrow list */
3500Sstevel@tonic-gate typedef struct hubd_offline_req {
3510Sstevel@tonic-gate 	usba_list_entry_t	or_queue; /* DO NOT MOVE! */
3520Sstevel@tonic-gate 	hubd_t			*or_hubd;
3530Sstevel@tonic-gate 	usb_port_t		or_port;
3540Sstevel@tonic-gate 	dev_info_t		*or_dip;
3550Sstevel@tonic-gate 	uint_t			or_flag;
3560Sstevel@tonic-gate } hubd_offline_req_t;
3570Sstevel@tonic-gate 
3580Sstevel@tonic-gate _NOTE(SCHEME_PROTECTS_DATA("unshared", hubd_offline_req))
3590Sstevel@tonic-gate 
3600Sstevel@tonic-gate 
3610Sstevel@tonic-gate /*
3620Sstevel@tonic-gate  * cfgadm state values
3630Sstevel@tonic-gate  */
3640Sstevel@tonic-gate #define	HUBD_CFGADM_NORMAL		0	/* normal state */
3650Sstevel@tonic-gate #define	HUBD_CFGADM_DISCONNECTED	1	/* logically disconnected */
3660Sstevel@tonic-gate #define	HUBD_CFGADM_UNCONFIGURED	2	/* port is unconfigured */
3670Sstevel@tonic-gate #define	HUBD_CFGADM_EMPTY		3	/* port is empty */
3680Sstevel@tonic-gate #define	HUBD_CFGADM_STILL_REFERENCED	4	/* ndi_devi_offline failed */
3690Sstevel@tonic-gate #define	HUBD_CFGADM_CONFIGURED		5	/* port is configured */
3700Sstevel@tonic-gate 
3710Sstevel@tonic-gate /*
3720Sstevel@tonic-gate  * Debug printing
3730Sstevel@tonic-gate  * Masks
3740Sstevel@tonic-gate  */
3750Sstevel@tonic-gate #define	DPRINT_MASK_ATTA	0x00000001
3760Sstevel@tonic-gate #define	DPRINT_MASK_CBOPS	0x00000002
3770Sstevel@tonic-gate #define	DPRINT_MASK_CALLBACK	0x00000004
3780Sstevel@tonic-gate #define	DPRINT_MASK_PORT	0x00000008
3790Sstevel@tonic-gate #define	DPRINT_MASK_HUB 	0x00000010
3800Sstevel@tonic-gate #define	DPRINT_MASK_HOTPLUG	0x00000020
3810Sstevel@tonic-gate #define	DPRINT_MASK_EVENTS	0x00000040
3820Sstevel@tonic-gate #define	DPRINT_MASK_PM		0x00000080
3830Sstevel@tonic-gate #define	DPRINT_MASK_ALL 	0xFFFFFFFF
3840Sstevel@tonic-gate 
3850Sstevel@tonic-gate 
3860Sstevel@tonic-gate /* status length used in getting hub status */
3870Sstevel@tonic-gate #define	GET_STATUS_LENGTH	0x04		/* length of get status req */
3880Sstevel@tonic-gate 
3890Sstevel@tonic-gate /* flag for hubd_start_polling */
3900Sstevel@tonic-gate #define	HUBD_ALWAYS_START_POLLING	1
3910Sstevel@tonic-gate 
3920Sstevel@tonic-gate /* enumeration timeout */
3930Sstevel@tonic-gate #define	HUBDI_ENUM_TIMEOUT	1	/* 1 second */
3940Sstevel@tonic-gate 
3951001Ssl147100 /* power budget unit in mA */
3961001Ssl147100 #define	USB_PWR_UNIT_LOAD	100
3971001Ssl147100 
3981001Ssl147100 /* power values in 100mA units */
3991001Ssl147100 #define	USB_HIGH_PWR_VALUE	5
4001001Ssl147100 #define	USB_LOW_PWR_VALUE	1
4011001Ssl147100 
4021001Ssl147100 /*
4031001Ssl147100  * According to section 9.6.3 of USB 2.0 spec,
4041001Ssl147100  * bMaxPower in the device configuration descriptor
4051001Ssl147100  * is expressed in 2mA units
4061001Ssl147100  */
4071001Ssl147100 #define	USB_CFG_DESCR_PWR_UNIT	2
4081001Ssl147100 
4090Sstevel@tonic-gate #ifdef	__cplusplus
4100Sstevel@tonic-gate }
4110Sstevel@tonic-gate #endif
4120Sstevel@tonic-gate 
4130Sstevel@tonic-gate #endif	/* _SYS_USB_HUBDVAR_H */
414