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_H 270Sstevel@tonic-gate #define _SYS_USB_EHCI_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 * Enhanced 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 registers and data structures shared by 420Sstevel@tonic-gate * the EHCI USB controller (HC) and the EHCI Driver. 430Sstevel@tonic-gate */ 440Sstevel@tonic-gate 450Sstevel@tonic-gate #include <sys/types.h> 460Sstevel@tonic-gate #include <sys/pci.h> 470Sstevel@tonic-gate #include <sys/sunddi.h> 480Sstevel@tonic-gate #include <sys/sunndi.h> 490Sstevel@tonic-gate #include <sys/ndi_impldefs.h> 500Sstevel@tonic-gate #include <sys/disp.h> 510Sstevel@tonic-gate 520Sstevel@tonic-gate #include <sys/usb/usba.h> 530Sstevel@tonic-gate 540Sstevel@tonic-gate #include <sys/usb/usba/hcdi.h> 550Sstevel@tonic-gate 560Sstevel@tonic-gate #include <sys/usb/hubd/hub.h> 570Sstevel@tonic-gate #include <sys/usb/usba/hubdi.h> 580Sstevel@tonic-gate #include <sys/usb/hubd/hubdvar.h> 590Sstevel@tonic-gate 600Sstevel@tonic-gate #include <sys/id32.h> 610Sstevel@tonic-gate 620Sstevel@tonic-gate #define EHCI_MAX_RH_PORTS 31 /* Maximum root hub ports */ 630Sstevel@tonic-gate 640Sstevel@tonic-gate 650Sstevel@tonic-gate /* 660Sstevel@tonic-gate * Each EHCI buffer can hold upto 4k bytes of data. Hence there is a 670Sstevel@tonic-gate * restriction of 4k alignment while allocating a dma buffer. 680Sstevel@tonic-gate */ 690Sstevel@tonic-gate #define EHCI_4K_ALIGN 0x1000 700Sstevel@tonic-gate 710Sstevel@tonic-gate /* 720Sstevel@tonic-gate * USB Host controller DMA scatter gather list defines for 730Sstevel@tonic-gate * Sparc and non-sparc architectures. 740Sstevel@tonic-gate */ 750Sstevel@tonic-gate #if defined(__sparc) 760Sstevel@tonic-gate #define EHCI_DMA_ATTR_MAX_XFER 0xffffffffull 770Sstevel@tonic-gate #define EHCI_DMA_ATTR_COUNT_MAX 0xffffffffull 780Sstevel@tonic-gate #define EHCI_DMA_ATTR_GRANULAR 512 790Sstevel@tonic-gate #define EHCI_DMA_ATTR_ALIGNMENT EHCI_4K_ALIGN 800Sstevel@tonic-gate #else 810Sstevel@tonic-gate #define EHCI_DMA_ATTR_MAX_XFER 0x00ffffffull 820Sstevel@tonic-gate #define EHCI_DMA_ATTR_COUNT_MAX 0x00ffffffull 830Sstevel@tonic-gate #define EHCI_DMA_ATTR_GRANULAR 1 841500Ssl147100 #define EHCI_DMA_ATTR_ALIGNMENT EHCI_4K_ALIGN 850Sstevel@tonic-gate #endif 860Sstevel@tonic-gate 870Sstevel@tonic-gate /* Set the default data structure (QTD,QH,SITD,ITD) to a 32 byte alignment */ 880Sstevel@tonic-gate #define EHCI_DMA_ATTR_TD_QH_ALIGNMENT 0x0020 890Sstevel@tonic-gate #define EHCI_DMA_ATTR_PFL_ALIGNMENT EHCI_4K_ALIGN 900Sstevel@tonic-gate 911500Ssl147100 /* TW scatter/gatter list defines */ 921500Ssl147100 #define EHCI_DMA_ATTR_TW_SGLLEN 0x7fffffff 931500Ssl147100 940Sstevel@tonic-gate /* 950Sstevel@tonic-gate * EHCI Capability Registers 960Sstevel@tonic-gate * 970Sstevel@tonic-gate * The registers specify the limits, restrictions and capabilities of the 980Sstevel@tonic-gate * specific EHCI Host Controller implementation. 990Sstevel@tonic-gate */ 1000Sstevel@tonic-gate typedef volatile struct ehci_caps { 1010Sstevel@tonic-gate uint8_t ehci_caps_length; /* Capability register length */ 1020Sstevel@tonic-gate uint8_t ehci_pad; /* Reserved */ 1030Sstevel@tonic-gate uint16_t ehci_version; /* Interface version number */ 1040Sstevel@tonic-gate uint32_t ehci_hcs_params; /* Structural paramters */ 1050Sstevel@tonic-gate uint32_t ehci_hcc_params; /* Capability paramters */ 1060Sstevel@tonic-gate uint8_t ehci_port_route[8]; /* Companion port route */ 1070Sstevel@tonic-gate } ehci_caps_t; 1080Sstevel@tonic-gate 1090Sstevel@tonic-gate /* 1100Sstevel@tonic-gate * EHCI revision 1110Sstevel@tonic-gate * 1120Sstevel@tonic-gate * EHCI driver supports EHCI host controllers compliant to 0.95 and higher 1130Sstevel@tonic-gate * revisions of EHCI specifications. 1140Sstevel@tonic-gate */ 1150Sstevel@tonic-gate #define EHCI_REVISION_0_95 0x95 /* Revision 0.95 */ 1160Sstevel@tonic-gate 1170Sstevel@tonic-gate /* EHCI HCS Params Register Bits */ 1180Sstevel@tonic-gate #define EHCI_HCS_PORT_INDICATOR 0x00010000 /* Port indicator control */ 1190Sstevel@tonic-gate #define EHCI_HCS_NUM_COMP_CTRLS 0x0000F000 /* No of companion ctrls */ 1200Sstevel@tonic-gate #define EHCI_HCS_NUM_COMP_CTRL_SHIFT 12 1210Sstevel@tonic-gate #define EHCI_HCS_NUM_PORTS_CC 0x00000F00 /* Ports per classic ctrls */ 1220Sstevel@tonic-gate #define EHCI_HCS_NUM_PORTS_CC_SHIFT 8 1230Sstevel@tonic-gate #define EHCI_HCS_PORT_ROUTING_RULES 0x00000080 /* Port routing rules */ 1240Sstevel@tonic-gate #define EHCI_HCS_PORT_POWER_CONTROL 0x00000010 /* Port power control */ 1250Sstevel@tonic-gate #define EHCI_HCS_NUM_PORTS 0x0000000F /* No of root hub ports */ 1260Sstevel@tonic-gate 1270Sstevel@tonic-gate /* EHCI HCC Params Register Bits */ 1280Sstevel@tonic-gate #define EHCI_HCC_EECP 0x0000FF00 /* Extended capbilities */ 1290Sstevel@tonic-gate #define EHCI_HCC_EECP_SHIFT 8 1300Sstevel@tonic-gate #define EHCI_HCC_EECP_MIN_OFFSET 0x00000040 /* Minimum valid offset */ 1310Sstevel@tonic-gate #define EHCI_HCC_ISOCH_SCHED_THRESHOLD 0x000000F0 /* Isoch sched threshold */ 1320Sstevel@tonic-gate #define EHCI_HCC_ASYNC_SCHED_PARK_CAP 0x00000004 /* Async schedule park cap */ 1330Sstevel@tonic-gate #define EHCI_HCC_PROG_FRAME_LIST_FLAG 0x00000002 /* Prog frame list flag */ 1340Sstevel@tonic-gate #define EHCI_HCC_64BIT_ADDR_CAP 0x00000001 /* 64bit addr capability */ 1350Sstevel@tonic-gate 1360Sstevel@tonic-gate /* EHCI Port Route Register Bits */ 1370Sstevel@tonic-gate #define EHCI_PORT_ROUTE_EVEN 0x0F /* Classic even port route */ 1380Sstevel@tonic-gate #define EHCI_PORT_ROUTE_ODD 0xF0 /* Classic odd port route */ 1390Sstevel@tonic-gate #define EHCI_PORT_ROUTE_ODD_SHIFT 4 1400Sstevel@tonic-gate 1410Sstevel@tonic-gate 1420Sstevel@tonic-gate /* 1430Sstevel@tonic-gate * EHCI Operational Registers 1440Sstevel@tonic-gate * 1450Sstevel@tonic-gate * The EHCI Host Controller contains a set of on-chip operational registers 1460Sstevel@tonic-gate * which are mapped into a non-cacheable portion of the system addressable 1470Sstevel@tonic-gate * space. These registers are also used by the EHCI Host Controller Driver. 1480Sstevel@tonic-gate * This structure must be aligned to 32 byte boundary. 1490Sstevel@tonic-gate */ 1500Sstevel@tonic-gate typedef volatile struct ehci_regs { 1510Sstevel@tonic-gate /* Control and status registers */ 1520Sstevel@tonic-gate uint32_t ehci_command; /* USB commands */ 1530Sstevel@tonic-gate uint32_t ehci_status; /* USB status */ 1540Sstevel@tonic-gate uint32_t ehci_interrupt; /* Interrupt enable */ 1550Sstevel@tonic-gate uint32_t ehci_frame_index; /* Frame index */ 1560Sstevel@tonic-gate 1570Sstevel@tonic-gate /* Memory pointer registers */ 1580Sstevel@tonic-gate uint32_t ehci_ctrl_segment; /* Control data segment */ 1590Sstevel@tonic-gate uint32_t ehci_periodic_list_base; /* Period frm list base addr */ 1600Sstevel@tonic-gate uint32_t ehci_async_list_addr; /* Async list base address */ 1610Sstevel@tonic-gate uint32_t ehci_pad[9]; /* Head of the bulk list */ 1620Sstevel@tonic-gate 1630Sstevel@tonic-gate /* Root hub registers */ 1640Sstevel@tonic-gate uint32_t ehci_config_flag; /* Config Flag */ 1650Sstevel@tonic-gate uint32_t ehci_rh_port_status[EHCI_MAX_RH_PORTS]; 1660Sstevel@tonic-gate /* Root hub port status and control information */ 1670Sstevel@tonic-gate } ehci_regs_t; 1680Sstevel@tonic-gate 1690Sstevel@tonic-gate /* EHCI Command Register Bits */ 1700Sstevel@tonic-gate #define EHCI_CMD_INTR_THRESHOLD 0x00FF0000 /* Intr threshold control */ 1710Sstevel@tonic-gate #define EHCI_CMD_INTR_SHIFT 16 1720Sstevel@tonic-gate #define EHCI_CMD_01_INTR 0x00010000 /* 01 micro-frame */ 1730Sstevel@tonic-gate #define EHCI_CMD_02_INTR 0x00020000 /* 02 micro-frames */ 1740Sstevel@tonic-gate #define EHCI_CMD_04_INTR 0x00040000 /* 04 micro-frames */ 1750Sstevel@tonic-gate #define EHCI_CMD_08_INTR 0x00080000 /* 08 micro-frames */ 1760Sstevel@tonic-gate #define EHCI_CMD_16_INTR 0x00100000 /* 16 micro-frames */ 1770Sstevel@tonic-gate #define EHCI_CMD_32_INTR 0x00200000 /* 32 micro-frames */ 1780Sstevel@tonic-gate #define EHCI_CMD_64_INTR 0x00400000 /* 64 micro-frames */ 1790Sstevel@tonic-gate 1800Sstevel@tonic-gate #define EHCI_CMD_ASYNC_PARK_ENABLE 0x00000800 /* Async sched park enable */ 1810Sstevel@tonic-gate #define EHCI_CMD_ASYNC_PARK_COUNT 0x00000300 /* Async sched park count */ 1820Sstevel@tonic-gate #define EHCI_CMD_ASYNC_PARK_COUNT_1 0x00000100 /* Async sched park cnt 1 */ 1830Sstevel@tonic-gate #define EHCI_CMD_ASYNC_PARK_COUNT_2 0x00000200 /* Async sched park cnt 2 */ 1840Sstevel@tonic-gate #define EHCI_CMD_ASYNC_PARK_COUNT_3 0x00000300 /* Async sched park cnt 3 */ 1850Sstevel@tonic-gate #define EHCI_CMD_ASYNC_PARK_SHIFT 8 1860Sstevel@tonic-gate #define EHCI_CMD_LIGHT_HC_RESET 0x00000080 /* Light host ctrl reset */ 1870Sstevel@tonic-gate #define EHCI_CMD_INTR_ON_ASYNC_ADVANCE 0x00000040 /* Async advance doorbell */ 1880Sstevel@tonic-gate #define EHCI_CMD_ASYNC_SCHED_ENABLE 0x00000020 /* Async schedule enable */ 1890Sstevel@tonic-gate #define EHCI_CMD_PERIODIC_SCHED_ENABLE 0x00000010 /* Periodic sched enable */ 1900Sstevel@tonic-gate #define EHCI_CMD_FRAME_LIST_SIZE 0x0000000C /* Frame list size */ 1910Sstevel@tonic-gate #define EHCI_CMD_FRAME_LIST_SIZE_SHIFT 2 1920Sstevel@tonic-gate #define EHCI_CMD_FRAME_1024_SIZE 0x00000000 /* 1024 frame list size */ 1930Sstevel@tonic-gate #define EHCI_CMD_FRAME_512_SIZE 0x00000004 /* 512 frame list size */ 1940Sstevel@tonic-gate #define EHCI_CMD_FRAME_256_SIZE 0X00000008 /* 256 frame list size */ 1950Sstevel@tonic-gate #define EHCI_CMD_HOST_CTRL_RESET 0x00000002 /* Host controller reset */ 1960Sstevel@tonic-gate #define EHCI_CMD_HOST_CTRL_RS 0x00000001 /* Host ctrl run or stop */ 1970Sstevel@tonic-gate #define EHCI_CMD_HOST_CTRL_RUN 0x00000001 /* Host controller run */ 1980Sstevel@tonic-gate #define EHCI_CMD_HOST_CTRL_STOP 0x00000000 /* Host controller stop */ 1990Sstevel@tonic-gate 2000Sstevel@tonic-gate /* EHCI Status Register Bits */ 2010Sstevel@tonic-gate #define EHCI_STS_ASYNC_SCHED_STATUS 0x00008000 /* Async schedule status */ 2020Sstevel@tonic-gate #define EHCI_STS_PERIODIC_SCHED_STATUS 0x00004000 /* Periodic sched status */ 2030Sstevel@tonic-gate #define EHCI_STS_EMPTY_ASYNC_SCHEDULE 0x00002000 /* Empty async schedule */ 2040Sstevel@tonic-gate #define EHCI_STS_HOST_CTRL_HALTED 0x00001000 /* Host controller Halted */ 2050Sstevel@tonic-gate #define EHCI_STS_ASYNC_ADVANCE_INTR 0x00000020 /* Intr on async advance */ 2060Sstevel@tonic-gate #define EHCI_STS_HOST_SYSTEM_ERROR_INTR 0x00000010 /* Host system error */ 2070Sstevel@tonic-gate #define EHCI_STS_FRM_LIST_ROLLOVER_INTR 0x00000008 /* Frame list rollover */ 2080Sstevel@tonic-gate #define EHCI_STS_RH_PORT_CHANGE_INTR 0x00000004 /* Port change detect */ 2090Sstevel@tonic-gate #define EHCI_STS_USB_ERROR_INTR 0x00000002 /* USB error interrupt */ 2100Sstevel@tonic-gate #define EHCI_STS_USB_INTR 0x00000001 /* USB interrupt */ 2110Sstevel@tonic-gate 2120Sstevel@tonic-gate /* EHCI Interrupt Register Bits */ 2130Sstevel@tonic-gate #define EHCI_INTR_ASYNC_ADVANCE 0x00000020 /* Async advance interrupt */ 2140Sstevel@tonic-gate #define EHCI_INTR_HOST_SYSTEM_ERROR 0x00000010 /* Host system error intr */ 2150Sstevel@tonic-gate #define EHCI_INTR_FRAME_LIST_ROLLOVER 0x00000008 /* Framelist rollover intr */ 2160Sstevel@tonic-gate #define EHCI_INTR_RH_PORT_CHANGE 0x00000004 /* Port change interrupt */ 2170Sstevel@tonic-gate #define EHCI_INTR_USB_ERROR 0x00000002 /* USB error interrupt */ 2180Sstevel@tonic-gate #define EHCI_INTR_USB 0x00000001 /* USB interrupt */ 2190Sstevel@tonic-gate 2200Sstevel@tonic-gate /* EHCI Frame Index Register Bits */ 2210Sstevel@tonic-gate #define EHCI_FRAME_INDEX 0x00003FFF /* Frame index */ 2220Sstevel@tonic-gate #define EHCI_FRAME_1024 0x00003FFF /* 1024 elements */ 2230Sstevel@tonic-gate #define EHCI_FRAME_0512 0x00001FFF /* 512 elements */ 2240Sstevel@tonic-gate #define EHCI_FRAME_0256 0x00000FFF /* 256 elements */ 2250Sstevel@tonic-gate 2260Sstevel@tonic-gate /* EHCI Control Data Structure Segment Register Bits */ 2270Sstevel@tonic-gate /* Most significant 32 bits for all EHCI data structures in 64bit addressing */ 2280Sstevel@tonic-gate #define EHCI_CTRLD_SEGMENT 0xFFFFFFFF /* Control data segment */ 2290Sstevel@tonic-gate 2300Sstevel@tonic-gate /* EHCI Periodic Frame List Base Address Register Bits */ 2310Sstevel@tonic-gate #define EHCI_PERIODIC_LIST_BASE 0xFFFFF000 /* Periodic framelist addr */ 2320Sstevel@tonic-gate #define EHCI_PERIODIC_LIST_BASE_SHIFT 12 2330Sstevel@tonic-gate 2340Sstevel@tonic-gate /* EHCI Asynchronous List Address Register Bits */ 2350Sstevel@tonic-gate #define EHCI_ASYNC_LIST_ADDR 0xFFFFFFE0 /* Async list address */ 2360Sstevel@tonic-gate #define EHCI_ASYNC_LIST_ADDR_SHIFT 5 2370Sstevel@tonic-gate 2380Sstevel@tonic-gate /* EHCI Config Flag Register Bits */ 2390Sstevel@tonic-gate #define EHCI_CONFIG_FLAG 0x00000001 /* Route host controllers */ 2400Sstevel@tonic-gate #define EHCI_CONFIG_FLAG_CLASSIC 0x00000000 /* Route to Classic ctrl */ 2410Sstevel@tonic-gate #define EHCI_CONFIG_FLAG_EHCI 0x00000001 /* Route to EHCI ctrl */ 2420Sstevel@tonic-gate 2430Sstevel@tonic-gate /* EHCI Root Hub Port Status and Control Register Bits */ 2440Sstevel@tonic-gate #define EHCI_RH_PORT_OVER_CURENT_ENABLE 0x00400000 /* Over current enable */ 2450Sstevel@tonic-gate #define EHCI_RH_PORT_DISCONNECT_ENABLE 0x00200000 /* Disconnect enable */ 2460Sstevel@tonic-gate #define EHCI_RH_PORT_CONNECT_ENABLE 0x00100000 /* Connect enable */ 2470Sstevel@tonic-gate #define EHCI_RH_PORT_INDICATOR 0x0000C000 /* Port indicator control */ 2480Sstevel@tonic-gate #define EHCI_RH_PORT_IND_SHIFT 14 2490Sstevel@tonic-gate #define EHCI_RH_PORT_IND_OFF 0x00000000 /* Port indicators off */ 2500Sstevel@tonic-gate #define EHCI_RH_PORT_IND_AMBER 0x00004000 /* Amber port indicator */ 2510Sstevel@tonic-gate #define EHCI_RH_PORT_IND_GREEN 0x00008000 /* Green port indicator */ 2520Sstevel@tonic-gate #define EHCI_RH_PORT_OWNER 0x00002000 /* Port ownership */ 2530Sstevel@tonic-gate #define EHCI_RH_PORT_OWNER_CLASSIC 0x00002000 /* Classic port ownership */ 2540Sstevel@tonic-gate #define EHCI_RH_PORT_OWNER_EHCI 0x00000000 /* EHCI port ownership */ 2550Sstevel@tonic-gate #define EHCI_RH_PORT_POWER 0x00001000 /* Port power */ 2560Sstevel@tonic-gate #define EHCI_RH_PORT_LINE_STATUS 0x00000C00 /* USB speed line status */ 2570Sstevel@tonic-gate #define EHCI_RH_PORT_LOW_SPEED 0x00000400 /* Low speed */ 2580Sstevel@tonic-gate #define EHCI_RH_PORT_RESET 0x00000100 /* Port reset */ 2590Sstevel@tonic-gate #define EHCI_RH_PORT_SUSPEND 0x00000080 /* Port suspend */ 2600Sstevel@tonic-gate #define EHCI_RH_PORT_RESUME 0x00000040 /* Port resume */ 2610Sstevel@tonic-gate #define EHCI_RH_PORT_OVER_CURR_CHANGE 0x00000020 /* Over current change */ 2620Sstevel@tonic-gate #define EHCI_RH_PORT_OVER_CURR_ACTIVE 0x00000010 /* Over current active */ 2630Sstevel@tonic-gate #define EHCI_RH_PORT_ENABLE_CHANGE 0x00000008 /* Port enable change */ 2640Sstevel@tonic-gate #define EHCI_RH_PORT_ENABLE 0x00000004 /* Port enable */ 2650Sstevel@tonic-gate #define EHCI_RH_PORT_CONNECT_STS_CHANGE 0x00000002 /* Connect status change */ 2660Sstevel@tonic-gate #define EHCI_RH_PORT_CONNECT_STATUS 0x00000001 /* Connect status */ 2670Sstevel@tonic-gate 2680Sstevel@tonic-gate /* Root hub port change bits mask */ 2690Sstevel@tonic-gate #define EHCI_RH_PORT_CLEAR_MASK 0x0000002A /* Clear bits mask */ 2700Sstevel@tonic-gate 2710Sstevel@tonic-gate 2720Sstevel@tonic-gate /* 2730Sstevel@tonic-gate * EHCI Extended Capability Registers 2740Sstevel@tonic-gate * 2750Sstevel@tonic-gate * Currently this register only specifies BIOS handoff information. 2760Sstevel@tonic-gate */ 2770Sstevel@tonic-gate #define EHCI_EX_CAP_SPECIFICS 0xFFFF0000 2780Sstevel@tonic-gate #define EHCI_EX_CAP_SPECIFICS_SHIFT 16 2790Sstevel@tonic-gate #define EHCI_EX_CAP_NEXT_PTR 0x0000FF00 2800Sstevel@tonic-gate #define EHCI_EX_CAP_NEXT_PTR_SHIFT 8 2810Sstevel@tonic-gate #define EHCI_EX_CAP_ID 0x000000FF 2820Sstevel@tonic-gate #define EHCI_EX_CAP_ID_SHIFT 0 2830Sstevel@tonic-gate #define EHCI_EX_CAP_ID_BIOS_HANDOFF 1 2840Sstevel@tonic-gate 2850Sstevel@tonic-gate #define EHCI_LEGSUP_OS_OWNED_SEM 0x01000000 2860Sstevel@tonic-gate #define EHCI_LEGSUP_BIOS_OWNED_SEM 0x00010000 2870Sstevel@tonic-gate 2880Sstevel@tonic-gate 2890Sstevel@tonic-gate /* 2900Sstevel@tonic-gate * Host Controller Periodic Frame List Area 2910Sstevel@tonic-gate * 2920Sstevel@tonic-gate * The Host Controller Periodic Frame List Area is a 4K structre of system 2930Sstevel@tonic-gate * memory that is established by the Host Controller Driver (HCD) and this 2940Sstevel@tonic-gate * structre is used for communication between HCD and HC. The HCD maintains 2950Sstevel@tonic-gate * a pointer to this structure in the Host Controller (HC). This structure 2960Sstevel@tonic-gate * must be aligned to a 4K boundary. There are 1024 periodic frame list 2970Sstevel@tonic-gate * entries. 2980Sstevel@tonic-gate */ 2990Sstevel@tonic-gate 3000Sstevel@tonic-gate #define EHCI_NUM_INTR_QH_LISTS 32 /* No of intr lists */ 3010Sstevel@tonic-gate #define EHCI_NUM_STATIC_NODES 63 /* No of static QHs */ 3020Sstevel@tonic-gate #define EHCI_NUM_PERIODIC_FRAME_LISTS 1024 /* No of entries */ 3030Sstevel@tonic-gate 3040Sstevel@tonic-gate typedef volatile struct ehci_periodic_frame_list { 3050Sstevel@tonic-gate uint32_t ehci_periodic_frame_list_table[ 3060Sstevel@tonic-gate EHCI_NUM_PERIODIC_FRAME_LISTS]; /* 1024 lists */ 3070Sstevel@tonic-gate } ehci_periodic_frame_list_t; 3080Sstevel@tonic-gate 3090Sstevel@tonic-gate 3100Sstevel@tonic-gate /* 3110Sstevel@tonic-gate * Host Controller Queue Head 3120Sstevel@tonic-gate * 3130Sstevel@tonic-gate * An Queue Head (QH) is a memory structure that describes the information 3140Sstevel@tonic-gate * necessary for the Host Controller to communicate with a device endpoint 3150Sstevel@tonic-gate * except High Speed and Full Speed Isochronous's endpoints. An QH includes 3160Sstevel@tonic-gate * a Queue Element Transfer Descriptor (QTD) pointer. This structure must 3170Sstevel@tonic-gate * be aligned to a 32 byte boundary. 3180Sstevel@tonic-gate */ 3190Sstevel@tonic-gate typedef volatile struct ehci_qh { 3200Sstevel@tonic-gate /* Endpoint capabilities or characteristics */ 3210Sstevel@tonic-gate uint32_t qh_link_ptr; /* Next QH or ITD or SITD */ 3220Sstevel@tonic-gate uint32_t qh_ctrl; /* Generic control information */ 3230Sstevel@tonic-gate uint32_t qh_split_ctrl; /* Split transaction control info */ 3240Sstevel@tonic-gate uint32_t qh_curr_qtd; /* Current QTD */ 3250Sstevel@tonic-gate 3260Sstevel@tonic-gate /* Tranfer overlay */ 3270Sstevel@tonic-gate uint32_t qh_next_qtd; /* Next QTD */ 3280Sstevel@tonic-gate uint32_t qh_alt_next_qtd; /* Next alternate QTD */ 3290Sstevel@tonic-gate uint32_t qh_status; /* Status of current QTD */ 3300Sstevel@tonic-gate uint32_t qh_buf[5]; /* Buffer pointers */ 3310Sstevel@tonic-gate uint32_t qh_buf_high[5]; /* For 64 bit addressing */ 3320Sstevel@tonic-gate 3330Sstevel@tonic-gate /* HCD private fields */ 3340Sstevel@tonic-gate uint32_t qh_dummy_qtd; /* Current dummy qtd */ 3350Sstevel@tonic-gate uint32_t qh_prev; /* Prevous QH */ 3360Sstevel@tonic-gate uint32_t qh_state; /* QH's state */ 3370Sstevel@tonic-gate uint32_t qh_reclaim_next; /* Next QH on reclaim list */ 3380Sstevel@tonic-gate uint32_t qh_reclaim_frame; /* Reclaim usb frame number */ 3390Sstevel@tonic-gate uint8_t qh_pad[8]; /* Required padding */ 3400Sstevel@tonic-gate } ehci_qh_t; 3410Sstevel@tonic-gate 3420Sstevel@tonic-gate /* 3430Sstevel@tonic-gate * qh_link_ptr control bits. 3440Sstevel@tonic-gate */ 3450Sstevel@tonic-gate #define EHCI_QH_LINK_PTR 0xFFFFFFE0 /* QH link ptr mask */ 3460Sstevel@tonic-gate #define EHCI_QH_LINK_REF 0x00000006 /* Ref to QH/ITD/SITD */ 3470Sstevel@tonic-gate #define EHCI_QH_LINK_REF_ITD 0x00000000 /* Isoch QTD pointer */ 3480Sstevel@tonic-gate #define EHCI_QH_LINK_REF_QH 0x00000002 /* QH pointer */ 3490Sstevel@tonic-gate #define EHCI_QH_LINK_REF_SITD 0x00000004 /* SIQTD pointer */ 3500Sstevel@tonic-gate #define EHCI_QH_LINK_REF_FSTN 0x00000006 /* FSTN pointer */ 3510Sstevel@tonic-gate #define EHCI_QH_LINK_PTR_VALID 0x00000001 /* Link ptr validity */ 3520Sstevel@tonic-gate 3530Sstevel@tonic-gate /* 3540Sstevel@tonic-gate * qh_ctrl control bits. 3550Sstevel@tonic-gate */ 3560Sstevel@tonic-gate #define EHCI_QH_CTRL_NC_RL 0xF0000000 /* Nak count reload */ 3570Sstevel@tonic-gate #define EHCI_QH_CTRL_NC_RL_SHIFT 28 /* NC reload shift */ 3580Sstevel@tonic-gate #define EHCI_QH_CTRL_MAX_NC 0xF0000000 /* Max Nak counts */ 3590Sstevel@tonic-gate #define EHCI_QH_CTRL_CONTROL_ED_FLAG 0x08000000 /* Ctrl endpoint flag */ 3600Sstevel@tonic-gate #define EHCI_QH_CTRL_MAXPKTSZ 0x07FF0000 /* Max packet length */ 3610Sstevel@tonic-gate #define EHCI_QH_CTRL_MAXPKTSZ_SHIFT 16 /* Max packet shift */ 3620Sstevel@tonic-gate #define EHCI_QH_CTRL_RECLAIM_HEAD 0x00008000 /* Head reclaim list */ 3630Sstevel@tonic-gate #define EHCI_QH_CTRL_DATA_TOGGLE 0x00004000 /* Data toggle */ 3640Sstevel@tonic-gate #define EHCI_QH_CTRL_ED_SPEED 0x00003000 /* Endpoint speed */ 3650Sstevel@tonic-gate #define EHCI_QH_CTRL_ED_FULL_SPEED 0x00000000 /* FullSpeed endpoint */ 3660Sstevel@tonic-gate #define EHCI_QH_CTRL_ED_LOW_SPEED 0x00001000 /* LowSpeed endpoint */ 3670Sstevel@tonic-gate #define EHCI_QH_CTRL_ED_HIGH_SPEED 0x00002000 /* HighSpeed endpoint */ 3680Sstevel@tonic-gate #define EHCI_QH_CTRL_ED_SPEED_SHIFT 12 /* ED speed shift */ 3690Sstevel@tonic-gate #define EHCI_QH_CTRL_ED_NUMBER 0x00000F00 /* Endpoint number */ 3700Sstevel@tonic-gate #define EHCI_QH_CTRL_ED_NUMBER_SHIFT 8 /* ED number shift */ 3710Sstevel@tonic-gate #define EHCI_QH_CTRL_ED_INACTIVATE 0x00000080 /* Inctivate endpoint */ 3720Sstevel@tonic-gate #define EHCI_QH_CTRL_DEVICE_ADDRESS 0x0000007F /* Device address */ 3730Sstevel@tonic-gate 3740Sstevel@tonic-gate /* 3750Sstevel@tonic-gate * q_split_ctrl control bits. 3760Sstevel@tonic-gate */ 3770Sstevel@tonic-gate #define EHCI_QH_SPLIT_CTRL_MULT 0xC0000000 /* HB multiplier */ 3780Sstevel@tonic-gate #define EHCI_QH_SPLIT_CTRL_MULT_SHIFT 30 /* HB mult Shift */ 3790Sstevel@tonic-gate #define EHCI_QH_SPLIT_CTRL_1_XACTS 0x40000000 /* 1 Xacts per uFrame */ 3800Sstevel@tonic-gate #define EHCI_QH_SPLIT_CTRL_2_XACTS 0x80000000 /* 2 Xacts per uFrame */ 3810Sstevel@tonic-gate #define EHCI_QH_SPLIT_CTRL_3_XACTS 0xC0000000 /* 3 Xacts per uFrame */ 3820Sstevel@tonic-gate #define EHCI_QH_SPLIT_CTRL_HUB_PORT 0x3F800000 /* HS hub port number */ 3830Sstevel@tonic-gate #define EHCI_QH_SPLIT_CTRL_HUB_PORT_SHIFT 23 /* HS hubport no shft */ 3840Sstevel@tonic-gate #define EHCI_QH_SPLIT_CTRL_HUB_ADDR 0x007F0000 /* HS hub address */ 3850Sstevel@tonic-gate #define EHCI_QH_SPLIT_CTRL_HUB_ADDR_SHIFT 16 /* HS hub addr mask */ 3860Sstevel@tonic-gate #define EHCI_QH_SPLIT_CTRL_COMP_MASK 0x0000FF00 /* Split comp mask */ 3870Sstevel@tonic-gate #define EHCI_QH_SPLIT_CTRL_COMP_SHIFT 8 /* Split comp shift */ 3880Sstevel@tonic-gate #define EHCI_QH_SPLIT_CTRL_INTR_MASK 0x000000FF /* Intr schedule mask */ 3890Sstevel@tonic-gate 3900Sstevel@tonic-gate /* 3910Sstevel@tonic-gate * qh_curr_qtd control bits. 3920Sstevel@tonic-gate */ 3930Sstevel@tonic-gate #define EHCI_QH_CURR_QTD_PTR 0xFFFFFFE0 /* Curr element QTD */ 3940Sstevel@tonic-gate 3950Sstevel@tonic-gate /* 3960Sstevel@tonic-gate * qh_next_qtd control bits. 3970Sstevel@tonic-gate */ 3980Sstevel@tonic-gate #define EHCI_QH_NEXT_QTD_PTR 0xFFFFFFE0 /* Next QTD */ 3990Sstevel@tonic-gate #define EHCI_QH_NEXT_QTD_PTR_VALID 0x00000001 /* Next QTD validity */ 4000Sstevel@tonic-gate 4010Sstevel@tonic-gate /* 4020Sstevel@tonic-gate * qh_alt_next_qtd control bits. 4030Sstevel@tonic-gate */ 4040Sstevel@tonic-gate #define EHCI_QH_ALT_NEXT_QTD_PTR 0xFFFFFFE0 /* Alternate next QTD */ 4050Sstevel@tonic-gate #define EHCI_QH_ALT_NEXT_QTD_PTR_VALID 0x00000001 /* Alt QTD validity */ 4060Sstevel@tonic-gate #define EHCI_QH_ALT_NEXT_QTD_NAKCNT 0x0000001E /* NAK counter */ 4070Sstevel@tonic-gate 4080Sstevel@tonic-gate /* 4090Sstevel@tonic-gate * qh_status control bits. 4100Sstevel@tonic-gate */ 4110Sstevel@tonic-gate #define EHCI_QH_STS_DATA_TOGGLE 0x80000000 /* Data toggle */ 4120Sstevel@tonic-gate #define EHCI_QH_STS_BYTES_TO_XFER 0x7FFF0000 /* Bytes to transfer */ 4130Sstevel@tonic-gate #define EHCI_QH_STS_BYTES_TO_XFER_SHIFT 16 /* Bytes to xfer mask */ 4140Sstevel@tonic-gate #define EHCI_QH_STS_INTR_ON_COMPLETE 0x00008000 /* Intr on complete */ 4150Sstevel@tonic-gate #define EHCI_QH_STS_C_PAGE 0x00007000 /* C page */ 4160Sstevel@tonic-gate #define EHCI_QH_STS_ERROR_COUNTER 0x00000C00 /* Error counter */ 4170Sstevel@tonic-gate #define EHCI_QH_STS_ERROR_COUNT_MASK 0x00000C00 /* Error count mask */ 4180Sstevel@tonic-gate #define EHCI_QH_STS_PID_CODE 0x00000300 /* PID code */ 4190Sstevel@tonic-gate #define EHCI_QH_STS_XACT_STATUS 0x000000FF /* Xact Status */ 4200Sstevel@tonic-gate #define EHCI_QH_STS_HS_XACT_STATUS 0x000000F8 /* HS Xact status */ 4210Sstevel@tonic-gate #define EHCI_QH_STS_NON_HS_XACT_STATUS 0x000000FD /* Non HS Xact status */ 4220Sstevel@tonic-gate #define EHCI_QH_STS_NO_ERROR 0x00000000 /* No error */ 4230Sstevel@tonic-gate #define EHCI_QH_STS_ACTIVE 0x00000080 /* Active */ 4240Sstevel@tonic-gate #define EHCI_QH_STS_HALTED 0x00000040 /* Halted */ 4250Sstevel@tonic-gate #define EHCI_QH_STS_DATA_BUFFER_ERR 0x00000020 /* Data buffer error */ 4260Sstevel@tonic-gate #define EHCI_QH_STS_BABBLE_DETECTED 0x00000010 /* Babble detected */ 4270Sstevel@tonic-gate #define EHCI_QH_STS_XACT_ERROR 0x00000008 /* Transaction error */ 4280Sstevel@tonic-gate #define EHCI_QH_STS_MISSED_uFRAME 0x00000004 /* Missed micro frame */ 4290Sstevel@tonic-gate #define EHCI_QH_STS_SPLIT_XSTATE 0x00000002 /* Split xact state */ 4300Sstevel@tonic-gate #define EHCI_QH_STS_DO_START_SPLIT 0x00000000 /* Do start split */ 4310Sstevel@tonic-gate #define EHCI_QH_STS_DO_COMPLETE_SPLIT 0x00000002 /* Do complete split */ 4320Sstevel@tonic-gate #define EHCI_QH_STS_PING_STATE 0x00000001 /* Ping state */ 4330Sstevel@tonic-gate #define EHCI_QH_STS_DO_OUT 0x00000000 /* Do OUT */ 4340Sstevel@tonic-gate #define EHCI_QH_STS_DO_PING 0x00000001 /* Do PING */ 4350Sstevel@tonic-gate #define EHCI_QH_STS_PRD_SPLIT_XACT_ERR 0x00000001 /* Periodic split err */ 4360Sstevel@tonic-gate 4370Sstevel@tonic-gate /* 4380Sstevel@tonic-gate * qh_buf[X] control bits. 4390Sstevel@tonic-gate */ 4400Sstevel@tonic-gate #define EHCI_QH_BUF_PTR 0xFFFFF000 /* Buffer pointer */ 4410Sstevel@tonic-gate #define EHCI_QH_BUF_CURR_OFFSET 0x00000FFF /* Current offset */ 4420Sstevel@tonic-gate #define EHCI_QH_BUF_CPROG_MASK 0x000000FF /* Split progress */ 4430Sstevel@tonic-gate #define EHCI_QH_BUF_SBYTES 0x00000FE0 /* Software S bytes */ 4440Sstevel@tonic-gate #define EHCI_QH_BUF_FRAME_TAG 0x0000001F /* Split xct frametag */ 4450Sstevel@tonic-gate 4460Sstevel@tonic-gate /* 4470Sstevel@tonic-gate * qh_buf_high[X] control bits. 4480Sstevel@tonic-gate */ 4490Sstevel@tonic-gate #define EHCI_QH_BUF_HIGH_PTR 0xFFFFFFFF /* For 64 addressing */ 4500Sstevel@tonic-gate 4510Sstevel@tonic-gate /* 4520Sstevel@tonic-gate * qh_state 4530Sstevel@tonic-gate * 4540Sstevel@tonic-gate * QH States 4550Sstevel@tonic-gate */ 4560Sstevel@tonic-gate #define EHCI_QH_FREE 1 /* Free QH */ 4570Sstevel@tonic-gate #define EHCI_QH_STATIC 2 /* Static QH */ 4580Sstevel@tonic-gate #define EHCI_QH_ACTIVE 3 /* Active QH */ 4590Sstevel@tonic-gate 4600Sstevel@tonic-gate 4610Sstevel@tonic-gate /* 4620Sstevel@tonic-gate * Host Controller Queue Element Transfer Descriptor 4630Sstevel@tonic-gate * 4640Sstevel@tonic-gate * A Queue Element Transfer Descriptor (QTD) is a memory structure that 4650Sstevel@tonic-gate * describes the information necessary for the Host Controller (HC) to 4660Sstevel@tonic-gate * transfer a block of data to or from a device endpoint except High 4670Sstevel@tonic-gate * Speed and Full Speed Isochronous's endpoints. These QTD's will be 4680Sstevel@tonic-gate * attached to a Queue Head (QH). This structure must be aligned to a 4690Sstevel@tonic-gate * 32 byte boundary. 4700Sstevel@tonic-gate */ 4710Sstevel@tonic-gate typedef volatile struct ehci_qtd { 4720Sstevel@tonic-gate uint32_t qtd_next_qtd; /* Next QTD */ 4730Sstevel@tonic-gate uint32_t qtd_alt_next_qtd; /* Next alternate QTD */ 4740Sstevel@tonic-gate uint32_t qtd_ctrl; /* Control information */ 4750Sstevel@tonic-gate uint32_t qtd_buf[5]; /* Buffer pointers */ 4760Sstevel@tonic-gate uint32_t qtd_buf_high[5]; /* For 64 bit addressing */ 4770Sstevel@tonic-gate 4780Sstevel@tonic-gate /* HCD private fields */ 4790Sstevel@tonic-gate uint32_t qtd_trans_wrapper; /* Transfer wrapper */ 4800Sstevel@tonic-gate uint32_t qtd_tw_next_qtd; /* Next qtd on TW */ 4810Sstevel@tonic-gate uint32_t qtd_active_qtd_next; /* Next QTD on active list */ 4820Sstevel@tonic-gate uint32_t qtd_active_qtd_prev; /* Prev QTD on active list */ 4830Sstevel@tonic-gate uint32_t qtd_state; /* QTD state */ 4840Sstevel@tonic-gate uint32_t qtd_ctrl_phase; /* Control xfer phase info */ 4851500Ssl147100 uint32_t qtd_xfer_offs; /* Starting buffer offset */ 4860Sstevel@tonic-gate uint32_t qtd_xfer_len; /* Transfer length */ 4870Sstevel@tonic-gate uint8_t qtd_pad[12]; /* Required padding */ 4880Sstevel@tonic-gate } ehci_qtd_t; 4890Sstevel@tonic-gate 4900Sstevel@tonic-gate /* 4910Sstevel@tonic-gate * qtd_next_qtd control bits. 4920Sstevel@tonic-gate */ 4930Sstevel@tonic-gate #define EHCI_QTD_NEXT_QTD_PTR 0xFFFFFFE0 /* Next QTD pointer */ 4940Sstevel@tonic-gate #define EHCI_QTD_NEXT_QTD_PTR_VALID 0x00000001 /* Next QTD validity */ 4950Sstevel@tonic-gate 4960Sstevel@tonic-gate /* 4970Sstevel@tonic-gate * qtd_alt_next_qtd control bits. 4980Sstevel@tonic-gate */ 4990Sstevel@tonic-gate #define EHCI_QTD_ALT_NEXT_QTD_PTR 0xFFFFFFE0 /* Alt QTD pointer */ 5000Sstevel@tonic-gate #define EHCI_QTD_ALT_NEXT_QTD_PTR_VALID 0x00000001 /* Alt QTD validity */ 5010Sstevel@tonic-gate 5020Sstevel@tonic-gate /* 5030Sstevel@tonic-gate * qtd_ctrl control bits. 5040Sstevel@tonic-gate */ 5050Sstevel@tonic-gate #define EHCI_QTD_CTRL_DATA_TOGGLE 0x80000000 /* Data toggle */ 5060Sstevel@tonic-gate #define EHCI_QTD_CTRL_DATA_TOGGLE_0 0x00000000 /* Data toggle 0 */ 5070Sstevel@tonic-gate #define EHCI_QTD_CTRL_DATA_TOGGLE_1 0x80000000 /* Data toggle 1 */ 5080Sstevel@tonic-gate #define EHCI_QTD_CTRL_BYTES_TO_XFER 0x7FFF0000 /* Bytes to xfer */ 5090Sstevel@tonic-gate #define EHCI_QTD_CTRL_BYTES_TO_XFER_SHIFT 16 /* Bytes xfer mask */ 5100Sstevel@tonic-gate #define EHCI_QTD_CTRL_INTR_ON_COMPLETE 0x00008000 /* Intr on complete */ 5110Sstevel@tonic-gate #define EHCI_QTD_CTRL_C_PAGE 0x00007000 /* Current page */ 5120Sstevel@tonic-gate #define EHCI_QTD_CTRL_MAX_ERR_COUNTS 0x00000C00 /* Max error counts */ 5130Sstevel@tonic-gate #define EHCI_QTD_CTRL_PID_CODE 0x00000300 /* PID code */ 5140Sstevel@tonic-gate #define EHCI_QTD_CTRL_OUT_PID 0x00000000 /* OUT token */ 5150Sstevel@tonic-gate #define EHCI_QTD_CTRL_IN_PID 0x00000100 /* IN token */ 5160Sstevel@tonic-gate #define EHCI_QTD_CTRL_SETUP_PID 0x00000200 /* SETUP token */ 5170Sstevel@tonic-gate #define EHCI_QTD_CTRL_XACT_STATUS 0x000000FF /* Xact status */ 5180Sstevel@tonic-gate #define EHCI_QTD_CTRL_HS_XACT_STATUS 0x000000F8 /* HS Xact status */ 5190Sstevel@tonic-gate #define EHCI_QTD_CTRL_NON_HS_XACT_STATUS 0x000000FD /* Non HS Xact status */ 5200Sstevel@tonic-gate #define EHCI_QTD_CTRL_NO_ERROR 0x00000000 /* No error */ 5210Sstevel@tonic-gate #define EHCI_QTD_CTRL_ACTIVE_XACT 0x00000080 /* Active xact */ 5220Sstevel@tonic-gate #define EHCI_QTD_CTRL_HALTED_XACT 0x00000040 /* Halted due to err */ 5230Sstevel@tonic-gate #define EHCI_QTD_CTRL_DATA_BUFFER_ERROR 0x00000020 /* Data buffer error */ 5240Sstevel@tonic-gate #define EHCI_QTD_CTRL_ERR_COUNT_MASK 0x00000C00 /* Error count */ 5250Sstevel@tonic-gate #define EHCI_QTD_CTRL_BABBLE_DETECTED 0x00000010 /* Babble detected */ 5260Sstevel@tonic-gate #define EHCI_QTD_CTRL_XACT_ERROR 0x00000008 /* Transaction error */ 5270Sstevel@tonic-gate #define EHCI_QTD_CTRL_MISSED_uFRAME 0x00000004 /* Missed uFrame */ 5280Sstevel@tonic-gate #define EHCI_QTD_CTRL_SPLIT_XACT_STATE 0x00000002 /* Split xact state */ 5290Sstevel@tonic-gate #define EHCI_QTD_CTRL_DO_START_SPLIT 0x00000000 /* Do start split */ 5300Sstevel@tonic-gate #define EHCI_QTD_CTRL_DO_COMPLETE_SPLIT 0x00000002 /* Do complete split */ 5310Sstevel@tonic-gate #define EHCI_QTD_CTRL_PING_STATE 0x00000001 /* Ping state */ 5320Sstevel@tonic-gate #define EHCI_QTD_CTRL_DO_OUT 0x00000000 /* Do OUT */ 5330Sstevel@tonic-gate #define EHCI_QTD_CTRL_DO_PING 0x00000001 /* Do PING */ 5340Sstevel@tonic-gate #define EHCI_QTD_CTRL_PRD_SPLIT_XACT_ERR 0x00000001 /* Periodic split err */ 5350Sstevel@tonic-gate 5360Sstevel@tonic-gate /* 5370Sstevel@tonic-gate * qtd_buf[X] control bits. 5380Sstevel@tonic-gate */ 5390Sstevel@tonic-gate #define EHCI_QTD_BUF_PTR 0xFFFFF000 /* Buffer pointer */ 5400Sstevel@tonic-gate #define EHCI_QTD_BUF_CURR_OFFSET 0x00000FFF /* Current offset */ 5410Sstevel@tonic-gate 5420Sstevel@tonic-gate /* 5430Sstevel@tonic-gate * qtd_buf_high[X] control bits. 5440Sstevel@tonic-gate */ 5450Sstevel@tonic-gate #define EHCI_QTD_BUF_HIGH_PTR 0xFFFFFFFF /* 64 bit addressing */ 5460Sstevel@tonic-gate 5470Sstevel@tonic-gate /* 5480Sstevel@tonic-gate * qtd_state 5490Sstevel@tonic-gate * 5500Sstevel@tonic-gate * QTD States 5510Sstevel@tonic-gate */ 5520Sstevel@tonic-gate #define EHCI_QTD_FREE 1 /* Free QTD */ 5530Sstevel@tonic-gate #define EHCI_QTD_DUMMY 2 /* Dummy QTD */ 5540Sstevel@tonic-gate #define EHCI_QTD_ACTIVE 3 /* Active QTD */ 5550Sstevel@tonic-gate #define EHCI_QTD_RECLAIM 4 /* Reclaim QTD */ 5560Sstevel@tonic-gate 5570Sstevel@tonic-gate /* 5580Sstevel@tonic-gate * qtd_ctrl_phase 5590Sstevel@tonic-gate * 5600Sstevel@tonic-gate * Control Transfer Phase information 5610Sstevel@tonic-gate */ 5620Sstevel@tonic-gate #define EHCI_CTRL_SETUP_PHASE 1 /* Setup phase */ 5630Sstevel@tonic-gate #define EHCI_CTRL_DATA_PHASE 2 /* Data phase */ 5640Sstevel@tonic-gate #define EHCI_CTRL_STATUS_PHASE 3 /* Status phase */ 5650Sstevel@tonic-gate 5660Sstevel@tonic-gate /* 5670Sstevel@tonic-gate * Host Controller Split Isochronous Transfer Descripter 5680Sstevel@tonic-gate * 5690Sstevel@tonic-gate * iTD/siTD is a memory structure that describes the information necessary for 5700Sstevel@tonic-gate * the Host Controller (HC) to transfer a block of data to or from a 5710Sstevel@tonic-gate * 1.1 isochronous device end point. The iTD/siTD will be inserted between 5720Sstevel@tonic-gate * the periodic frame list and the interrupt tree lattice. This structure 5730Sstevel@tonic-gate * must be aligned to a 32 byte boundary. 5740Sstevel@tonic-gate */ 5750Sstevel@tonic-gate typedef volatile struct ehci_itd { 5760Sstevel@tonic-gate uint32_t itd_link_ptr; /* Next TD */ 5770Sstevel@tonic-gate uint32_t itd_body[15]; /* iTD and siTD body */ 5783255Slg150142 uint32_t itd_body_high[7]; /* For 64 bit addressing */ 5790Sstevel@tonic-gate 5800Sstevel@tonic-gate /* Padding required */ 5813255Slg150142 uint32_t itd_pad; 5820Sstevel@tonic-gate 5830Sstevel@tonic-gate /* HCD private fields */ 5840Sstevel@tonic-gate uint32_t itd_trans_wrapper; /* Transfer wrapper */ 5850Sstevel@tonic-gate uint32_t itd_itw_next_itd; /* Next iTD on TW */ 5860Sstevel@tonic-gate uint32_t itd_next_active_itd; /* Next iTD in active list */ 5870Sstevel@tonic-gate uint32_t itd_state; /* iTD state */ 5883255Slg150142 uint32_t itd_index[8]; /* iTD index */ 5890Sstevel@tonic-gate uint64_t itd_frame_number; /* Frame iTD exists */ 5900Sstevel@tonic-gate uint64_t itd_reclaim_number; /* Frame iTD is reclaimed */ 5910Sstevel@tonic-gate } ehci_itd_t; 5920Sstevel@tonic-gate 5930Sstevel@tonic-gate /* 5940Sstevel@tonic-gate * Generic Link Ptr Bits 5950Sstevel@tonic-gate * EHCI_TD_LINK_PTR : Points to the next data object to be processed 5960Sstevel@tonic-gate * EHCI_TD_LINK_PTR_TYPE : Type of reference this descriptor is 5970Sstevel@tonic-gate * EHCI_TD_LINK_PTR_VALID : Is this link pointer valid 5980Sstevel@tonic-gate */ 5990Sstevel@tonic-gate #define EHCI_ITD_LINK_PTR 0xFFFFFFE0 /* TD link ptr mask */ 6000Sstevel@tonic-gate #define EHCI_ITD_LINK_REF 0x00000006 /* Ref to TD/ITD/SITD */ 6010Sstevel@tonic-gate #define EHCI_ITD_LINK_REF_ITD 0x00000000 /* ITD pointer */ 6020Sstevel@tonic-gate #define EHCI_ITD_LINK_REF_QH 0x00000002 /* QH pointer */ 6030Sstevel@tonic-gate #define EHCI_ITD_LINK_REF_SITD 0x00000004 /* SITD pointer */ 6040Sstevel@tonic-gate #define EHCI_ITD_LINK_REF_FSTN 0x00000006 /* FSTN pointer */ 6050Sstevel@tonic-gate #define EHCI_ITD_LINK_PTR_INVALID 0x00000001 /* Link ptr validity */ 6060Sstevel@tonic-gate 6073255Slg150142 #define EHCI_ITD_CTRL_LIST_SIZE 8 6083255Slg150142 #define EHCI_ITD_BUFFER_LIST_SIZE 7 6090Sstevel@tonic-gate #define EHCI_ITD_CTRL0 0 /* Status and Ctrl List */ 6100Sstevel@tonic-gate #define EHCI_ITD_CTRL1 1 6110Sstevel@tonic-gate #define EHCI_ITD_CTRL2 2 6120Sstevel@tonic-gate #define EHCI_ITD_CTRL3 3 6130Sstevel@tonic-gate #define EHCI_ITD_CTRL4 4 6140Sstevel@tonic-gate #define EHCI_ITD_CTRL5 5 6150Sstevel@tonic-gate #define EHCI_ITD_CTRL6 6 6160Sstevel@tonic-gate #define EHCI_ITD_CTRL7 7 6170Sstevel@tonic-gate #define EHCI_ITD_BUFFER0 8 /* Buffer Page Ptr List */ 6180Sstevel@tonic-gate #define EHCI_ITD_BUFFER1 9 6190Sstevel@tonic-gate #define EHCI_ITD_BUFFER2 10 6200Sstevel@tonic-gate #define EHCI_ITD_BUFFER3 11 6210Sstevel@tonic-gate #define EHCI_ITD_BUFFER4 12 6220Sstevel@tonic-gate #define EHCI_ITD_BUFFER5 13 6230Sstevel@tonic-gate #define EHCI_ITD_BUFFER6 14 6240Sstevel@tonic-gate 6253255Slg150142 /* 6263255Slg150142 * iTD Transaction Status and Control bits 6273255Slg150142 */ 6283255Slg150142 #define EHCI_ITD_XFER_STATUS_MASK 0xF0000000 6293255Slg150142 #define EHCI_ITD_XFER_STATUS_SHIFT 28 6303255Slg150142 #define EHCI_ITD_XFER_ACTIVE 0x80000000 6313255Slg150142 #define EHCI_ITD_XFER_DATA_BUFFER_ERR 0x40000000 6323255Slg150142 #define EHCI_ITD_XFER_BABBLE 0x20000000 6333255Slg150142 #define EHCI_ITD_XFER_ERROR 0x10000000 6343255Slg150142 #define EHCI_ITD_XFER_LENGTH 0x0FFF0000 6353255Slg150142 #define EHCI_ITD_XFER_IOC 0x00008000 6363255Slg150142 #define EHCI_ITD_XFER_IOC_ON 0x00008000 6373255Slg150142 #define EHCI_ITD_XFER_IOC_OFF 0x00000000 6383255Slg150142 #define EHCI_ITD_XFER_PAGE_SELECT 0x00007000 6393255Slg150142 #define EHCI_ITD_XFER_OFFSET 0x00000FFF 6403255Slg150142 6413255Slg150142 /* 6423255Slg150142 * iTD Buffer Page Pointer bits 6433255Slg150142 */ 6443255Slg150142 #define EHCI_ITD_CTRL_BUFFER_MASK 0xFFFFF000 6453255Slg150142 #define EHCI_ITD_CTRL_ENDPT_MASK 0x00000F00 6463255Slg150142 #define EHCI_ITD_CTRL_DEVICE_MASK 0x0000007F 6473255Slg150142 #define EHCI_ITD_CTRL_DIR 0x00000800 6483255Slg150142 #define EHCI_ITD_CTRL_DIR_IN 0x00000800 6493255Slg150142 #define EHCI_ITD_CTRL_DIR_OUT 0x00000000 6503255Slg150142 #define EHCI_ITD_CTRL_MAX_PACKET_MASK 0x000007FF 6513255Slg150142 #define EHCI_ITD_CTRL_MULTI_MASK 0x00000003 6523255Slg150142 #define EHCI_ITD_CTRL_ONE_XACT 0x00000001 6533255Slg150142 #define EHCI_ITD_CTRL_TWO_XACT 0x00000002 6543255Slg150142 #define EHCI_ITD_CTRL_THREE_XACT 0x00000003 6553255Slg150142 6563255Slg150142 /* Unused iTD index */ 6573255Slg150142 #define EHCI_ITD_UNUSED_INDEX 0xFFFFFFFF 6583255Slg150142 6590Sstevel@tonic-gate #define EHCI_SITD_CTRL 0 6600Sstevel@tonic-gate #define EHCI_SITD_UFRAME_SCHED 1 6610Sstevel@tonic-gate #define EHCI_SITD_XFER_STATE 2 6620Sstevel@tonic-gate #define EHCI_SITD_BUFFER0 3 6630Sstevel@tonic-gate #define EHCI_SITD_BUFFER1 4 6640Sstevel@tonic-gate #define EHCI_SITD_PREV_SITD 5 6650Sstevel@tonic-gate 6660Sstevel@tonic-gate /* 6670Sstevel@tonic-gate * sitd_ctrl bits 6680Sstevel@tonic-gate * EHCI_SITD_CTRL_DIR : Direction of transaction 6690Sstevel@tonic-gate * EHCI_SITD_CTRL_PORT_MASK : Port # of recipient transaction translator(TT) 6700Sstevel@tonic-gate * EHCI_SITD_CTRL_HUB_MASK : Device address of the TT's hub 6710Sstevel@tonic-gate * EHCI_SITD_CTRL_END_PT_MASK : Endpoint # on device serving as data source/sink 6720Sstevel@tonic-gate * EHCI_SITD_CTRL_DEVICE_MASK : Address of device serving as data source/sink 6730Sstevel@tonic-gate */ 6740Sstevel@tonic-gate #define EHCI_SITD_CTRL_DIR 0x80000000 6750Sstevel@tonic-gate #define EHCI_SITD_CTRL_DIR_IN 0x80000000 6760Sstevel@tonic-gate #define EHCI_SITD_CTRL_DIR_OUT 0x00000000 6770Sstevel@tonic-gate #define EHCI_SITD_CTRL_PORT_MASK 0x7F000000 6780Sstevel@tonic-gate #define EHCI_SITD_CTRL_PORT_SHIFT 24 6790Sstevel@tonic-gate #define EHCI_SITD_CTRL_HUB_MASK 0x007F0000 6800Sstevel@tonic-gate #define EHCI_SITD_CTRL_HUB_SHIFT 16 6810Sstevel@tonic-gate #define EHCI_SITD_CTRL_END_PT_MASK 0x00000F00 6820Sstevel@tonic-gate #define EHCI_SITD_CTRL_END_PT_SHIFT 8 6830Sstevel@tonic-gate #define EHCI_SITD_CTRL_DEVICE_MASK 0x0000007F 6840Sstevel@tonic-gate #define EHCI_SITD_CTRL_DEVICE_SHIFT 0 6850Sstevel@tonic-gate 6860Sstevel@tonic-gate /* 6870Sstevel@tonic-gate * sitd_uframe_sched bits 6880Sstevel@tonic-gate * EHCI_SITD_UFRAME_CMASK_MASK : Determines which uFrame the HC executes CSplit 6890Sstevel@tonic-gate * EHCI_SITD_UFRAME_SMASK_MASK : Determines which uFrame the HC executes SSplit 6900Sstevel@tonic-gate */ 6910Sstevel@tonic-gate #define EHCI_SITD_UFRAME_CMASK_MASK 0x0000FF00 6920Sstevel@tonic-gate #define EHCI_SITD_UFRAME_CMASK_SHIFT 8 6930Sstevel@tonic-gate #define EHCI_SITD_UFRAME_SMASK_MASK 0x000000FF 6940Sstevel@tonic-gate #define EHCI_SITD_UFRAME_SMASK_SHIFT 0 6950Sstevel@tonic-gate 6960Sstevel@tonic-gate /* 6970Sstevel@tonic-gate * sitd_xfer_state bits 6980Sstevel@tonic-gate * EHCI_SITD_XFER_IOC_MASK : Interrupt when transaction is complete. 6990Sstevel@tonic-gate * EHCI_SITD_XFER_PAGE_MASK : Which data page pointer should be concatenated 7000Sstevel@tonic-gate * with the CurrentOffset to construct a data 7010Sstevel@tonic-gate * buffer pointer 7020Sstevel@tonic-gate * EHCI_SITD_XFER_TOTAL_MASK : Total number of bytes expected in xfer(1023 Max). 7030Sstevel@tonic-gate * EHCI_SITD_XFER_CPROG_MASK : HC tracks which CSplit has been executed. 7040Sstevel@tonic-gate * EHCI_SITD_XFER_STATUS_MASK : Status of xfer 7050Sstevel@tonic-gate */ 7060Sstevel@tonic-gate #define EHCI_SITD_XFER_IOC_MASK 0x80000000 7070Sstevel@tonic-gate #define EHCI_SITD_XFER_IOC_ON 0x80000000 7080Sstevel@tonic-gate #define EHCI_SITD_XFER_IOC_OFF 0x00000000 7090Sstevel@tonic-gate #define EHCI_SITD_XFER_PAGE_MASK 0x40000000 7100Sstevel@tonic-gate #define EHCI_SITD_XFER_PAGE_0 0x00000000 7110Sstevel@tonic-gate #define EHCI_SITD_XFER_PAGE_1 0x40000000 7120Sstevel@tonic-gate #define EHCI_SITD_XFER_TOTAL_MASK 0x03FF0000 7130Sstevel@tonic-gate #define EHCI_SITD_XFER_TOTAL_SHIFT 16 7140Sstevel@tonic-gate #define EHCI_SITD_XFER_CPROG_MASK 0x0000FF00 7150Sstevel@tonic-gate #define EHCI_SITD_XFER_CPROG_SHIFT 8 7160Sstevel@tonic-gate #define EHCI_SITD_XFER_STATUS_MASK 0x000000FF 7170Sstevel@tonic-gate #define EHCI_SITD_XFER_STATUS_SHIFT 0 7180Sstevel@tonic-gate #define EHCI_SITD_XFER_ACTIVE 0x80 7190Sstevel@tonic-gate #define EHCI_SITD_XFER_ERROR 0x40 7200Sstevel@tonic-gate #define EHCI_SITD_XFER_DATA_BUFFER_ERR 0x20 7210Sstevel@tonic-gate #define EHCI_SITD_XFER_BABBLE 0x10 7220Sstevel@tonic-gate #define EHCI_SITD_XFER_XACT_ERROR 0x08 7230Sstevel@tonic-gate #define EHCI_SITD_XFER_MISSED_UFRAME 0x04 7240Sstevel@tonic-gate #define EHCI_SITD_XFER_SPLIT_XACT_STATE 0x02 7250Sstevel@tonic-gate #define EHCI_SITD_XFER_SSPLIT_STATE 0x00 7260Sstevel@tonic-gate #define EHCI_SITD_XFER_CSPLIT_STATE 0x02 7270Sstevel@tonic-gate 7280Sstevel@tonic-gate /* 7290Sstevel@tonic-gate * sitd_xfer_buffer0/1 7300Sstevel@tonic-gate * EHCI_SITD_XFER_BUFFER_MASK : Buffer Pointer List 7310Sstevel@tonic-gate * EHCI_SITD_XFER_OFFSET_MASK : Current byte offset 7320Sstevel@tonic-gate * EHCI_SITD_XFER_TP_MASK : Transaction position 7330Sstevel@tonic-gate * EHCI_SITD_XFER_TCOUNT_MASK : Transaction count 7340Sstevel@tonic-gate */ 7350Sstevel@tonic-gate #define EHCI_SITD_XFER_BUFFER_MASK 0xFFFFF000 7360Sstevel@tonic-gate #define EHCI_SITD_XFER_BUFFER_SHIFT 12 7370Sstevel@tonic-gate #define EHCI_SITD_XFER_OFFSET_MASK 0x00000FFF 7380Sstevel@tonic-gate #define EHCI_SITD_XFER_OFFSET_SHIFT 0 7390Sstevel@tonic-gate #define EHCI_SITD_XFER_TP_MASK 0x00000018 7400Sstevel@tonic-gate #define EHCI_SITD_XFER_TP_ALL 0x0 7410Sstevel@tonic-gate #define EHCI_SITD_XFER_TP_BEGIN 0x1 7420Sstevel@tonic-gate #define EHCI_SITD_XFER_TP_MID 0x2 7430Sstevel@tonic-gate #define EHCI_SITD_XFER_TP_END 0x3 7440Sstevel@tonic-gate #define EHCI_SITD_XFER_TCOUNT_MASK 0x00000007 7450Sstevel@tonic-gate #define EHCI_SITD_XFER_TCOUNT_SHIFT 0 7460Sstevel@tonic-gate 7470Sstevel@tonic-gate /* 7480Sstevel@tonic-gate * qtd_state 7490Sstevel@tonic-gate * 7500Sstevel@tonic-gate * ITD States 7510Sstevel@tonic-gate */ 7520Sstevel@tonic-gate #define EHCI_ITD_FREE 1 /* Free ITD */ 7530Sstevel@tonic-gate #define EHCI_ITD_DUMMY 2 /* Dummy ITD */ 7540Sstevel@tonic-gate #define EHCI_ITD_ACTIVE 3 /* Active ITD */ 7550Sstevel@tonic-gate #define EHCI_ITD_RECLAIM 4 /* Reclaim ITD */ 7560Sstevel@tonic-gate 7570Sstevel@tonic-gate #ifdef __cplusplus 7580Sstevel@tonic-gate } 7590Sstevel@tonic-gate #endif 7600Sstevel@tonic-gate 7610Sstevel@tonic-gate #endif /* _SYS_USB_EHCI_H */ 762