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 53304303fSsl * Common Development and Distribution License (the "License"). 63304303fSsl * 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*d29f5a71Szhigang lu - Sun Microsystems - Beijing China * Copyright 2008 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_XFER_H 277c478bd9Sstevel@tonic-gate #define _SYS_USB_EHCI_XFER_H 287c478bd9Sstevel@tonic-gate 297c478bd9Sstevel@tonic-gate 307c478bd9Sstevel@tonic-gate #ifdef __cplusplus 317c478bd9Sstevel@tonic-gate extern "C" { 327c478bd9Sstevel@tonic-gate #endif 337c478bd9Sstevel@tonic-gate 347c478bd9Sstevel@tonic-gate /* 357c478bd9Sstevel@tonic-gate * Enchanced Host Controller Driver (EHCI) 367c478bd9Sstevel@tonic-gate * 377c478bd9Sstevel@tonic-gate * The EHCI driver is a software driver which interfaces to the Universal 387c478bd9Sstevel@tonic-gate * Serial Bus layer (USBA) and the Host Controller (HC). The interface to 397c478bd9Sstevel@tonic-gate * the Host Controller is defined by the EHCI Host Controller Interface. 407c478bd9Sstevel@tonic-gate * 417c478bd9Sstevel@tonic-gate * This header file describes the data structures and function prototypes 427c478bd9Sstevel@tonic-gate * required for the EHCI Driver to perform different USB transfers. 437c478bd9Sstevel@tonic-gate */ 447c478bd9Sstevel@tonic-gate 457c478bd9Sstevel@tonic-gate /* EHCI Queue Head (QH) related functions */ 467c478bd9Sstevel@tonic-gate extern ehci_qh_t *ehci_alloc_qh( 477c478bd9Sstevel@tonic-gate ehci_state_t *ehcip, 487c478bd9Sstevel@tonic-gate usba_pipe_handle_data_t *ph, 497c478bd9Sstevel@tonic-gate uint_t flag); 507c478bd9Sstevel@tonic-gate extern void ehci_insert_qh( 517c478bd9Sstevel@tonic-gate ehci_state_t *ehcip, 527c478bd9Sstevel@tonic-gate usba_pipe_handle_data_t *ph); 537c478bd9Sstevel@tonic-gate extern void ehci_remove_qh( 547c478bd9Sstevel@tonic-gate ehci_state_t *ehcip, 557c478bd9Sstevel@tonic-gate ehci_pipe_private_t *pp, 567c478bd9Sstevel@tonic-gate boolean_t reclaim); 577c478bd9Sstevel@tonic-gate extern void ehci_deallocate_qh( 587c478bd9Sstevel@tonic-gate ehci_state_t *ehcip, 597c478bd9Sstevel@tonic-gate ehci_qh_t *old_qh); 607c478bd9Sstevel@tonic-gate extern uint32_t ehci_qh_cpu_to_iommu( 617c478bd9Sstevel@tonic-gate ehci_state_t *ehcip, 627c478bd9Sstevel@tonic-gate ehci_qh_t *addr); 637c478bd9Sstevel@tonic-gate extern ehci_qh_t *ehci_qh_iommu_to_cpu( 647c478bd9Sstevel@tonic-gate ehci_state_t *ehcip, 657c478bd9Sstevel@tonic-gate uintptr_t addr); 667c478bd9Sstevel@tonic-gate 677c478bd9Sstevel@tonic-gate /* EHCI Queue Element Transfer Descriptor (QTD) related functions */ 687c478bd9Sstevel@tonic-gate extern ehci_trans_wrapper_t *ehci_allocate_ctrl_resources( 697c478bd9Sstevel@tonic-gate ehci_state_t *ehcip, 707c478bd9Sstevel@tonic-gate ehci_pipe_private_t *pp, 717c478bd9Sstevel@tonic-gate usb_ctrl_req_t *ctrl_reqp, 727c478bd9Sstevel@tonic-gate usb_flags_t usb_flags); 737c478bd9Sstevel@tonic-gate extern void ehci_insert_ctrl_req( 747c478bd9Sstevel@tonic-gate ehci_state_t *ehcip, 757c478bd9Sstevel@tonic-gate usba_pipe_handle_data_t *ph, 767c478bd9Sstevel@tonic-gate usb_ctrl_req_t *ctrl_reqp, 777c478bd9Sstevel@tonic-gate ehci_trans_wrapper_t *tw, 787c478bd9Sstevel@tonic-gate usb_flags_t usb_flags); 797c478bd9Sstevel@tonic-gate extern ehci_trans_wrapper_t *ehci_allocate_bulk_resources( 807c478bd9Sstevel@tonic-gate ehci_state_t *ehcip, 817c478bd9Sstevel@tonic-gate ehci_pipe_private_t *pp, 827c478bd9Sstevel@tonic-gate usb_bulk_req_t *bulk_reqp, 837c478bd9Sstevel@tonic-gate usb_flags_t usb_flags); 847c478bd9Sstevel@tonic-gate extern void ehci_insert_bulk_req( 857c478bd9Sstevel@tonic-gate ehci_state_t *ehcip, 867c478bd9Sstevel@tonic-gate usba_pipe_handle_data_t *ph, 877c478bd9Sstevel@tonic-gate usb_bulk_req_t *bulk_reqp, 887c478bd9Sstevel@tonic-gate ehci_trans_wrapper_t *tw, 897c478bd9Sstevel@tonic-gate usb_flags_t flags); 907c478bd9Sstevel@tonic-gate extern int ehci_start_periodic_pipe_polling( 917c478bd9Sstevel@tonic-gate ehci_state_t *ehcip, 927c478bd9Sstevel@tonic-gate usba_pipe_handle_data_t *ph, 937c478bd9Sstevel@tonic-gate usb_opaque_t periodic_in_reqp, 947c478bd9Sstevel@tonic-gate usb_flags_t flags); 957c478bd9Sstevel@tonic-gate extern ehci_trans_wrapper_t *ehci_allocate_intr_resources( 967c478bd9Sstevel@tonic-gate ehci_state_t *ehcip, 977c478bd9Sstevel@tonic-gate usba_pipe_handle_data_t *ph, 987c478bd9Sstevel@tonic-gate usb_intr_req_t *intr_reqp, 997c478bd9Sstevel@tonic-gate usb_flags_t usb_flags); 1007c478bd9Sstevel@tonic-gate extern void ehci_insert_intr_req( 1017c478bd9Sstevel@tonic-gate ehci_state_t *ehcip, 1027c478bd9Sstevel@tonic-gate ehci_pipe_private_t *pp, 1037c478bd9Sstevel@tonic-gate ehci_trans_wrapper_t *tw, 1047c478bd9Sstevel@tonic-gate usb_flags_t flags); 1057c478bd9Sstevel@tonic-gate extern int ehci_stop_periodic_pipe_polling( 1067c478bd9Sstevel@tonic-gate ehci_state_t *ehcip, 1077c478bd9Sstevel@tonic-gate usba_pipe_handle_data_t *ph, 1087c478bd9Sstevel@tonic-gate usb_flags_t flags); 1097c478bd9Sstevel@tonic-gate extern int ehci_insert_qtd( 1107c478bd9Sstevel@tonic-gate ehci_state_t *ehcip, 1113304303fSsl uint32_t qtd_ctrl, 1123304303fSsl size_t qtd_dma_offs, 1137c478bd9Sstevel@tonic-gate size_t qtd_length, 1147c478bd9Sstevel@tonic-gate uint32_t qtd_flag, 1157c478bd9Sstevel@tonic-gate ehci_pipe_private_t *pp, 1167c478bd9Sstevel@tonic-gate ehci_trans_wrapper_t *tw); 1177c478bd9Sstevel@tonic-gate extern void ehci_remove_qtd_from_active_qtd_list( 1187c478bd9Sstevel@tonic-gate ehci_state_t *ehcip, 1197c478bd9Sstevel@tonic-gate ehci_qtd_t *curr_qtd); 1207c478bd9Sstevel@tonic-gate extern void ehci_deallocate_qtd( 1217c478bd9Sstevel@tonic-gate ehci_state_t *ehcip, 1227c478bd9Sstevel@tonic-gate ehci_qtd_t *old_qtd); 1237c478bd9Sstevel@tonic-gate extern uint32_t ehci_qtd_cpu_to_iommu( 1247c478bd9Sstevel@tonic-gate ehci_state_t *ehcip, 1257c478bd9Sstevel@tonic-gate ehci_qtd_t *addr); 1267c478bd9Sstevel@tonic-gate extern ehci_qtd_t *ehci_qtd_iommu_to_cpu( 1277c478bd9Sstevel@tonic-gate ehci_state_t *ehcip, 1287c478bd9Sstevel@tonic-gate uintptr_t addr); 1297c478bd9Sstevel@tonic-gate 1307c478bd9Sstevel@tonic-gate /* Transfer Wrapper (TW) functions */ 1317c478bd9Sstevel@tonic-gate extern int ehci_allocate_tds_for_tw( 1327c478bd9Sstevel@tonic-gate ehci_state_t *ehcip, 1337c478bd9Sstevel@tonic-gate ehci_pipe_private_t *pp, 1347c478bd9Sstevel@tonic-gate ehci_trans_wrapper_t *tw, 1357c478bd9Sstevel@tonic-gate size_t qtd_count); 1367c478bd9Sstevel@tonic-gate extern void ehci_stop_xfer_timer( 1377c478bd9Sstevel@tonic-gate ehci_state_t *ehcip, 1387c478bd9Sstevel@tonic-gate ehci_trans_wrapper_t *tw, 1397c478bd9Sstevel@tonic-gate uint_t flag); 1407c478bd9Sstevel@tonic-gate extern void ehci_deallocate_tw( 1417c478bd9Sstevel@tonic-gate ehci_state_t *ehcip, 1427c478bd9Sstevel@tonic-gate ehci_pipe_private_t *pp, 1437c478bd9Sstevel@tonic-gate ehci_trans_wrapper_t *tw); 1447c478bd9Sstevel@tonic-gate extern void ehci_free_dma_resources( 1457c478bd9Sstevel@tonic-gate ehci_state_t *ehcip, 1467c478bd9Sstevel@tonic-gate usba_pipe_handle_data_t *ph); 1477c478bd9Sstevel@tonic-gate 1487c478bd9Sstevel@tonic-gate /* Miscillaneous functions */ 1497c478bd9Sstevel@tonic-gate extern int ehci_allocate_intr_in_resource( 1507c478bd9Sstevel@tonic-gate ehci_state_t *ehcip, 1517c478bd9Sstevel@tonic-gate ehci_pipe_private_t *pp, 1527c478bd9Sstevel@tonic-gate ehci_trans_wrapper_t *tw, 1537c478bd9Sstevel@tonic-gate usb_flags_t flags); 1547c478bd9Sstevel@tonic-gate extern void ehci_deallocate_intr_in_resource( 1557c478bd9Sstevel@tonic-gate ehci_state_t *ehcip, 1567c478bd9Sstevel@tonic-gate ehci_pipe_private_t *pp, 1577c478bd9Sstevel@tonic-gate ehci_trans_wrapper_t *tw); 1587c478bd9Sstevel@tonic-gate extern void ehci_pipe_cleanup( 1597c478bd9Sstevel@tonic-gate ehci_state_t *ehcip, 1607c478bd9Sstevel@tonic-gate usba_pipe_handle_data_t *ph); 1617c478bd9Sstevel@tonic-gate extern void ehci_check_for_transfers_completion( 1627c478bd9Sstevel@tonic-gate ehci_state_t *ehcip, 1637c478bd9Sstevel@tonic-gate ehci_pipe_private_t *pp); 1647c478bd9Sstevel@tonic-gate extern void ehci_restore_data_toggle( 1657c478bd9Sstevel@tonic-gate ehci_state_t *ehcip, 1667c478bd9Sstevel@tonic-gate usba_pipe_handle_data_t *ph); 1677c478bd9Sstevel@tonic-gate extern void ehci_handle_outstanding_requests( 1687c478bd9Sstevel@tonic-gate ehci_state_t *ehcip, 1697c478bd9Sstevel@tonic-gate ehci_pipe_private_t *pp); 1707c478bd9Sstevel@tonic-gate extern void ehci_do_client_periodic_in_req_callback( 1717c478bd9Sstevel@tonic-gate ehci_state_t *ehcip, 1727c478bd9Sstevel@tonic-gate ehci_pipe_private_t *pp, 1737c478bd9Sstevel@tonic-gate usb_cr_t completion_reason); 1747c478bd9Sstevel@tonic-gate extern void ehci_hcdi_callback( 1757c478bd9Sstevel@tonic-gate usba_pipe_handle_data_t *ph, 1767c478bd9Sstevel@tonic-gate ehci_trans_wrapper_t *tw, 1777c478bd9Sstevel@tonic-gate usb_cr_t completion_reason); 1787c478bd9Sstevel@tonic-gate extern void ehci_handle_clear_tt_buffer( 1797c478bd9Sstevel@tonic-gate ehci_state_t *ehcip, 1807c478bd9Sstevel@tonic-gate ehci_pipe_private_t *pp, 1817c478bd9Sstevel@tonic-gate ehci_trans_wrapper_t *tw, 1827c478bd9Sstevel@tonic-gate ehci_qtd_t *qtd, 1837c478bd9Sstevel@tonic-gate void *); 1847c478bd9Sstevel@tonic-gate extern void ehci_handle_clear_tt_buffer_error( 1857c478bd9Sstevel@tonic-gate ehci_state_t *ehcip, 1867c478bd9Sstevel@tonic-gate ehci_pipe_private_t *hub_pp, 1877c478bd9Sstevel@tonic-gate ehci_trans_wrapper_t *tw, 1887c478bd9Sstevel@tonic-gate ehci_qtd_t *qtd, 1897c478bd9Sstevel@tonic-gate void *, 1907c478bd9Sstevel@tonic-gate usb_cr_t error); 1917c478bd9Sstevel@tonic-gate #ifdef __cplusplus 1927c478bd9Sstevel@tonic-gate } 1937c478bd9Sstevel@tonic-gate #endif 1947c478bd9Sstevel@tonic-gate 1957c478bd9Sstevel@tonic-gate #endif /* _SYS_USB_EHCI_XFER_H */ 196