1*7c478bd9Sstevel@tonic-gate /* 2*7c478bd9Sstevel@tonic-gate * CDDL HEADER START 3*7c478bd9Sstevel@tonic-gate * 4*7c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*7c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*7c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*7c478bd9Sstevel@tonic-gate * with the License. 8*7c478bd9Sstevel@tonic-gate * 9*7c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*7c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*7c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 12*7c478bd9Sstevel@tonic-gate * and limitations under the License. 13*7c478bd9Sstevel@tonic-gate * 14*7c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*7c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*7c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*7c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*7c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*7c478bd9Sstevel@tonic-gate * 20*7c478bd9Sstevel@tonic-gate * CDDL HEADER END 21*7c478bd9Sstevel@tonic-gate * 22*7c478bd9Sstevel@tonic-gate * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 23*7c478bd9Sstevel@tonic-gate * Use is subject to license terms. 24*7c478bd9Sstevel@tonic-gate */ 25*7c478bd9Sstevel@tonic-gate 26*7c478bd9Sstevel@tonic-gate #ifndef _SYS_USB_USB_MIDVAR_H 27*7c478bd9Sstevel@tonic-gate #define _SYS_USB_USB_MIDVAR_H 28*7c478bd9Sstevel@tonic-gate 29*7c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 30*7c478bd9Sstevel@tonic-gate 31*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 32*7c478bd9Sstevel@tonic-gate extern "C" { 33*7c478bd9Sstevel@tonic-gate #endif 34*7c478bd9Sstevel@tonic-gate 35*7c478bd9Sstevel@tonic-gate #include <sys/usb/usba/usbai_private.h> 36*7c478bd9Sstevel@tonic-gate 37*7c478bd9Sstevel@tonic-gate typedef struct usb_mid_power_struct { 38*7c478bd9Sstevel@tonic-gate void *mip_usb_mid; /* points back to usb_mid_t */ 39*7c478bd9Sstevel@tonic-gate 40*7c478bd9Sstevel@tonic-gate uint8_t mip_wakeup_enabled; 41*7c478bd9Sstevel@tonic-gate 42*7c478bd9Sstevel@tonic-gate /* this is the bit mask of the power states that device has */ 43*7c478bd9Sstevel@tonic-gate uint8_t mip_pwr_states; 44*7c478bd9Sstevel@tonic-gate 45*7c478bd9Sstevel@tonic-gate /* wakeup and power transistion capabilites of an interface */ 46*7c478bd9Sstevel@tonic-gate uint8_t mip_pm_capabilities; 47*7c478bd9Sstevel@tonic-gate 48*7c478bd9Sstevel@tonic-gate uint8_t mip_current_power; /* current power level */ 49*7c478bd9Sstevel@tonic-gate } usb_mid_power_t; 50*7c478bd9Sstevel@tonic-gate 51*7c478bd9Sstevel@tonic-gate /* warlock directives, stable data */ 52*7c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(usb_mid_power_t::mip_usb_mid)) 53*7c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(usb_mid_power_t::mip_wakeup_enabled)) 54*7c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(usb_mid_power_t::mip_pwr_states)) 55*7c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(usb_mid_power_t::mip_pm_capabilities)) 56*7c478bd9Sstevel@tonic-gate 57*7c478bd9Sstevel@tonic-gate 58*7c478bd9Sstevel@tonic-gate /* 59*7c478bd9Sstevel@tonic-gate * soft state information for this usb_mid 60*7c478bd9Sstevel@tonic-gate */ 61*7c478bd9Sstevel@tonic-gate typedef struct usb_mid { 62*7c478bd9Sstevel@tonic-gate int mi_instance; 63*7c478bd9Sstevel@tonic-gate 64*7c478bd9Sstevel@tonic-gate uint_t mi_init_state; 65*7c478bd9Sstevel@tonic-gate uint_t mi_ugen_open_count; 66*7c478bd9Sstevel@tonic-gate 67*7c478bd9Sstevel@tonic-gate kmutex_t mi_mutex; 68*7c478bd9Sstevel@tonic-gate 69*7c478bd9Sstevel@tonic-gate /* 70*7c478bd9Sstevel@tonic-gate * dev_info_t reference 71*7c478bd9Sstevel@tonic-gate */ 72*7c478bd9Sstevel@tonic-gate dev_info_t *mi_dip; 73*7c478bd9Sstevel@tonic-gate 74*7c478bd9Sstevel@tonic-gate /* pointer to usb_mid_power_t */ 75*7c478bd9Sstevel@tonic-gate usb_mid_power_t *mi_pm; 76*7c478bd9Sstevel@tonic-gate 77*7c478bd9Sstevel@tonic-gate /* 78*7c478bd9Sstevel@tonic-gate * save the usba_device pointer 79*7c478bd9Sstevel@tonic-gate */ 80*7c478bd9Sstevel@tonic-gate usba_device_t *mi_usba_device; 81*7c478bd9Sstevel@tonic-gate 82*7c478bd9Sstevel@tonic-gate int mi_softstate; 83*7c478bd9Sstevel@tonic-gate 84*7c478bd9Sstevel@tonic-gate int mi_dev_state; 85*7c478bd9Sstevel@tonic-gate 86*7c478bd9Sstevel@tonic-gate int mi_n_ifs; 87*7c478bd9Sstevel@tonic-gate 88*7c478bd9Sstevel@tonic-gate /* track event registration of children */ 89*7c478bd9Sstevel@tonic-gate uint8_t *mi_child_events; 90*7c478bd9Sstevel@tonic-gate /* 91*7c478bd9Sstevel@tonic-gate * mi_children_dips is a array for holding 92*7c478bd9Sstevel@tonic-gate * each child dip indexed by interface number 93*7c478bd9Sstevel@tonic-gate */ 94*7c478bd9Sstevel@tonic-gate dev_info_t **mi_children_dips; 95*7c478bd9Sstevel@tonic-gate boolean_t mi_removed_children; 96*7c478bd9Sstevel@tonic-gate 97*7c478bd9Sstevel@tonic-gate size_t mi_cd_list_length; 98*7c478bd9Sstevel@tonic-gate int mi_attach_count; 99*7c478bd9Sstevel@tonic-gate 100*7c478bd9Sstevel@tonic-gate /* logging of messages */ 101*7c478bd9Sstevel@tonic-gate usb_log_handle_t mi_log_handle; 102*7c478bd9Sstevel@tonic-gate 103*7c478bd9Sstevel@tonic-gate /* usb registration */ 104*7c478bd9Sstevel@tonic-gate usb_client_dev_data_t *mi_dev_data; 105*7c478bd9Sstevel@tonic-gate 106*7c478bd9Sstevel@tonic-gate /* event support */ 107*7c478bd9Sstevel@tonic-gate ndi_event_hdl_t mi_ndi_event_hdl; 108*7c478bd9Sstevel@tonic-gate 109*7c478bd9Sstevel@tonic-gate /* ugen support */ 110*7c478bd9Sstevel@tonic-gate usb_ugen_hdl_t mi_ugen_hdl; 111*7c478bd9Sstevel@tonic-gate 112*7c478bd9Sstevel@tonic-gate } usb_mid_t; 113*7c478bd9Sstevel@tonic-gate 114*7c478bd9Sstevel@tonic-gate _NOTE(MUTEX_PROTECTS_DATA(usb_mid::mi_mutex, usb_mid)) 115*7c478bd9Sstevel@tonic-gate _NOTE(MUTEX_PROTECTS_DATA(usb_mid::mi_mutex, usb_mid_power_t)) 116*7c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(usb_mid::mi_instance 117*7c478bd9Sstevel@tonic-gate usb_mid::mi_ndi_event_hdl 118*7c478bd9Sstevel@tonic-gate usb_mid::mi_dev_data 119*7c478bd9Sstevel@tonic-gate usb_mid::mi_log_handle 120*7c478bd9Sstevel@tonic-gate usb_mid::mi_ugen_hdl 121*7c478bd9Sstevel@tonic-gate usb_mid::mi_dip 122*7c478bd9Sstevel@tonic-gate usb_mid::mi_pm)) 123*7c478bd9Sstevel@tonic-gate 124*7c478bd9Sstevel@tonic-gate #define USB_MID_MINOR_UGEN_BITS_MASK 0x1ff 125*7c478bd9Sstevel@tonic-gate #define USB_MID_MINOR_INSTANCE_SHIFT 9 126*7c478bd9Sstevel@tonic-gate #define USB_MID_MINOR_INSTANCE_MASK ~USB_MID_MINOR_UGEN_BITS_MASK 127*7c478bd9Sstevel@tonic-gate #define USB_MID_MINOR_TO_INSTANCE(minor) \ 128*7c478bd9Sstevel@tonic-gate (((minor) & USB_MID_MINOR_INSTANCE_MASK) >> \ 129*7c478bd9Sstevel@tonic-gate USB_MID_MINOR_INSTANCE_SHIFT) 130*7c478bd9Sstevel@tonic-gate 131*7c478bd9Sstevel@tonic-gate /* init state */ 132*7c478bd9Sstevel@tonic-gate #define USB_MID_LOCK_INIT 0x0001 133*7c478bd9Sstevel@tonic-gate #define USB_MID_MINOR_NODE_CREATED 0x0002 134*7c478bd9Sstevel@tonic-gate #define USB_MID_EVENTS_REGISTERED 0x0004 135*7c478bd9Sstevel@tonic-gate 136*7c478bd9Sstevel@tonic-gate /* Tracking events registered by children */ 137*7c478bd9Sstevel@tonic-gate #define USB_MID_CHILD_EVENT_DISCONNECT 0x01 138*7c478bd9Sstevel@tonic-gate #define USB_MID_CHILD_EVENT_PRESUSPEND 0x02 139*7c478bd9Sstevel@tonic-gate 140*7c478bd9Sstevel@tonic-gate /* 141*7c478bd9Sstevel@tonic-gate * Debug printing 142*7c478bd9Sstevel@tonic-gate * Masks 143*7c478bd9Sstevel@tonic-gate */ 144*7c478bd9Sstevel@tonic-gate #define DPRINT_MASK_ATTA 0x00000001 145*7c478bd9Sstevel@tonic-gate #define DPRINT_MASK_CBOPS 0x00000002 146*7c478bd9Sstevel@tonic-gate #define DPRINT_MASK_EVENTS 0x00000004 147*7c478bd9Sstevel@tonic-gate #define DPRINT_MASK_DUMPING 0x00000008 /* usb_mid dump mask */ 148*7c478bd9Sstevel@tonic-gate #define DPRINT_MASK_PM 0x00000010 149*7c478bd9Sstevel@tonic-gate #define DPRINT_MASK_ALL 0xFFFFFFFF 150*7c478bd9Sstevel@tonic-gate 151*7c478bd9Sstevel@tonic-gate 152*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 153*7c478bd9Sstevel@tonic-gate } 154*7c478bd9Sstevel@tonic-gate #endif 155*7c478bd9Sstevel@tonic-gate 156*7c478bd9Sstevel@tonic-gate #endif /* _SYS_USB_USB_MIDVAR_H */ 157