xref: /illumos-gate/usr/src/uts/common/sys/usb/hcd/ehci/ehci_util.h (revision dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9)
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_EHCI_UTIL_H
27 #define	_SYS_USB_EHCI_UTIL_H
28 
29 
30 #ifdef	__cplusplus
31 extern "C" {
32 #endif
33 
34 /*
35  * Enchanced Host Controller Driver (EHCI)
36  *
37  * The EHCI driver is a software driver which interfaces to the Universal
38  * Serial Bus layer (USBA) and the Host Controller (HC). The interface to
39  * the Host Controller is defined by the EHCI Host Controller Interface.
40  *
41  * This header file describes the EHCI driver data structures and function
42  * prototypes for the EHCI Host Controller initilization/deintilization,
43  * Bandwidth Allocation and other miscellaneous functionalities.
44  */
45 
46 /*
47  * EHCI driver initialization function prototypes.
48  */
49 extern void	ehci_set_dma_attributes(ehci_state_t	*ehcip);
50 extern int	ehci_allocate_pools(ehci_state_t	*ehcip);
51 extern void	ehci_decode_ddi_dma_addr_bind_handle_result(
52 				ehci_state_t		*ehcip,
53 				int			result);
54 extern int	ehci_map_regs(ehci_state_t		*ehcip);
55 extern int	ehci_register_intrs_and_init_mutex(
56 				ehci_state_t		*ehcip);
57 extern int	ehci_init_ctlr(ehci_state_t		*ehcip,
58 				int			init_type);
59 extern usba_hcdi_ops_t	*ehci_alloc_hcdi_ops(
60 				ehci_state_t		*ehcip);
61 
62 /*
63  * EHCI driver deinitialization function prototypes.
64  */
65 extern int	ehci_cleanup(ehci_state_t		*ehcip);
66 extern int	ehci_cpr_suspend(ehci_state_t		*ehcip);
67 extern int	ehci_cpr_resume(ehci_state_t		*ehcip);
68 
69 /*
70  * EHCI driver Bandwidth Allocation function prototypes.
71  */
72 extern int	ehci_allocate_bandwidth(ehci_state_t	*ehcip,
73 				usba_pipe_handle_data_t	*ph,
74 				uint_t			*pnode,
75 				uchar_t			*smask,
76 				uchar_t			*cmask);
77 extern void	ehci_deallocate_bandwidth(ehci_state_t	*ehcip,
78 				usba_pipe_handle_data_t	*ph,
79 				uint_t			pnode,
80 				uchar_t			smask,
81 				uchar_t			cmask);
82 extern int	ehci_adjust_polling_interval(
83 				ehci_state_t		*ehcip,
84 				usb_ep_descr_t		*endpoint,
85 				usb_port_status_t	port_status);
86 
87 /*
88  * EHCI driver miscellaneous function prototypes.
89  */
90 extern ehci_state_t	*ehci_obtain_state(
91 				dev_info_t		*dip);
92 extern int	ehci_state_is_operational(
93 				ehci_state_t		*ehcip);
94 extern int	ehci_do_soft_reset(
95 				ehci_state_t		*ehcip);
96 extern usb_req_attrs_t ehci_get_xfer_attrs(ehci_state_t	*ehcip,
97 				ehci_pipe_private_t	*pp,
98 				ehci_trans_wrapper_t	*tw);
99 extern usb_frame_number_t ehci_get_current_frame_number(
100 				ehci_state_t		*ehcip);
101 extern int	ehci_wait_for_sof(
102 				ehci_state_t		*ehcip);
103 extern void	ehci_toggle_scheduler(
104 				ehci_state_t		*ehcip);
105 
106 extern void	ehci_print_caps(ehci_state_t 		*ehcip);
107 extern void	ehci_print_regs(ehci_state_t 		*ehcip);
108 extern void	ehci_print_qh(ehci_state_t		*ehcip,
109 				ehci_qh_t		*qh);
110 extern void	ehci_print_qtd(ehci_state_t		*ehcip,
111 				ehci_qtd_t		*qtd);
112 extern void	ehci_create_stats(ehci_state_t		*ehcip);
113 extern void	ehci_destroy_stats(ehci_state_t		*ehcip);
114 extern void	ehci_do_intrs_stats(ehci_state_t	*ehcip,
115 				int		val);
116 extern void	ehci_do_byte_stats(ehci_state_t		*ehcip,
117 				size_t		len,
118 				uint8_t		attr,
119 				uint8_t		addr);
120 
121 #ifdef __cplusplus
122 }
123 #endif
124 
125 #endif /* _SYS_USB_EHCI_UTIL_H */
126