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 5*6881Sbharding * Common Development and Distribution License (the "License"). 6*6881Sbharding * 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*6881Sbharding * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 23*6881Sbharding * Use is subject to license terms. 240Sstevel@tonic-gate */ 250Sstevel@tonic-gate 260Sstevel@tonic-gate #ifndef _SYS_1394_ADAPTERS_HCI1394_OHCI_H 270Sstevel@tonic-gate #define _SYS_1394_ADAPTERS_HCI1394_OHCI_H 280Sstevel@tonic-gate 290Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 300Sstevel@tonic-gate 310Sstevel@tonic-gate /* 320Sstevel@tonic-gate * hci1394_ohci.h 330Sstevel@tonic-gate * Provides access macros and routines to the OpenHCI HW. 340Sstevel@tonic-gate */ 350Sstevel@tonic-gate 360Sstevel@tonic-gate #ifdef __cplusplus 370Sstevel@tonic-gate extern "C" { 380Sstevel@tonic-gate #endif 390Sstevel@tonic-gate 400Sstevel@tonic-gate #include <sys/ddi.h> 410Sstevel@tonic-gate #include <sys/modctl.h> 420Sstevel@tonic-gate #include <sys/sunddi.h> 430Sstevel@tonic-gate #include <sys/types.h> 440Sstevel@tonic-gate #include <sys/note.h> 450Sstevel@tonic-gate 460Sstevel@tonic-gate #include <sys/1394/adapters/hci1394_def.h> 470Sstevel@tonic-gate #include <sys/1394/adapters/hci1394_buf.h> 480Sstevel@tonic-gate 490Sstevel@tonic-gate 500Sstevel@tonic-gate #define OHCI_MAX_SELFID_SIZE 2048 510Sstevel@tonic-gate #define OHCI_BUSGEN_MAX 0xFF 520Sstevel@tonic-gate 530Sstevel@tonic-gate 540Sstevel@tonic-gate /* Misc */ 550Sstevel@tonic-gate #define OHCI_REG_SET 1 /* ddi_regs_map_setup */ 560Sstevel@tonic-gate #define OHCI_CHIP_RESET_TIME_IN_uSEC ((clock_t)100) /* 100uS */ 570Sstevel@tonic-gate #define OHCI_BUS_RESET_TIME_IN_uSEC ((clock_t)100000) /* 100mS */ 580Sstevel@tonic-gate #define OHCI_MAX_COOKIE 16 590Sstevel@tonic-gate #define OHCI_uS_PER_BUS_CYCLE 125 600Sstevel@tonic-gate #define OHCI_nS_PER_BUS_CYCLE 125000 610Sstevel@tonic-gate #define OHCI_BUS_CYCLE_TO_uS(cycles) (cycles * OHCI_uS_PER_BUS_CYCLE) 620Sstevel@tonic-gate #define OHCI_BUS_CYCLE_TO_nS(cycles) (cycles * OHCI_nS_PER_BUS_CYCLE) 630Sstevel@tonic-gate #define OHCI_CYCLE_SEC_SHIFT 13 640Sstevel@tonic-gate #define OHCI_CYCLE_SEC_MASK 0xE000 650Sstevel@tonic-gate #define OHCI_CYCLE_CNT_MASK 0x1FFF 660Sstevel@tonic-gate #define OHCI_MAX_CYCLE_CNT 8000 670Sstevel@tonic-gate #define OHCI_TIMESTAMP_MASK 0xFFFF 680Sstevel@tonic-gate #define OHCI_REG_ADDR_MASK 0x7FC 690Sstevel@tonic-gate 700Sstevel@tonic-gate /* OpenHCI Global Swap location in PCI space */ 710Sstevel@tonic-gate #define OHCI_PCI_HCI_CONTROL_REG ((off_t)0x40) 720Sstevel@tonic-gate #define OHCI_PCI_GLOBAL_SWAP 0x00000001 730Sstevel@tonic-gate 740Sstevel@tonic-gate 750Sstevel@tonic-gate /* PHY Register #1 */ 760Sstevel@tonic-gate #define OHCI_PHY_RHB 0x80 770Sstevel@tonic-gate #define OHCI_PHY_IBR 0x40 780Sstevel@tonic-gate #define OHCI_PHY_MAX_GAP 0x3F 790Sstevel@tonic-gate 800Sstevel@tonic-gate /* PHY Register #4 */ 810Sstevel@tonic-gate #define OHCI_PHY_EXTND_MASK 0xE0 820Sstevel@tonic-gate #define OHCI_PHY_EXTND 0xE0 830Sstevel@tonic-gate 840Sstevel@tonic-gate /* PHY Register #4 */ 850Sstevel@tonic-gate #define OHCI_PHY_CNTDR 0x40 860Sstevel@tonic-gate 870Sstevel@tonic-gate /* PHY Register #5 */ 880Sstevel@tonic-gate #define OHCI_PHY_ISBR 0x40 890Sstevel@tonic-gate #define OHCI_PHY_LOOP_ERR 0x20 900Sstevel@tonic-gate #define OHCI_PHY_PWRFAIL_ERR 0x10 910Sstevel@tonic-gate #define OHCI_PHY_TIMEOUT_ERR 0x08 920Sstevel@tonic-gate #define OHCI_PHY_PORTEVT_ERR 0x04 930Sstevel@tonic-gate #define OHCI_PHY_ENBL_ACCEL 0x02 940Sstevel@tonic-gate #define OHCI_PHY_ENBL_MULTI 0x01 950Sstevel@tonic-gate 960Sstevel@tonic-gate /* OpenHCI Event Codes. Refer to OHCI 1.0 section 3.1.1 */ 970Sstevel@tonic-gate #define OHCI_EVT_NO_STATUS 0x0 980Sstevel@tonic-gate #define OHCI_EVT_LONG_PACKET 0x2 990Sstevel@tonic-gate #define OHCI_EVT_MISSING_ACK 0x3 1000Sstevel@tonic-gate #define OHCI_EVT_UNDERRUN 0x4 1010Sstevel@tonic-gate #define OHCI_EVT_OVERRUN 0x5 1020Sstevel@tonic-gate #define OHCI_EVT_DESCRIPTOR_READ 0x6 1030Sstevel@tonic-gate #define OHCI_EVT_DATA_READ 0x7 1040Sstevel@tonic-gate #define OHCI_EVT_DATA_WRITE 0x8 1050Sstevel@tonic-gate #define OHCI_EVT_BUS_RESET 0x9 1060Sstevel@tonic-gate #define OHCI_EVT_TIMEOUT 0xA 1070Sstevel@tonic-gate #define OHCI_EVT_TCODE_ERR 0xB 1080Sstevel@tonic-gate #define OHCI_EVT_UNKNOWN 0xE 1090Sstevel@tonic-gate #define OHCI_EVT_FLUSHED 0xF 1100Sstevel@tonic-gate #define OHCI_ACK_COMPLETE 0x11 1110Sstevel@tonic-gate #define OHCI_ACK_PENDING 0x12 1120Sstevel@tonic-gate #define OHCI_ACK_BUSY_X 0x14 1130Sstevel@tonic-gate #define OHCI_ACK_BUSY_A 0x15 1140Sstevel@tonic-gate #define OHCI_ACK_BUSY_B 0x16 1150Sstevel@tonic-gate #define OHCI_ACK_TARDY 0x1B 1160Sstevel@tonic-gate #define OHCI_ACK_CONFLICT_ERROR 0x1C 1170Sstevel@tonic-gate #define OHCI_ACK_DATA_ERROR 0x1D 1180Sstevel@tonic-gate #define OHCI_ACK_TYPE_ERROR 0x1E 1190Sstevel@tonic-gate #define OHCI_ACK_ADDRESS_ERROR 0x1F 1200Sstevel@tonic-gate 1210Sstevel@tonic-gate #define OHCI_REG_NODEID_ROOT 0x40000000 1220Sstevel@tonic-gate #define OHCI_REG_BUSOPTIONS_CMC 0x40000000 1230Sstevel@tonic-gate 1240Sstevel@tonic-gate /* hci_regs_s.ir_ctxt_regs.ctxt_match */ 1250Sstevel@tonic-gate #define OHCI_MTC_TAG3_MASK 0x80000000 1260Sstevel@tonic-gate #define OHCI_MTC_TAG3_SHIFT 31 1270Sstevel@tonic-gate #define OHCI_MTC_TAG2_MASK 0x40000000 1280Sstevel@tonic-gate #define OHCI_MTC_TAG2_SHIFT 30 1290Sstevel@tonic-gate #define OHCI_MTC_TAG1_MASK 0x20000000 1300Sstevel@tonic-gate #define OHCI_MTC_TAG1_SHIFT 29 1310Sstevel@tonic-gate #define OHCI_MTC_TAG0_MASK 0x10000000 1320Sstevel@tonic-gate #define OHCI_MTC_TAG0_SHIFT 28 1330Sstevel@tonic-gate #define OHCI_MTC_MATCH_MASK 0x07FFF000 1340Sstevel@tonic-gate #define OHCI_MTC_MATCH_SHIFT 12 1350Sstevel@tonic-gate #define OHCI_MTC_SYNC_MASK 0x00000F00 1360Sstevel@tonic-gate #define OHCI_MTC_SYNC_SHIFT 8 1370Sstevel@tonic-gate #define OHCI_MTC_TAG1SY_MASK 0x00000040 1380Sstevel@tonic-gate #define OHCI_MTC_TAG1SY_SHIFT 6 1390Sstevel@tonic-gate #define OHCI_MTC_CHAN_MASK 0x0000003F 1400Sstevel@tonic-gate #define OHCI_MTC_CHAN_SHIFT 0 1410Sstevel@tonic-gate 1420Sstevel@tonic-gate /* hci_regs_s.self_id_buflo - See OpenHCI 1.00 section 11.1 */ 1430Sstevel@tonic-gate #define OHCI_SLF_BUF_LO 0xFFFFF800 1440Sstevel@tonic-gate 1450Sstevel@tonic-gate /* hci_regs_s.self_id_count - See OpenHCI 1.00 section 11.2 */ 1460Sstevel@tonic-gate #define OHCI_SLFC_ERROR 0x80000000 1470Sstevel@tonic-gate #define OHCI_SLFC_GEN_MASK 0x00FF0000 1480Sstevel@tonic-gate #define OHCI_SLFC_GEN_SHIFT 16 1490Sstevel@tonic-gate #define OHCI_SLFC_NUM_QUADS_MASK 0x00001FFC 1500Sstevel@tonic-gate 1510Sstevel@tonic-gate 1520Sstevel@tonic-gate /* 1530Sstevel@tonic-gate * hci_regs_s.int_event_* and hci_regs_s.int_mask_* 1540Sstevel@tonic-gate * See OpenHCI 1.00 section 6 1550Sstevel@tonic-gate */ 1560Sstevel@tonic-gate #define OHCI_INTR_REQ_TX_CMPLT 0x00000001 1570Sstevel@tonic-gate #define OHCI_INTR_RESP_TX_CMPLT 0x00000002 1580Sstevel@tonic-gate #define OHCI_INTR_ARRQ 0x00000004 1590Sstevel@tonic-gate #define OHCI_INTR_ARRS 0x00000008 1600Sstevel@tonic-gate #define OHCI_INTR_RQPKT 0x00000010 1610Sstevel@tonic-gate #define OHCI_INTR_RSPKT 0x00000020 1620Sstevel@tonic-gate #define OHCI_INTR_ISOCH_TX 0x00000040 /* RO */ 1630Sstevel@tonic-gate #define OHCI_INTR_ISOCH_RX 0x00000080 /* RO */ 1640Sstevel@tonic-gate #define OHCI_INTR_POST_WR_ERR 0x00000100 1650Sstevel@tonic-gate #define OHCI_INTR_LOCK_RESP_ERR 0x00000200 1660Sstevel@tonic-gate #define OHCI_INTR_SELFID_CMPLT 0x00010000 1670Sstevel@tonic-gate #define OHCI_INTR_BUS_RESET 0x00020000 1680Sstevel@tonic-gate #define OHCI_INTR_PHY 0x00080000 1690Sstevel@tonic-gate #define OHCI_INTR_CYC_SYNCH 0x00100000 1700Sstevel@tonic-gate #define OHCI_INTR_CYC_64_SECS 0x00200000 1710Sstevel@tonic-gate #define OHCI_INTR_CYC_LOST 0x00400000 1720Sstevel@tonic-gate #define OHCI_INTR_CYC_INCONSISTENT 0x00800000 1730Sstevel@tonic-gate #define OHCI_INTR_UNRECOVERABLE_ERR 0x01000000 1740Sstevel@tonic-gate #define OHCI_INTR_CYC_TOO_LONG 0x02000000 1750Sstevel@tonic-gate #define OHCI_INTR_PHY_REG_RCVD 0x04000000 1760Sstevel@tonic-gate #define OHCI_INTR_VENDOR_SPECIFIC 0x40000000 1770Sstevel@tonic-gate #define OHCI_INTR_MASTER_INTR_ENBL 0x80000000 /* int_mask_* only */ 1780Sstevel@tonic-gate 1790Sstevel@tonic-gate /* hci_regs_s.fairness_ctrl - See OpenHCI 1.00 section 5.8 */ 1800Sstevel@tonic-gate #define OHCI_FAIR_PRI_REQ 0x000000FF 1810Sstevel@tonic-gate 1820Sstevel@tonic-gate /* hci_regs_s.link_ctrl_set/clr - See OpenHCI 1.00 section 5.9 */ 1830Sstevel@tonic-gate #define OHCI_LC_CYC_SRC 0x00400000 1840Sstevel@tonic-gate #define OHCI_LC_CYC_MAST 0x00200000 1850Sstevel@tonic-gate #define OHCI_LC_CTIME_ENBL 0x00100000 1860Sstevel@tonic-gate #define OHCI_LC_RCV_PHY 0x00000400 1870Sstevel@tonic-gate #define OHCI_LC_RCV_SELF 0x00000200 1880Sstevel@tonic-gate #define OHCI_LC_CYC_SYNC 0x00000010 1890Sstevel@tonic-gate 1900Sstevel@tonic-gate /* Defines for registers in HCI register space */ 1910Sstevel@tonic-gate /* Note: bits are read/write unless otherwise noted (RO-read only) */ 1920Sstevel@tonic-gate 1930Sstevel@tonic-gate /* hci_regs_s.version - See OpenHCI 1.00 section 5.2 */ 1940Sstevel@tonic-gate #define OHCI_VER_GUID_ROM 0x01000000 1950Sstevel@tonic-gate #define OHCI_VER_VERSION_MASK 0x00FF0000 1960Sstevel@tonic-gate #define OHCI_VER_VERSION_SHIFT 16 1970Sstevel@tonic-gate #define OHCI_VER_REVISION_MASK 0x000000FF 1980Sstevel@tonic-gate #define OHCI_VERSION(version) \ 1990Sstevel@tonic-gate ((version & OHCI_VER_VERSION_MASK) >> OHCI_VER_VERSION_SHIFT) 2000Sstevel@tonic-gate #define OHCI_REVISION(revision) \ 2010Sstevel@tonic-gate (revision & OHCI_VER_REVISION_MASK) 2020Sstevel@tonic-gate 2030Sstevel@tonic-gate /* hci_regs_s.guid_rom - See OpenHCI 1.00 section 5.3 */ 2040Sstevel@tonic-gate #define OHCI_GROM_ADDR_RESET 0x80000000 /* 1-initiate reset */ 2050Sstevel@tonic-gate #define OHCI_GROM_RD_START 0x02000000 /* 1-start byte read */ 2060Sstevel@tonic-gate #define OHCI_GROM_RD_DATA 0x00FF0000 /* RO */ 2070Sstevel@tonic-gate 2080Sstevel@tonic-gate /* hci_regs_s.at_retries - See OpenHCI 1.00 section 5.4 */ 2090Sstevel@tonic-gate #define OHCI_RET_SECLIM_MASK 0xE0000000 /* dual-phase retry */ 2100Sstevel@tonic-gate #define OHCI_RET_SECLIM_SHIFT 29 2110Sstevel@tonic-gate #define OHCI_RET_CYCLLIM_MASK 0xFFFF0000 /* dual-phase retry */ 2120Sstevel@tonic-gate #define OHCI_RET_CYCLLIM_SHIFT 16 2130Sstevel@tonic-gate #define OHCI_RET_MAX_PHYS_RESP_MASK 0x00000F00 /* physical resp rtry */ 2140Sstevel@tonic-gate #define OHCI_RET_MAX_PHYS_RESP_SHIFT 8 2150Sstevel@tonic-gate #define OHCI_RET_MAX_ATRESP_MASK 0x000000F0 /* AT response retry */ 2160Sstevel@tonic-gate #define OHCI_RET_MAX_ATRESP_SHIFT 4 2170Sstevel@tonic-gate #define OHCI_RET_MAX_ATREQ_MASK 0x0000000F /* AT request retry */ 2180Sstevel@tonic-gate #define OHCI_RET_MAX_ATREQ_SHIFT 0 2190Sstevel@tonic-gate 2200Sstevel@tonic-gate /* hci_regs_s.csr_ctrl - See OpenHCI 1.00 section 5.5.1 */ 2210Sstevel@tonic-gate #define OHCI_CSR_DONE 0x80000000 /* RO 1-cmp_swap complete */ 2220Sstevel@tonic-gate #define OHCI_CSR_SELECT 0x00000003 2230Sstevel@tonic-gate 2240Sstevel@tonic-gate #define OHCI_CSR_SEL_BUS_MGR_ID 0 /* bus manager ID register */ 2250Sstevel@tonic-gate #define OHCI_CSR_SEL_BANDWIDTH_AVAIL 1 /* bandwidth available reg */ 2260Sstevel@tonic-gate #define OHCI_CSR_SEL_CHANS_AVAIL_HI 2 /* channels_available_hi reg */ 2270Sstevel@tonic-gate #define OHCI_CSR_SEL_CHANS_AVAIL_LO 3 /* channels_available_lo reg */ 2280Sstevel@tonic-gate 2290Sstevel@tonic-gate /* hci_regs_s.config_rom_hdr - See OpenHCI 1.00 section 5.5.6 */ 2300Sstevel@tonic-gate #define OHCI_CROM_INFO_LEN 0xFF000000 2310Sstevel@tonic-gate #define OHCI_CROM_CRC_LEN 0x00FF0000 2320Sstevel@tonic-gate #define OHCI_CROM_ROM_CRC_VAL 0x0000FFFF 2330Sstevel@tonic-gate 2340Sstevel@tonic-gate /* hci_regs_s.bus_options - See OpenHCI 1.00 section 5.5.4 */ 2350Sstevel@tonic-gate #define OHCI_BOPT_IRMC 0x80000000 /* Isoch resrce mgr capable */ 2360Sstevel@tonic-gate #define OHCI_BOPT_CMC 0x40000000 /* cycle master capable */ 2370Sstevel@tonic-gate #define OHCI_BOPT_ISC 0x20000000 /* isochronous data capable */ 2380Sstevel@tonic-gate #define OHCI_BOPT_BMC 0x10000000 /* bus manager capable */ 2390Sstevel@tonic-gate #define OHCI_BOPT_PMC 0x80000000 /* power manager capable */ 2400Sstevel@tonic-gate #define OHCI_BOPT_CYC_CLK_ACC 0x00FF0000 2410Sstevel@tonic-gate #define OHCI_BOPT_MAX_REC 0x0000F000 2420Sstevel@tonic-gate #define OHCI_BOPT_GEN 0x000000C0 2430Sstevel@tonic-gate #define OHCI_BOPT_LINK_SPD 0x00000007 2440Sstevel@tonic-gate 2450Sstevel@tonic-gate /* hci_regs_s.guid_hi - See OpenHCI 1.00 section 5.5.5 */ 2460Sstevel@tonic-gate #define OHCI_GUID_NODE_VENDOR_ID 0xFFFFFF00 2470Sstevel@tonic-gate #define OHCI_GUID_CHIP_ID_HI 0x000000FF 2480Sstevel@tonic-gate 2490Sstevel@tonic-gate /* hci_regs_s.config_rom_maplo - See OpenHCI 1.00 section 5.5.6 */ 2500Sstevel@tonic-gate #define OHCI_CMAP_ADDR 0xFFFFFF00 /* 1k aligned */ 2510Sstevel@tonic-gate 2520Sstevel@tonic-gate /* hci_regs_s.posted_write_addrhi - See OpenHCI 1.00 section 13.2.8.1 */ 2530Sstevel@tonic-gate #define OHCI_POST_SOURCE_ID 0xFFFF0000 2540Sstevel@tonic-gate #define OHCI_POST_OFFSET_HI 0x0000FFFF 2550Sstevel@tonic-gate 2560Sstevel@tonic-gate /* hci_regs_s.vendor_id - See OpenHCI 1.00 section 5.2 */ 2570Sstevel@tonic-gate #define OHCI_VEND_ID 0x00FFFFFF 2580Sstevel@tonic-gate #define OHCI_VEND_UNIQUE 0xFF000000 2590Sstevel@tonic-gate 2600Sstevel@tonic-gate /* hci_regs_s.hc_ctrl_set/clr - See OpenHCI 1.00 section 5.7 */ 2610Sstevel@tonic-gate #define OHCI_HC_NO_BSWAP 0x40000000 /* 1-big endian,0-little end */ 2620Sstevel@tonic-gate #define OHCI_HC_PROG_PHY_ENBL 0x00800000 /* 1-prog phy capabilities */ 2630Sstevel@tonic-gate #define OHCI_HC_APHY_ENBL 0x00040000 /* 1-Aphy enhancements enbld */ 2640Sstevel@tonic-gate #define OHCI_HC_LPS 0x00080000 /* 1-link pwr on, 0-off */ 2650Sstevel@tonic-gate #define OHCI_HC_POSTWR_ENBL 0x00040000 /* 1-enabled, 0-disabled */ 2660Sstevel@tonic-gate #define OHCI_HC_LINK_ENBL 0x00020000 /* 1-enabled, 0-disabled */ 2670Sstevel@tonic-gate #define OHCI_HC_SOFT_RESET 0x00010000 /* 1-reset in prog, 0-done */ 2680Sstevel@tonic-gate 2690Sstevel@tonic-gate /* hci_regs_s.node_id - See OpenHCI 1.00 section 5.10 */ 2700Sstevel@tonic-gate #define OHCI_NDID_IDVALID 0x80000000 2710Sstevel@tonic-gate #define OHCI_NDID_ROOT_MASK 0x40000000 2720Sstevel@tonic-gate #define OHCI_NDID_ROOT_SHIFT 30 2730Sstevel@tonic-gate #define OHCI_NDID_CPS_MASK 0x08000000 2740Sstevel@tonic-gate #define OHCI_NDID_CPS_SHIFT 27 2750Sstevel@tonic-gate #define OHCI_NDID_BUSNUM_MASK 0x0000FFC0 2760Sstevel@tonic-gate #define OHCI_NDID_BUSNUM_SHIFT 6 2770Sstevel@tonic-gate #define OHCI_NDID_NODENUM_MASK 0x0000003F 2780Sstevel@tonic-gate #define OHCI_NDID_NODENUM_SHIFT 0 2790Sstevel@tonic-gate 2800Sstevel@tonic-gate /* hci_regs_s.phy_ctrl - See OpenHCI 1.00 section 5.11, 1394-1994 J.4.1 */ 2810Sstevel@tonic-gate #define OHCI_PHYC_RDDONE 0x80000000 2820Sstevel@tonic-gate #define OHCI_PHYC_RDREG 0x00008000 2830Sstevel@tonic-gate #define OHCI_PHYC_WRREG 0x00004000 2840Sstevel@tonic-gate #define OHCI_PHYC_RDADDR_MASK 0x0F000000 2850Sstevel@tonic-gate #define OHCI_PHYC_RDADDR_SHIFT 24 2860Sstevel@tonic-gate #define OHCI_PHYC_RDDATA_MASK 0x00FF0000 2870Sstevel@tonic-gate #define OHCI_PHYC_RDDATA_SHIFT 16 2880Sstevel@tonic-gate #define OHCI_PHYC_REGADDR_MASK 0x00000F00 2890Sstevel@tonic-gate #define OHCI_PHYC_REGADDR_SHIFT 8 2900Sstevel@tonic-gate #define OHCI_PHYC_WRDATA_MASK 0x000000FF 2910Sstevel@tonic-gate #define OHCI_PHYC_WRDATA_SHIFT 0 2920Sstevel@tonic-gate 2930Sstevel@tonic-gate /* hci_regs_s.context_ctrl -- several contexts */ 2940Sstevel@tonic-gate #define OHCI_CC_RUN_MASK 0x00008000 2950Sstevel@tonic-gate #define OHCI_CC_RUN_SHIFT 15 2960Sstevel@tonic-gate #define OHCI_CC_WAKE_MASK 0x00001000 2970Sstevel@tonic-gate #define OHCI_CC_WAKE_SHIFT 12 2980Sstevel@tonic-gate #define OHCI_CC_DEAD_MASK 0x00000800 2990Sstevel@tonic-gate #define OHCI_CC_DEAD_SHIFT 11 3000Sstevel@tonic-gate #define OHCI_CC_ACTIVE_MASK 0x00000400 3010Sstevel@tonic-gate #define OHCI_CC_ACTIVE_SHIFT 10 3020Sstevel@tonic-gate 3030Sstevel@tonic-gate #define OHCI_CC_SPD_MASK 0x000000E0 3040Sstevel@tonic-gate #define OHCI_CC_SPD_SHIFT 5 3050Sstevel@tonic-gate #define OHCI_CC_EVT_MASK 0x0000001F 3060Sstevel@tonic-gate #define OHCI_CC_EVT_SHIFT 0 3070Sstevel@tonic-gate 3080Sstevel@tonic-gate /* hci_regs context_ctrl for IR */ 3090Sstevel@tonic-gate #define OHCI_IRCTL_BFILL_MASK 0x80000000 3100Sstevel@tonic-gate #define OHCI_IRCTL_BFILL_SHIFT 31 3110Sstevel@tonic-gate #define OHCI_IRCTL_IHDR_MASK 0x40000000 3120Sstevel@tonic-gate #define OHCI_IRCTL_IHDR_SHIFT 30 3130Sstevel@tonic-gate #define OHCI_IRCTL_MTC_ENBL_MASK 0x20000000 3140Sstevel@tonic-gate #define OHCI_IRCTL_MTC_ENBL_SHIFT 29 3150Sstevel@tonic-gate #define OHCI_IRCTL_MULTI_MASK 0x10000000 3160Sstevel@tonic-gate #define OHCI_IRCTL_MULTI_SHIFT 28 3170Sstevel@tonic-gate 3180Sstevel@tonic-gate /* hci_regs context_ctrl for IT */ 3190Sstevel@tonic-gate #define OHCI_ITCTL_MTC_ENBL_MASK 0x80000000 3200Sstevel@tonic-gate #define OHCI_ITCTL_MTC_ENBL_SHIFT 31 3210Sstevel@tonic-gate #define OHCI_ITCTL_MATCH_MASK 0x7FFF0000 3220Sstevel@tonic-gate #define OHCI_ITCTL_MATCH_SHIFT 16 3230Sstevel@tonic-gate 3240Sstevel@tonic-gate 3250Sstevel@tonic-gate #define HCI1394_IS_ARRESP(tcode) \ 3260Sstevel@tonic-gate ((tcode == IEEE1394_TCODE_WRITE_RESP) || \ 3270Sstevel@tonic-gate (tcode == IEEE1394_TCODE_READ_QUADLET_RESP) || \ 3280Sstevel@tonic-gate (tcode == IEEE1394_TCODE_READ_BLOCK_RESP) || \ 3290Sstevel@tonic-gate (tcode == IEEE1394_TCODE_LOCK_RESP)) 3300Sstevel@tonic-gate 3310Sstevel@tonic-gate #define HCI1394_IS_ARREQ(tcode) \ 3320Sstevel@tonic-gate ((tcode == IEEE1394_TCODE_READ_QUADLET) || \ 3330Sstevel@tonic-gate (tcode == IEEE1394_TCODE_WRITE_QUADLET) || \ 3340Sstevel@tonic-gate (tcode == IEEE1394_TCODE_READ_BLOCK) || \ 3350Sstevel@tonic-gate (tcode == IEEE1394_TCODE_WRITE_BLOCK) || \ 3360Sstevel@tonic-gate (tcode == IEEE1394_TCODE_LOCK) || \ 3370Sstevel@tonic-gate (tcode == IEEE1394_TCODE_PHY)) 3380Sstevel@tonic-gate 3390Sstevel@tonic-gate #define HCI1394_IRCTXT_CTRL_SET(HCIP, I, BFFILL, IHDR, MATCHENBL, MULTI, RUN, \ 3400Sstevel@tonic-gate WAKE) (ddi_put32((HCIP)->ohci->ohci_reg_handle, \ 3410Sstevel@tonic-gate &(HCIP)->ohci->ohci_regs->ir[(I)].ctxt_ctrl_set, \ 3420Sstevel@tonic-gate 0 | (((BFFILL) << OHCI_IRCTL_BFILL_SHIFT) & OHCI_IRCTL_BFILL_MASK) | \ 3430Sstevel@tonic-gate (((IHDR) << OHCI_IRCTL_IHDR_SHIFT) & OHCI_IRCTL_IHDR_MASK) | \ 3440Sstevel@tonic-gate (((MATCHENBL) << OHCI_IRCTL_MTC_ENBL_SHIFT) & \ 3450Sstevel@tonic-gate OHCI_IRCTL_MTC_ENBL_MASK) | \ 3460Sstevel@tonic-gate (((MULTI) << OHCI_IRCTL_MULTI_SHIFT) & OHCI_IRCTL_MULTI_MASK) | \ 3470Sstevel@tonic-gate (((RUN) << OHCI_CC_RUN_SHIFT) & OHCI_CC_RUN_MASK) | \ 3480Sstevel@tonic-gate (((WAKE) << OHCI_CC_WAKE_SHIFT) & OHCI_CC_WAKE_MASK))) 3490Sstevel@tonic-gate 3500Sstevel@tonic-gate #define HCI1394_IRCTXT_CTRL_CLR(HCIP, I, BFFILL, IHDR, MATCHENBL, MULTI, RUN) \ 3510Sstevel@tonic-gate (ddi_put32((HCIP)->ohci->ohci_reg_handle, \ 3520Sstevel@tonic-gate &(HCIP)->ohci->ohci_regs->ir[(I)].ctxt_ctrl_clr, \ 3530Sstevel@tonic-gate 0 | (((BFFILL) << OHCI_IRCTL_BFILL_SHIFT) & OHCI_IRCTL_BFILL_MASK) | \ 3540Sstevel@tonic-gate (((IHDR) << OHCI_IRCTL_IHDR_SHIFT) & OHCI_IRCTL_IHDR_MASK) | \ 3550Sstevel@tonic-gate (((MATCHENBL) << OHCI_IRCTL_MTC_ENBL_SHIFT) & \ 3560Sstevel@tonic-gate OHCI_IRCTL_MTC_ENBL_MASK) | \ 3570Sstevel@tonic-gate (((MULTI) << OHCI_IRCTL_MULTI_SHIFT) & OHCI_IRCTL_MULTI_MASK) | \ 3580Sstevel@tonic-gate (((RUN) << OHCI_CC_RUN_SHIFT) & OHCI_CC_RUN_MASK))) 3590Sstevel@tonic-gate 3600Sstevel@tonic-gate #define HCI1394_ITCTXT_CTRL_SET(HCIP, I, MATCHENBL, MATCH, RUN, WAKE) \ 3610Sstevel@tonic-gate (ddi_put32((HCIP)->ohci->ohci_reg_handle, \ 3620Sstevel@tonic-gate &(HCIP)->ohci->ohci_regs->it[(I)].ctxt_ctrl_set, 0 | \ 3630Sstevel@tonic-gate (((MATCHENBL) << OHCI_ITCTL_MTC_ENBL_SHIFT) & \ 3640Sstevel@tonic-gate OHCI_ITCTL_MTC_ENBL_MASK) | \ 3650Sstevel@tonic-gate (((MATCH) << OHCI_ITCTL_MATCH_SHIFT) & OHCI_ITCTL_MATCH_MASK) | \ 3660Sstevel@tonic-gate (((RUN) << OHCI_CC_RUN_SHIFT) & OHCI_CC_RUN_MASK) | \ 3670Sstevel@tonic-gate (((WAKE) << OHCI_CC_WAKE_SHIFT) & OHCI_CC_WAKE_MASK))) 3680Sstevel@tonic-gate 3690Sstevel@tonic-gate #define HCI1394_ITCTXT_CTRL_CLR(HCIP, I, MATCHENBL, MATCH, RUN) \ 3700Sstevel@tonic-gate (ddi_put32((HCIP)->ohci->ohci_reg_handle, \ 3710Sstevel@tonic-gate &(HCIP)->ohci->ohci_regs->it[(I)].ctxt_ctrl_clr, 0 | \ 3720Sstevel@tonic-gate (((MATCHENBL) << OHCI_ITCTL_MTC_ENBL_SHIFT) & \ 3730Sstevel@tonic-gate OHCI_ITCTL_MTC_ENBL_MASK) | \ 3740Sstevel@tonic-gate (((MATCH) << OHCI_ITCTL_MATCH_SHIFT) & OHCI_ITCTL_MATCH_MASK) | \ 3750Sstevel@tonic-gate (((RUN) << OHCI_CC_RUN_SHIFT) & OHCI_CC_RUN_MASK))) 3760Sstevel@tonic-gate 3770Sstevel@tonic-gate 3780Sstevel@tonic-gate #define HCI1394_IRCTXT_MATCH_WRITE(HCIP, I, TAG3, TAG2, TAG1, TAG0, MATCH, \ 3790Sstevel@tonic-gate SYNC, TAG1SYNC, CHAN) (ddi_put32((HCIP)->ohci->ohci_reg_handle, \ 3800Sstevel@tonic-gate &(HCIP)->ohci->ohci_regs->ir[(I)].ctxt_match, 0 | \ 3810Sstevel@tonic-gate (((TAG3) << OHCI_MTC_TAG3_SHIFT) & OHCI_MTC_TAG3_MASK) | \ 3820Sstevel@tonic-gate (((TAG2) << OHCI_MTC_TAG2_SHIFT) & OHCI_MTC_TAG2_MASK) | \ 3830Sstevel@tonic-gate (((TAG1) << OHCI_MTC_TAG1_SHIFT) & OHCI_MTC_TAG1_MASK) | \ 3840Sstevel@tonic-gate (((TAG0) << OHCI_MTC_TAG0_SHIFT) & OHCI_MTC_TAG0_MASK) | \ 3850Sstevel@tonic-gate (((MATCH) << OHCI_MTC_MATCH_SHIFT) & OHCI_MTC_MATCH_MASK) | \ 3860Sstevel@tonic-gate (((SYNC) << OHCI_MTC_SYNC_SHIFT) & OHCI_MTC_SYNC_MASK) | \ 3870Sstevel@tonic-gate (((TAG1SYNC) << OHCI_MTC_TAG1SY_SHIFT) & OHCI_MTC_TAG1SY_MASK) | \ 3880Sstevel@tonic-gate (((CHAN) << OHCI_MTC_CHAN_SHIFT) & OHCI_MTC_CHAN_MASK))) 3890Sstevel@tonic-gate 3900Sstevel@tonic-gate #define HCI1394_ISOCH_CTXT_ACTIVE(SOFTSTATEP, CTXTP) \ 3910Sstevel@tonic-gate (ddi_get32((SOFTSTATEP)->ohci->ohci_reg_handle, \ 3920Sstevel@tonic-gate &(CTXTP)->ctxt_regsp->ctxt_ctrl_set) & OHCI_CC_ACTIVE_MASK) 3930Sstevel@tonic-gate 3940Sstevel@tonic-gate #define HCI1394_ISOCH_CTXT_RUN(SOFTSTATEP, CTXTP) \ 3950Sstevel@tonic-gate (ddi_get32((SOFTSTATEP)->ohci->ohci_reg_handle, \ 3960Sstevel@tonic-gate &(CTXTP)->ctxt_regsp->ctxt_ctrl_set) & OHCI_CC_RUN_MASK) 3970Sstevel@tonic-gate 3980Sstevel@tonic-gate #define HCI1394_ISOCH_CTXT_CMD_PTR(SOFTSTATEP, CTXTP) \ 3990Sstevel@tonic-gate (ddi_get32((SOFTSTATEP)->ohci->ohci_reg_handle, \ 4000Sstevel@tonic-gate &(CTXTP)->ctxt_regsp->cmd_ptrlo)) 4010Sstevel@tonic-gate 4020Sstevel@tonic-gate /* 4030Sstevel@tonic-gate * 1394 OpenHCI 1.0 general context register layout 4040Sstevel@tonic-gate * All contexts except for Isoch Receive have the following layout 4050Sstevel@tonic-gate * See the OpenHCI v1.0 specification for register definitions. 4060Sstevel@tonic-gate */ 4070Sstevel@tonic-gate typedef struct hci1394_ctxt_regs_s { 4080Sstevel@tonic-gate uint32_t ctxt_ctrl_set; 4090Sstevel@tonic-gate uint32_t ctxt_ctrl_clr; 4100Sstevel@tonic-gate uint32_t reserved; 4110Sstevel@tonic-gate uint32_t cmd_ptrlo; 4120Sstevel@tonic-gate } hci1394_ctxt_regs_t; 4130Sstevel@tonic-gate 4140Sstevel@tonic-gate /* 4150Sstevel@tonic-gate * 1394 OpenHCI 1.0 Isochronous Receive context register layout 4160Sstevel@tonic-gate * See the OpenHCI v1.0 specification for register definitions. 4170Sstevel@tonic-gate */ 4180Sstevel@tonic-gate typedef struct hci1394_ir_ctxt_regs_s { 4190Sstevel@tonic-gate uint32_t ctxt_ctrl_set; 4200Sstevel@tonic-gate uint32_t ctxt_ctrl_clr; 4210Sstevel@tonic-gate uint32_t reserved0; 4220Sstevel@tonic-gate uint32_t cmd_ptrlo; 4230Sstevel@tonic-gate uint32_t ctxt_match; 4240Sstevel@tonic-gate uint32_t reserved1[3]; 4250Sstevel@tonic-gate } hci1394_ir_ctxt_regs_t; 4260Sstevel@tonic-gate 4270Sstevel@tonic-gate /* 4280Sstevel@tonic-gate * 1394 OpenHCI 1.0 registers 4290Sstevel@tonic-gate * See the OpenHCI v1.0 specification for register definitions. 4300Sstevel@tonic-gate */ 4310Sstevel@tonic-gate typedef struct hci1394_regs_s { 4320Sstevel@tonic-gate uint32_t version; 4330Sstevel@tonic-gate uint32_t guid_rom; 4340Sstevel@tonic-gate uint32_t at_retries; 4350Sstevel@tonic-gate uint32_t csr_data; 4360Sstevel@tonic-gate uint32_t csr_compare_data; 4370Sstevel@tonic-gate uint32_t csr_ctrl; 4380Sstevel@tonic-gate uint32_t config_rom_hdr; 4390Sstevel@tonic-gate uint32_t bus_id; 4400Sstevel@tonic-gate uint32_t bus_options; 4410Sstevel@tonic-gate uint32_t guid_hi; 4420Sstevel@tonic-gate uint32_t guid_lo; 4430Sstevel@tonic-gate uint32_t reserved01; 4440Sstevel@tonic-gate uint32_t reserved02; 4450Sstevel@tonic-gate uint32_t config_rom_maplo; 4460Sstevel@tonic-gate uint32_t posted_write_addrlo; 4470Sstevel@tonic-gate uint32_t posted_write_addrhi; 4480Sstevel@tonic-gate uint32_t vendor_id; 4490Sstevel@tonic-gate uint32_t reserved03[3]; 4500Sstevel@tonic-gate uint32_t hc_ctrl_set; 4510Sstevel@tonic-gate uint32_t hc_ctrl_clr; 4520Sstevel@tonic-gate uint32_t reserved06[2]; 4530Sstevel@tonic-gate uint32_t reserved08; 4540Sstevel@tonic-gate uint32_t self_id_buflo; 4550Sstevel@tonic-gate uint32_t self_id_count; 4560Sstevel@tonic-gate uint32_t reserved09; 4570Sstevel@tonic-gate uint32_t ir_multi_maskhi_set; 4580Sstevel@tonic-gate uint32_t ir_multi_maskhi_clr; 4590Sstevel@tonic-gate uint32_t ir_multi_masklo_set; 4600Sstevel@tonic-gate uint32_t ir_multi_masklo_clr; 4610Sstevel@tonic-gate uint32_t intr_event_set; 4620Sstevel@tonic-gate uint32_t intr_event_clr; 4630Sstevel@tonic-gate uint32_t intr_mask_set; 4640Sstevel@tonic-gate uint32_t intr_mask_clr; 4650Sstevel@tonic-gate uint32_t it_intr_event_set; 4660Sstevel@tonic-gate uint32_t it_intr_event_clr; 4670Sstevel@tonic-gate uint32_t it_intr_mask_set; 4680Sstevel@tonic-gate uint32_t it_intr_mask_clr; 4690Sstevel@tonic-gate uint32_t ir_intr_event_set; 4700Sstevel@tonic-gate uint32_t ir_intr_event_clr; 4710Sstevel@tonic-gate uint32_t ir_intr_mask_set; 4720Sstevel@tonic-gate uint32_t ir_intr_mask_clr; 4730Sstevel@tonic-gate uint32_t reserved10[11]; 4740Sstevel@tonic-gate uint32_t fairness_ctrl; 4750Sstevel@tonic-gate uint32_t link_ctrl_set; 4760Sstevel@tonic-gate uint32_t link_ctrl_clr; 4770Sstevel@tonic-gate uint32_t node_id; 4780Sstevel@tonic-gate uint32_t phy_ctrl; 4790Sstevel@tonic-gate uint32_t isoch_cycle_timer; 4800Sstevel@tonic-gate uint32_t reserved21[3]; 4810Sstevel@tonic-gate uint32_t ar_req_filterhi_set; 4820Sstevel@tonic-gate uint32_t ar_req_filterhi_clr; 4830Sstevel@tonic-gate uint32_t ar_req_filterlo_set; 4840Sstevel@tonic-gate uint32_t ar_req_filterlo_clr; 4850Sstevel@tonic-gate uint32_t phys_req_filterhi_set; 4860Sstevel@tonic-gate uint32_t phys_req_filterhi_clr; 4870Sstevel@tonic-gate uint32_t phys_req_filterlo_set; 4880Sstevel@tonic-gate uint32_t phys_req_filterlo_clr; 4890Sstevel@tonic-gate uint32_t phys_upper_bound; 4900Sstevel@tonic-gate uint32_t reserved24[23]; 4910Sstevel@tonic-gate hci1394_ctxt_regs_t at_req; 4920Sstevel@tonic-gate uint32_t reserved47[4]; 4930Sstevel@tonic-gate hci1394_ctxt_regs_t at_resp; 4940Sstevel@tonic-gate uint32_t reserved51[4]; 4950Sstevel@tonic-gate hci1394_ctxt_regs_t ar_req; 4960Sstevel@tonic-gate uint32_t reserved55[4]; 4970Sstevel@tonic-gate hci1394_ctxt_regs_t ar_resp; 4980Sstevel@tonic-gate uint32_t reserved59[4]; 4990Sstevel@tonic-gate hci1394_ctxt_regs_t it[HCI1394_MAX_ISOCH_CONTEXTS]; 5000Sstevel@tonic-gate hci1394_ir_ctxt_regs_t ir[HCI1394_MAX_ISOCH_CONTEXTS]; 5010Sstevel@tonic-gate } hci1394_regs_t; 5020Sstevel@tonic-gate 5030Sstevel@tonic-gate 5040Sstevel@tonic-gate /* private structure to keep track of OpenHCI */ 5050Sstevel@tonic-gate typedef struct hci1394_ohci_s { 5060Sstevel@tonic-gate /* config ROM and selfid buffers */ 5070Sstevel@tonic-gate hci1394_buf_handle_t ohci_cfgrom_handle; 5080Sstevel@tonic-gate hci1394_buf_handle_t ohci_selfid_handle; 5090Sstevel@tonic-gate 5100Sstevel@tonic-gate /* 5110Sstevel@tonic-gate * Phy register #1 cached settings. These are only used for 1394-1995 5120Sstevel@tonic-gate * phy's. When setting the root holdoff bit and gap count in 1394, 5130Sstevel@tonic-gate * you send out a PHY configuration packet. The 1995 PHY's will 5140Sstevel@tonic-gate * not look at the PHY packet if we sent it out which means we have 5150Sstevel@tonic-gate * to write directly to PHY register 1. This creates some ugly race 5160Sstevel@tonic-gate * conditions. Since we will be following up these settings with a bus 5170Sstevel@tonic-gate * reset shortly, we "cache" them until we generate the bus reset. This 5180Sstevel@tonic-gate * solution is not perfect, but it is the best of a bad thing. 5190Sstevel@tonic-gate */ 5200Sstevel@tonic-gate boolean_t ohci_set_root_holdoff; 5210Sstevel@tonic-gate boolean_t ohci_set_gap_count; 5220Sstevel@tonic-gate uint_t ohci_gap_count; 5230Sstevel@tonic-gate 5240Sstevel@tonic-gate /* 5250Sstevel@tonic-gate * The bus time is kept using the cycle timer and then counting the 5260Sstevel@tonic-gate * rollovers via the cycle 64 seconds interrupt. (NOTE: every 2 5270Sstevel@tonic-gate * interrupts is one rollover) We do not wish to be interrupting 5280Sstevel@tonic-gate * the CPU if there is nothing plugged into the bus (since bus time 5290Sstevel@tonic-gate * really isn't used for anything yet (maybe when bridges come out?)). 5300Sstevel@tonic-gate * We will start with the interrupt disabled, if the bus master writes 5310Sstevel@tonic-gate * to the CSR bus time register, we will enable the interrupt. These 5320Sstevel@tonic-gate * fields keep track of the rollover and whether or not the interrupt 5330Sstevel@tonic-gate * is enabled. 5340Sstevel@tonic-gate */ 5350Sstevel@tonic-gate volatile uint_t ohci_bustime_count; 5360Sstevel@tonic-gate boolean_t ohci_bustime_enabled; 5370Sstevel@tonic-gate 5380Sstevel@tonic-gate /* whether we have a 1394-1995 or 1394A phy */ 5390Sstevel@tonic-gate h1394_phy_t ohci_phy; 5400Sstevel@tonic-gate 5410Sstevel@tonic-gate /* General Driver Info */ 5420Sstevel@tonic-gate hci1394_drvinfo_t *ohci_drvinfo; 5430Sstevel@tonic-gate 5440Sstevel@tonic-gate /* 5450Sstevel@tonic-gate * self id buffer and config rom info. These are towards bottom of the 5460Sstevel@tonic-gate * structure to make debugging easier. 5470Sstevel@tonic-gate */ 5480Sstevel@tonic-gate hci1394_buf_info_t ohci_selfid; 5490Sstevel@tonic-gate hci1394_buf_info_t ohci_cfgrom; 5500Sstevel@tonic-gate 5510Sstevel@tonic-gate /* OpenHCI registers */ 5520Sstevel@tonic-gate ddi_acc_handle_t ohci_reg_handle; 5530Sstevel@tonic-gate hci1394_regs_t *ohci_regs; 5540Sstevel@tonic-gate 5550Sstevel@tonic-gate /* 5560Sstevel@tonic-gate * This mutex is used to protect "atomic" operations to the OpenHCI 5570Sstevel@tonic-gate * hardware. This includes reads and writes to the PHY, cswap 5580Sstevel@tonic-gate * operations to the HW implemented CSR registers, and any read/modify/ 5590Sstevel@tonic-gate * write operations such as updating atreq retries. 5600Sstevel@tonic-gate */ 5610Sstevel@tonic-gate kmutex_t ohci_mutex; 5620Sstevel@tonic-gate 5630Sstevel@tonic-gate hci1394_state_t *soft_state; 5640Sstevel@tonic-gate } hci1394_ohci_t; 5650Sstevel@tonic-gate 5660Sstevel@tonic-gate _NOTE(SCHEME_PROTECTS_DATA("Single thread modifies", \ 5670Sstevel@tonic-gate hci1394_ohci_s::ohci_bustime_count \ 5680Sstevel@tonic-gate hci1394_ohci_s::ohci_bustime_enabled \ 5690Sstevel@tonic-gate hci1394_ohci_s::ohci_gap_count \ 5700Sstevel@tonic-gate hci1394_ohci_s::ohci_set_gap_count \ 5710Sstevel@tonic-gate hci1394_ohci_s::ohci_set_root_holdoff)) 5720Sstevel@tonic-gate 5730Sstevel@tonic-gate /* handle passed back from init() and used for rest of functions */ 5740Sstevel@tonic-gate typedef hci1394_ohci_t *hci1394_ohci_handle_t; 5750Sstevel@tonic-gate 5760Sstevel@tonic-gate 5770Sstevel@tonic-gate int hci1394_ohci_init(hci1394_state_t *soft_state, hci1394_drvinfo_t *drvinfo, 5780Sstevel@tonic-gate hci1394_ohci_handle_t *ohci_hdl); 5790Sstevel@tonic-gate void hci1394_ohci_fini(hci1394_ohci_handle_t *ohci_hdl); 5800Sstevel@tonic-gate 5810Sstevel@tonic-gate void hci1394_ohci_reg_read(hci1394_ohci_handle_t ohci_hdl, uint_t offset, 5820Sstevel@tonic-gate uint32_t *data); 5830Sstevel@tonic-gate void hci1394_ohci_reg_write(hci1394_ohci_handle_t ohci_hdl, uint_t offset, 5840Sstevel@tonic-gate uint32_t data); 5850Sstevel@tonic-gate int hci1394_ohci_phy_init(hci1394_ohci_handle_t ohci_hdl); 5860Sstevel@tonic-gate int hci1394_ohci_phy_set(hci1394_ohci_handle_t ohci_hdl, uint_t regAddr, 5870Sstevel@tonic-gate uint_t bits); 5880Sstevel@tonic-gate int hci1394_ohci_phy_clr(hci1394_ohci_handle_t ohci_hdl, uint_t regAddr, 5890Sstevel@tonic-gate uint_t bits); 5900Sstevel@tonic-gate int hci1394_ohci_phy_read(hci1394_ohci_handle_t ohci_hdl, uint_t regAddr, 5910Sstevel@tonic-gate uint_t *rdData); 5920Sstevel@tonic-gate int hci1394_ohci_phy_write(hci1394_ohci_handle_t ohci_hdl, uint_t regAddr, 5930Sstevel@tonic-gate uint_t wrData); 5940Sstevel@tonic-gate int hci1394_ohci_phy_info(hci1394_ohci_handle_t ohci_hdl, uint32_t *info); 5950Sstevel@tonic-gate void hci1394_ohci_intr_master_enable(hci1394_ohci_handle_t ohci_hdl); 5960Sstevel@tonic-gate void hci1394_ohci_intr_master_disable(hci1394_ohci_handle_t ohci_hdl); 5970Sstevel@tonic-gate uint32_t hci1394_ohci_intr_asserted(hci1394_ohci_handle_t ohci_hdl); 5980Sstevel@tonic-gate void hci1394_ohci_intr_enable(hci1394_ohci_handle_t ohci_hdl, 5990Sstevel@tonic-gate uint32_t intr_mask); 6000Sstevel@tonic-gate void hci1394_ohci_intr_disable(hci1394_ohci_handle_t ohci_hdl, 6010Sstevel@tonic-gate uint32_t intr_mask); 6020Sstevel@tonic-gate void hci1394_ohci_intr_clear(hci1394_ohci_handle_t ohci_hdl, 6030Sstevel@tonic-gate uint32_t intr_mask); 6040Sstevel@tonic-gate uint32_t hci1394_ohci_it_intr_asserted(hci1394_ohci_handle_t ohci_hdl); 6050Sstevel@tonic-gate void hci1394_ohci_it_intr_enable(hci1394_ohci_handle_t ohci_hdl, 6060Sstevel@tonic-gate uint32_t intr_mask); 6070Sstevel@tonic-gate void hci1394_ohci_it_intr_disable(hci1394_ohci_handle_t ohci_hdl, 6080Sstevel@tonic-gate uint32_t intr_mask); 6090Sstevel@tonic-gate void hci1394_ohci_it_intr_clear(hci1394_ohci_handle_t ohci_hdl, 6100Sstevel@tonic-gate uint32_t intr_mask); 6110Sstevel@tonic-gate int hci1394_ohci_it_ctxt_count_get(hci1394_ohci_handle_t ohci_hdl); 6120Sstevel@tonic-gate void hci1394_ohci_it_cmd_ptr_set(hci1394_ohci_handle_t ohci_hdl, 6130Sstevel@tonic-gate uint_t context_number, uint32_t io_addr); 6140Sstevel@tonic-gate uint32_t hci1394_ohci_ir_intr_asserted(hci1394_ohci_handle_t ohci_hdl); 6150Sstevel@tonic-gate void hci1394_ohci_ir_intr_enable(hci1394_ohci_handle_t ohci_hdl, 6160Sstevel@tonic-gate uint32_t intr_mask); 6170Sstevel@tonic-gate void hci1394_ohci_ir_intr_disable(hci1394_ohci_handle_t ohci_hdl, 6180Sstevel@tonic-gate uint32_t intr_mask); 6190Sstevel@tonic-gate void hci1394_ohci_ir_intr_clear(hci1394_ohci_handle_t ohci_hdl, 6200Sstevel@tonic-gate uint32_t intr_mask); 6210Sstevel@tonic-gate int hci1394_ohci_ir_ctxt_count_get(hci1394_ohci_handle_t ohci_hdl); 6220Sstevel@tonic-gate void hci1394_ohci_ir_cmd_ptr_set(hci1394_ohci_handle_t ohci_hdl, 6230Sstevel@tonic-gate uint_t context_number, uint32_t io_addr); 6240Sstevel@tonic-gate void hci1394_ohci_link_enable(hci1394_ohci_handle_t ohci_hdl); 6250Sstevel@tonic-gate void hci1394_ohci_link_disable(hci1394_ohci_handle_t ohci_hdl); 6260Sstevel@tonic-gate uint_t hci1394_ohci_current_busgen(hci1394_ohci_handle_t ohci_hdl); 6270Sstevel@tonic-gate int hci1394_ohci_soft_reset(hci1394_ohci_handle_t ohci_hdl); 6280Sstevel@tonic-gate int hci1394_ohci_startup(hci1394_ohci_handle_t ohci_hdl); 6290Sstevel@tonic-gate uint64_t hci1394_ohci_guid(hci1394_ohci_handle_t ohci_hdl); 6300Sstevel@tonic-gate int hci1394_ohci_csr_read(hci1394_ohci_handle_t ohci_hdl, uint_t offset, 6310Sstevel@tonic-gate uint32_t *data); 6320Sstevel@tonic-gate int hci1394_ohci_csr_cswap(hci1394_ohci_handle_t ohci_hdl, uint_t generation, 6330Sstevel@tonic-gate uint_t offset, uint32_t compare, uint32_t swap, uint32_t *old); 6340Sstevel@tonic-gate int hci1394_ohci_bus_reset(hci1394_ohci_handle_t ohci_hdl); 635*6881Sbharding int hci1394_ohci_bus_reset_nroot(hci1394_ohci_handle_t ohci_hdl); 6360Sstevel@tonic-gate int hci1394_ohci_bus_reset_short(hci1394_ohci_handle_t ohci_hdl); 6370Sstevel@tonic-gate void hci1394_ohci_postwr_addr(hci1394_ohci_handle_t ohci_hdl, uint64_t *addr); 6380Sstevel@tonic-gate int hci1394_ohci_contender_enable(hci1394_ohci_handle_t ohci_hdl); 6390Sstevel@tonic-gate int hci1394_ohci_root_holdoff_enable(hci1394_ohci_handle_t ohci_hdl); 6400Sstevel@tonic-gate int hci1394_ohci_gap_count_set(hci1394_ohci_handle_t ohci_hdl, 6410Sstevel@tonic-gate uint_t gap_count); 6420Sstevel@tonic-gate int hci1394_ohci_phy_filter_set(hci1394_ohci_handle_t ohci_hdl, 6430Sstevel@tonic-gate uint64_t mask, uint_t generation); 6440Sstevel@tonic-gate int hci1394_ohci_phy_filter_clr(hci1394_ohci_handle_t ohci_hdl, 6450Sstevel@tonic-gate uint64_t mask, uint_t generation); 6460Sstevel@tonic-gate void hci1394_ohci_cfgrom_update(hci1394_ohci_handle_t ohci_hdl, 6470Sstevel@tonic-gate void *local_buf, uint_t quadlet_count); 6480Sstevel@tonic-gate void hci1394_ohci_selfid_enable(hci1394_ohci_handle_t ohci_hdl); 6490Sstevel@tonic-gate void hci1394_ohci_selfid_read(hci1394_ohci_handle_t ohci_hdl, uint_t offset, 6500Sstevel@tonic-gate uint32_t *data); 6510Sstevel@tonic-gate void hci1394_ohci_selfid_info(hci1394_ohci_handle_t ohci_hdl, uint_t *busgen, 6520Sstevel@tonic-gate uint_t *size, boolean_t *error); 6530Sstevel@tonic-gate boolean_t hci1394_ohci_selfid_buf_current(hci1394_ohci_handle_t ohci_hdl); 6540Sstevel@tonic-gate void hci1394_ohci_selfid_sync(hci1394_ohci_handle_t ohci_hdl); 6550Sstevel@tonic-gate void hci1394_ohci_nodeid_set(hci1394_ohci_handle_t ohci_hdl, uint_t nodeid); 6560Sstevel@tonic-gate void hci1394_ohci_nodeid_get(hci1394_ohci_handle_t ohci_hdl, uint_t *nodeid); 6570Sstevel@tonic-gate void hci1394_ohci_nodeid_info(hci1394_ohci_handle_t ohci_hdl, 6580Sstevel@tonic-gate uint_t *nodeid, boolean_t *error); 6590Sstevel@tonic-gate void hci1394_ohci_cycletime_get(hci1394_ohci_handle_t ohci_hdl, 6600Sstevel@tonic-gate uint32_t *cycle_time); 6610Sstevel@tonic-gate void hci1394_ohci_cycletime_set(hci1394_ohci_handle_t ohci_hdl, 6620Sstevel@tonic-gate uint32_t cycle_time); 6630Sstevel@tonic-gate void hci1394_ohci_bustime_get(hci1394_ohci_handle_t ohci_hdl, 6640Sstevel@tonic-gate uint32_t *bus_time); 6650Sstevel@tonic-gate void hci1394_ohci_bustime_set(hci1394_ohci_handle_t ohci_hdl, 6660Sstevel@tonic-gate uint32_t bus_time); 6670Sstevel@tonic-gate void hci1394_ohci_atreq_retries_get(hci1394_ohci_handle_t ohci_hdl, 6680Sstevel@tonic-gate uint_t *atreq_retries); 6690Sstevel@tonic-gate void hci1394_ohci_atreq_retries_set(hci1394_ohci_handle_t ohci_hdl, 6700Sstevel@tonic-gate uint_t atreq_retries); 6710Sstevel@tonic-gate void hci1394_ohci_isr_cycle64seconds(hci1394_ohci_handle_t ohci_hdl); 6720Sstevel@tonic-gate void hci1394_ohci_isr_phy(hci1394_ohci_handle_t ohci_hdl); 6730Sstevel@tonic-gate boolean_t hci1394_ohci_root_check(hci1394_ohci_handle_t ohci_hdl); 6740Sstevel@tonic-gate boolean_t hci1394_ohci_cmc_check(hci1394_ohci_handle_t ohci_hdl); 6750Sstevel@tonic-gate void hci1394_ohci_cycle_master_enable(hci1394_ohci_handle_t ohci_hdl); 6760Sstevel@tonic-gate void hci1394_ohci_cycle_master_disable(hci1394_ohci_handle_t ohci_hdl); 6770Sstevel@tonic-gate int hci1394_ohci_resume(hci1394_ohci_handle_t ohci_hdl); 6780Sstevel@tonic-gate void hci1394_ohci_bus_capabilities(hci1394_ohci_handle_t ohci_hdl, 6790Sstevel@tonic-gate uint32_t *bus_capabilities); 6800Sstevel@tonic-gate boolean_t hci1394_ohci_at_active(hci1394_ohci_handle_t ohci_hdl); 6810Sstevel@tonic-gate void hci1394_ohci_atreq_start(hci1394_ohci_handle_t ohci_hdl, 6820Sstevel@tonic-gate uint32_t cmdptr); 6830Sstevel@tonic-gate void hci1394_ohci_atreq_wake(hci1394_ohci_handle_t ohci_hdl); 6840Sstevel@tonic-gate void hci1394_ohci_atreq_stop(hci1394_ohci_handle_t ohci_hdl); 6850Sstevel@tonic-gate void hci1394_ohci_arresp_start(hci1394_ohci_handle_t ohci_hdl, 6860Sstevel@tonic-gate uint32_t cmdptr); 6870Sstevel@tonic-gate void hci1394_ohci_arresp_wake(hci1394_ohci_handle_t ohci_hdl); 6880Sstevel@tonic-gate void hci1394_ohci_arresp_stop(hci1394_ohci_handle_t ohci_hdl); 6890Sstevel@tonic-gate void hci1394_ohci_arreq_start(hci1394_ohci_handle_t ohci_hdl, 6900Sstevel@tonic-gate uint32_t cmdptr); 6910Sstevel@tonic-gate void hci1394_ohci_arreq_wake(hci1394_ohci_handle_t ohci_hdl); 6920Sstevel@tonic-gate void hci1394_ohci_arreq_stop(hci1394_ohci_handle_t ohci_hdl); 6930Sstevel@tonic-gate void hci1394_ohci_atresp_start(hci1394_ohci_handle_t ohci_hdl, 6940Sstevel@tonic-gate uint32_t cmdptr); 6950Sstevel@tonic-gate void hci1394_ohci_atresp_wake(hci1394_ohci_handle_t ohci_hdl); 6960Sstevel@tonic-gate void hci1394_ohci_atresp_stop(hci1394_ohci_handle_t ohci_hdl); 6970Sstevel@tonic-gate 6980Sstevel@tonic-gate 6990Sstevel@tonic-gate #ifdef __cplusplus 7000Sstevel@tonic-gate } 7010Sstevel@tonic-gate #endif 7020Sstevel@tonic-gate 7030Sstevel@tonic-gate #endif /* _SYS_1394_ADAPTERS_HCI1394_OHCI_H */ 704