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
53b00f311Syq  * Common Development and Distribution License (the "License").
63b00f311Syq  * 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*7484d118SRaymond Chen  * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
237c478bd9Sstevel@tonic-gate  */
247c478bd9Sstevel@tonic-gate 
257c478bd9Sstevel@tonic-gate #ifndef _SYS_USB_EHCI_UTIL_H
267c478bd9Sstevel@tonic-gate #define	_SYS_USB_EHCI_UTIL_H
277c478bd9Sstevel@tonic-gate 
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
307c478bd9Sstevel@tonic-gate extern "C" {
317c478bd9Sstevel@tonic-gate #endif
327c478bd9Sstevel@tonic-gate 
337c478bd9Sstevel@tonic-gate /*
347c478bd9Sstevel@tonic-gate  * Enchanced Host Controller Driver (EHCI)
357c478bd9Sstevel@tonic-gate  *
367c478bd9Sstevel@tonic-gate  * The EHCI driver is a software driver which interfaces to the Universal
377c478bd9Sstevel@tonic-gate  * Serial Bus layer (USBA) and the Host Controller (HC). The interface to
387c478bd9Sstevel@tonic-gate  * the Host Controller is defined by the EHCI Host Controller Interface.
397c478bd9Sstevel@tonic-gate  *
407c478bd9Sstevel@tonic-gate  * This header file describes the EHCI driver data structures and function
417c478bd9Sstevel@tonic-gate  * prototypes for the EHCI Host Controller initilization/deintilization,
427c478bd9Sstevel@tonic-gate  * Bandwidth Allocation and other miscellaneous functionalities.
437c478bd9Sstevel@tonic-gate  */
447c478bd9Sstevel@tonic-gate 
457c478bd9Sstevel@tonic-gate /*
467c478bd9Sstevel@tonic-gate  * EHCI driver initialization function prototypes.
477c478bd9Sstevel@tonic-gate  */
487c478bd9Sstevel@tonic-gate extern void	ehci_set_dma_attributes(ehci_state_t	*ehcip);
497c478bd9Sstevel@tonic-gate extern int	ehci_allocate_pools(ehci_state_t	*ehcip);
507c478bd9Sstevel@tonic-gate extern void	ehci_decode_ddi_dma_addr_bind_handle_result(
517c478bd9Sstevel@tonic-gate 				ehci_state_t		*ehcip,
527c478bd9Sstevel@tonic-gate 				int			result);
537c478bd9Sstevel@tonic-gate extern int	ehci_map_regs(ehci_state_t		*ehcip);
547c478bd9Sstevel@tonic-gate extern int	ehci_register_intrs_and_init_mutex(
557c478bd9Sstevel@tonic-gate 				ehci_state_t		*ehcip);
563b00f311Syq extern int	ehci_init_ctlr(ehci_state_t		*ehcip,
573b00f311Syq 				int			init_type);
587c478bd9Sstevel@tonic-gate extern usba_hcdi_ops_t	*ehci_alloc_hcdi_ops(
597c478bd9Sstevel@tonic-gate 				ehci_state_t		*ehcip);
607c478bd9Sstevel@tonic-gate 
617c478bd9Sstevel@tonic-gate /*
627c478bd9Sstevel@tonic-gate  * EHCI driver deinitialization function prototypes.
637c478bd9Sstevel@tonic-gate  */
647c478bd9Sstevel@tonic-gate extern int	ehci_cleanup(ehci_state_t		*ehcip);
657c478bd9Sstevel@tonic-gate extern int	ehci_cpr_suspend(ehci_state_t		*ehcip);
667c478bd9Sstevel@tonic-gate extern int	ehci_cpr_resume(ehci_state_t		*ehcip);
677c478bd9Sstevel@tonic-gate 
687c478bd9Sstevel@tonic-gate /*
697c478bd9Sstevel@tonic-gate  * EHCI driver Bandwidth Allocation function prototypes.
707c478bd9Sstevel@tonic-gate  */
717c478bd9Sstevel@tonic-gate extern int	ehci_allocate_bandwidth(ehci_state_t	*ehcip,
727c478bd9Sstevel@tonic-gate 				usba_pipe_handle_data_t	*ph,
737c478bd9Sstevel@tonic-gate 				uint_t			*pnode,
747c478bd9Sstevel@tonic-gate 				uchar_t			*smask,
757c478bd9Sstevel@tonic-gate 				uchar_t			*cmask);
767c478bd9Sstevel@tonic-gate extern void	ehci_deallocate_bandwidth(ehci_state_t	*ehcip,
777c478bd9Sstevel@tonic-gate 				usba_pipe_handle_data_t	*ph,
787c478bd9Sstevel@tonic-gate 				uint_t			pnode,
797c478bd9Sstevel@tonic-gate 				uchar_t			smask,
807c478bd9Sstevel@tonic-gate 				uchar_t			cmask);
817c478bd9Sstevel@tonic-gate extern int	ehci_adjust_polling_interval(
827c478bd9Sstevel@tonic-gate 				ehci_state_t		*ehcip,
837c478bd9Sstevel@tonic-gate 				usb_ep_descr_t		*endpoint,
847c478bd9Sstevel@tonic-gate 				usb_port_status_t	port_status);
857c478bd9Sstevel@tonic-gate 
867c478bd9Sstevel@tonic-gate /*
877c478bd9Sstevel@tonic-gate  * EHCI driver miscellaneous function prototypes.
887c478bd9Sstevel@tonic-gate  */
897c478bd9Sstevel@tonic-gate extern ehci_state_t	*ehci_obtain_state(
907c478bd9Sstevel@tonic-gate 				dev_info_t		*dip);
917c478bd9Sstevel@tonic-gate extern int	ehci_state_is_operational(
927c478bd9Sstevel@tonic-gate 				ehci_state_t		*ehcip);
937c478bd9Sstevel@tonic-gate extern int	ehci_do_soft_reset(
947c478bd9Sstevel@tonic-gate 				ehci_state_t		*ehcip);
957c478bd9Sstevel@tonic-gate extern usb_req_attrs_t ehci_get_xfer_attrs(ehci_state_t	*ehcip,
967c478bd9Sstevel@tonic-gate 				ehci_pipe_private_t	*pp,
977c478bd9Sstevel@tonic-gate 				ehci_trans_wrapper_t	*tw);
987c478bd9Sstevel@tonic-gate extern usb_frame_number_t ehci_get_current_frame_number(
997c478bd9Sstevel@tonic-gate 				ehci_state_t		*ehcip);
1007c478bd9Sstevel@tonic-gate extern int	ehci_wait_for_sof(
1017c478bd9Sstevel@tonic-gate 				ehci_state_t		*ehcip);
1027c478bd9Sstevel@tonic-gate extern void	ehci_toggle_scheduler(
1037c478bd9Sstevel@tonic-gate 				ehci_state_t		*ehcip);
104*7484d118SRaymond Chen extern void	ehci_toggle_scheduler_on_pipe(ehci_state_t *ehcip);
1057c478bd9Sstevel@tonic-gate 
1067c478bd9Sstevel@tonic-gate extern void	ehci_print_caps(ehci_state_t 		*ehcip);
1077c478bd9Sstevel@tonic-gate extern void	ehci_print_regs(ehci_state_t 		*ehcip);
1087c478bd9Sstevel@tonic-gate extern void	ehci_print_qh(ehci_state_t		*ehcip,
1097c478bd9Sstevel@tonic-gate 				ehci_qh_t		*qh);
1107c478bd9Sstevel@tonic-gate extern void	ehci_print_qtd(ehci_state_t		*ehcip,
1117c478bd9Sstevel@tonic-gate 				ehci_qtd_t		*qtd);
1127c478bd9Sstevel@tonic-gate extern void	ehci_create_stats(ehci_state_t		*ehcip);
1137c478bd9Sstevel@tonic-gate extern void	ehci_destroy_stats(ehci_state_t		*ehcip);
1147c478bd9Sstevel@tonic-gate extern void	ehci_do_intrs_stats(ehci_state_t	*ehcip,
1157c478bd9Sstevel@tonic-gate 				int		val);
1167c478bd9Sstevel@tonic-gate extern void	ehci_do_byte_stats(ehci_state_t		*ehcip,
1177c478bd9Sstevel@tonic-gate 				size_t		len,
1187c478bd9Sstevel@tonic-gate 				uint8_t		attr,
1197c478bd9Sstevel@tonic-gate 				uint8_t		addr);
1207c478bd9Sstevel@tonic-gate 
1217c478bd9Sstevel@tonic-gate #ifdef __cplusplus
1227c478bd9Sstevel@tonic-gate }
1237c478bd9Sstevel@tonic-gate #endif
1247c478bd9Sstevel@tonic-gate 
1257c478bd9Sstevel@tonic-gate #endif /* _SYS_USB_EHCI_UTIL_H */
126