xref: /onnv-gate/usr/src/uts/common/sys/usb/clients/hwarc/hwarc.h (revision 9430:637732b28916)
1*9430SRaymond.Chen@Sun.COM /*
2*9430SRaymond.Chen@Sun.COM  * CDDL HEADER START
3*9430SRaymond.Chen@Sun.COM  *
4*9430SRaymond.Chen@Sun.COM  * The contents of this file are subject to the terms of the
5*9430SRaymond.Chen@Sun.COM  * Common Development and Distribution License (the "License").
6*9430SRaymond.Chen@Sun.COM  * You may not use this file except in compliance with the License.
7*9430SRaymond.Chen@Sun.COM  *
8*9430SRaymond.Chen@Sun.COM  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*9430SRaymond.Chen@Sun.COM  * or http://www.opensolaris.org/os/licensing.
10*9430SRaymond.Chen@Sun.COM  * See the License for the specific language governing permissions
11*9430SRaymond.Chen@Sun.COM  * and limitations under the License.
12*9430SRaymond.Chen@Sun.COM  *
13*9430SRaymond.Chen@Sun.COM  * When distributing Covered Code, include this CDDL HEADER in each
14*9430SRaymond.Chen@Sun.COM  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*9430SRaymond.Chen@Sun.COM  * If applicable, add the following below this CDDL HEADER, with the
16*9430SRaymond.Chen@Sun.COM  * fields enclosed by brackets "[]" replaced with your own identifying
17*9430SRaymond.Chen@Sun.COM  * information: Portions Copyright [yyyy] [name of copyright owner]
18*9430SRaymond.Chen@Sun.COM  *
19*9430SRaymond.Chen@Sun.COM  * CDDL HEADER END
20*9430SRaymond.Chen@Sun.COM  */
21*9430SRaymond.Chen@Sun.COM /*
22*9430SRaymond.Chen@Sun.COM  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
23*9430SRaymond.Chen@Sun.COM  * Use is subject to license terms.
24*9430SRaymond.Chen@Sun.COM  */
25*9430SRaymond.Chen@Sun.COM 
26*9430SRaymond.Chen@Sun.COM #ifndef _SYS_USB_HWARC_H
27*9430SRaymond.Chen@Sun.COM #define	_SYS_USB_HWARC_H
28*9430SRaymond.Chen@Sun.COM 
29*9430SRaymond.Chen@Sun.COM #ifdef	__cplusplus
30*9430SRaymond.Chen@Sun.COM extern "C" {
31*9430SRaymond.Chen@Sun.COM #endif
32*9430SRaymond.Chen@Sun.COM 
33*9430SRaymond.Chen@Sun.COM #include <sys/usb/usba/usbai_private.h>
34*9430SRaymond.Chen@Sun.COM #include <sys/uwb/uwbai.h>
35*9430SRaymond.Chen@Sun.COM 
36*9430SRaymond.Chen@Sun.COM /* Power Management support */
37*9430SRaymond.Chen@Sun.COM typedef struct hwarc_power {
38*9430SRaymond.Chen@Sun.COM 
39*9430SRaymond.Chen@Sun.COM 	void			*hrc_state;		/* Hwarc state */
40*9430SRaymond.Chen@Sun.COM 	uint8_t			hrc_pwr_states;		/* Hwarc power state */
41*9430SRaymond.Chen@Sun.COM 	int			hrc_pm_busy;		/* Hwarc busy counter */
42*9430SRaymond.Chen@Sun.COM 
43*9430SRaymond.Chen@Sun.COM 	uint8_t			hrc_pm_capabilities;	/* PM capabilities */
44*9430SRaymond.Chen@Sun.COM 	uint8_t			hrc_current_power; 	/* Hwarc power value */
45*9430SRaymond.Chen@Sun.COM 
46*9430SRaymond.Chen@Sun.COM 	uint8_t			hrc_wakeup_enabled;	/* Remote Wakeup */
47*9430SRaymond.Chen@Sun.COM } hwarc_power_t;
48*9430SRaymond.Chen@Sun.COM 
49*9430SRaymond.Chen@Sun.COM /* Hwarc State structure */
50*9430SRaymond.Chen@Sun.COM typedef struct hwarc_state {
51*9430SRaymond.Chen@Sun.COM 	dev_info_t		*hrc_dip;		/* Dip of Hwarc */
52*9430SRaymond.Chen@Sun.COM 
53*9430SRaymond.Chen@Sun.COM 	usb_client_dev_data_t	*hrc_reg;		/* Usb dev data */
54*9430SRaymond.Chen@Sun.COM 	usb_if_data_t		*hrc_if_descr;  	/* Interface descr */
55*9430SRaymond.Chen@Sun.COM 
56*9430SRaymond.Chen@Sun.COM 	usb_pipe_handle_t	hrc_default_ph; 	/* Default pipe */
57*9430SRaymond.Chen@Sun.COM 	usb_ep_descr_t		hrc_intr_ep_descr;	/* Inter ep descr */
58*9430SRaymond.Chen@Sun.COM 	usb_pipe_handle_t	hrc_intr_ph;		/* Inter pipe hdl */
59*9430SRaymond.Chen@Sun.COM 	char			*hrc_devinst;		/* Device instance */
60*9430SRaymond.Chen@Sun.COM 
61*9430SRaymond.Chen@Sun.COM 	int			hrc_dev_state; 		/* USB device state */
62*9430SRaymond.Chen@Sun.COM 	uint_t			hrc_open_count;
63*9430SRaymond.Chen@Sun.COM 
64*9430SRaymond.Chen@Sun.COM 	kmutex_t		hrc_mutex;		/* Global hwarc mutex */
65*9430SRaymond.Chen@Sun.COM 
66*9430SRaymond.Chen@Sun.COM 	kcondvar_t		hrc_serial_cv;		/* Serial access cond */
67*9430SRaymond.Chen@Sun.COM 	boolean_t		hrc_serial_inuse;	/* Serial access flag */
68*9430SRaymond.Chen@Sun.COM 
69*9430SRaymond.Chen@Sun.COM 
70*9430SRaymond.Chen@Sun.COM 	boolean_t		hrc_locks_initialized;  /* Init status flag */
71*9430SRaymond.Chen@Sun.COM 
72*9430SRaymond.Chen@Sun.COM 	hwarc_power_t		*hrc_pm; 		/* PM state of hwarc */
73*9430SRaymond.Chen@Sun.COM 
74*9430SRaymond.Chen@Sun.COM 	usb_log_handle_t	hrc_log_hdl; 		/* Hwarc log handle */
75*9430SRaymond.Chen@Sun.COM 	uwb_dev_handle_t	hrc_dev_hdl;		/* Uwb dev handle */
76*9430SRaymond.Chen@Sun.COM } hwarc_state_t;
77*9430SRaymond.Chen@Sun.COM 
78*9430SRaymond.Chen@Sun.COM _NOTE(MUTEX_PROTECTS_DATA(hwarc_state_t::hrc_mutex, hwarc_state_t))
79*9430SRaymond.Chen@Sun.COM _NOTE(DATA_READABLE_WITHOUT_LOCK(hwarc_state_t::{
80*9430SRaymond.Chen@Sun.COM 	hrc_dev_hdl
81*9430SRaymond.Chen@Sun.COM 	hrc_dev_state
82*9430SRaymond.Chen@Sun.COM 	hrc_intr_ep_descr
83*9430SRaymond.Chen@Sun.COM 	hrc_default_ph
84*9430SRaymond.Chen@Sun.COM 	hrc_reg
85*9430SRaymond.Chen@Sun.COM 	hrc_intr_ph
86*9430SRaymond.Chen@Sun.COM 	hrc_log_hdl
87*9430SRaymond.Chen@Sun.COM 	hrc_dip
88*9430SRaymond.Chen@Sun.COM 	hrc_if_descr
89*9430SRaymond.Chen@Sun.COM 
90*9430SRaymond.Chen@Sun.COM }))
91*9430SRaymond.Chen@Sun.COM 
92*9430SRaymond.Chen@Sun.COM 
93*9430SRaymond.Chen@Sun.COM #define	USB_DEV_DESCR_SIZE	18		/* Hwarc device descr size */
94*9430SRaymond.Chen@Sun.COM 
95*9430SRaymond.Chen@Sun.COM 
96*9430SRaymond.Chen@Sun.COM #define	HWA_EXEC_RC_CMD 	40 		/* UWB Radio cmd request code */
97*9430SRaymond.Chen@Sun.COM 
98*9430SRaymond.Chen@Sun.COM #define	HWARC_SER_NOSIG		B_FALSE		/* Hwarc serialization */
99*9430SRaymond.Chen@Sun.COM #define	HWARC_SER_SIG		B_TRUE
100*9430SRaymond.Chen@Sun.COM 
101*9430SRaymond.Chen@Sun.COM #define	HWARC_SET_IF		0x21		/* Hwarc bmRequestType */
102*9430SRaymond.Chen@Sun.COM #define	HWARC_GET_IF		0xA1
103*9430SRaymond.Chen@Sun.COM 
104*9430SRaymond.Chen@Sun.COM 
105*9430SRaymond.Chen@Sun.COM /* HWARC masks for debug printing */
106*9430SRaymond.Chen@Sun.COM #define	PRINT_MASK_ATTA		0x00000001
107*9430SRaymond.Chen@Sun.COM #define	PRINT_MASK_OPEN 	0x00000002
108*9430SRaymond.Chen@Sun.COM #define	PRINT_MASK_CLOSE	0x00000004
109*9430SRaymond.Chen@Sun.COM #define	PRINT_MASK_READ		0x00000008
110*9430SRaymond.Chen@Sun.COM #define	PRINT_MASK_IOCTL	0x00000010
111*9430SRaymond.Chen@Sun.COM #define	PRINT_MASK_PM		0x00000020
112*9430SRaymond.Chen@Sun.COM #define	PRINT_MASK_CB		0x00000040
113*9430SRaymond.Chen@Sun.COM #define	PRINT_MASK_HOTPLUG	0x00000080
114*9430SRaymond.Chen@Sun.COM #define	PRINT_MASK_DEVCTRL	0x00000100
115*9430SRaymond.Chen@Sun.COM #define	PRINT_MASK_DEVMAP	0x00000200
116*9430SRaymond.Chen@Sun.COM #define	PRINT_MASK_ALL		0xFFFFFFFF
117*9430SRaymond.Chen@Sun.COM 
118*9430SRaymond.Chen@Sun.COM #ifdef __cplusplus
119*9430SRaymond.Chen@Sun.COM }
120*9430SRaymond.Chen@Sun.COM #endif
121*9430SRaymond.Chen@Sun.COM 
122*9430SRaymond.Chen@Sun.COM #endif	/* _SYS_USB_HWARC_H */
123