1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
|
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_USB_EHCI_XFER_H
#define _SYS_USB_EHCI_XFER_H
#ifdef __cplusplus
extern "C" {
#endif
/*
* Enchanced Host Controller Driver (EHCI)
*
* The EHCI driver is a software driver which interfaces to the Universal
* Serial Bus layer (USBA) and the Host Controller (HC). The interface to
* the Host Controller is defined by the EHCI Host Controller Interface.
*
* This header file describes the data structures and function prototypes
* required for the EHCI Driver to perform different USB transfers.
*/
/* EHCI Queue Head (QH) related functions */
extern ehci_qh_t *ehci_alloc_qh(
ehci_state_t *ehcip,
usba_pipe_handle_data_t *ph,
uint_t flag);
extern void ehci_insert_qh(
ehci_state_t *ehcip,
usba_pipe_handle_data_t *ph);
extern void ehci_remove_qh(
ehci_state_t *ehcip,
ehci_pipe_private_t *pp,
boolean_t reclaim);
extern void ehci_deallocate_qh(
ehci_state_t *ehcip,
ehci_qh_t *old_qh);
extern uint32_t ehci_qh_cpu_to_iommu(
ehci_state_t *ehcip,
ehci_qh_t *addr);
extern ehci_qh_t *ehci_qh_iommu_to_cpu(
ehci_state_t *ehcip,
uintptr_t addr);
/* EHCI Queue Element Transfer Descriptor (QTD) related functions */
extern ehci_trans_wrapper_t *ehci_allocate_ctrl_resources(
ehci_state_t *ehcip,
ehci_pipe_private_t *pp,
usb_ctrl_req_t *ctrl_reqp,
usb_flags_t usb_flags);
extern void ehci_insert_ctrl_req(
ehci_state_t *ehcip,
usba_pipe_handle_data_t *ph,
usb_ctrl_req_t *ctrl_reqp,
ehci_trans_wrapper_t *tw,
usb_flags_t usb_flags);
extern ehci_trans_wrapper_t *ehci_allocate_bulk_resources(
ehci_state_t *ehcip,
ehci_pipe_private_t *pp,
usb_bulk_req_t *bulk_reqp,
usb_flags_t usb_flags);
extern void ehci_insert_bulk_req(
ehci_state_t *ehcip,
usba_pipe_handle_data_t *ph,
usb_bulk_req_t *bulk_reqp,
ehci_trans_wrapper_t *tw,
usb_flags_t flags);
extern int ehci_start_periodic_pipe_polling(
ehci_state_t *ehcip,
usba_pipe_handle_data_t *ph,
usb_opaque_t periodic_in_reqp,
usb_flags_t flags);
extern ehci_trans_wrapper_t *ehci_allocate_intr_resources(
ehci_state_t *ehcip,
usba_pipe_handle_data_t *ph,
usb_intr_req_t *intr_reqp,
usb_flags_t usb_flags);
extern void ehci_insert_intr_req(
ehci_state_t *ehcip,
ehci_pipe_private_t *pp,
ehci_trans_wrapper_t *tw,
usb_flags_t flags);
extern int ehci_stop_periodic_pipe_polling(
ehci_state_t *ehcip,
usba_pipe_handle_data_t *ph,
usb_flags_t flags);
extern int ehci_insert_qtd(
ehci_state_t *ehcip,
uint32_t qtd_ctrl,
size_t qtd_dma_offs,
size_t qtd_length,
uint32_t qtd_flag,
ehci_pipe_private_t *pp,
ehci_trans_wrapper_t *tw);
extern void ehci_remove_qtd_from_active_qtd_list(
ehci_state_t *ehcip,
ehci_qtd_t *curr_qtd);
extern void ehci_deallocate_qtd(
ehci_state_t *ehcip,
ehci_qtd_t *old_qtd);
extern uint32_t ehci_qtd_cpu_to_iommu(
ehci_state_t *ehcip,
ehci_qtd_t *addr);
extern ehci_qtd_t *ehci_qtd_iommu_to_cpu(
ehci_state_t *ehcip,
uintptr_t addr);
/* Transfer Wrapper (TW) functions */
extern int ehci_allocate_tds_for_tw(
ehci_state_t *ehcip,
ehci_pipe_private_t *pp,
ehci_trans_wrapper_t *tw,
size_t qtd_count);
extern void ehci_stop_xfer_timer(
ehci_state_t *ehcip,
ehci_trans_wrapper_t *tw,
uint_t flag);
extern void ehci_deallocate_tw(
ehci_state_t *ehcip,
ehci_pipe_private_t *pp,
ehci_trans_wrapper_t *tw);
extern void ehci_free_dma_resources(
ehci_state_t *ehcip,
usba_pipe_handle_data_t *ph);
/* Miscillaneous functions */
extern int ehci_allocate_intr_in_resource(
ehci_state_t *ehcip,
ehci_pipe_private_t *pp,
ehci_trans_wrapper_t *tw,
usb_flags_t flags);
extern void ehci_deallocate_intr_in_resource(
ehci_state_t *ehcip,
ehci_pipe_private_t *pp,
ehci_trans_wrapper_t *tw);
extern void ehci_pipe_cleanup(
ehci_state_t *ehcip,
usba_pipe_handle_data_t *ph);
extern void ehci_check_for_transfers_completion(
ehci_state_t *ehcip,
ehci_pipe_private_t *pp);
extern void ehci_restore_data_toggle(
ehci_state_t *ehcip,
usba_pipe_handle_data_t *ph);
extern void ehci_handle_outstanding_requests(
ehci_state_t *ehcip,
ehci_pipe_private_t *pp);
extern void ehci_do_client_periodic_in_req_callback(
ehci_state_t *ehcip,
ehci_pipe_private_t *pp,
usb_cr_t completion_reason);
extern void ehci_hcdi_callback(
usba_pipe_handle_data_t *ph,
ehci_trans_wrapper_t *tw,
usb_cr_t completion_reason);
extern void ehci_handle_clear_tt_buffer(
ehci_state_t *ehcip,
ehci_pipe_private_t *pp,
ehci_trans_wrapper_t *tw,
ehci_qtd_t *qtd,
void *);
extern void ehci_handle_clear_tt_buffer_error(
ehci_state_t *ehcip,
ehci_pipe_private_t *hub_pp,
ehci_trans_wrapper_t *tw,
ehci_qtd_t *qtd,
void *,
usb_cr_t error);
#ifdef __cplusplus
}
#endif
#endif /* _SYS_USB_EHCI_XFER_H */
|