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