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 #ifdef __cplusplus 307c478bd9Sstevel@tonic-gate extern "C" { 317c478bd9Sstevel@tonic-gate #endif 327c478bd9Sstevel@tonic-gate 337c478bd9Sstevel@tonic-gate #include <sys/usb/usba/usbai_private.h> 347c478bd9Sstevel@tonic-gate 357c478bd9Sstevel@tonic-gate 367c478bd9Sstevel@tonic-gate /* 377c478bd9Sstevel@tonic-gate * soft state information for this usb_mid 387c478bd9Sstevel@tonic-gate */ 397c478bd9Sstevel@tonic-gate typedef struct usb_mid { 407c478bd9Sstevel@tonic-gate int mi_instance; 417c478bd9Sstevel@tonic-gate 427c478bd9Sstevel@tonic-gate uint_t mi_init_state; 437c478bd9Sstevel@tonic-gate uint_t mi_ugen_open_count; 447c478bd9Sstevel@tonic-gate 457c478bd9Sstevel@tonic-gate kmutex_t mi_mutex; 467c478bd9Sstevel@tonic-gate 477c478bd9Sstevel@tonic-gate /* 487c478bd9Sstevel@tonic-gate * dev_info_t reference 497c478bd9Sstevel@tonic-gate */ 507c478bd9Sstevel@tonic-gate dev_info_t *mi_dip; 517c478bd9Sstevel@tonic-gate 52*d73ae94eSgc /* pointer to usb_common_power_t */ 53*d73ae94eSgc usb_common_power_t *mi_pm; 547c478bd9Sstevel@tonic-gate 557c478bd9Sstevel@tonic-gate /* 567c478bd9Sstevel@tonic-gate * save the usba_device pointer 577c478bd9Sstevel@tonic-gate */ 587c478bd9Sstevel@tonic-gate usba_device_t *mi_usba_device; 597c478bd9Sstevel@tonic-gate 607c478bd9Sstevel@tonic-gate int mi_softstate; 617c478bd9Sstevel@tonic-gate 627c478bd9Sstevel@tonic-gate int mi_dev_state; 637c478bd9Sstevel@tonic-gate 647c478bd9Sstevel@tonic-gate int mi_n_ifs; 657c478bd9Sstevel@tonic-gate 667c478bd9Sstevel@tonic-gate /* track event registration of children */ 677c478bd9Sstevel@tonic-gate uint8_t *mi_child_events; 68*d73ae94eSgc 69*d73ae94eSgc /* record the interface num of each child node */ 70*d73ae94eSgc uint_t *mi_children_ifs; 71*d73ae94eSgc 727c478bd9Sstevel@tonic-gate /* 73*d73ae94eSgc * mi_children_dips is an array for holding 747c478bd9Sstevel@tonic-gate * each child dip indexed by interface number 757c478bd9Sstevel@tonic-gate */ 767c478bd9Sstevel@tonic-gate dev_info_t **mi_children_dips; 77*d73ae94eSgc 787c478bd9Sstevel@tonic-gate boolean_t mi_removed_children; 797c478bd9Sstevel@tonic-gate 807c478bd9Sstevel@tonic-gate size_t mi_cd_list_length; 817c478bd9Sstevel@tonic-gate int mi_attach_count; 827c478bd9Sstevel@tonic-gate 837c478bd9Sstevel@tonic-gate /* logging of messages */ 847c478bd9Sstevel@tonic-gate usb_log_handle_t mi_log_handle; 857c478bd9Sstevel@tonic-gate 867c478bd9Sstevel@tonic-gate /* usb registration */ 877c478bd9Sstevel@tonic-gate usb_client_dev_data_t *mi_dev_data; 887c478bd9Sstevel@tonic-gate 897c478bd9Sstevel@tonic-gate /* event support */ 907c478bd9Sstevel@tonic-gate ndi_event_hdl_t mi_ndi_event_hdl; 917c478bd9Sstevel@tonic-gate 927c478bd9Sstevel@tonic-gate /* ugen support */ 937c478bd9Sstevel@tonic-gate usb_ugen_hdl_t mi_ugen_hdl; 947c478bd9Sstevel@tonic-gate 957c478bd9Sstevel@tonic-gate } usb_mid_t; 967c478bd9Sstevel@tonic-gate 977c478bd9Sstevel@tonic-gate _NOTE(MUTEX_PROTECTS_DATA(usb_mid::mi_mutex, usb_mid)) 98*d73ae94eSgc _NOTE(MUTEX_PROTECTS_DATA(usb_mid::mi_mutex, usb_common_power_t)) 997c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(usb_mid::mi_instance 1007c478bd9Sstevel@tonic-gate usb_mid::mi_ndi_event_hdl 1017c478bd9Sstevel@tonic-gate usb_mid::mi_dev_data 1027c478bd9Sstevel@tonic-gate usb_mid::mi_log_handle 1037c478bd9Sstevel@tonic-gate usb_mid::mi_ugen_hdl 1047c478bd9Sstevel@tonic-gate usb_mid::mi_dip 1057c478bd9Sstevel@tonic-gate usb_mid::mi_pm)) 1067c478bd9Sstevel@tonic-gate 1077c478bd9Sstevel@tonic-gate #define USB_MID_MINOR_UGEN_BITS_MASK 0x1ff 1087c478bd9Sstevel@tonic-gate #define USB_MID_MINOR_INSTANCE_SHIFT 9 1097c478bd9Sstevel@tonic-gate #define USB_MID_MINOR_INSTANCE_MASK ~USB_MID_MINOR_UGEN_BITS_MASK 1107c478bd9Sstevel@tonic-gate #define USB_MID_MINOR_TO_INSTANCE(minor) \ 1117c478bd9Sstevel@tonic-gate (((minor) & USB_MID_MINOR_INSTANCE_MASK) >> \ 1127c478bd9Sstevel@tonic-gate USB_MID_MINOR_INSTANCE_SHIFT) 1137c478bd9Sstevel@tonic-gate 1147c478bd9Sstevel@tonic-gate /* init state */ 1157c478bd9Sstevel@tonic-gate #define USB_MID_LOCK_INIT 0x0001 1167c478bd9Sstevel@tonic-gate #define USB_MID_MINOR_NODE_CREATED 0x0002 1177c478bd9Sstevel@tonic-gate #define USB_MID_EVENTS_REGISTERED 0x0004 1187c478bd9Sstevel@tonic-gate 1197c478bd9Sstevel@tonic-gate /* Tracking events registered by children */ 1207c478bd9Sstevel@tonic-gate #define USB_MID_CHILD_EVENT_DISCONNECT 0x01 1217c478bd9Sstevel@tonic-gate #define USB_MID_CHILD_EVENT_PRESUSPEND 0x02 1227c478bd9Sstevel@tonic-gate 1237c478bd9Sstevel@tonic-gate /* 1247c478bd9Sstevel@tonic-gate * Debug printing 1257c478bd9Sstevel@tonic-gate * Masks 1267c478bd9Sstevel@tonic-gate */ 1277c478bd9Sstevel@tonic-gate #define DPRINT_MASK_ATTA 0x00000001 1287c478bd9Sstevel@tonic-gate #define DPRINT_MASK_CBOPS 0x00000002 1297c478bd9Sstevel@tonic-gate #define DPRINT_MASK_EVENTS 0x00000004 1307c478bd9Sstevel@tonic-gate #define DPRINT_MASK_DUMPING 0x00000008 /* usb_mid dump mask */ 1317c478bd9Sstevel@tonic-gate #define DPRINT_MASK_PM 0x00000010 1327c478bd9Sstevel@tonic-gate #define DPRINT_MASK_ALL 0xFFFFFFFF 1337c478bd9Sstevel@tonic-gate 1347c478bd9Sstevel@tonic-gate 1357c478bd9Sstevel@tonic-gate #ifdef __cplusplus 1367c478bd9Sstevel@tonic-gate } 1377c478bd9Sstevel@tonic-gate #endif 1387c478bd9Sstevel@tonic-gate 1397c478bd9Sstevel@tonic-gate #endif /* _SYS_USB_USB_MIDVAR_H */ 140