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