1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate  *
4*7c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate  * with the License.
8*7c478bd9Sstevel@tonic-gate  *
9*7c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate  * and limitations under the License.
13*7c478bd9Sstevel@tonic-gate  *
14*7c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate  *
20*7c478bd9Sstevel@tonic-gate  * CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate  */
22*7c478bd9Sstevel@tonic-gate /*
23*7c478bd9Sstevel@tonic-gate  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24*7c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
25*7c478bd9Sstevel@tonic-gate  */
26*7c478bd9Sstevel@tonic-gate 
27*7c478bd9Sstevel@tonic-gate #ifndef	_SYS_USB_UHCITGT_H
28*7c478bd9Sstevel@tonic-gate #define	_SYS_USB_UHCITGT_H
29*7c478bd9Sstevel@tonic-gate 
30*7c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*7c478bd9Sstevel@tonic-gate 
32*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus
33*7c478bd9Sstevel@tonic-gate extern "C" {
34*7c478bd9Sstevel@tonic-gate #endif
35*7c478bd9Sstevel@tonic-gate 
36*7c478bd9Sstevel@tonic-gate /*
37*7c478bd9Sstevel@tonic-gate  * Universal Host Controller Driver (UHCI)
38*7c478bd9Sstevel@tonic-gate  *
39*7c478bd9Sstevel@tonic-gate  * Declarations, prototypes for talking to HCDI
40*7c478bd9Sstevel@tonic-gate  *
41*7c478bd9Sstevel@tonic-gate  *   Function prototypes
42*7c478bd9Sstevel@tonic-gate  */
43*7c478bd9Sstevel@tonic-gate int		uhci_hcdi_pipe_open(usba_pipe_handle_data_t *, usb_flags_t);
44*7c478bd9Sstevel@tonic-gate int		uhci_hcdi_pipe_close(usba_pipe_handle_data_t *, usb_flags_t);
45*7c478bd9Sstevel@tonic-gate int		uhci_hcdi_pipe_reset(usba_pipe_handle_data_t *, usb_flags_t);
46*7c478bd9Sstevel@tonic-gate int		uhci_hcdi_pipe_ctrl_xfer(usba_pipe_handle_data_t *,
47*7c478bd9Sstevel@tonic-gate 			usb_ctrl_req_t *, usb_flags_t);
48*7c478bd9Sstevel@tonic-gate int		uhci_hcdi_pipe_bulk_xfer(usba_pipe_handle_data_t *,
49*7c478bd9Sstevel@tonic-gate 			usb_bulk_req_t *, usb_flags_t);
50*7c478bd9Sstevel@tonic-gate int		uhci_hcdi_pipe_isoc_xfer(usba_pipe_handle_data_t *,
51*7c478bd9Sstevel@tonic-gate 			usb_isoc_req_t *, usb_flags_t);
52*7c478bd9Sstevel@tonic-gate int		uhci_hcdi_pipe_intr_xfer(usba_pipe_handle_data_t *,
53*7c478bd9Sstevel@tonic-gate 			usb_intr_req_t *, usb_flags_t);
54*7c478bd9Sstevel@tonic-gate int		uhci_hcdi_pipe_stop_intr_polling(usba_pipe_handle_data_t *,
55*7c478bd9Sstevel@tonic-gate 			usb_flags_t);
56*7c478bd9Sstevel@tonic-gate int		uhci_hcdi_pipe_stop_isoc_polling(usba_pipe_handle_data_t *,
57*7c478bd9Sstevel@tonic-gate 			usb_flags_t);
58*7c478bd9Sstevel@tonic-gate int		uhci_hcdi_bulk_transfer_size(usba_device_t *, size_t *);
59*7c478bd9Sstevel@tonic-gate usb_frame_number_t uhci_hcdi_get_current_frame_number(usba_device_t *);
60*7c478bd9Sstevel@tonic-gate uint_t		uhci_hcdi_get_max_isoc_pkts(usba_device_t *);
61*7c478bd9Sstevel@tonic-gate 
62*7c478bd9Sstevel@tonic-gate /*
63*7c478bd9Sstevel@tonic-gate  *  Shared function declarations
64*7c478bd9Sstevel@tonic-gate  */
65*7c478bd9Sstevel@tonic-gate queue_head_t	*uhci_alloc_queue_head(uhci_state_t *uhcip);
66*7c478bd9Sstevel@tonic-gate uhci_state_t	*uhci_obtain_state(dev_info_t *dip);
67*7c478bd9Sstevel@tonic-gate 
68*7c478bd9Sstevel@tonic-gate int		uhci_insert_ctrl_td(uhci_state_t *uhcip,
69*7c478bd9Sstevel@tonic-gate 			usba_pipe_handle_data_t	*pipe_handle,
70*7c478bd9Sstevel@tonic-gate 			usb_ctrl_req_t	*req,
71*7c478bd9Sstevel@tonic-gate 			usb_flags_t		flags);
72*7c478bd9Sstevel@tonic-gate int		uhci_insert_bulk_td(uhci_state_t *uhcip,
73*7c478bd9Sstevel@tonic-gate 			usba_pipe_handle_data_t	*pipe_handle,
74*7c478bd9Sstevel@tonic-gate 			usb_bulk_req_t		*req,
75*7c478bd9Sstevel@tonic-gate 			usb_flags_t		flags);
76*7c478bd9Sstevel@tonic-gate int		uhci_insert_intr_td(uhci_state_t *uhcip,
77*7c478bd9Sstevel@tonic-gate 			usba_pipe_handle_data_t	*pipe_handle,
78*7c478bd9Sstevel@tonic-gate 			usb_intr_req_t		*req,
79*7c478bd9Sstevel@tonic-gate 			usb_flags_t		flags);
80*7c478bd9Sstevel@tonic-gate int		uhci_insert_isoc_td(
81*7c478bd9Sstevel@tonic-gate 			uhci_state_t		*uhcip,
82*7c478bd9Sstevel@tonic-gate 			usba_pipe_handle_data_t	*ph,
83*7c478bd9Sstevel@tonic-gate 			usb_isoc_req_t		*isoc_req,
84*7c478bd9Sstevel@tonic-gate 			size_t			length,
85*7c478bd9Sstevel@tonic-gate 			usb_flags_t		usb_flags);
86*7c478bd9Sstevel@tonic-gate 
87*7c478bd9Sstevel@tonic-gate void		uhci_remove_qh(uhci_state_t *uhcip, uhci_pipe_private_t *pp);
88*7c478bd9Sstevel@tonic-gate void		uhci_insert_qh(uhci_state_t *uhcip,
89*7c478bd9Sstevel@tonic-gate 			usba_pipe_handle_data_t	*pipe_handle);
90*7c478bd9Sstevel@tonic-gate void		uhci_modify_td_active_bits(
91*7c478bd9Sstevel@tonic-gate 			uhci_state_t		*uhcip,
92*7c478bd9Sstevel@tonic-gate 			uhci_pipe_private_t	*pp);
93*7c478bd9Sstevel@tonic-gate 
94*7c478bd9Sstevel@tonic-gate int		uhci_allocate_bandwidth(uhci_state_t *uhcip,
95*7c478bd9Sstevel@tonic-gate 		    usba_pipe_handle_data_t *pipe_handle, uint_t *node);
96*7c478bd9Sstevel@tonic-gate void		uhci_deallocate_bandwidth(uhci_state_t *uhcip,
97*7c478bd9Sstevel@tonic-gate 		    usba_pipe_handle_data_t *pipe_handle);
98*7c478bd9Sstevel@tonic-gate void		uhci_remove_tds_tws(uhci_state_t *uhcip,
99*7c478bd9Sstevel@tonic-gate 		    usba_pipe_handle_data_t *ph);
100*7c478bd9Sstevel@tonic-gate void		uhci_remove_isoc_tds_tws(uhci_state_t *uhcip,
101*7c478bd9Sstevel@tonic-gate 		    uhci_pipe_private_t *ph);
102*7c478bd9Sstevel@tonic-gate int		uhci_start_isoc_receive_polling(
103*7c478bd9Sstevel@tonic-gate 			uhci_state_t		*uhcip,
104*7c478bd9Sstevel@tonic-gate 			usba_pipe_handle_data_t	*ph,
105*7c478bd9Sstevel@tonic-gate 			usb_isoc_req_t		*req,
106*7c478bd9Sstevel@tonic-gate 			usb_flags_t		usb_flags);
107*7c478bd9Sstevel@tonic-gate 
108*7c478bd9Sstevel@tonic-gate 
109*7c478bd9Sstevel@tonic-gate void		uhci_save_data_toggle(uhci_pipe_private_t *pp);
110*7c478bd9Sstevel@tonic-gate int		uhci_handle_root_hub_request(
111*7c478bd9Sstevel@tonic-gate 			uhci_state_t		*uhcip,
112*7c478bd9Sstevel@tonic-gate 			usba_pipe_handle_data_t  *pipe_handle,
113*7c478bd9Sstevel@tonic-gate 			usb_ctrl_req_t	*req);
114*7c478bd9Sstevel@tonic-gate 
115*7c478bd9Sstevel@tonic-gate void		uhci_remove_bulk_tds_tws(uhci_state_t *uhcip,
116*7c478bd9Sstevel@tonic-gate 			uhci_pipe_private_t *pp,
117*7c478bd9Sstevel@tonic-gate 			int what);
118*7c478bd9Sstevel@tonic-gate void		uhci_root_hub_reset_occurred(uhci_state_t *uhcip,
119*7c478bd9Sstevel@tonic-gate 			usb_port_t port);
120*7c478bd9Sstevel@tonic-gate int		uhci_root_hub_allocate_intr_pipe_resource(
121*7c478bd9Sstevel@tonic-gate 			uhci_state_t *uhcip,
122*7c478bd9Sstevel@tonic-gate 			usb_flags_t flags);
123*7c478bd9Sstevel@tonic-gate void		uhci_root_hub_intr_pipe_cleanup(uhci_state_t *uhcip,
124*7c478bd9Sstevel@tonic-gate 						usb_cr_t cr);
125*7c478bd9Sstevel@tonic-gate void		uhci_hcdi_callback(uhci_state_t *uhcip,
126*7c478bd9Sstevel@tonic-gate 			uhci_pipe_private_t *pp,
127*7c478bd9Sstevel@tonic-gate 			usba_pipe_handle_data_t *ph,
128*7c478bd9Sstevel@tonic-gate 			uhci_trans_wrapper_t *tw,
129*7c478bd9Sstevel@tonic-gate 			usb_cr_t cr);
130*7c478bd9Sstevel@tonic-gate int		uhci_allocate_periodic_in_resource(uhci_state_t *uhcip,
131*7c478bd9Sstevel@tonic-gate 			uhci_pipe_private_t *pp,
132*7c478bd9Sstevel@tonic-gate 			uhci_trans_wrapper_t *tw, usb_flags_t flags);
133*7c478bd9Sstevel@tonic-gate 
134*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus
135*7c478bd9Sstevel@tonic-gate }
136*7c478bd9Sstevel@tonic-gate #endif
137*7c478bd9Sstevel@tonic-gate 
138*7c478bd9Sstevel@tonic-gate #endif /* _SYS_USB_UHCITGT_H */
139