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 2008 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 
30 #ifdef	__cplusplus
31 extern "C" {
32 #endif
33 
34 #include <sys/usb/usba/usbai_private.h>
35 
36 /*
37  * soft	state information for this usb_ia
38  */
39 typedef struct usb_ia {
40 	int			ia_instance;
41 
42 	uint_t			ia_init_state;
43 
44 	kmutex_t		ia_mutex;
45 
46 	/*
47 	 * dev_info_t reference
48 	 */
49 	dev_info_t		*ia_dip;
50 
51 	/* pointer to usb_ia_power_t */
52 	usb_common_power_t	*ia_pm;
53 
54 	int			ia_dev_state;
55 
56 	int			ia_first_if;
57 	int			ia_n_ifs;
58 
59 	/* track event registration of children */
60 	uint8_t			*ia_child_events;
61 	/*
62 	 * ia_children_dips is a  array for holding
63 	 * each child dip indexed by interface number
64 	 */
65 	dev_info_t		**ia_children_dips;
66 
67 	size_t			ia_cd_list_length;
68 
69 	/* logging of messages */
70 	usb_log_handle_t	ia_log_handle;
71 
72 	/* usb registration */
73 	usb_client_dev_data_t	*ia_dev_data;
74 
75 	/* event support */
76 	ndi_event_hdl_t		ia_ndi_event_hdl;
77 
78 } usb_ia_t;
79 
80 _NOTE(MUTEX_PROTECTS_DATA(usb_ia::ia_mutex, usb_ia))
81 _NOTE(MUTEX_PROTECTS_DATA(usb_ia::ia_mutex, usb_common_power_t))
82 _NOTE(DATA_READABLE_WITHOUT_LOCK(usb_ia::ia_instance
83 		usb_ia::ia_ndi_event_hdl
84 		usb_ia::ia_dev_data
85 		usb_ia::ia_log_handle
86 		usb_ia::ia_dip
87 		usb_ia::ia_pm))
88 
89 /* init state */
90 #define	USB_IA_LOCK_INIT		0x0001
91 #define	USB_IA_MINOR_NODE_CREATED	0x0002
92 #define	USB_IA_EVENTS_REGISTERED	0x0004
93 
94 /* Tracking events registered by children */
95 #define	USB_IA_CHILD_EVENT_DISCONNECT	0x01
96 #define	USB_IA_CHILD_EVENT_PRESUSPEND	0x02
97 
98 /*
99  * Debug printing
100  * Masks
101  */
102 #define	DPRINT_MASK_ATTA	0x00000001
103 #define	DPRINT_MASK_CBOPS	0x00000002
104 #define	DPRINT_MASK_EVENTS	0x00000004
105 #define	DPRINT_MASK_PM		0x00000010
106 #define	DPRINT_MASK_ALL 	0xFFFFFFFF
107 
108 
109 #ifdef	__cplusplus
110 }
111 #endif
112 
113 #endif	/* _SYS_USB_USB_IA_H */
114