1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef	_SYS_USB_USB_IA_H
27 #define	_SYS_USB_USB_IA_H
28 
29 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 #ifdef	__cplusplus
32 extern "C" {
33 #endif
34 
35 #include <sys/usb/usba/usbai_private.h>
36 
37 /*
38  * soft	state information for this usb_ia
39  */
40 typedef struct usb_ia {
41 	int			ia_instance;
42 
43 	uint_t			ia_init_state;
44 
45 	kmutex_t		ia_mutex;
46 
47 	/*
48 	 * dev_info_t reference
49 	 */
50 	dev_info_t		*ia_dip;
51 
52 	/* pointer to usb_ia_power_t */
53 	usb_common_power_t	*ia_pm;
54 
55 	int			ia_dev_state;
56 
57 	int			ia_first_if;
58 	int			ia_n_ifs;
59 
60 	/* track event registration of children */
61 	uint8_t			*ia_child_events;
62 	/*
63 	 * ia_children_dips is a  array for holding
64 	 * each child dip indexed by interface number
65 	 */
66 	dev_info_t		**ia_children_dips;
67 
68 	size_t			ia_cd_list_length;
69 
70 	/* logging of messages */
71 	usb_log_handle_t	ia_log_handle;
72 
73 	/* usb registration */
74 	usb_client_dev_data_t	*ia_dev_data;
75 
76 	/* event support */
77 	ndi_event_hdl_t		ia_ndi_event_hdl;
78 
79 } usb_ia_t;
80 
81 _NOTE(MUTEX_PROTECTS_DATA(usb_ia::ia_mutex, usb_ia))
82 _NOTE(MUTEX_PROTECTS_DATA(usb_ia::ia_mutex, usb_common_power_t))
83 _NOTE(DATA_READABLE_WITHOUT_LOCK(usb_ia::ia_instance
84 		usb_ia::ia_ndi_event_hdl
85 		usb_ia::ia_dev_data
86 		usb_ia::ia_log_handle
87 		usb_ia::ia_dip
88 		usb_ia::ia_pm))
89 
90 /* init state */
91 #define	USB_IA_LOCK_INIT		0x0001
92 #define	USB_IA_MINOR_NODE_CREATED	0x0002
93 #define	USB_IA_EVENTS_REGISTERED	0x0004
94 
95 /* Tracking events registered by children */
96 #define	USB_IA_CHILD_EVENT_DISCONNECT	0x01
97 #define	USB_IA_CHILD_EVENT_PRESUSPEND	0x02
98 
99 /*
100  * Debug printing
101  * Masks
102  */
103 #define	DPRINT_MASK_ATTA	0x00000001
104 #define	DPRINT_MASK_CBOPS	0x00000002
105 #define	DPRINT_MASK_EVENTS	0x00000004
106 #define	DPRINT_MASK_PM		0x00000010
107 #define	DPRINT_MASK_ALL 	0xFFFFFFFF
108 
109 
110 #ifdef	__cplusplus
111 }
112 #endif
113 
114 #endif	/* _SYS_USB_USB_IA_H */
115