xref: /titanic_41/usr/src/uts/common/sys/usb/hcd/ehci/ehci_util.h (revision 6a634c9dca3093f3922e4b7ab826d7bdf17bf78e)
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 (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
23  */
24 
25 #ifndef _SYS_USB_EHCI_UTIL_H
26 #define	_SYS_USB_EHCI_UTIL_H
27 
28 
29 #ifdef	__cplusplus
30 extern "C" {
31 #endif
32 
33 /*
34  * Enchanced Host Controller Driver (EHCI)
35  *
36  * The EHCI driver is a software driver which interfaces to the Universal
37  * Serial Bus layer (USBA) and the Host Controller (HC). The interface to
38  * the Host Controller is defined by the EHCI Host Controller Interface.
39  *
40  * This header file describes the EHCI driver data structures and function
41  * prototypes for the EHCI Host Controller initilization/deintilization,
42  * Bandwidth Allocation and other miscellaneous functionalities.
43  */
44 
45 /*
46  * EHCI driver initialization function prototypes.
47  */
48 extern void	ehci_set_dma_attributes(ehci_state_t	*ehcip);
49 extern int	ehci_allocate_pools(ehci_state_t	*ehcip);
50 extern void	ehci_decode_ddi_dma_addr_bind_handle_result(
51 				ehci_state_t		*ehcip,
52 				int			result);
53 extern int	ehci_map_regs(ehci_state_t		*ehcip);
54 extern int	ehci_register_intrs_and_init_mutex(
55 				ehci_state_t		*ehcip);
56 extern int	ehci_init_ctlr(ehci_state_t		*ehcip,
57 				int			init_type);
58 extern usba_hcdi_ops_t	*ehci_alloc_hcdi_ops(
59 				ehci_state_t		*ehcip);
60 
61 /*
62  * EHCI driver deinitialization function prototypes.
63  */
64 extern int	ehci_cleanup(ehci_state_t		*ehcip);
65 extern int	ehci_cpr_suspend(ehci_state_t		*ehcip);
66 extern int	ehci_cpr_resume(ehci_state_t		*ehcip);
67 
68 /*
69  * EHCI driver Bandwidth Allocation function prototypes.
70  */
71 extern int	ehci_allocate_bandwidth(ehci_state_t	*ehcip,
72 				usba_pipe_handle_data_t	*ph,
73 				uint_t			*pnode,
74 				uchar_t			*smask,
75 				uchar_t			*cmask);
76 extern void	ehci_deallocate_bandwidth(ehci_state_t	*ehcip,
77 				usba_pipe_handle_data_t	*ph,
78 				uint_t			pnode,
79 				uchar_t			smask,
80 				uchar_t			cmask);
81 extern int	ehci_adjust_polling_interval(
82 				ehci_state_t		*ehcip,
83 				usb_ep_descr_t		*endpoint,
84 				usb_port_status_t	port_status);
85 
86 /*
87  * EHCI driver miscellaneous function prototypes.
88  */
89 extern ehci_state_t	*ehci_obtain_state(
90 				dev_info_t		*dip);
91 extern int	ehci_state_is_operational(
92 				ehci_state_t		*ehcip);
93 extern int	ehci_do_soft_reset(
94 				ehci_state_t		*ehcip);
95 extern usb_req_attrs_t ehci_get_xfer_attrs(ehci_state_t	*ehcip,
96 				ehci_pipe_private_t	*pp,
97 				ehci_trans_wrapper_t	*tw);
98 extern usb_frame_number_t ehci_get_current_frame_number(
99 				ehci_state_t		*ehcip);
100 extern int	ehci_wait_for_sof(
101 				ehci_state_t		*ehcip);
102 extern void	ehci_toggle_scheduler(
103 				ehci_state_t		*ehcip);
104 extern void	ehci_toggle_scheduler_on_pipe(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