xref: /onnv-gate/usr/src/uts/common/sys/usb/hcd/ehci/ehci_util.h (revision 12886:2e278bf762e0)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
51458Syq193411  * Common Development and Distribution License (the "License").
61458Syq193411  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
210Sstevel@tonic-gate /*
22*12886SRaymond.Chen@Sun.COM  * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
230Sstevel@tonic-gate  */
240Sstevel@tonic-gate 
250Sstevel@tonic-gate #ifndef _SYS_USB_EHCI_UTIL_H
260Sstevel@tonic-gate #define	_SYS_USB_EHCI_UTIL_H
270Sstevel@tonic-gate 
280Sstevel@tonic-gate 
290Sstevel@tonic-gate #ifdef	__cplusplus
300Sstevel@tonic-gate extern "C" {
310Sstevel@tonic-gate #endif
320Sstevel@tonic-gate 
330Sstevel@tonic-gate /*
340Sstevel@tonic-gate  * Enchanced Host Controller Driver (EHCI)
350Sstevel@tonic-gate  *
360Sstevel@tonic-gate  * The EHCI driver is a software driver which interfaces to the Universal
370Sstevel@tonic-gate  * Serial Bus layer (USBA) and the Host Controller (HC). The interface to
380Sstevel@tonic-gate  * the Host Controller is defined by the EHCI Host Controller Interface.
390Sstevel@tonic-gate  *
400Sstevel@tonic-gate  * This header file describes the EHCI driver data structures and function
410Sstevel@tonic-gate  * prototypes for the EHCI Host Controller initilization/deintilization,
420Sstevel@tonic-gate  * Bandwidth Allocation and other miscellaneous functionalities.
430Sstevel@tonic-gate  */
440Sstevel@tonic-gate 
450Sstevel@tonic-gate /*
460Sstevel@tonic-gate  * EHCI driver initialization function prototypes.
470Sstevel@tonic-gate  */
480Sstevel@tonic-gate extern void	ehci_set_dma_attributes(ehci_state_t	*ehcip);
490Sstevel@tonic-gate extern int	ehci_allocate_pools(ehci_state_t	*ehcip);
500Sstevel@tonic-gate extern void	ehci_decode_ddi_dma_addr_bind_handle_result(
510Sstevel@tonic-gate 				ehci_state_t		*ehcip,
520Sstevel@tonic-gate 				int			result);
530Sstevel@tonic-gate extern int	ehci_map_regs(ehci_state_t		*ehcip);
540Sstevel@tonic-gate extern int	ehci_register_intrs_and_init_mutex(
550Sstevel@tonic-gate 				ehci_state_t		*ehcip);
561458Syq193411 extern int	ehci_init_ctlr(ehci_state_t		*ehcip,
571458Syq193411 				int			init_type);
580Sstevel@tonic-gate extern usba_hcdi_ops_t	*ehci_alloc_hcdi_ops(
590Sstevel@tonic-gate 				ehci_state_t		*ehcip);
600Sstevel@tonic-gate 
610Sstevel@tonic-gate /*
620Sstevel@tonic-gate  * EHCI driver deinitialization function prototypes.
630Sstevel@tonic-gate  */
640Sstevel@tonic-gate extern int	ehci_cleanup(ehci_state_t		*ehcip);
650Sstevel@tonic-gate extern int	ehci_cpr_suspend(ehci_state_t		*ehcip);
660Sstevel@tonic-gate extern int	ehci_cpr_resume(ehci_state_t		*ehcip);
670Sstevel@tonic-gate 
680Sstevel@tonic-gate /*
690Sstevel@tonic-gate  * EHCI driver Bandwidth Allocation function prototypes.
700Sstevel@tonic-gate  */
710Sstevel@tonic-gate extern int	ehci_allocate_bandwidth(ehci_state_t	*ehcip,
720Sstevel@tonic-gate 				usba_pipe_handle_data_t	*ph,
730Sstevel@tonic-gate 				uint_t			*pnode,
740Sstevel@tonic-gate 				uchar_t			*smask,
750Sstevel@tonic-gate 				uchar_t			*cmask);
760Sstevel@tonic-gate extern void	ehci_deallocate_bandwidth(ehci_state_t	*ehcip,
770Sstevel@tonic-gate 				usba_pipe_handle_data_t	*ph,
780Sstevel@tonic-gate 				uint_t			pnode,
790Sstevel@tonic-gate 				uchar_t			smask,
800Sstevel@tonic-gate 				uchar_t			cmask);
810Sstevel@tonic-gate extern int	ehci_adjust_polling_interval(
820Sstevel@tonic-gate 				ehci_state_t		*ehcip,
830Sstevel@tonic-gate 				usb_ep_descr_t		*endpoint,
840Sstevel@tonic-gate 				usb_port_status_t	port_status);
850Sstevel@tonic-gate 
860Sstevel@tonic-gate /*
870Sstevel@tonic-gate  * EHCI driver miscellaneous function prototypes.
880Sstevel@tonic-gate  */
890Sstevel@tonic-gate extern ehci_state_t	*ehci_obtain_state(
900Sstevel@tonic-gate 				dev_info_t		*dip);
910Sstevel@tonic-gate extern int	ehci_state_is_operational(
920Sstevel@tonic-gate 				ehci_state_t		*ehcip);
930Sstevel@tonic-gate extern int	ehci_do_soft_reset(
940Sstevel@tonic-gate 				ehci_state_t		*ehcip);
950Sstevel@tonic-gate extern usb_req_attrs_t ehci_get_xfer_attrs(ehci_state_t	*ehcip,
960Sstevel@tonic-gate 				ehci_pipe_private_t	*pp,
970Sstevel@tonic-gate 				ehci_trans_wrapper_t	*tw);
980Sstevel@tonic-gate extern usb_frame_number_t ehci_get_current_frame_number(
990Sstevel@tonic-gate 				ehci_state_t		*ehcip);
1000Sstevel@tonic-gate extern int	ehci_wait_for_sof(
1010Sstevel@tonic-gate 				ehci_state_t		*ehcip);
1020Sstevel@tonic-gate extern void	ehci_toggle_scheduler(
1030Sstevel@tonic-gate 				ehci_state_t		*ehcip);
104*12886SRaymond.Chen@Sun.COM extern void	ehci_toggle_scheduler_on_pipe(ehci_state_t *ehcip);
1050Sstevel@tonic-gate 
1060Sstevel@tonic-gate extern void	ehci_print_caps(ehci_state_t 		*ehcip);
1070Sstevel@tonic-gate extern void	ehci_print_regs(ehci_state_t 		*ehcip);
1080Sstevel@tonic-gate extern void	ehci_print_qh(ehci_state_t		*ehcip,
1090Sstevel@tonic-gate 				ehci_qh_t		*qh);
1100Sstevel@tonic-gate extern void	ehci_print_qtd(ehci_state_t		*ehcip,
1110Sstevel@tonic-gate 				ehci_qtd_t		*qtd);
1120Sstevel@tonic-gate extern void	ehci_create_stats(ehci_state_t		*ehcip);
1130Sstevel@tonic-gate extern void	ehci_destroy_stats(ehci_state_t		*ehcip);
1140Sstevel@tonic-gate extern void	ehci_do_intrs_stats(ehci_state_t	*ehcip,
1150Sstevel@tonic-gate 				int		val);
1160Sstevel@tonic-gate extern void	ehci_do_byte_stats(ehci_state_t		*ehcip,
1170Sstevel@tonic-gate 				size_t		len,
1180Sstevel@tonic-gate 				uint8_t		attr,
1190Sstevel@tonic-gate 				uint8_t		addr);
1200Sstevel@tonic-gate 
1210Sstevel@tonic-gate #ifdef __cplusplus
1220Sstevel@tonic-gate }
1230Sstevel@tonic-gate #endif
1240Sstevel@tonic-gate 
1250Sstevel@tonic-gate #endif /* _SYS_USB_EHCI_UTIL_H */
126