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