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 2004 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _SYS_USB_EHCI_UTIL_H
28 #define	_SYS_USB_EHCI_UTIL_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 /*
37  * Enchanced Host Controller Driver (EHCI)
38  *
39  * The EHCI driver is a software driver which interfaces to the Universal
40  * Serial Bus layer (USBA) and the Host Controller (HC). The interface to
41  * the Host Controller is defined by the EHCI Host Controller Interface.
42  *
43  * This header file describes the EHCI driver data structures and function
44  * prototypes for the EHCI Host Controller initilization/deintilization,
45  * Bandwidth Allocation and other miscellaneous functionalities.
46  */
47 
48 /*
49  * EHCI driver initialization function prototypes.
50  */
51 extern void	ehci_set_dma_attributes(ehci_state_t	*ehcip);
52 extern int	ehci_allocate_pools(ehci_state_t	*ehcip);
53 extern void	ehci_decode_ddi_dma_addr_bind_handle_result(
54 				ehci_state_t		*ehcip,
55 				int			result);
56 extern int	ehci_map_regs(ehci_state_t		*ehcip);
57 extern int	ehci_register_intrs_and_init_mutex(
58 				ehci_state_t		*ehcip);
59 extern int	ehci_init_ctlr(ehci_state_t		*ehcip);
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