xref: /illumos-gate/usr/src/uts/common/sys/usb/usba/hcdi_impl.h (revision 948f2876ce2a3010558f4f6937e16086ebcd36f2)
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, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_SYS_USB_HCDI_IMPL_H
28 #define	_SYS_USB_HCDI_IMPL_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 /*
37  * Per HCD Data Structures
38  */
39 typedef  struct usba_hcdi {
40 	dev_info_t		*hcdi_dip;	/* ptr to devinfo struct */
41 
42 	ddi_dma_attr_t		*hcdi_dma_attr;
43 
44 	/*
45 	 * list of HCD operations
46 	 */
47 	struct usba_hcdi_ops	*hcdi_ops;
48 
49 	int			hcdi_flags;	    /* flag options */
50 
51 	/* soft interrupt support */
52 	ddi_softint_handle_t	hcdi_softint_hdl;	/* soft intr handle */
53 	usba_list_entry_t	hcdi_cb_queue;
54 
55 	/*
56 	 * min xfer and min/max burstsizes for DDI_CTLOPS_IOMIN
57 	 */
58 	uint_t			hcdi_min_xfer;
59 	uchar_t			hcdi_min_burst_size;
60 	uchar_t			hcdi_max_burst_size;
61 
62 	/*
63 	 * usba_device ptr for root hub
64 	 */
65 	usba_device_t		*hcdi_usba_device;
66 
67 	/*
68 	 * usb bus address allocation
69 	 */
70 	char		hcdi_usb_address_in_use[USBA_ADDRESS_ARRAY_SIZE];
71 
72 	usb_log_handle_t	hcdi_log_handle;
73 
74 	kmutex_t		hcdi_mutex;
75 	ddi_iblock_cookie_t	hcdi_iblock_cookie;
76 	ddi_iblock_cookie_t	hcdi_soft_iblock_cookie;
77 
78 	/*
79 	 * Hotplug event statistics since hcdi loaded.
80 	 */
81 	ulong_t			hcdi_total_hotplug_success;
82 	ulong_t			hcdi_total_hotplug_failure;
83 
84 	/*
85 	 * Resetable hotplug event statistics.
86 	 */
87 	ulong_t			hcdi_hotplug_success;
88 	ulong_t			hcdi_hotplug_failure;
89 
90 	/*
91 	 * Total number of devices currently enumerated.
92 	 */
93 	uchar_t			hcdi_device_count;
94 
95 	/*
96 	 * kstat structures
97 	 */
98 	kstat_t			*hcdi_hotplug_stats;
99 	kstat_t			*hcdi_error_stats;
100 
101 	/*
102 	 * ugen default binding
103 	 */
104 	uint_t			hcdi_ugen_default_binding;
105 } usba_hcdi_t;
106 
107 _NOTE(MUTEX_PROTECTS_DATA(usba_hcdi::hcdi_mutex,
108 				usba_hcdi::hcdi_usb_address_in_use))
109 _NOTE(DATA_READABLE_WITHOUT_LOCK(usba_hcdi_t::hcdi_usba_device))
110 _NOTE(DATA_READABLE_WITHOUT_LOCK(usba_hcdi_t::hcdi_ugen_default_binding))
111 
112 
113 /*
114  * retrieving the hcdi structure from dip
115  */
116 void usba_hcdi_set_hcdi(dev_info_t *dip, usba_hcdi_t *hcdi);
117 usba_hcdi_t *usba_hcdi_get_hcdi(dev_info_t *dip);
118 
119 /* initialize/destroy HCDI info */
120 void usba_hcdi_initialization();
121 void usba_hcdi_destroy();
122 
123 #ifdef __cplusplus
124 }
125 #endif
126 
127 #endif	/* _SYS_USB_HCDI_IMPL_H */
128