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 5*d73ae94eSgc * Common Development and Distribution License (the "License"). 6*d73ae94eSgc * You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate * 87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate * and limitations under the License. 127c478bd9Sstevel@tonic-gate * 137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate * 197c478bd9Sstevel@tonic-gate * CDDL HEADER END 20*d73ae94eSgc */ 21*d73ae94eSgc /* 22*d73ae94eSgc * Copyright 2006 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_USB_MIDVAR_H 277c478bd9Sstevel@tonic-gate #define _SYS_USB_USB_MIDVAR_H 287c478bd9Sstevel@tonic-gate 297c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 307c478bd9Sstevel@tonic-gate 317c478bd9Sstevel@tonic-gate #ifdef __cplusplus 327c478bd9Sstevel@tonic-gate extern "C" { 337c478bd9Sstevel@tonic-gate #endif 347c478bd9Sstevel@tonic-gate 357c478bd9Sstevel@tonic-gate #include <sys/usb/usba/usbai_private.h> 367c478bd9Sstevel@tonic-gate 377c478bd9Sstevel@tonic-gate 387c478bd9Sstevel@tonic-gate /* 397c478bd9Sstevel@tonic-gate * soft state information for this usb_mid 407c478bd9Sstevel@tonic-gate */ 417c478bd9Sstevel@tonic-gate typedef struct usb_mid { 427c478bd9Sstevel@tonic-gate int mi_instance; 437c478bd9Sstevel@tonic-gate 447c478bd9Sstevel@tonic-gate uint_t mi_init_state; 457c478bd9Sstevel@tonic-gate uint_t mi_ugen_open_count; 467c478bd9Sstevel@tonic-gate 477c478bd9Sstevel@tonic-gate kmutex_t mi_mutex; 487c478bd9Sstevel@tonic-gate 497c478bd9Sstevel@tonic-gate /* 507c478bd9Sstevel@tonic-gate * dev_info_t reference 517c478bd9Sstevel@tonic-gate */ 527c478bd9Sstevel@tonic-gate dev_info_t *mi_dip; 537c478bd9Sstevel@tonic-gate 54*d73ae94eSgc /* pointer to usb_common_power_t */ 55*d73ae94eSgc usb_common_power_t *mi_pm; 567c478bd9Sstevel@tonic-gate 577c478bd9Sstevel@tonic-gate /* 587c478bd9Sstevel@tonic-gate * save the usba_device pointer 597c478bd9Sstevel@tonic-gate */ 607c478bd9Sstevel@tonic-gate usba_device_t *mi_usba_device; 617c478bd9Sstevel@tonic-gate 627c478bd9Sstevel@tonic-gate int mi_softstate; 637c478bd9Sstevel@tonic-gate 647c478bd9Sstevel@tonic-gate int mi_dev_state; 657c478bd9Sstevel@tonic-gate 667c478bd9Sstevel@tonic-gate int mi_n_ifs; 677c478bd9Sstevel@tonic-gate 687c478bd9Sstevel@tonic-gate /* track event registration of children */ 697c478bd9Sstevel@tonic-gate uint8_t *mi_child_events; 70*d73ae94eSgc 71*d73ae94eSgc /* record the interface num of each child node */ 72*d73ae94eSgc uint_t *mi_children_ifs; 73*d73ae94eSgc 747c478bd9Sstevel@tonic-gate /* 75*d73ae94eSgc * mi_children_dips is an array for holding 767c478bd9Sstevel@tonic-gate * each child dip indexed by interface number 777c478bd9Sstevel@tonic-gate */ 787c478bd9Sstevel@tonic-gate dev_info_t **mi_children_dips; 79*d73ae94eSgc 807c478bd9Sstevel@tonic-gate boolean_t mi_removed_children; 817c478bd9Sstevel@tonic-gate 827c478bd9Sstevel@tonic-gate size_t mi_cd_list_length; 837c478bd9Sstevel@tonic-gate int mi_attach_count; 847c478bd9Sstevel@tonic-gate 857c478bd9Sstevel@tonic-gate /* logging of messages */ 867c478bd9Sstevel@tonic-gate usb_log_handle_t mi_log_handle; 877c478bd9Sstevel@tonic-gate 887c478bd9Sstevel@tonic-gate /* usb registration */ 897c478bd9Sstevel@tonic-gate usb_client_dev_data_t *mi_dev_data; 907c478bd9Sstevel@tonic-gate 917c478bd9Sstevel@tonic-gate /* event support */ 927c478bd9Sstevel@tonic-gate ndi_event_hdl_t mi_ndi_event_hdl; 937c478bd9Sstevel@tonic-gate 947c478bd9Sstevel@tonic-gate /* ugen support */ 957c478bd9Sstevel@tonic-gate usb_ugen_hdl_t mi_ugen_hdl; 967c478bd9Sstevel@tonic-gate 977c478bd9Sstevel@tonic-gate } usb_mid_t; 987c478bd9Sstevel@tonic-gate 997c478bd9Sstevel@tonic-gate _NOTE(MUTEX_PROTECTS_DATA(usb_mid::mi_mutex, usb_mid)) 100*d73ae94eSgc _NOTE(MUTEX_PROTECTS_DATA(usb_mid::mi_mutex, usb_common_power_t)) 1017c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(usb_mid::mi_instance 1027c478bd9Sstevel@tonic-gate usb_mid::mi_ndi_event_hdl 1037c478bd9Sstevel@tonic-gate usb_mid::mi_dev_data 1047c478bd9Sstevel@tonic-gate usb_mid::mi_log_handle 1057c478bd9Sstevel@tonic-gate usb_mid::mi_ugen_hdl 1067c478bd9Sstevel@tonic-gate usb_mid::mi_dip 1077c478bd9Sstevel@tonic-gate usb_mid::mi_pm)) 1087c478bd9Sstevel@tonic-gate 1097c478bd9Sstevel@tonic-gate #define USB_MID_MINOR_UGEN_BITS_MASK 0x1ff 1107c478bd9Sstevel@tonic-gate #define USB_MID_MINOR_INSTANCE_SHIFT 9 1117c478bd9Sstevel@tonic-gate #define USB_MID_MINOR_INSTANCE_MASK ~USB_MID_MINOR_UGEN_BITS_MASK 1127c478bd9Sstevel@tonic-gate #define USB_MID_MINOR_TO_INSTANCE(minor) \ 1137c478bd9Sstevel@tonic-gate (((minor) & USB_MID_MINOR_INSTANCE_MASK) >> \ 1147c478bd9Sstevel@tonic-gate USB_MID_MINOR_INSTANCE_SHIFT) 1157c478bd9Sstevel@tonic-gate 1167c478bd9Sstevel@tonic-gate /* init state */ 1177c478bd9Sstevel@tonic-gate #define USB_MID_LOCK_INIT 0x0001 1187c478bd9Sstevel@tonic-gate #define USB_MID_MINOR_NODE_CREATED 0x0002 1197c478bd9Sstevel@tonic-gate #define USB_MID_EVENTS_REGISTERED 0x0004 1207c478bd9Sstevel@tonic-gate 1217c478bd9Sstevel@tonic-gate /* Tracking events registered by children */ 1227c478bd9Sstevel@tonic-gate #define USB_MID_CHILD_EVENT_DISCONNECT 0x01 1237c478bd9Sstevel@tonic-gate #define USB_MID_CHILD_EVENT_PRESUSPEND 0x02 1247c478bd9Sstevel@tonic-gate 1257c478bd9Sstevel@tonic-gate /* 1267c478bd9Sstevel@tonic-gate * Debug printing 1277c478bd9Sstevel@tonic-gate * Masks 1287c478bd9Sstevel@tonic-gate */ 1297c478bd9Sstevel@tonic-gate #define DPRINT_MASK_ATTA 0x00000001 1307c478bd9Sstevel@tonic-gate #define DPRINT_MASK_CBOPS 0x00000002 1317c478bd9Sstevel@tonic-gate #define DPRINT_MASK_EVENTS 0x00000004 1327c478bd9Sstevel@tonic-gate #define DPRINT_MASK_DUMPING 0x00000008 /* usb_mid dump mask */ 1337c478bd9Sstevel@tonic-gate #define DPRINT_MASK_PM 0x00000010 1347c478bd9Sstevel@tonic-gate #define DPRINT_MASK_ALL 0xFFFFFFFF 1357c478bd9Sstevel@tonic-gate 1367c478bd9Sstevel@tonic-gate 1377c478bd9Sstevel@tonic-gate #ifdef __cplusplus 1387c478bd9Sstevel@tonic-gate } 1397c478bd9Sstevel@tonic-gate #endif 1407c478bd9Sstevel@tonic-gate 1417c478bd9Sstevel@tonic-gate #endif /* _SYS_USB_USB_MIDVAR_H */ 142