1.\" $NetBSD: tc.9,v 1.9 2004/10/04 19:12:52 rumble Exp $ 2.\" 3.\" Copyright (c) 2001 The NetBSD Foundation, Inc. 4.\" All rights reserved. 5.\" 6.\" This code is derived from software contributed to The NetBSD Foundation 7.\" by Gregory McGarry. 8.\" 9.\" Redistribution and use in source and binary forms, with or without 10.\" modification, are permitted provided that the following conditions 11.\" are met: 12.\" 1. Redistributions of source code must retain the above copyright 13.\" notice, this list of conditions and the following disclaimer. 14.\" 2. Redistributions in binary form must reproduce the above copyright 15.\" notice, this list of conditions and the following disclaimer in the 16.\" documentation and/or other materials provided with the distribution. 17.\" 3. All advertising materials mentioning features or use of this software 18.\" must display the following acknowledgement: 19.\" This product includes software developed by the NetBSD 20.\" Foundation, Inc. and its contributors. 21.\" 4. Neither the name of The NetBSD Foundation nor the names of its 22.\" contributors may be used to endorse or promote products derived 23.\" from this software without specific prior written permission. 24.\" 25.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 26.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 27.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 28.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 29.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 30.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 31.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 32.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 33.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 35.\" POSSIBILITY OF SUCH DAMAGE. 36.\" 37.Dd October 7, 2001 38.Dt TC 9 39.Os 40.Sh NAME 41.Nm TC , 42.Nm tc_intr_establish , 43.Nm tc_intr_disestablish , 44.Nm tc_intr_evcnt . 45.Nm tc_mb , 46.Nm tc_wmb , 47.Nm tc_syncbus , 48.Nm tc_badaddr , 49.Nm TC_DENSE_TO_SPARSE , 50.Nm TC_PHYS_TO_UNCACHED 51.Nd TURBOchannel bus 52.Sh SYNOPSIS 53.In machine/bus.h 54.In dev/tc/tcvar.h 55.In dev/tc/tcdevs.h 56.Ft void 57.Fn tc_intr_establish "struct device *dev" "void *cookie" \ 58"int level" "int (*handler)(void *)" "void *arg" 59.Ft void 60.Fn tc_intr_disestablish "struct device *dev" "void *cookie" 61.Ft const struct evcnt * 62.Fn tc_intr_evcnt "struct device *dev" "void *cookie" 63.Ft void 64.Fn tc_mb "" 65.Ft void 66.Fn tc_wmb "" 67.Ft void 68.Fn tc_syncbus "" 69.Ft int 70.Fn tc_badaddr "tc_addr_t tcaddr" 71.Ft tc_addr_t 72.Fn TC_DENSE_TO_SPARSE "tc_addr_t addr" 73.Ft tc_addr_t 74.Fn TC_PHYS_TO_UNCACHED "tc_addr_t addr" 75.Sh DESCRIPTION 76The 77.Nm 78device provides support for the DEC TURBOchannel bus found on all DEC 79TURBOchannel machines with MIPS (DECstation 5000 series, excluding the 805000/200) and Alpha (3000-series) systems. 81TURBOchannel is a 32-bit wide synchronous DMA-capable bus, running 82at 25 MHz on higher-end machines and at 12.5 MHz on lower-end machines. 83.Sh DATA TYPES 84Drivers for devices attached to the TURBOchannel bus will make use of 85the following data types: 86.Bl -tag -width compact 87.It Fa struct tc_attach_args 88A structure use to inform the driver of TURBOchannel bus properties. 89It contains the following members: 90.Bd -literal 91 bus_space_tag_t ta_memt; 92 bus_dma_tag_t ta_dmat; 93 char ta_modname[TC_ROM_LLEN+1]; 94 u_int ta_slot; 95 tc_offset_t ta_offset; 96 tc_addr_t ta_addr; 97 void *ta_cookie; 98 u_int ta_busspeed; 99.Ed 100.Pp 101The 102.Em ta_busspeed 103member specifies the TURBOchannel bus speed and is useful for 104time-related functions. 105Values values are 106.Em TC_SPEED_12_5_MHZ 107for the 12.5 MHz bus and 108.Em TC_SPEED_25_MHZ 109for the 50 MHz bus. 110.El 111.Sh FUNCTIONS 112.Bl -tag -width compact 113.It Fn tc_intr_establish "dev" "cookie" "level" "handler" "arg" 114Establish an interrupt handler with device 115.Fa dev 116for the interrupt described completely by 117.Fa cookie , 118the value passed to the driver in the 119.Em ta_cookie 120member of the 121.Em tc_attach_args 122structure. 123The priority of the interrupt is specified by 124.Fa level . 125When the interrupt occurs the function 126.Fa handler 127is called with argument 128.Fa arg . 129.It Fn tc_intr_disestablish "dev" "cookie" 130Dis-establish the interrupt handler with device 131.Fa dev 132for the interrupt described completely 133.Fa cookie . 134.It Fn tc_intr_evcnt "dev" "cookie" 135Do interrupt event counting with device 136.Fa dev 137for the event described completely by 138.Fa cookie . 139.It Fn tc_mb "" 140A read/write memory barrier. 141Any CPU-to-memory reads/writes before the barrier must complete before 142any CPU-to-memory reads/writes after it. 143.It Fn tc_wmb "" 144A write memory barrier. 145Any CPU-to-memory writes before the barrier must complete 146before any CPU-to-memory writes after it. 147.It Fn tc_syncbus "" 148Synchronise writes on the TURBOchannel bus by ensuring CPU writes are 149propagated across the TURBOchannel bus. 150.It Fn tc_badaddr "tcaddr" 151Returns non-zero if the given address 152.Fa tcaddr 153is invalid. 154.It Fn TC_DENSE_TO_SPARSE "addr" 155Convert the given physical address 156.Fa addr 157in TURBOchannel dense space to the corresponding address in 158TURBOchannel sparse space. 159.It Fn TC_PHYS_TO_UNCACHED "addr" 160Convert the given system memory physical address 161.Fa addr 162to the physical address of the corresponding region that is not 163cached. 164.El 165.Sh AUTOCONFIGURATION 166The TURBOchannel bus is a direct-connection bus. 167During autoconfiguration, the parent specifies the name of the found 168TURBOchannel module into the 169.Fa ta_modname 170member of the 171.Em tc_attach_args 172structure. 173Drivers should match on this name. 174.Sh DMA SUPPORT 175The TURBOchannel bus supports 32-bit, bidirectional DMA transfers. 176Support is provided by the standard 177.Xr bus_dma 9 178interface. 179.Sh CODE REFERENCES 180This section describes places within the 181.Nx 182source tree where actual code implementing or using the 183machine-independent TURBOchannel subsystem can be found. 184All pathnames are relative to 185.Pa /usr/src . 186.Pp 187The TURBOchannel subsystem itself is implemented within the file 188.Pa sys/dev/tc/tc_subr.c . 189Machine-dependent portions can be found in 190.Pa sys/arch/\*[Lt]arch\*[Gt]/tc/tcbus.c . 191.Sh SEE ALSO 192.Xr tc 4 , 193.Xr autoconf 9 , 194.Xr bus_dma 9 , 195.Xr bus_space 9 , 196.Xr driver 9 197