17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*3b00f311Syq  * Common Development and Distribution License (the "License").
6*3b00f311Syq  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
22*3b00f311Syq  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
247c478bd9Sstevel@tonic-gate  */
257c478bd9Sstevel@tonic-gate 
267c478bd9Sstevel@tonic-gate #ifndef _SYS_USB_EHCI_UTIL_H
277c478bd9Sstevel@tonic-gate #define	_SYS_USB_EHCI_UTIL_H
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
307c478bd9Sstevel@tonic-gate 
317c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
327c478bd9Sstevel@tonic-gate extern "C" {
337c478bd9Sstevel@tonic-gate #endif
347c478bd9Sstevel@tonic-gate 
357c478bd9Sstevel@tonic-gate /*
367c478bd9Sstevel@tonic-gate  * Enchanced Host Controller Driver (EHCI)
377c478bd9Sstevel@tonic-gate  *
387c478bd9Sstevel@tonic-gate  * The EHCI driver is a software driver which interfaces to the Universal
397c478bd9Sstevel@tonic-gate  * Serial Bus layer (USBA) and the Host Controller (HC). The interface to
407c478bd9Sstevel@tonic-gate  * the Host Controller is defined by the EHCI Host Controller Interface.
417c478bd9Sstevel@tonic-gate  *
427c478bd9Sstevel@tonic-gate  * This header file describes the EHCI driver data structures and function
437c478bd9Sstevel@tonic-gate  * prototypes for the EHCI Host Controller initilization/deintilization,
447c478bd9Sstevel@tonic-gate  * Bandwidth Allocation and other miscellaneous functionalities.
457c478bd9Sstevel@tonic-gate  */
467c478bd9Sstevel@tonic-gate 
477c478bd9Sstevel@tonic-gate /*
487c478bd9Sstevel@tonic-gate  * EHCI driver initialization function prototypes.
497c478bd9Sstevel@tonic-gate  */
507c478bd9Sstevel@tonic-gate extern void	ehci_set_dma_attributes(ehci_state_t	*ehcip);
517c478bd9Sstevel@tonic-gate extern int	ehci_allocate_pools(ehci_state_t	*ehcip);
527c478bd9Sstevel@tonic-gate extern void	ehci_decode_ddi_dma_addr_bind_handle_result(
537c478bd9Sstevel@tonic-gate 				ehci_state_t		*ehcip,
547c478bd9Sstevel@tonic-gate 				int			result);
557c478bd9Sstevel@tonic-gate extern int	ehci_map_regs(ehci_state_t		*ehcip);
567c478bd9Sstevel@tonic-gate extern int	ehci_register_intrs_and_init_mutex(
577c478bd9Sstevel@tonic-gate 				ehci_state_t		*ehcip);
58*3b00f311Syq extern int	ehci_init_ctlr(ehci_state_t		*ehcip,
59*3b00f311Syq 				int			init_type);
607c478bd9Sstevel@tonic-gate extern usba_hcdi_ops_t	*ehci_alloc_hcdi_ops(
617c478bd9Sstevel@tonic-gate 				ehci_state_t		*ehcip);
627c478bd9Sstevel@tonic-gate 
637c478bd9Sstevel@tonic-gate /*
647c478bd9Sstevel@tonic-gate  * EHCI driver deinitialization function prototypes.
657c478bd9Sstevel@tonic-gate  */
667c478bd9Sstevel@tonic-gate extern int	ehci_cleanup(ehci_state_t		*ehcip);
677c478bd9Sstevel@tonic-gate extern int	ehci_cpr_suspend(ehci_state_t		*ehcip);
687c478bd9Sstevel@tonic-gate extern int	ehci_cpr_resume(ehci_state_t		*ehcip);
697c478bd9Sstevel@tonic-gate 
707c478bd9Sstevel@tonic-gate /*
717c478bd9Sstevel@tonic-gate  * EHCI driver Bandwidth Allocation function prototypes.
727c478bd9Sstevel@tonic-gate  */
737c478bd9Sstevel@tonic-gate extern int	ehci_allocate_bandwidth(ehci_state_t	*ehcip,
747c478bd9Sstevel@tonic-gate 				usba_pipe_handle_data_t	*ph,
757c478bd9Sstevel@tonic-gate 				uint_t			*pnode,
767c478bd9Sstevel@tonic-gate 				uchar_t			*smask,
777c478bd9Sstevel@tonic-gate 				uchar_t			*cmask);
787c478bd9Sstevel@tonic-gate extern void	ehci_deallocate_bandwidth(ehci_state_t	*ehcip,
797c478bd9Sstevel@tonic-gate 				usba_pipe_handle_data_t	*ph,
807c478bd9Sstevel@tonic-gate 				uint_t			pnode,
817c478bd9Sstevel@tonic-gate 				uchar_t			smask,
827c478bd9Sstevel@tonic-gate 				uchar_t			cmask);
837c478bd9Sstevel@tonic-gate extern int	ehci_adjust_polling_interval(
847c478bd9Sstevel@tonic-gate 				ehci_state_t		*ehcip,
857c478bd9Sstevel@tonic-gate 				usb_ep_descr_t		*endpoint,
867c478bd9Sstevel@tonic-gate 				usb_port_status_t	port_status);
877c478bd9Sstevel@tonic-gate 
887c478bd9Sstevel@tonic-gate /*
897c478bd9Sstevel@tonic-gate  * EHCI driver miscellaneous function prototypes.
907c478bd9Sstevel@tonic-gate  */
917c478bd9Sstevel@tonic-gate extern ehci_state_t	*ehci_obtain_state(
927c478bd9Sstevel@tonic-gate 				dev_info_t		*dip);
937c478bd9Sstevel@tonic-gate extern int	ehci_state_is_operational(
947c478bd9Sstevel@tonic-gate 				ehci_state_t		*ehcip);
957c478bd9Sstevel@tonic-gate extern int	ehci_do_soft_reset(
967c478bd9Sstevel@tonic-gate 				ehci_state_t		*ehcip);
977c478bd9Sstevel@tonic-gate extern usb_req_attrs_t ehci_get_xfer_attrs(ehci_state_t	*ehcip,
987c478bd9Sstevel@tonic-gate 				ehci_pipe_private_t	*pp,
997c478bd9Sstevel@tonic-gate 				ehci_trans_wrapper_t	*tw);
1007c478bd9Sstevel@tonic-gate extern usb_frame_number_t ehci_get_current_frame_number(
1017c478bd9Sstevel@tonic-gate 				ehci_state_t		*ehcip);
1027c478bd9Sstevel@tonic-gate extern int	ehci_wait_for_sof(
1037c478bd9Sstevel@tonic-gate 				ehci_state_t		*ehcip);
1047c478bd9Sstevel@tonic-gate extern void	ehci_toggle_scheduler(
1057c478bd9Sstevel@tonic-gate 				ehci_state_t		*ehcip);
1067c478bd9Sstevel@tonic-gate 
1077c478bd9Sstevel@tonic-gate extern void	ehci_print_caps(ehci_state_t 		*ehcip);
1087c478bd9Sstevel@tonic-gate extern void	ehci_print_regs(ehci_state_t 		*ehcip);
1097c478bd9Sstevel@tonic-gate extern void	ehci_print_qh(ehci_state_t		*ehcip,
1107c478bd9Sstevel@tonic-gate 				ehci_qh_t		*qh);
1117c478bd9Sstevel@tonic-gate extern void	ehci_print_qtd(ehci_state_t		*ehcip,
1127c478bd9Sstevel@tonic-gate 				ehci_qtd_t		*qtd);
1137c478bd9Sstevel@tonic-gate extern void	ehci_create_stats(ehci_state_t		*ehcip);
1147c478bd9Sstevel@tonic-gate extern void	ehci_destroy_stats(ehci_state_t		*ehcip);
1157c478bd9Sstevel@tonic-gate extern void	ehci_do_intrs_stats(ehci_state_t	*ehcip,
1167c478bd9Sstevel@tonic-gate 				int		val);
1177c478bd9Sstevel@tonic-gate extern void	ehci_do_byte_stats(ehci_state_t		*ehcip,
1187c478bd9Sstevel@tonic-gate 				size_t		len,
1197c478bd9Sstevel@tonic-gate 				uint8_t		attr,
1207c478bd9Sstevel@tonic-gate 				uint8_t		addr);
1217c478bd9Sstevel@tonic-gate 
1227c478bd9Sstevel@tonic-gate #ifdef __cplusplus
1237c478bd9Sstevel@tonic-gate }
1247c478bd9Sstevel@tonic-gate #endif
1257c478bd9Sstevel@tonic-gate 
1267c478bd9Sstevel@tonic-gate #endif /* _SYS_USB_EHCI_UTIL_H */
127