/* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License, Version 1.0 only * (the "License"). You may not use this file except in compliance * with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. * See the License for the specific language governing permissions * and limitations under the License. * * When distributing Covered Code, include this CDDL HEADER in each * file and include the License file at usr/src/OPENSOLARIS.LICENSE. * If applicable, add the following below this CDDL HEADER, with the * fields enclosed by brackets "[]" replaced with your own identifying * information: Portions Copyright [yyyy] [name of copyright owner] * * CDDL HEADER END */ /* * Copyright 2004 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #ifndef _SYS_USB_UHCI_H #define _SYS_USB_UHCI_H #pragma ident "%Z%%M% %I% %E% SMI" #include #ifdef __cplusplus extern "C" { #endif /* * Universal Host Controller Driver (UHCI) * * The UHCI driver is a driver which interfaces to the Universal * Serial Bus Driver (USBA) and the Host Controller (HC). The interface to * the Host Controller is defined by the Universal Host Controller * Interface spec. */ #define LEGACYMODE_REG_OFFSET 0xc0 #define LEGACYMODE_REG_INIT_VALUE 0xaf00 /* * The register set of the UCHI controller * This structure is laid out for proper alignment so no need to pack(1). */ typedef volatile struct hcr_regs { uint16_t USBCMD; uint16_t USBSTS; uint16_t USBINTR; uint16_t FRNUM; uint32_t FRBASEADD; uchar_t SOFMOD; uchar_t rsvd[3]; uint16_t PORTSC[2]; } hc_regs_t; /* * #defines for the USB Command Register */ #define USBCMD_REG_MAXPKT_64 0x0080 #define USBCMD_REG_CONFIG_FLAG 0x0040 #define USBCMD_REG_SW_DEBUG 0x0020 #define USBCMD_REG_FGBL_RESUME 0x0010 #define USBCMD_REG_ENER_GBL_SUSPEND 0x0008 #define USBCMD_REG_GBL_RESET 0x0004 #define USBCMD_REG_HC_RESET 0x0002 #define USBCMD_REG_HC_RUN 0x0001 /* * #defines for the USB Status Register */ #define USBSTS_REG_HC_HALTED 0x0020 #define USBSTS_REG_HC_PROCESS_ERR 0x0010 #define USBSTS_REG_HOST_SYS_ERR 0x0008 #define USBSTS_REG_RESUME_DETECT 0x0004 #define USBSTS_REG_USB_ERR_INTR 0x0002 #define USBSTS_REG_USB_INTR 0x0001 /* * #defines for the USB Root Hub Port Register */ #define HCR_PORT_CCS 0x1 #define HCR_PORT_CSC 0x2 #define HCR_PORT_ENABLE 0x4 #define HCR_PORT_ENDIS_CHG 0x8 #define HCR_PORT_LINE_STATSU 0x30 #define HCR_PORT_RESUME_DETECT 0x40 #define HCR_PORT_LSDA 0x100 #define HCR_PORT_RESET 0x200 #define HCR_PORT_SUSPEND 0x1000 /* * #defines for USB Interrupt Enable Register */ #define USBINTR_REG_SPINT_EN 0x0008 #define USBINTR_REG_IOC_EN 0x0004 #define USBINTR_REG_RESUME_INT_EN 0x0002 #define USBINTR_REG_TOCRC_INT_EN 0x0001 #define ENABLE_ALL_INTRS 0x000F #define DISABLE_ALL_INTRS 0x0000 #define UHCI_INTR_MASK 0x3f #define SetReg32(hndl, addr, val) ddi_put32((hndl), \ &(addr), (val)) #define GetReg32(hndl, addr) ddi_get32((hndl), &(addr)) #define SetQH32(ucp, addr, val) \ SetReg32((ucp)->uhci_qh_pool_mem_handle, (addr), (val)) #define GetQH32(ucp, addr) \ GetReg32((ucp)->uhci_qh_pool_mem_handle, (addr)) #define SetTD32(ucp, addr, val) \ SetReg32((ucp)->uhci_td_pool_mem_handle, (addr), (val)) #define GetTD32(ucp, addr) \ GetReg32((ucp)->uhci_td_pool_mem_handle, (addr)) #define SetFL32(ucp, addr, val) \ SetReg32((ucp)->uhci_flt_mem_handle, (addr), (val)) #define GetFL32(ucp, addr) \ GetReg32((ucp)->uhci_flt_mem_handle, (addr)) /* * UHCI Queue Head structure, aligned on 16 byte boundary */ typedef struct uhci_qh { /* Hardware controlled bits */ uint32_t link_ptr; /* Next Queue Head / TD */ uint32_t element_ptr; /* Next queue head / TD */ /* Software controlled bits */ uint16_t node; /* Node that its attached */ uint16_t qh_flag; /* See below */ struct uhci_qh *prev_qh; /* Pointer to Prev queue head */ struct uhci_td *td_tailp; /* Pointer to the last TD of QH */ struct uhci_bulk_isoc_xfer_info *bulk_xfer_info; uint64_t __pad1; /* align to 16 bytes */ } queue_head_t; #define NUM_STATIC_NODES 63 #define NUM_INTR_QH_LISTS 64 #define NUM_FRAME_LST_ENTRIES 1024 #define TREE_HEIGHT 5 #define VIRTUAL_TREE_HEIGHT 5 #define SIZE_OF_FRAME_LST_TABLE 1024 * 4 #define HC_TD_HEAD 0x0 #define HC_QUEUE_HEAD 0x2 #define HC_DEPTH_FIRST 0x4 #define HC_END_OF_LIST 0x1 #define QUEUE_HEAD_FLAG_STATIC 0x1 #define QUEUE_HEAD_FLAG_FREE 0x2 #define QUEUE_HEAD_FLAG_BUSY 0x3 #define QH_LINK_PTR_MASK 0xFFFFFFF0 #define QH_ELEMENT_PTR_MASK 0xFFFFFFF0 #define FRAME_LST_PTR_MASK 0xFFFFFFF0 #define GetField(u, td, f, o, l) \ ((GetTD32(u, (td)->f) >> (o)) & ((1U<f, \ (GetTD32(u, (td)->f) & ~(((1U<