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