xref: /illumos-gate/usr/src/uts/common/sys/usb/usba/hcdi_impl.h (revision bc1f688b4872ace323eaddbb1a6365d054e7bf56)
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 2008 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef	_SYS_USB_HCDI_IMPL_H
27 #define	_SYS_USB_HCDI_IMPL_H
28 
29 
30 #ifdef	__cplusplus
31 extern "C" {
32 #endif
33 
34 /*
35  * Per HCD Data Structures
36  */
37 typedef  struct usba_hcdi {
38 	dev_info_t		*hcdi_dip;	/* ptr to devinfo struct */
39 
40 	ddi_dma_attr_t		*hcdi_dma_attr;
41 
42 	/*
43 	 * list of HCD operations
44 	 */
45 	struct usba_hcdi_ops	*hcdi_ops;
46 
47 	int			hcdi_flags;	    /* flag options */
48 
49 	/* soft interrupt support */
50 	ddi_softint_handle_t	hcdi_softint_hdl;	/* soft intr handle */
51 	usba_list_entry_t	hcdi_cb_queue;
52 
53 	/*
54 	 * min xfer and min/max burstsizes for DDI_CTLOPS_IOMIN
55 	 */
56 	uint_t			hcdi_min_xfer;
57 	uchar_t			hcdi_min_burst_size;
58 	uchar_t			hcdi_max_burst_size;
59 
60 	/*
61 	 * usba_device ptr for root hub
62 	 */
63 	usba_device_t		*hcdi_usba_device;
64 
65 	/*
66 	 * usb bus address allocation
67 	 */
68 	char		hcdi_usb_address_in_use[USBA_ADDRESS_ARRAY_SIZE];
69 
70 	usb_log_handle_t	hcdi_log_handle;
71 
72 	kmutex_t		hcdi_mutex;
73 	ddi_iblock_cookie_t	hcdi_iblock_cookie;
74 	ddi_iblock_cookie_t	hcdi_soft_iblock_cookie;
75 
76 	/*
77 	 * Hotplug event statistics since hcdi loaded.
78 	 */
79 	ulong_t			hcdi_total_hotplug_success;
80 	ulong_t			hcdi_total_hotplug_failure;
81 
82 	/*
83 	 * Resetable hotplug event statistics.
84 	 */
85 	ulong_t			hcdi_hotplug_success;
86 	ulong_t			hcdi_hotplug_failure;
87 
88 	/*
89 	 * Total number of devices currently enumerated.
90 	 */
91 	uchar_t			hcdi_device_count;
92 
93 	/*
94 	 * kstat structures
95 	 */
96 	kstat_t			*hcdi_hotplug_stats;
97 	kstat_t			*hcdi_error_stats;
98 
99 	/*
100 	 * ugen default binding
101 	 */
102 	uint_t			hcdi_ugen_default_binding;
103 } usba_hcdi_t;
104 
105 _NOTE(MUTEX_PROTECTS_DATA(usba_hcdi::hcdi_mutex,
106 				usba_hcdi::hcdi_usb_address_in_use))
107 _NOTE(DATA_READABLE_WITHOUT_LOCK(usba_hcdi_t::hcdi_usba_device))
108 _NOTE(DATA_READABLE_WITHOUT_LOCK(usba_hcdi_t::hcdi_ugen_default_binding))
109 
110 
111 /*
112  * retrieving the hcdi structure from dip
113  */
114 void usba_hcdi_set_hcdi(dev_info_t *dip, usba_hcdi_t *hcdi);
115 usba_hcdi_t *usba_hcdi_get_hcdi(dev_info_t *dip);
116 
117 /* initialize/destroy HCDI info */
118 void usba_hcdi_initialization();
119 void usba_hcdi_destroy();
120 
121 #ifdef __cplusplus
122 }
123 #endif
124 
125 #endif	/* _SYS_USB_HCDI_IMPL_H */
126