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 57c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 67c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 77c478bd9Sstevel@tonic-gate * with the License. 87c478bd9Sstevel@tonic-gate * 97c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 107c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 117c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 127c478bd9Sstevel@tonic-gate * and limitations under the License. 137c478bd9Sstevel@tonic-gate * 147c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 157c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 167c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 177c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 187c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 197c478bd9Sstevel@tonic-gate * 207c478bd9Sstevel@tonic-gate * CDDL HEADER END 217c478bd9Sstevel@tonic-gate */ 227c478bd9Sstevel@tonic-gate /* 23*35f36846Ssl * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 247c478bd9Sstevel@tonic-gate * Use is subject to license terms. 257c478bd9Sstevel@tonic-gate */ 267c478bd9Sstevel@tonic-gate 277c478bd9Sstevel@tonic-gate #ifndef _SYS_USB_HUBDVAR_H 287c478bd9Sstevel@tonic-gate #define _SYS_USB_HUBDVAR_H 297c478bd9Sstevel@tonic-gate 307c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 317c478bd9Sstevel@tonic-gate 327c478bd9Sstevel@tonic-gate #ifdef __cplusplus 337c478bd9Sstevel@tonic-gate extern "C" { 347c478bd9Sstevel@tonic-gate #endif 357c478bd9Sstevel@tonic-gate 367c478bd9Sstevel@tonic-gate #include <sys/sunndi.h> 377c478bd9Sstevel@tonic-gate #include <sys/ndi_impldefs.h> 387c478bd9Sstevel@tonic-gate #include <sys/usb/usba/usba_types.h> 397c478bd9Sstevel@tonic-gate #include <sys/callb.h> 407c478bd9Sstevel@tonic-gate 417c478bd9Sstevel@tonic-gate /* 427c478bd9Sstevel@tonic-gate * HUB USB device state management : 437c478bd9Sstevel@tonic-gate * 447c478bd9Sstevel@tonic-gate * CHILD PWRLVL---1>--------+ 457c478bd9Sstevel@tonic-gate * ^ | 467c478bd9Sstevel@tonic-gate * 8 | 477c478bd9Sstevel@tonic-gate * | | 487c478bd9Sstevel@tonic-gate * 9 | 497c478bd9Sstevel@tonic-gate * v | 507c478bd9Sstevel@tonic-gate * PWRED_DWN---<3----4>--ONLINE---<2-----1>-DISCONNECTED 517c478bd9Sstevel@tonic-gate * | | ^ | | 527c478bd9Sstevel@tonic-gate * | | 10 | | 537c478bd9Sstevel@tonic-gate * | | | | | 547c478bd9Sstevel@tonic-gate * | | RECOVER-<2-------+ | 557c478bd9Sstevel@tonic-gate * | | ^ | 567c478bd9Sstevel@tonic-gate * | 5 6 | 577c478bd9Sstevel@tonic-gate * | | | | 587c478bd9Sstevel@tonic-gate * | v | | 597c478bd9Sstevel@tonic-gate * +----5>----------SUSPENDED----<5----7>----+ 607c478bd9Sstevel@tonic-gate * 617c478bd9Sstevel@tonic-gate * 1 = Device Unplug 627c478bd9Sstevel@tonic-gate * 2 = Original Device reconnected and after hub driver restores its own 637c478bd9Sstevel@tonic-gate * device state. 647c478bd9Sstevel@tonic-gate * 3 = Device idles for time T & transitions to low power state 657c478bd9Sstevel@tonic-gate * 4 = Remote wakeup by device OR Application kicking off IO to device 667c478bd9Sstevel@tonic-gate * 5 = Notification to save state prior to DDI_SUSPEND 677c478bd9Sstevel@tonic-gate * 6 = Notification to restore state after DDI_RESUME with correct device 687c478bd9Sstevel@tonic-gate * and after hub driver restores its own device state. 697c478bd9Sstevel@tonic-gate * 7 = Notification to restore state after DDI_RESUME with device 707c478bd9Sstevel@tonic-gate * disconnected or a wrong device 717c478bd9Sstevel@tonic-gate * 8 = Hub detect child doing remote wakeup and request the PM 727c478bd9Sstevel@tonic-gate * framework to bring it to full power 737c478bd9Sstevel@tonic-gate * 9 = PM framework has compeleted call power entry point of the child 747c478bd9Sstevel@tonic-gate * and bus ctls of hub 757c478bd9Sstevel@tonic-gate * 10 = Restoring states of its children i.e. set addrs & config. 767c478bd9Sstevel@tonic-gate * 777c478bd9Sstevel@tonic-gate */ 787c478bd9Sstevel@tonic-gate 797c478bd9Sstevel@tonic-gate #define HUBD_INITIAL_SOFT_SPACE 4 807c478bd9Sstevel@tonic-gate 817c478bd9Sstevel@tonic-gate typedef struct hub_power_struct { 827c478bd9Sstevel@tonic-gate void *hubp_hubd; /* points back to hubd_t */ 837c478bd9Sstevel@tonic-gate 847c478bd9Sstevel@tonic-gate uint8_t hubp_wakeup_enabled; /* remote wakeup enabled? */ 857c478bd9Sstevel@tonic-gate 867c478bd9Sstevel@tonic-gate /* this is the bit mask of the power states that device has */ 877c478bd9Sstevel@tonic-gate uint8_t hubp_pwr_states; 887c478bd9Sstevel@tonic-gate 897c478bd9Sstevel@tonic-gate int hubp_busy_pm; /* device busy accounting */ 907c478bd9Sstevel@tonic-gate 917c478bd9Sstevel@tonic-gate /* wakeup and power transition capabilities of an interface */ 927c478bd9Sstevel@tonic-gate uint8_t hubp_pm_capabilities; 937c478bd9Sstevel@tonic-gate 947c478bd9Sstevel@tonic-gate uint8_t hubp_current_power; /* current power level */ 957c478bd9Sstevel@tonic-gate 967c478bd9Sstevel@tonic-gate time_t hubp_time_at_full_power; /* timestamp 0->3 */ 977c478bd9Sstevel@tonic-gate 987c478bd9Sstevel@tonic-gate uint8_t hubp_min_pm_threshold; /* in seconds */ 997c478bd9Sstevel@tonic-gate 1007c478bd9Sstevel@tonic-gate /* power state of all children are tracked here */ 1017c478bd9Sstevel@tonic-gate uint8_t *hubp_child_pwrstate; 1027c478bd9Sstevel@tonic-gate 1037c478bd9Sstevel@tonic-gate /* pm-components properties are stored here */ 1047c478bd9Sstevel@tonic-gate char *hubp_pmcomp[5]; 1057c478bd9Sstevel@tonic-gate 1067c478bd9Sstevel@tonic-gate usba_cfg_pwr_descr_t hubp_confpwr_descr; /* config pwr descr */ 1077c478bd9Sstevel@tonic-gate } hub_power_t; 1087c478bd9Sstevel@tonic-gate 1097c478bd9Sstevel@tonic-gate /* warlock directives, stable data */ 1107c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(hub_power_t::hubp_hubd)) 1117c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(hub_power_t::hubp_wakeup_enabled)) 1127c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(hub_power_t::hubp_pwr_states)) 1137c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(hub_power_t::hubp_time_at_full_power)) 1147c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(hub_power_t::hubp_min_pm_threshold)) 1157c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(hub_power_t::hubp_pm_capabilities)) 1167c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(hub_power_t::hubp_pmcomp)) 1177c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(hub_power_t::hubp_confpwr_descr)) 1187c478bd9Sstevel@tonic-gate 1197c478bd9Sstevel@tonic-gate 1207c478bd9Sstevel@tonic-gate #define HUBD_APID_NAMELEN 32 /* max len in cfgadm display */ 1217c478bd9Sstevel@tonic-gate 1227c478bd9Sstevel@tonic-gate /* 1237c478bd9Sstevel@tonic-gate * hubd cpr data structure used for callback before kernel threads are 1247c478bd9Sstevel@tonic-gate * suspended 1257c478bd9Sstevel@tonic-gate */ 1267c478bd9Sstevel@tonic-gate typedef struct hubd_cpr { 1277c478bd9Sstevel@tonic-gate callb_cpr_t cpr; /* for cpr related info */ 1287c478bd9Sstevel@tonic-gate struct hubd *statep; /* ohci soft state struct */ 1297c478bd9Sstevel@tonic-gate kmutex_t lockp; 1307c478bd9Sstevel@tonic-gate } hubd_cpr_t; 1317c478bd9Sstevel@tonic-gate 1327c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(hubd_cpr_t::cpr)) 1337c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(hubd_cpr_t::statep)) 1347c478bd9Sstevel@tonic-gate 1357c478bd9Sstevel@tonic-gate 1367c478bd9Sstevel@tonic-gate /* 1377c478bd9Sstevel@tonic-gate * soft state information for this hubd 1387c478bd9Sstevel@tonic-gate */ 1397c478bd9Sstevel@tonic-gate typedef struct hubd { 1407c478bd9Sstevel@tonic-gate int h_instance; 1417c478bd9Sstevel@tonic-gate uint_t h_init_state; 1427c478bd9Sstevel@tonic-gate uint_t h_dev_state; 1437c478bd9Sstevel@tonic-gate int8_t h_bus_ctls; 1447c478bd9Sstevel@tonic-gate int8_t h_bus_pwr; 1457c478bd9Sstevel@tonic-gate hub_power_t *h_hubpm; /* pointer to power struct */ 1467c478bd9Sstevel@tonic-gate dev_info_t *h_dip; 1477c478bd9Sstevel@tonic-gate 1487c478bd9Sstevel@tonic-gate /* 1497c478bd9Sstevel@tonic-gate * mutex to protect softstate and hw regs 1507c478bd9Sstevel@tonic-gate */ 1517c478bd9Sstevel@tonic-gate kmutex_t h_mutex; 1527c478bd9Sstevel@tonic-gate 1537c478bd9Sstevel@tonic-gate /* 1547c478bd9Sstevel@tonic-gate * save the usba_device pointer 1557c478bd9Sstevel@tonic-gate */ 1567c478bd9Sstevel@tonic-gate usba_device_t *h_usba_device; 1577c478bd9Sstevel@tonic-gate 1587c478bd9Sstevel@tonic-gate int h_softstate; 1597c478bd9Sstevel@tonic-gate 1607c478bd9Sstevel@tonic-gate /* 1617c478bd9Sstevel@tonic-gate * default pipe handle 1627c478bd9Sstevel@tonic-gate */ 1637c478bd9Sstevel@tonic-gate usb_pipe_handle_t h_default_pipe; 1647c478bd9Sstevel@tonic-gate 1657c478bd9Sstevel@tonic-gate /* 1667c478bd9Sstevel@tonic-gate * pipe handle for ep1 1677c478bd9Sstevel@tonic-gate */ 1687c478bd9Sstevel@tonic-gate usb_pipe_handle_t h_ep1_ph; 1697c478bd9Sstevel@tonic-gate usb_ep_descr_t h_ep1_descr; 1707c478bd9Sstevel@tonic-gate usb_pipe_policy_t h_pipe_policy; 1717c478bd9Sstevel@tonic-gate uint_t h_intr_pipe_state; 1727c478bd9Sstevel@tonic-gate 1737c478bd9Sstevel@tonic-gate /* 1747c478bd9Sstevel@tonic-gate * root hub descriptor 1757c478bd9Sstevel@tonic-gate */ 1767c478bd9Sstevel@tonic-gate struct usb_hub_descr h_hub_descr; 1777c478bd9Sstevel@tonic-gate 1787c478bd9Sstevel@tonic-gate /* 1797c478bd9Sstevel@tonic-gate * hotplug handling 1807c478bd9Sstevel@tonic-gate */ 1817c478bd9Sstevel@tonic-gate uint_t h_hotplug_thread; 1827c478bd9Sstevel@tonic-gate 1837c478bd9Sstevel@tonic-gate /* 1847c478bd9Sstevel@tonic-gate * h_children_dips is a array for holding 1857c478bd9Sstevel@tonic-gate * each child dip indexed by port 1867c478bd9Sstevel@tonic-gate * h_usba_devices is the corresponding usba_device 1877c478bd9Sstevel@tonic-gate */ 1887c478bd9Sstevel@tonic-gate dev_info_t **h_children_dips; 1897c478bd9Sstevel@tonic-gate size_t h_cd_list_length; 1907c478bd9Sstevel@tonic-gate usba_device_t **h_usba_devices; 1917c478bd9Sstevel@tonic-gate 1927c478bd9Sstevel@tonic-gate /* change reported by hub, limited to 31 ports */ 1937c478bd9Sstevel@tonic-gate usb_port_mask_t h_port_change; 1947c478bd9Sstevel@tonic-gate 1957c478bd9Sstevel@tonic-gate /* waiting for reset completion callback */ 1967c478bd9Sstevel@tonic-gate usb_port_mask_t h_port_reset_wait; 1977c478bd9Sstevel@tonic-gate 1987c478bd9Sstevel@tonic-gate /* track transitions of child on each port */ 1997c478bd9Sstevel@tonic-gate uint16_t h_port_state[MAX_PORTS + 1]; 2007c478bd9Sstevel@tonic-gate 2017c478bd9Sstevel@tonic-gate /* track event registration of children */ 2027c478bd9Sstevel@tonic-gate uint8_t h_child_events[MAX_PORTS + 1]; 2037c478bd9Sstevel@tonic-gate 2047c478bd9Sstevel@tonic-gate kcondvar_t h_cv_reset_port; 2057c478bd9Sstevel@tonic-gate uint_t h_intr_completion_reason; 2067c478bd9Sstevel@tonic-gate usb_log_handle_t h_log_handle; /* for logging msgs */ 2077c478bd9Sstevel@tonic-gate 2087c478bd9Sstevel@tonic-gate ndi_event_hdl_t h_ndi_event_hdl; 2097c478bd9Sstevel@tonic-gate hubd_cpr_t *h_cpr_cb; 2107c478bd9Sstevel@tonic-gate 2117c478bd9Sstevel@tonic-gate /* 2127c478bd9Sstevel@tonic-gate * Hotplug event statistics since hub was attached 2137c478bd9Sstevel@tonic-gate */ 2147c478bd9Sstevel@tonic-gate ulong_t h_total_hotplug_success; 2157c478bd9Sstevel@tonic-gate ulong_t h_total_hotplug_failure; 2167c478bd9Sstevel@tonic-gate 2177c478bd9Sstevel@tonic-gate /* for minor node */ 2187c478bd9Sstevel@tonic-gate char *h_ancestry_str; 2197c478bd9Sstevel@tonic-gate 2207c478bd9Sstevel@tonic-gate /* registration data */ 2217c478bd9Sstevel@tonic-gate usb_client_dev_data_t *h_dev_data; 2227c478bd9Sstevel@tonic-gate 2237c478bd9Sstevel@tonic-gate /* for deathrow implementation */ 2247c478bd9Sstevel@tonic-gate boolean_t h_cleanup_enabled; 2257c478bd9Sstevel@tonic-gate boolean_t h_cleanup_needed; 2267c478bd9Sstevel@tonic-gate boolean_t h_cleanup_active; 227*35f36846Ssl 228*35f36846Ssl /* 229*35f36846Ssl * for power budget support 230*35f36846Ssl * h_pwr_limit and h_pwr_left are expressed 231*35f36846Ssl * in 2mA units 232*35f36846Ssl */ 233*35f36846Ssl boolean_t h_local_pwr_capable; 234*35f36846Ssl boolean_t h_local_pwr_on; 235*35f36846Ssl uint16_t h_pwr_limit; /* per port pwr limit */ 236*35f36846Ssl int16_t h_pwr_left; /* limit on the whole hub */ 237*35f36846Ssl 238*35f36846Ssl /* 239*35f36846Ssl * conf file override to power budget property 240*35f36846Ssl * if 1, power budget is disabled 241*35f36846Ssl */ 242*35f36846Ssl boolean_t h_ignore_pwr_budget; 2437c478bd9Sstevel@tonic-gate } hubd_t; 2447c478bd9Sstevel@tonic-gate 2457c478bd9Sstevel@tonic-gate _NOTE(MUTEX_PROTECTS_DATA(hubd::h_mutex, hubd)) 2467c478bd9Sstevel@tonic-gate _NOTE(MUTEX_PROTECTS_DATA(hubd::h_mutex, hub_power_t)) 2477c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(hubd::h_default_pipe 2487c478bd9Sstevel@tonic-gate hubd::h_usba_device 2497c478bd9Sstevel@tonic-gate hubd::h_dev_data 2507c478bd9Sstevel@tonic-gate hubd::h_ndi_event_hdl 2517c478bd9Sstevel@tonic-gate hubd::h_cpr_cb 2527c478bd9Sstevel@tonic-gate hubd::h_log_handle 2537c478bd9Sstevel@tonic-gate hubd::h_ep1_ph 2547c478bd9Sstevel@tonic-gate hubd::h_instance 2557c478bd9Sstevel@tonic-gate hubd::h_hubpm 2567c478bd9Sstevel@tonic-gate hubd::h_dip 257*35f36846Ssl hubd::h_ignore_pwr_budget 2587c478bd9Sstevel@tonic-gate )) 2597c478bd9Sstevel@tonic-gate 2607c478bd9Sstevel@tonic-gate _NOTE(SCHEME_PROTECTS_DATA("stable data", usb_ep_descr)) 2617c478bd9Sstevel@tonic-gate 2627c478bd9Sstevel@tonic-gate #define HUBD_UNIT(dev) (getminor((dev))) 2637c478bd9Sstevel@tonic-gate #define HUBD_MUTEX(hubd) (&((hubd)->h_mutex)) 2647c478bd9Sstevel@tonic-gate #define HUBD_SS_ISOPEN 0x0001 2657c478bd9Sstevel@tonic-gate #define HUBD_ACK_ALL_CHANGES PORT_CHANGE_MASK 2667c478bd9Sstevel@tonic-gate 2677c478bd9Sstevel@tonic-gate /* init state */ 2687c478bd9Sstevel@tonic-gate #define HUBD_LOCKS_DONE 0x0001 2697c478bd9Sstevel@tonic-gate #define HUBD_HUBDI_REGISTERED 0x0002 2707c478bd9Sstevel@tonic-gate #define HUBD_MINOR_NODE_CREATED 0x0004 271*35f36846Ssl #define HUBD_CHILDREN_CREATED 0x0008 2727c478bd9Sstevel@tonic-gate #define HUBD_EVENTS_REGISTERED 0x0020 2737c478bd9Sstevel@tonic-gate 2747c478bd9Sstevel@tonic-gate /* 2757c478bd9Sstevel@tonic-gate * port flags : These are essentially extensions of Port Status Field Bits 2767c478bd9Sstevel@tonic-gate * as in USB 2.0 spec Table 11-21 and #defined in hubd.h file. We make use 2777c478bd9Sstevel@tonic-gate * of the unused bits (5-7,13-15) here to track states of the hub's child. 2787c478bd9Sstevel@tonic-gate */ 2797c478bd9Sstevel@tonic-gate #define HUBD_CHILD_ATTACHING 0x0020 2807c478bd9Sstevel@tonic-gate #define HUBD_CHILD_DETACHING 0x0040 2817c478bd9Sstevel@tonic-gate #define HUBD_CHILD_PWRLVL_CHNG 0x0080 2827c478bd9Sstevel@tonic-gate #define HUBD_CHILD_RAISE_POWER 0x2000 2837c478bd9Sstevel@tonic-gate #define HUBD_CHILD_ZAP 0x4000 2847c478bd9Sstevel@tonic-gate 2857c478bd9Sstevel@tonic-gate /* Tracking events registered by children */ 2867c478bd9Sstevel@tonic-gate #define HUBD_CHILD_EVENT_DISCONNECT 0x01 2877c478bd9Sstevel@tonic-gate #define HUBD_CHILD_EVENT_PRESUSPEND 0x02 2887c478bd9Sstevel@tonic-gate 2897c478bd9Sstevel@tonic-gate /* This dev state is used exclusively by hub to change port suspend/resume */ 2907c478bd9Sstevel@tonic-gate #define USB_DEV_HUB_CHILD_PWRLVL 0x80 2917c478bd9Sstevel@tonic-gate #define USB_DEV_HUB_STATE_RECOVER 0x81 2927c478bd9Sstevel@tonic-gate 2937c478bd9Sstevel@tonic-gate /* 2947c478bd9Sstevel@tonic-gate * hubd interrupt pipe management : 2957c478bd9Sstevel@tonic-gate * 2967c478bd9Sstevel@tonic-gate * Following are the states of the interrupt pipe 2977c478bd9Sstevel@tonic-gate * 2987c478bd9Sstevel@tonic-gate * IDLE: 2997c478bd9Sstevel@tonic-gate * initial state and after closing of the interrupt pipe 3007c478bd9Sstevel@tonic-gate * 3017c478bd9Sstevel@tonic-gate * OPENING: 3027c478bd9Sstevel@tonic-gate * Set when the pipe is being opened 3037c478bd9Sstevel@tonic-gate * 3047c478bd9Sstevel@tonic-gate * ACTIVE: 3057c478bd9Sstevel@tonic-gate * Set when the pipe has been opened in hubd_open_intr_pipe. This is 3067c478bd9Sstevel@tonic-gate * typically after a hub has got enumerated and initialized. 3077c478bd9Sstevel@tonic-gate * 3087c478bd9Sstevel@tonic-gate * CLOSING : 3097c478bd9Sstevel@tonic-gate * Set when the pipe is closed by calling hubd_close_intr_pipe(). This is 3107c478bd9Sstevel@tonic-gate * typically called on hub disconnect via hubd_cleanup. 3117c478bd9Sstevel@tonic-gate */ 3127c478bd9Sstevel@tonic-gate #define HUBD_INTR_PIPE_IDLE 0 3137c478bd9Sstevel@tonic-gate #define HUBD_INTR_PIPE_OPENING 1 3147c478bd9Sstevel@tonic-gate #define HUBD_INTR_PIPE_ACTIVE 2 3157c478bd9Sstevel@tonic-gate #define HUBD_INTR_PIPE_STOPPED 3 3167c478bd9Sstevel@tonic-gate #define HUBD_INTR_PIPE_CLOSING 4 3177c478bd9Sstevel@tonic-gate 3187c478bd9Sstevel@tonic-gate 3197c478bd9Sstevel@tonic-gate /* request structure for putting dips on deathrow list */ 3207c478bd9Sstevel@tonic-gate typedef struct hubd_offline_req { 3217c478bd9Sstevel@tonic-gate usba_list_entry_t or_queue; /* DO NOT MOVE! */ 3227c478bd9Sstevel@tonic-gate hubd_t *or_hubd; 3237c478bd9Sstevel@tonic-gate usb_port_t or_port; 3247c478bd9Sstevel@tonic-gate dev_info_t *or_dip; 3257c478bd9Sstevel@tonic-gate uint_t or_flag; 3267c478bd9Sstevel@tonic-gate } hubd_offline_req_t; 3277c478bd9Sstevel@tonic-gate 3287c478bd9Sstevel@tonic-gate _NOTE(SCHEME_PROTECTS_DATA("unshared", hubd_offline_req)) 3297c478bd9Sstevel@tonic-gate 3307c478bd9Sstevel@tonic-gate 3317c478bd9Sstevel@tonic-gate /* 3327c478bd9Sstevel@tonic-gate * cfgadm state values 3337c478bd9Sstevel@tonic-gate */ 3347c478bd9Sstevel@tonic-gate #define HUBD_CFGADM_NORMAL 0 /* normal state */ 3357c478bd9Sstevel@tonic-gate #define HUBD_CFGADM_DISCONNECTED 1 /* logically disconnected */ 3367c478bd9Sstevel@tonic-gate #define HUBD_CFGADM_UNCONFIGURED 2 /* port is unconfigured */ 3377c478bd9Sstevel@tonic-gate #define HUBD_CFGADM_EMPTY 3 /* port is empty */ 3387c478bd9Sstevel@tonic-gate #define HUBD_CFGADM_STILL_REFERENCED 4 /* ndi_devi_offline failed */ 3397c478bd9Sstevel@tonic-gate #define HUBD_CFGADM_CONFIGURED 5 /* port is configured */ 3407c478bd9Sstevel@tonic-gate 3417c478bd9Sstevel@tonic-gate /* 3427c478bd9Sstevel@tonic-gate * Debug printing 3437c478bd9Sstevel@tonic-gate * Masks 3447c478bd9Sstevel@tonic-gate */ 3457c478bd9Sstevel@tonic-gate #define DPRINT_MASK_ATTA 0x00000001 3467c478bd9Sstevel@tonic-gate #define DPRINT_MASK_CBOPS 0x00000002 3477c478bd9Sstevel@tonic-gate #define DPRINT_MASK_CALLBACK 0x00000004 3487c478bd9Sstevel@tonic-gate #define DPRINT_MASK_PORT 0x00000008 3497c478bd9Sstevel@tonic-gate #define DPRINT_MASK_HUB 0x00000010 3507c478bd9Sstevel@tonic-gate #define DPRINT_MASK_HOTPLUG 0x00000020 3517c478bd9Sstevel@tonic-gate #define DPRINT_MASK_EVENTS 0x00000040 3527c478bd9Sstevel@tonic-gate #define DPRINT_MASK_PM 0x00000080 3537c478bd9Sstevel@tonic-gate #define DPRINT_MASK_ALL 0xFFFFFFFF 3547c478bd9Sstevel@tonic-gate 3557c478bd9Sstevel@tonic-gate 3567c478bd9Sstevel@tonic-gate /* status length used in getting hub status */ 3577c478bd9Sstevel@tonic-gate #define GET_STATUS_LENGTH 0x04 /* length of get status req */ 3587c478bd9Sstevel@tonic-gate 3597c478bd9Sstevel@tonic-gate /* flag for hubd_start_polling */ 3607c478bd9Sstevel@tonic-gate #define HUBD_ALWAYS_START_POLLING 1 3617c478bd9Sstevel@tonic-gate 3627c478bd9Sstevel@tonic-gate /* enumeration timeout */ 3637c478bd9Sstevel@tonic-gate #define HUBDI_ENUM_TIMEOUT 1 /* 1 second */ 3647c478bd9Sstevel@tonic-gate 365*35f36846Ssl /* power budget unit in mA */ 366*35f36846Ssl #define USB_PWR_UNIT_LOAD 100 367*35f36846Ssl 368*35f36846Ssl /* power values in 100mA units */ 369*35f36846Ssl #define USB_HIGH_PWR_VALUE 5 370*35f36846Ssl #define USB_LOW_PWR_VALUE 1 371*35f36846Ssl 372*35f36846Ssl /* 373*35f36846Ssl * According to section 9.6.3 of USB 2.0 spec, 374*35f36846Ssl * bMaxPower in the device configuration descriptor 375*35f36846Ssl * is expressed in 2mA units 376*35f36846Ssl */ 377*35f36846Ssl #define USB_CFG_DESCR_PWR_UNIT 2 378*35f36846Ssl 3797c478bd9Sstevel@tonic-gate #ifdef __cplusplus 3807c478bd9Sstevel@tonic-gate } 3817c478bd9Sstevel@tonic-gate #endif 3827c478bd9Sstevel@tonic-gate 3837c478bd9Sstevel@tonic-gate #endif /* _SYS_USB_HUBDVAR_H */ 384