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 51500Ssl147100 * Common Development and Distribution License (the "License"). 61500Ssl147100 * 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*7492SZhigang.Lu@Sun.COM * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 230Sstevel@tonic-gate * Use is subject to license terms. 240Sstevel@tonic-gate */ 250Sstevel@tonic-gate 260Sstevel@tonic-gate #ifndef _SYS_USB_EHCI_XFER_H 270Sstevel@tonic-gate #define _SYS_USB_EHCI_XFER_H 280Sstevel@tonic-gate 290Sstevel@tonic-gate 300Sstevel@tonic-gate #ifdef __cplusplus 310Sstevel@tonic-gate extern "C" { 320Sstevel@tonic-gate #endif 330Sstevel@tonic-gate 340Sstevel@tonic-gate /* 350Sstevel@tonic-gate * Enchanced Host Controller Driver (EHCI) 360Sstevel@tonic-gate * 370Sstevel@tonic-gate * The EHCI driver is a software driver which interfaces to the Universal 380Sstevel@tonic-gate * Serial Bus layer (USBA) and the Host Controller (HC). The interface to 390Sstevel@tonic-gate * the Host Controller is defined by the EHCI Host Controller Interface. 400Sstevel@tonic-gate * 410Sstevel@tonic-gate * This header file describes the data structures and function prototypes 420Sstevel@tonic-gate * required for the EHCI Driver to perform different USB transfers. 430Sstevel@tonic-gate */ 440Sstevel@tonic-gate 450Sstevel@tonic-gate /* EHCI Queue Head (QH) related functions */ 460Sstevel@tonic-gate extern ehci_qh_t *ehci_alloc_qh( 470Sstevel@tonic-gate ehci_state_t *ehcip, 480Sstevel@tonic-gate usba_pipe_handle_data_t *ph, 490Sstevel@tonic-gate uint_t flag); 500Sstevel@tonic-gate extern void ehci_insert_qh( 510Sstevel@tonic-gate ehci_state_t *ehcip, 520Sstevel@tonic-gate usba_pipe_handle_data_t *ph); 530Sstevel@tonic-gate extern void ehci_remove_qh( 540Sstevel@tonic-gate ehci_state_t *ehcip, 550Sstevel@tonic-gate ehci_pipe_private_t *pp, 560Sstevel@tonic-gate boolean_t reclaim); 570Sstevel@tonic-gate extern void ehci_deallocate_qh( 580Sstevel@tonic-gate ehci_state_t *ehcip, 590Sstevel@tonic-gate ehci_qh_t *old_qh); 600Sstevel@tonic-gate extern uint32_t ehci_qh_cpu_to_iommu( 610Sstevel@tonic-gate ehci_state_t *ehcip, 620Sstevel@tonic-gate ehci_qh_t *addr); 630Sstevel@tonic-gate extern ehci_qh_t *ehci_qh_iommu_to_cpu( 640Sstevel@tonic-gate ehci_state_t *ehcip, 650Sstevel@tonic-gate uintptr_t addr); 660Sstevel@tonic-gate 670Sstevel@tonic-gate /* EHCI Queue Element Transfer Descriptor (QTD) related functions */ 680Sstevel@tonic-gate extern ehci_trans_wrapper_t *ehci_allocate_ctrl_resources( 690Sstevel@tonic-gate ehci_state_t *ehcip, 700Sstevel@tonic-gate ehci_pipe_private_t *pp, 710Sstevel@tonic-gate usb_ctrl_req_t *ctrl_reqp, 720Sstevel@tonic-gate usb_flags_t usb_flags); 730Sstevel@tonic-gate extern void ehci_insert_ctrl_req( 740Sstevel@tonic-gate ehci_state_t *ehcip, 750Sstevel@tonic-gate usba_pipe_handle_data_t *ph, 760Sstevel@tonic-gate usb_ctrl_req_t *ctrl_reqp, 770Sstevel@tonic-gate ehci_trans_wrapper_t *tw, 780Sstevel@tonic-gate usb_flags_t usb_flags); 790Sstevel@tonic-gate extern ehci_trans_wrapper_t *ehci_allocate_bulk_resources( 800Sstevel@tonic-gate ehci_state_t *ehcip, 810Sstevel@tonic-gate ehci_pipe_private_t *pp, 820Sstevel@tonic-gate usb_bulk_req_t *bulk_reqp, 830Sstevel@tonic-gate usb_flags_t usb_flags); 840Sstevel@tonic-gate extern void ehci_insert_bulk_req( 850Sstevel@tonic-gate ehci_state_t *ehcip, 860Sstevel@tonic-gate usba_pipe_handle_data_t *ph, 870Sstevel@tonic-gate usb_bulk_req_t *bulk_reqp, 880Sstevel@tonic-gate ehci_trans_wrapper_t *tw, 890Sstevel@tonic-gate usb_flags_t flags); 900Sstevel@tonic-gate extern int ehci_start_periodic_pipe_polling( 910Sstevel@tonic-gate ehci_state_t *ehcip, 920Sstevel@tonic-gate usba_pipe_handle_data_t *ph, 930Sstevel@tonic-gate usb_opaque_t periodic_in_reqp, 940Sstevel@tonic-gate usb_flags_t flags); 950Sstevel@tonic-gate extern ehci_trans_wrapper_t *ehci_allocate_intr_resources( 960Sstevel@tonic-gate ehci_state_t *ehcip, 970Sstevel@tonic-gate usba_pipe_handle_data_t *ph, 980Sstevel@tonic-gate usb_intr_req_t *intr_reqp, 990Sstevel@tonic-gate usb_flags_t usb_flags); 1000Sstevel@tonic-gate extern void ehci_insert_intr_req( 1010Sstevel@tonic-gate ehci_state_t *ehcip, 1020Sstevel@tonic-gate ehci_pipe_private_t *pp, 1030Sstevel@tonic-gate ehci_trans_wrapper_t *tw, 1040Sstevel@tonic-gate usb_flags_t flags); 1050Sstevel@tonic-gate extern int ehci_stop_periodic_pipe_polling( 1060Sstevel@tonic-gate ehci_state_t *ehcip, 1070Sstevel@tonic-gate usba_pipe_handle_data_t *ph, 1080Sstevel@tonic-gate usb_flags_t flags); 1090Sstevel@tonic-gate extern int ehci_insert_qtd( 1100Sstevel@tonic-gate ehci_state_t *ehcip, 1111500Ssl147100 uint32_t qtd_ctrl, 1121500Ssl147100 size_t qtd_dma_offs, 1130Sstevel@tonic-gate size_t qtd_length, 1140Sstevel@tonic-gate uint32_t qtd_flag, 1150Sstevel@tonic-gate ehci_pipe_private_t *pp, 1160Sstevel@tonic-gate ehci_trans_wrapper_t *tw); 1170Sstevel@tonic-gate extern void ehci_remove_qtd_from_active_qtd_list( 1180Sstevel@tonic-gate ehci_state_t *ehcip, 1190Sstevel@tonic-gate ehci_qtd_t *curr_qtd); 1200Sstevel@tonic-gate extern void ehci_deallocate_qtd( 1210Sstevel@tonic-gate ehci_state_t *ehcip, 1220Sstevel@tonic-gate ehci_qtd_t *old_qtd); 1230Sstevel@tonic-gate extern uint32_t ehci_qtd_cpu_to_iommu( 1240Sstevel@tonic-gate ehci_state_t *ehcip, 1250Sstevel@tonic-gate ehci_qtd_t *addr); 1260Sstevel@tonic-gate extern ehci_qtd_t *ehci_qtd_iommu_to_cpu( 1270Sstevel@tonic-gate ehci_state_t *ehcip, 1280Sstevel@tonic-gate uintptr_t addr); 1290Sstevel@tonic-gate 1300Sstevel@tonic-gate /* Transfer Wrapper (TW) functions */ 1310Sstevel@tonic-gate extern int ehci_allocate_tds_for_tw( 1320Sstevel@tonic-gate ehci_state_t *ehcip, 1330Sstevel@tonic-gate ehci_pipe_private_t *pp, 1340Sstevel@tonic-gate ehci_trans_wrapper_t *tw, 1350Sstevel@tonic-gate size_t qtd_count); 1360Sstevel@tonic-gate extern void ehci_stop_xfer_timer( 1370Sstevel@tonic-gate ehci_state_t *ehcip, 1380Sstevel@tonic-gate ehci_trans_wrapper_t *tw, 1390Sstevel@tonic-gate uint_t flag); 1400Sstevel@tonic-gate extern void ehci_deallocate_tw( 1410Sstevel@tonic-gate ehci_state_t *ehcip, 1420Sstevel@tonic-gate ehci_pipe_private_t *pp, 1430Sstevel@tonic-gate ehci_trans_wrapper_t *tw); 1440Sstevel@tonic-gate extern void ehci_free_dma_resources( 1450Sstevel@tonic-gate ehci_state_t *ehcip, 1460Sstevel@tonic-gate usba_pipe_handle_data_t *ph); 1470Sstevel@tonic-gate 1480Sstevel@tonic-gate /* Miscillaneous functions */ 1490Sstevel@tonic-gate extern int ehci_allocate_intr_in_resource( 1500Sstevel@tonic-gate ehci_state_t *ehcip, 1510Sstevel@tonic-gate ehci_pipe_private_t *pp, 1520Sstevel@tonic-gate ehci_trans_wrapper_t *tw, 1530Sstevel@tonic-gate usb_flags_t flags); 1540Sstevel@tonic-gate extern void ehci_deallocate_intr_in_resource( 1550Sstevel@tonic-gate ehci_state_t *ehcip, 1560Sstevel@tonic-gate ehci_pipe_private_t *pp, 1570Sstevel@tonic-gate ehci_trans_wrapper_t *tw); 1580Sstevel@tonic-gate extern void ehci_pipe_cleanup( 1590Sstevel@tonic-gate ehci_state_t *ehcip, 1600Sstevel@tonic-gate usba_pipe_handle_data_t *ph); 1610Sstevel@tonic-gate extern void ehci_check_for_transfers_completion( 1620Sstevel@tonic-gate ehci_state_t *ehcip, 1630Sstevel@tonic-gate ehci_pipe_private_t *pp); 1640Sstevel@tonic-gate extern void ehci_restore_data_toggle( 1650Sstevel@tonic-gate ehci_state_t *ehcip, 1660Sstevel@tonic-gate usba_pipe_handle_data_t *ph); 1670Sstevel@tonic-gate extern void ehci_handle_outstanding_requests( 1680Sstevel@tonic-gate ehci_state_t *ehcip, 1690Sstevel@tonic-gate ehci_pipe_private_t *pp); 1700Sstevel@tonic-gate extern void ehci_do_client_periodic_in_req_callback( 1710Sstevel@tonic-gate ehci_state_t *ehcip, 1720Sstevel@tonic-gate ehci_pipe_private_t *pp, 1730Sstevel@tonic-gate usb_cr_t completion_reason); 1740Sstevel@tonic-gate extern void ehci_hcdi_callback( 1750Sstevel@tonic-gate usba_pipe_handle_data_t *ph, 1760Sstevel@tonic-gate ehci_trans_wrapper_t *tw, 1770Sstevel@tonic-gate usb_cr_t completion_reason); 1780Sstevel@tonic-gate extern void ehci_handle_clear_tt_buffer( 1790Sstevel@tonic-gate ehci_state_t *ehcip, 1800Sstevel@tonic-gate ehci_pipe_private_t *pp, 1810Sstevel@tonic-gate ehci_trans_wrapper_t *tw, 1820Sstevel@tonic-gate ehci_qtd_t *qtd, 1830Sstevel@tonic-gate void *); 1840Sstevel@tonic-gate extern void ehci_handle_clear_tt_buffer_error( 1850Sstevel@tonic-gate ehci_state_t *ehcip, 1860Sstevel@tonic-gate ehci_pipe_private_t *hub_pp, 1870Sstevel@tonic-gate ehci_trans_wrapper_t *tw, 1880Sstevel@tonic-gate ehci_qtd_t *qtd, 1890Sstevel@tonic-gate void *, 1900Sstevel@tonic-gate usb_cr_t error); 1910Sstevel@tonic-gate #ifdef __cplusplus 1920Sstevel@tonic-gate } 1930Sstevel@tonic-gate #endif 1940Sstevel@tonic-gate 1950Sstevel@tonic-gate #endif /* _SYS_USB_EHCI_XFER_H */ 196