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