ehci_util.h revision 7492:2387323b838f
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
31extern "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 */
49extern void	ehci_set_dma_attributes(ehci_state_t	*ehcip);
50extern int	ehci_allocate_pools(ehci_state_t	*ehcip);
51extern void	ehci_decode_ddi_dma_addr_bind_handle_result(
52				ehci_state_t		*ehcip,
53				int			result);
54extern int	ehci_map_regs(ehci_state_t		*ehcip);
55extern int	ehci_register_intrs_and_init_mutex(
56				ehci_state_t		*ehcip);
57extern int	ehci_init_ctlr(ehci_state_t		*ehcip,
58				int			init_type);
59extern usba_hcdi_ops_t	*ehci_alloc_hcdi_ops(
60				ehci_state_t		*ehcip);
61
62/*
63 * EHCI driver deinitialization function prototypes.
64 */
65extern int	ehci_cleanup(ehci_state_t		*ehcip);
66extern int	ehci_cpr_suspend(ehci_state_t		*ehcip);
67extern int	ehci_cpr_resume(ehci_state_t		*ehcip);
68
69/*
70 * EHCI driver Bandwidth Allocation function prototypes.
71 */
72extern 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);
77extern 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);
82extern 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 */
90extern ehci_state_t	*ehci_obtain_state(
91				dev_info_t		*dip);
92extern int	ehci_state_is_operational(
93				ehci_state_t		*ehcip);
94extern int	ehci_do_soft_reset(
95				ehci_state_t		*ehcip);
96extern usb_req_attrs_t ehci_get_xfer_attrs(ehci_state_t	*ehcip,
97				ehci_pipe_private_t	*pp,
98				ehci_trans_wrapper_t	*tw);
99extern usb_frame_number_t ehci_get_current_frame_number(
100				ehci_state_t		*ehcip);
101extern int	ehci_wait_for_sof(
102				ehci_state_t		*ehcip);
103extern void	ehci_toggle_scheduler(
104				ehci_state_t		*ehcip);
105
106extern void	ehci_print_caps(ehci_state_t 		*ehcip);
107extern void	ehci_print_regs(ehci_state_t 		*ehcip);
108extern void	ehci_print_qh(ehci_state_t		*ehcip,
109				ehci_qh_t		*qh);
110extern void	ehci_print_qtd(ehci_state_t		*ehcip,
111				ehci_qtd_t		*qtd);
112extern void	ehci_create_stats(ehci_state_t		*ehcip);
113extern void	ehci_destroy_stats(ehci_state_t		*ehcip);
114extern void	ehci_do_intrs_stats(ehci_state_t	*ehcip,
115				int		val);
116extern 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