ehci_xfer.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_XFER_H
27#define	_SYS_USB_EHCI_XFER_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 data structures and function prototypes
42 * required for the EHCI Driver to perform different USB transfers.
43 */
44
45/* EHCI Queue Head (QH) related functions */
46extern ehci_qh_t *ehci_alloc_qh(
47				ehci_state_t		*ehcip,
48				usba_pipe_handle_data_t	*ph,
49				uint_t			flag);
50extern void	ehci_insert_qh(
51				ehci_state_t		*ehcip,
52				usba_pipe_handle_data_t	*ph);
53extern void	ehci_remove_qh(
54				ehci_state_t		*ehcip,
55				ehci_pipe_private_t	*pp,
56				boolean_t		reclaim);
57extern void	ehci_deallocate_qh(
58				ehci_state_t		*ehcip,
59				ehci_qh_t		*old_qh);
60extern uint32_t	ehci_qh_cpu_to_iommu(
61				ehci_state_t		*ehcip,
62				ehci_qh_t		*addr);
63extern ehci_qh_t *ehci_qh_iommu_to_cpu(
64				ehci_state_t		*ehcip,
65				uintptr_t		addr);
66
67/* EHCI Queue Element Transfer Descriptor (QTD) related functions */
68extern ehci_trans_wrapper_t *ehci_allocate_ctrl_resources(
69				ehci_state_t		*ehcip,
70				ehci_pipe_private_t	*pp,
71				usb_ctrl_req_t		*ctrl_reqp,
72				usb_flags_t		usb_flags);
73extern void	ehci_insert_ctrl_req(
74				ehci_state_t		*ehcip,
75				usba_pipe_handle_data_t	*ph,
76				usb_ctrl_req_t		*ctrl_reqp,
77				ehci_trans_wrapper_t	*tw,
78				usb_flags_t		usb_flags);
79extern ehci_trans_wrapper_t *ehci_allocate_bulk_resources(
80				ehci_state_t		*ehcip,
81				ehci_pipe_private_t	*pp,
82				usb_bulk_req_t		*bulk_reqp,
83				usb_flags_t		usb_flags);
84extern void	ehci_insert_bulk_req(
85				ehci_state_t		*ehcip,
86				usba_pipe_handle_data_t	*ph,
87				usb_bulk_req_t		*bulk_reqp,
88				ehci_trans_wrapper_t	*tw,
89				usb_flags_t		flags);
90extern int	ehci_start_periodic_pipe_polling(
91				ehci_state_t		*ehcip,
92				usba_pipe_handle_data_t	*ph,
93				usb_opaque_t		periodic_in_reqp,
94				usb_flags_t		flags);
95extern ehci_trans_wrapper_t *ehci_allocate_intr_resources(
96				ehci_state_t		*ehcip,
97				usba_pipe_handle_data_t	*ph,
98				usb_intr_req_t		*intr_reqp,
99				usb_flags_t		usb_flags);
100extern void	ehci_insert_intr_req(
101				ehci_state_t		*ehcip,
102				ehci_pipe_private_t	*pp,
103				ehci_trans_wrapper_t	*tw,
104				usb_flags_t		flags);
105extern int	ehci_stop_periodic_pipe_polling(
106				ehci_state_t		*ehcip,
107				usba_pipe_handle_data_t	*ph,
108				usb_flags_t		flags);
109extern int	ehci_insert_qtd(
110				ehci_state_t		*ehcip,
111				uint32_t		qtd_ctrl,
112				size_t			qtd_dma_offs,
113				size_t			qtd_length,
114				uint32_t		qtd_flag,
115				ehci_pipe_private_t	*pp,
116				ehci_trans_wrapper_t	*tw);
117extern void	ehci_remove_qtd_from_active_qtd_list(
118				ehci_state_t		*ehcip,
119				ehci_qtd_t		*curr_qtd);
120extern void	ehci_deallocate_qtd(
121				ehci_state_t		*ehcip,
122				ehci_qtd_t		*old_qtd);
123extern uint32_t	ehci_qtd_cpu_to_iommu(
124				ehci_state_t		*ehcip,
125				ehci_qtd_t		*addr);
126extern ehci_qtd_t *ehci_qtd_iommu_to_cpu(
127				ehci_state_t		*ehcip,
128				uintptr_t		addr);
129
130/* Transfer Wrapper (TW) functions */
131extern int	ehci_allocate_tds_for_tw(
132				ehci_state_t		*ehcip,
133				ehci_pipe_private_t	*pp,
134				ehci_trans_wrapper_t	*tw,
135				size_t			qtd_count);
136extern void	ehci_stop_xfer_timer(
137				ehci_state_t		*ehcip,
138				ehci_trans_wrapper_t	*tw,
139				uint_t			flag);
140extern void	ehci_deallocate_tw(
141				ehci_state_t		*ehcip,
142				ehci_pipe_private_t	*pp,
143				ehci_trans_wrapper_t	*tw);
144extern void	ehci_free_dma_resources(
145				ehci_state_t		*ehcip,
146				usba_pipe_handle_data_t	*ph);
147
148/* Miscillaneous functions */
149extern int	ehci_allocate_intr_in_resource(
150				ehci_state_t		*ehcip,
151				ehci_pipe_private_t	*pp,
152				ehci_trans_wrapper_t	*tw,
153				usb_flags_t		flags);
154extern void	ehci_deallocate_intr_in_resource(
155				ehci_state_t		*ehcip,
156				ehci_pipe_private_t	*pp,
157				ehci_trans_wrapper_t	*tw);
158extern void	ehci_pipe_cleanup(
159				ehci_state_t		*ehcip,
160				usba_pipe_handle_data_t	*ph);
161extern void	ehci_check_for_transfers_completion(
162				ehci_state_t		*ehcip,
163				ehci_pipe_private_t	*pp);
164extern void	ehci_restore_data_toggle(
165				ehci_state_t		*ehcip,
166				usba_pipe_handle_data_t	*ph);
167extern void	ehci_handle_outstanding_requests(
168				ehci_state_t		*ehcip,
169				ehci_pipe_private_t	*pp);
170extern void	ehci_do_client_periodic_in_req_callback(
171				ehci_state_t		*ehcip,
172				ehci_pipe_private_t	*pp,
173				usb_cr_t		completion_reason);
174extern void	ehci_hcdi_callback(
175				usba_pipe_handle_data_t	*ph,
176				ehci_trans_wrapper_t	*tw,
177				usb_cr_t		completion_reason);
178extern void	ehci_handle_clear_tt_buffer(
179				ehci_state_t		*ehcip,
180				ehci_pipe_private_t	*pp,
181				ehci_trans_wrapper_t	*tw,
182				ehci_qtd_t		*qtd,
183				void			*);
184extern void	ehci_handle_clear_tt_buffer_error(
185				ehci_state_t		*ehcip,
186				ehci_pipe_private_t	*hub_pp,
187				ehci_trans_wrapper_t	*tw,
188				ehci_qtd_t		*qtd,
189				void			*,
190				usb_cr_t		error);
191#ifdef __cplusplus
192}
193#endif
194
195#endif /* _SYS_USB_EHCI_XFER_H */
196