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 * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 237c478bd9Sstevel@tonic-gate * Use is subject to license terms. 247c478bd9Sstevel@tonic-gate */ 257c478bd9Sstevel@tonic-gate 267c478bd9Sstevel@tonic-gate #ifndef _SYS_USB_USBA_USBA_TYPES_H 277c478bd9Sstevel@tonic-gate #define _SYS_USB_USBA_USBA_TYPES_H 287c478bd9Sstevel@tonic-gate 297c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 307c478bd9Sstevel@tonic-gate 317c478bd9Sstevel@tonic-gate #include <sys/taskq.h> 327c478bd9Sstevel@tonic-gate #include <sys/usb/usba/usba_private.h> 337c478bd9Sstevel@tonic-gate #include <sys/usb/usba/usbai_private.h> 347c478bd9Sstevel@tonic-gate 357c478bd9Sstevel@tonic-gate #ifdef __cplusplus 367c478bd9Sstevel@tonic-gate extern "C" { 377c478bd9Sstevel@tonic-gate #endif 387c478bd9Sstevel@tonic-gate 397c478bd9Sstevel@tonic-gate /* backup structure for opaque usb_pipe_handle_t */ 407c478bd9Sstevel@tonic-gate typedef struct usba_ph_impl { 417c478bd9Sstevel@tonic-gate kmutex_t usba_ph_mutex; 427c478bd9Sstevel@tonic-gate struct usba_pipe_handle_data *usba_ph_data; /* actual pipe handle */ 437c478bd9Sstevel@tonic-gate dev_info_t *usba_ph_dip; /* owner dip */ 447c478bd9Sstevel@tonic-gate usb_ep_descr_t usba_ph_ep; /* save ep descr */ 457c478bd9Sstevel@tonic-gate usb_pipe_policy_t usba_ph_policy; /* saved pipe policy */ 467c478bd9Sstevel@tonic-gate uint_t usba_ph_flags; 477c478bd9Sstevel@tonic-gate 487c478bd9Sstevel@tonic-gate /* 497c478bd9Sstevel@tonic-gate * usba_ph_ref_count is a count of the number of 507c478bd9Sstevel@tonic-gate * concurrent activities on this pipe 517c478bd9Sstevel@tonic-gate */ 527c478bd9Sstevel@tonic-gate int usba_ph_ref_count; 537c478bd9Sstevel@tonic-gate 547c478bd9Sstevel@tonic-gate /* pipe state management */ 557c478bd9Sstevel@tonic-gate usb_pipe_state_t usba_ph_state; 567c478bd9Sstevel@tonic-gate int usba_ph_state_changing; 577c478bd9Sstevel@tonic-gate } usba_ph_impl_t; 587c478bd9Sstevel@tonic-gate 597c478bd9Sstevel@tonic-gate _NOTE(MUTEX_PROTECTS_DATA(usba_ph_impl::usba_ph_mutex, usba_ph_impl)) 607c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(usba_ph_impl::usba_ph_data)) 617c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(usba_ph_impl::usba_ph_dip)) 627c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(usba_ph_impl::usba_ph_ep)) 637c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(usba_ph_impl::usba_ph_policy)) 647c478bd9Sstevel@tonic-gate 657c478bd9Sstevel@tonic-gate /* for usba_ph_flags */ 667c478bd9Sstevel@tonic-gate #define USBA_PH_DATA_TOGGLE 0x01 /* mask for data toggle */ 677c478bd9Sstevel@tonic-gate #define USBA_PH_DATA_PERSISTENT 0x02 /* persistent pipe */ 687c478bd9Sstevel@tonic-gate 697c478bd9Sstevel@tonic-gate 707c478bd9Sstevel@tonic-gate /* 717c478bd9Sstevel@tonic-gate * usba_pipe_handle_data 727c478bd9Sstevel@tonic-gate * allocated by USBA and used by USBA and HCD but opaque to 737c478bd9Sstevel@tonic-gate * client driver 747c478bd9Sstevel@tonic-gate * 757c478bd9Sstevel@tonic-gate * pipes can be shared but pipe_handles are unique 767c478bd9Sstevel@tonic-gate * 777c478bd9Sstevel@tonic-gate * p_hcd_private is a pointer to private data for HCD. This space 787c478bd9Sstevel@tonic-gate * is allocated and maintained by HCD 797c478bd9Sstevel@tonic-gate */ 807c478bd9Sstevel@tonic-gate typedef struct usba_pipe_handle_data { 817c478bd9Sstevel@tonic-gate struct usba_ph_impl *p_ph_impl; /* backpointer to ph_impl */ 827c478bd9Sstevel@tonic-gate 837c478bd9Sstevel@tonic-gate /* For linking pipe requests on the pipe */ 847c478bd9Sstevel@tonic-gate usba_list_entry_t p_queue; 857c478bd9Sstevel@tonic-gate 867c478bd9Sstevel@tonic-gate /* shared usba_device structure */ 877c478bd9Sstevel@tonic-gate struct usba_device *p_usba_device; /* set on pipe open */ 887c478bd9Sstevel@tonic-gate 897c478bd9Sstevel@tonic-gate /* pipe policy and endpoint descriptor for this pipe */ 907c478bd9Sstevel@tonic-gate usb_pipe_policy_t p_policy; /* maintained by USBA */ 917c478bd9Sstevel@tonic-gate usb_ep_descr_t p_ep; 927c478bd9Sstevel@tonic-gate 937c478bd9Sstevel@tonic-gate /* passed during open. needed for reset etc. */ 947c478bd9Sstevel@tonic-gate dev_info_t *p_dip; 957c478bd9Sstevel@tonic-gate 967c478bd9Sstevel@tonic-gate /* access control */ 977c478bd9Sstevel@tonic-gate kmutex_t p_mutex; /* mutex protecting pipe handle */ 987c478bd9Sstevel@tonic-gate 997c478bd9Sstevel@tonic-gate /* per-pipe private data for HCD */ 1007c478bd9Sstevel@tonic-gate usb_opaque_t p_hcd_private; 1017c478bd9Sstevel@tonic-gate 1027c478bd9Sstevel@tonic-gate /* per-pipe private data for client */ 1037c478bd9Sstevel@tonic-gate usb_opaque_t p_client_private; 1047c478bd9Sstevel@tonic-gate 1057c478bd9Sstevel@tonic-gate /* 1067c478bd9Sstevel@tonic-gate * p_req_count is the count of number requests active 1077c478bd9Sstevel@tonic-gate * on this pipe 1087c478bd9Sstevel@tonic-gate */ 1097c478bd9Sstevel@tonic-gate int p_req_count; 1107c478bd9Sstevel@tonic-gate 1117c478bd9Sstevel@tonic-gate /* private use by USBA */ 1127c478bd9Sstevel@tonic-gate usb_opaque_t p_usba_private; 1137c478bd9Sstevel@tonic-gate 1147c478bd9Sstevel@tonic-gate /* 1157c478bd9Sstevel@tonic-gate * each pipe handle has its own taskq for callbacks and async reqs 1167c478bd9Sstevel@tonic-gate * Note that this will not be used for normal callbacks if 1177c478bd9Sstevel@tonic-gate * USB_FLAGS_SERIALIZED_CB is passed to usb_pipe_open(). 1187c478bd9Sstevel@tonic-gate */ 1197c478bd9Sstevel@tonic-gate taskq_t *p_taskq; 1207c478bd9Sstevel@tonic-gate 1217c478bd9Sstevel@tonic-gate /* thread currently serving the queue */ 1227c478bd9Sstevel@tonic-gate kthread_t *p_thread_id; 1237c478bd9Sstevel@tonic-gate 1247c478bd9Sstevel@tonic-gate /* cb queue serviced by taskq thread */ 1257c478bd9Sstevel@tonic-gate usba_list_entry_t p_cb_queue; 1267c478bd9Sstevel@tonic-gate 1277c478bd9Sstevel@tonic-gate /* count for soft interrupts */ 1287c478bd9Sstevel@tonic-gate uint_t p_soft_intr; 1297c478bd9Sstevel@tonic-gate 1307c478bd9Sstevel@tonic-gate /* flag for special things */ 1317c478bd9Sstevel@tonic-gate uint_t p_spec_flag; 1327c478bd9Sstevel@tonic-gate 1337c478bd9Sstevel@tonic-gate } usba_pipe_handle_data_t; 1347c478bd9Sstevel@tonic-gate 1357c478bd9Sstevel@tonic-gate #define USBA_PH_FLAG_USE_SOFT_INTR 0x1 1367c478bd9Sstevel@tonic-gate #define USBA_PH_FLAG_TQ_SHARE 0x2 /* Shared TaskQ for callbacks */ 1377c478bd9Sstevel@tonic-gate 1387c478bd9Sstevel@tonic-gate 1397c478bd9Sstevel@tonic-gate 1407c478bd9Sstevel@tonic-gate /* macro to get the endpoint descriptor */ 1417c478bd9Sstevel@tonic-gate #define USBA_DEFAULT_PIPE_EP 0 /* ep 0 is default pipe */ 1427c478bd9Sstevel@tonic-gate #define USBA_PH2ENDPOINT(ph) (((usba_pipe_handle_data_t *)(ph))->p_ep) 1437c478bd9Sstevel@tonic-gate 1447c478bd9Sstevel@tonic-gate #define USBA_PIPE_CLOSING(state) \ 1457c478bd9Sstevel@tonic-gate (((state) == USB_PIPE_STATE_CLOSING) || \ 1467c478bd9Sstevel@tonic-gate ((state) == USB_PIPE_STATE_CLOSED)) 1477c478bd9Sstevel@tonic-gate 1487c478bd9Sstevel@tonic-gate #define USBA_IS_DEFAULT_PIPE(ph) ((ph) == \ 1497c478bd9Sstevel@tonic-gate (ph)->p_usba_device->usb_ph_list[USBA_DEFAULT_PIPE_EP].usba_ph_data) 1507c478bd9Sstevel@tonic-gate 1517c478bd9Sstevel@tonic-gate _NOTE(MUTEX_PROTECTS_DATA(usba_pipe_handle_data::p_mutex, \ 1527c478bd9Sstevel@tonic-gate usba_pipe_handle_data)) 1537c478bd9Sstevel@tonic-gate 1547c478bd9Sstevel@tonic-gate /* these should be really stable data */ 1557c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(usba_pipe_handle_data::p_ph_impl)) 1567c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(usba_pipe_handle_data::p_usba_device)) 1577c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(usba_pipe_handle_data::p_hcd_private)) 1587c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(usba_pipe_handle_data::p_client_private)) 1597c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(usba_pipe_handle_data::p_ep)) 1607c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(usba_pipe_handle_data::p_dip)) 1617c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(usba_pipe_handle_data::p_taskq)) 1627c478bd9Sstevel@tonic-gate 1637c478bd9Sstevel@tonic-gate 1647c478bd9Sstevel@tonic-gate /* 1657c478bd9Sstevel@tonic-gate * usb_addr: 1667c478bd9Sstevel@tonic-gate * This is the USB address of a device 1677c478bd9Sstevel@tonic-gate */ 1687c478bd9Sstevel@tonic-gate typedef uchar_t usb_addr_t; 1697c478bd9Sstevel@tonic-gate 1707c478bd9Sstevel@tonic-gate #define USBA_DEFAULT_ADDR 0 1717c478bd9Sstevel@tonic-gate 1727c478bd9Sstevel@tonic-gate /* 1737c478bd9Sstevel@tonic-gate * number of endpoint per device, 16 IN and 16 OUT. 1747c478bd9Sstevel@tonic-gate * this define is used for pipehandle list, pipe reserved list 1757c478bd9Sstevel@tonic-gate * and pipe open count array. 1767c478bd9Sstevel@tonic-gate * these lists are indexed by endpoint number * ((address & direction)? 2 : 1) 1777c478bd9Sstevel@tonic-gate * 1787c478bd9Sstevel@tonic-gate * We use a bit mask for exclusive open tracking and therefore 1797c478bd9Sstevel@tonic-gate * USB_N_ENDPOINTS must be equal to the bit size of int. 1807c478bd9Sstevel@tonic-gate * 1817c478bd9Sstevel@tonic-gate */ 1827c478bd9Sstevel@tonic-gate #define USBA_N_ENDPOINTS 32 1837c478bd9Sstevel@tonic-gate 1847c478bd9Sstevel@tonic-gate /* 1857c478bd9Sstevel@tonic-gate * USB spec defines 4 different power states of any usb device. 1867c478bd9Sstevel@tonic-gate * They are D0, D1, D2 & D3. So, we need a total of 5 pm-components 1877c478bd9Sstevel@tonic-gate * 4 for power and 1 for name. 1887c478bd9Sstevel@tonic-gate */ 1897c478bd9Sstevel@tonic-gate #define USBA_N_PMCOMP 5 1907c478bd9Sstevel@tonic-gate 1917c478bd9Sstevel@tonic-gate /* 1927c478bd9Sstevel@tonic-gate * usb port status 1937c478bd9Sstevel@tonic-gate */ 1947c478bd9Sstevel@tonic-gate typedef uint8_t usb_port_status_t; 1957c478bd9Sstevel@tonic-gate typedef uint16_t usb_port_t; 1967c478bd9Sstevel@tonic-gate typedef uint32_t usb_port_mask_t; 1977c478bd9Sstevel@tonic-gate 1987c478bd9Sstevel@tonic-gate #define USBA_LOW_SPEED_DEV 0x1 1997c478bd9Sstevel@tonic-gate #define USBA_FULL_SPEED_DEV 0x2 2007c478bd9Sstevel@tonic-gate #define USBA_HIGH_SPEED_DEV 0x3 2017c478bd9Sstevel@tonic-gate 2027c478bd9Sstevel@tonic-gate /* 2037c478bd9Sstevel@tonic-gate * NDI event is registered on a per-dip basis. usba_device can be 2047c478bd9Sstevel@tonic-gate * shared by multiple dips, hence the following structure is 2057c478bd9Sstevel@tonic-gate * need to keep per-dip event info. 2067c478bd9Sstevel@tonic-gate */ 2077c478bd9Sstevel@tonic-gate typedef struct usba_evdata { 2087c478bd9Sstevel@tonic-gate struct usba_evdata *ev_next; 2097c478bd9Sstevel@tonic-gate dev_info_t *ev_dip; 2107c478bd9Sstevel@tonic-gate 2117c478bd9Sstevel@tonic-gate /* NDI evetn service callback ids */ 2127c478bd9Sstevel@tonic-gate ddi_callback_id_t ev_rm_cb_id; 2137c478bd9Sstevel@tonic-gate ddi_callback_id_t ev_ins_cb_id; 2147c478bd9Sstevel@tonic-gate ddi_callback_id_t ev_suspend_cb_id; 2157c478bd9Sstevel@tonic-gate ddi_callback_id_t ev_resume_cb_id; 2167c478bd9Sstevel@tonic-gate } usba_evdata_t; 2177c478bd9Sstevel@tonic-gate 2187c478bd9Sstevel@tonic-gate /* 2197c478bd9Sstevel@tonic-gate * a client may request dev_data multiple times (eg. for 2207c478bd9Sstevel@tonic-gate * ugen support) so we need a linked list 2217c478bd9Sstevel@tonic-gate */ 2227c478bd9Sstevel@tonic-gate typedef struct usb_client_dev_data_list { 2237c478bd9Sstevel@tonic-gate struct usb_client_dev_data_list *cddl_next; 2247c478bd9Sstevel@tonic-gate struct usb_client_dev_data_list *cddl_prev; 2257c478bd9Sstevel@tonic-gate dev_info_t *cddl_dip; 2267c478bd9Sstevel@tonic-gate usb_client_dev_data_t *cddl_dev_data; 2277c478bd9Sstevel@tonic-gate uint_t cddl_ifno; 2287c478bd9Sstevel@tonic-gate } usb_client_dev_data_list_t; 2297c478bd9Sstevel@tonic-gate 2307c478bd9Sstevel@tonic-gate /* 2317c478bd9Sstevel@tonic-gate * This structure uniquely identifies a USB device 2327c478bd9Sstevel@tonic-gate * with all interfaces, or just one interface of a USB device. 2337c478bd9Sstevel@tonic-gate * usba_device is associated with a devinfo node 2347c478bd9Sstevel@tonic-gate * 2357c478bd9Sstevel@tonic-gate * This structure is allocated and maintained by USBA and 2367c478bd9Sstevel@tonic-gate * read-only for HCD 2377c478bd9Sstevel@tonic-gate * 2387c478bd9Sstevel@tonic-gate * There can be multiple clients per device (multi-class 2397c478bd9Sstevel@tonic-gate * device) in which case this structure is shared. 2407c478bd9Sstevel@tonic-gate */ 2417c478bd9Sstevel@tonic-gate typedef struct usba_device { 2427c478bd9Sstevel@tonic-gate /* for linking all usba_devices on this bus */ 2437c478bd9Sstevel@tonic-gate usba_list_entry_t usb_device_list; 2447c478bd9Sstevel@tonic-gate 2457c478bd9Sstevel@tonic-gate /* linked list of all pipe handles on this device per endpoint */ 2467c478bd9Sstevel@tonic-gate struct usba_ph_impl usb_ph_list[USBA_N_ENDPOINTS]; 2477c478bd9Sstevel@tonic-gate 2487c478bd9Sstevel@tonic-gate kmutex_t usb_mutex; /* protecting usba_device */ 2497c478bd9Sstevel@tonic-gate 2507c478bd9Sstevel@tonic-gate dev_info_t *usb_dip; 2517c478bd9Sstevel@tonic-gate 2527c478bd9Sstevel@tonic-gate struct usba_hcdi_ops *usb_hcdi_ops; /* ptr to HCD ops */ 2537c478bd9Sstevel@tonic-gate 2547c478bd9Sstevel@tonic-gate struct usba_hubdi *usb_hubdi; 2557c478bd9Sstevel@tonic-gate 2567c478bd9Sstevel@tonic-gate usb_addr_t usb_addr; /* usb address */ 2577c478bd9Sstevel@tonic-gate 2587c478bd9Sstevel@tonic-gate uchar_t usb_no_cpr; /* CPR? */ 2597c478bd9Sstevel@tonic-gate 2607c478bd9Sstevel@tonic-gate dev_info_t *usb_root_hub_dip; 2617c478bd9Sstevel@tonic-gate struct hubd *usb_root_hubd; 2627c478bd9Sstevel@tonic-gate 2637c478bd9Sstevel@tonic-gate usb_dev_descr_t *usb_dev_descr; /* device descriptor */ 2647c478bd9Sstevel@tonic-gate 2657c478bd9Sstevel@tonic-gate uchar_t *usb_cfg; /* raw config descriptor */ 2667c478bd9Sstevel@tonic-gate size_t usb_cfg_length; /* length of raw descr */ 2677c478bd9Sstevel@tonic-gate 2687c478bd9Sstevel@tonic-gate char *usb_mfg_str; /* manufacturer string */ 2697c478bd9Sstevel@tonic-gate char *usb_product_str; /* product string */ 2707c478bd9Sstevel@tonic-gate char *usb_serialno_str; /* serial number string */ 2717c478bd9Sstevel@tonic-gate char *usb_preferred_driver; /* user's choice */ 2727c478bd9Sstevel@tonic-gate 2737c478bd9Sstevel@tonic-gate usb_port_status_t usb_port_status; /* usb hub port status */ 2747c478bd9Sstevel@tonic-gate usb_port_t usb_port; 2757c478bd9Sstevel@tonic-gate 2767c478bd9Sstevel@tonic-gate /* To support split transactions */ 2777c478bd9Sstevel@tonic-gate struct usba_device *usb_hs_hub_usba_dev; /* HS hub usba device */ 2787c478bd9Sstevel@tonic-gate usb_addr_t usb_hs_hub_addr; /* High speed hub address */ 2797c478bd9Sstevel@tonic-gate usb_port_t usb_hs_hub_port; /* High speed hub port */ 2807c478bd9Sstevel@tonic-gate 2817c478bd9Sstevel@tonic-gate /* For high speed hub bandwidth allocation scheme */ 2827c478bd9Sstevel@tonic-gate uint_t usb_hs_hub_min_bandwidth; 2837c478bd9Sstevel@tonic-gate uint_t usb_hs_hub_bandwidth[32]; 2847c478bd9Sstevel@tonic-gate 2857c478bd9Sstevel@tonic-gate /* store all config cloud here */ 2867c478bd9Sstevel@tonic-gate uchar_t **usb_cfg_array; 2877c478bd9Sstevel@tonic-gate uint_t usb_cfg_array_length; 2887c478bd9Sstevel@tonic-gate 2897c478bd9Sstevel@tonic-gate uint16_t *usb_cfg_array_len; 2907c478bd9Sstevel@tonic-gate uint_t usb_cfg_array_len_length; 2917c478bd9Sstevel@tonic-gate 2927c478bd9Sstevel@tonic-gate uint_t usb_cfg_value; 2937c478bd9Sstevel@tonic-gate uint_t usb_active_cfg_ndx; 2947c478bd9Sstevel@tonic-gate char **usb_cfg_str_descr; 2957c478bd9Sstevel@tonic-gate uchar_t usb_n_cfgs; 2967c478bd9Sstevel@tonic-gate uchar_t usb_n_ifs; 2977c478bd9Sstevel@tonic-gate 298*35f36846Ssl /* 299*35f36846Ssl * power drawn from hub, if > 0, the power has been 300*35f36846Ssl * subtracted from the parent hub's power budget 301*35f36846Ssl */ 302*35f36846Ssl uint16_t usb_pwr_from_hub; 303*35f36846Ssl 3047c478bd9Sstevel@tonic-gate /* ref count, if > 0, this structure is in use */ 3057c478bd9Sstevel@tonic-gate int usb_ref_count; 3067c478bd9Sstevel@tonic-gate 3077c478bd9Sstevel@tonic-gate /* list of requests allocated for this device, detects leaks */ 3087c478bd9Sstevel@tonic-gate usba_list_entry_t usb_allocated; /* alloc'ed reqs list */ 3097c478bd9Sstevel@tonic-gate 3107c478bd9Sstevel@tonic-gate /* NDI event service cookies */ 3117c478bd9Sstevel@tonic-gate ddi_eventcookie_t rm_cookie; 3127c478bd9Sstevel@tonic-gate ddi_eventcookie_t ins_cookie; 3137c478bd9Sstevel@tonic-gate ddi_eventcookie_t suspend_cookie; 3147c478bd9Sstevel@tonic-gate ddi_eventcookie_t resume_cookie; 3157c478bd9Sstevel@tonic-gate 3167c478bd9Sstevel@tonic-gate /* linked list of callid (per-devinfo) */ 3177c478bd9Sstevel@tonic-gate usba_evdata_t *usb_evdata; 3187c478bd9Sstevel@tonic-gate 3197c478bd9Sstevel@tonic-gate /* client cleanup checks */ 3207c478bd9Sstevel@tonic-gate uchar_t *usb_client_flags; 3217c478bd9Sstevel@tonic-gate 3227c478bd9Sstevel@tonic-gate struct { 3237c478bd9Sstevel@tonic-gate dev_info_t *dip; 3247c478bd9Sstevel@tonic-gate } *usb_client_attach_list; 3257c478bd9Sstevel@tonic-gate 3267c478bd9Sstevel@tonic-gate usb_client_dev_data_list_t usb_client_dev_data_list; 3277c478bd9Sstevel@tonic-gate 3287c478bd9Sstevel@tonic-gate struct { 3297c478bd9Sstevel@tonic-gate dev_info_t *dip; 3307c478bd9Sstevel@tonic-gate usb_event_t *ev_data; 3317c478bd9Sstevel@tonic-gate } *usb_client_ev_cb_list; 3327c478bd9Sstevel@tonic-gate 3337c478bd9Sstevel@tonic-gate /* Shared task queue implementation. */ 3347c478bd9Sstevel@tonic-gate taskq_t *usb_shared_taskq[USBA_N_ENDPOINTS]; 3357c478bd9Sstevel@tonic-gate uchar_t usb_shared_taskq_ref_count 3367c478bd9Sstevel@tonic-gate [USBA_N_ENDPOINTS]; 3377c478bd9Sstevel@tonic-gate } usba_device_t; 3387c478bd9Sstevel@tonic-gate 3397c478bd9Sstevel@tonic-gate #define USBA_CLIENT_FLAG_SIZE 1 3407c478bd9Sstevel@tonic-gate #define USBA_CLIENT_FLAG_ATTACH 0x01 3417c478bd9Sstevel@tonic-gate #define USBA_CLIENT_FLAG_EV_CBS 0x02 3427c478bd9Sstevel@tonic-gate #define USBA_CLIENT_FLAG_DEV_DATA 0x04 3437c478bd9Sstevel@tonic-gate 3447c478bd9Sstevel@tonic-gate _NOTE(MUTEX_PROTECTS_DATA(usba_device::usb_mutex, usba_device)) 3457c478bd9Sstevel@tonic-gate _NOTE(MUTEX_PROTECTS_DATA(usba_device::usb_mutex, usba_evdata)) 3467c478bd9Sstevel@tonic-gate 3477c478bd9Sstevel@tonic-gate _NOTE(SCHEME_PROTECTS_DATA("chg at attach only", 3487c478bd9Sstevel@tonic-gate usba_evdata::ev_rm_cb_id)) 3497c478bd9Sstevel@tonic-gate _NOTE(SCHEME_PROTECTS_DATA("chg at attach only", 3507c478bd9Sstevel@tonic-gate usba_evdata::ev_ins_cb_id)) 3517c478bd9Sstevel@tonic-gate _NOTE(SCHEME_PROTECTS_DATA("chg at attach only", 3527c478bd9Sstevel@tonic-gate usba_evdata::ev_suspend_cb_id)) 3537c478bd9Sstevel@tonic-gate _NOTE(SCHEME_PROTECTS_DATA("chg at attach only", 3547c478bd9Sstevel@tonic-gate usba_evdata::ev_resume_cb_id)) 3557c478bd9Sstevel@tonic-gate 3567c478bd9Sstevel@tonic-gate /* this should be really stable data */ 3577c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(usba_device::usb_serialno_str)) 3587c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(usba_device::usb_root_hub_dip)) 3597c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(usba_device::usb_root_hubd)) 3607c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(usba_device::usb_product_str)) 3617c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(usba_device::usb_preferred_driver)) 3627c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(usba_device::usb_port)) 3637c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(usba_device::usb_n_ifs)) 3647c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(usba_device::usb_n_cfgs)) 3657c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(usba_device::usb_mfg_str)) 3667c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(usba_device::usb_dev_descr)) 3677c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(usba_device::usb_ph_list)) 3687c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(usba_device::usb_cfg_value)) 3697c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(usba_device::usb_cfg_str_descr)) 3707c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(usba_device::usb_cfg_length)) 3717c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(usba_device::usb_cfg_array)) 3727c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(usba_device::usb_cfg_array_len)) 3737c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(usba_device::usb_cfg_array_length)) 3747c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(usba_device::usb_cfg_array_len_length)) 3757c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(usba_device::usb_cfg)) 3767c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(usba_device::usb_hcdi_ops)) 3777c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(usba_device::usb_addr)) 3787c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(usba_device::usb_port_status)) 3797c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(usba_device::rm_cookie)) 3807c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(usba_device::ins_cookie)) 3817c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(usba_device::suspend_cookie)) 3827c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(usba_device::resume_cookie)) 3837c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(usba_device::usb_client_flags)) 3847c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(usba_device::usb_client_attach_list)) 3857c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(usba_device::usb_client_ev_cb_list)) 3867c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(usba_device::usb_dip)) 3877c478bd9Sstevel@tonic-gate _NOTE(SCHEME_PROTECTS_DATA("set at device creation", 3887c478bd9Sstevel@tonic-gate usba_device::usb_shared_taskq)) 3897c478bd9Sstevel@tonic-gate 3907c478bd9Sstevel@tonic-gate /* 3917c478bd9Sstevel@tonic-gate * serialization in drivers 3927c478bd9Sstevel@tonic-gate */ 3937c478bd9Sstevel@tonic-gate typedef struct usba_serialization_impl { 3947c478bd9Sstevel@tonic-gate dev_info_t *s_dip; 3957c478bd9Sstevel@tonic-gate kcondvar_t s_cv; 3967c478bd9Sstevel@tonic-gate kmutex_t s_mutex; 3977c478bd9Sstevel@tonic-gate kthread_t *s_thread; 3987c478bd9Sstevel@tonic-gate int s_count; 3997c478bd9Sstevel@tonic-gate uint_t s_flag; 4007c478bd9Sstevel@tonic-gate } usba_serialization_impl_t; 4017c478bd9Sstevel@tonic-gate 4027c478bd9Sstevel@tonic-gate _NOTE(SCHEME_PROTECTS_DATA("unshared private data", 4037c478bd9Sstevel@tonic-gate usba_serialization_impl)) 4047c478bd9Sstevel@tonic-gate 4057c478bd9Sstevel@tonic-gate #ifdef __cplusplus 4067c478bd9Sstevel@tonic-gate } 4077c478bd9Sstevel@tonic-gate #endif 4087c478bd9Sstevel@tonic-gate 4097c478bd9Sstevel@tonic-gate #endif /* _SYS_USB_USBA_USBA_TYPES_H */ 410