xref: /onnv-gate/usr/src/uts/common/sys/usb/clients/wusb_df/wusb_df.h (revision 9430:637732b28916)
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 2009 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef _SYS_USB_WUSB_DF_H
27 #define	_SYS_USB_WUSB_DF_H
28 
29 
30 #ifdef	__cplusplus
31 extern "C" {
32 #endif
33 
34 #include <sys/usb/usba/usbai_private.h>
35 
36 /*
37  * Power Management support
38  */
39 typedef struct wusb_df_power  {
40 
41 	void		*wusb_df_state;	/* points back to wusb_df_state */
42 	uint8_t		wusb_df_pwr_states; /* bit mask of device pwr states */
43 	int		wusb_df_pm_busy;
44 	uint8_t		wusb_df_wakeup_enabled;
45 
46 	/* wakeup and power transistion capabilites of an interface */
47 	uint8_t		wusb_df_pm_capabilities;
48 
49 
50 	uint8_t		wusb_df_current_power;
51 } wusb_df_power_t;
52 
53 
54 /*
55  * State structure
56  */
57 typedef struct wusb_df_state {
58 	dev_info_t		*wusb_df_dip;	/* per-device info handle */
59 	usb_client_dev_data_t	*wusb_df_reg;	/* registration data */
60 	usb_ep_descr_t		wusb_df_intr_ep_descr;	/* Intr ep descr */
61 	usb_pipe_handle_t	wusb_df_intr_ph;	/* Intr pipe handle.  */
62 	char			*wusb_df_devinst;	/* Dev and instance */
63 	int			wusb_df_dev_state; /* USB device states. */
64 	kmutex_t		wusb_df_mutex;
65 	kcondvar_t		wusb_df_serial_cv;
66 	boolean_t		wusb_df_serial_inuse;
67 	boolean_t		wusb_df_locks_initialized;
68 	wusb_df_power_t		*wusb_df_pm;
69 	usb_log_handle_t	wusb_df_log_hdl;
70 } wusb_df_state_t;
71 
72 _NOTE(MUTEX_PROTECTS_DATA(wusb_df_state::wusb_df_mutex, wusb_df_state))
73 
74 _NOTE(DATA_READABLE_WITHOUT_LOCK(wusb_df_state_t::{
75 	wusb_df_log_hdl
76 	wusb_df_intr_ph
77 	wusb_df_dip
78 	wusb_df_reg
79 }))
80 /* Macros */
81 
82 #define	WUSB_DF_REQUEST_SIZE	65535	/* Read request size maximum */
83 #define	USB_DEV_DESCR_SIZE	18	/* device descr size */
84 
85 
86 /* For serialization. */
87 #define	WUSB_DF_SER_NOSIG	B_FALSE
88 #define	WUSB_DF_SER_SIG		B_TRUE
89 
90 /* For logging. */
91 
92 #define	PRINT_MASK_ALL		0xFFFFFFFF
93 #define	PRINT_MASK_ATTA		0x00000001
94 #define	PRINT_MASK_PM		0x00000010
95 #define	PRINT_MASK_CB		0x00000020
96 #define	PRINT_MASK_CPR		0x00000040
97 
98 #ifdef __cplusplus
99 }
100 #endif
101 
102 #endif	/* _SYS_USB_WUSB_DF_H */
103