1*01869ca4Swiz.\" $NetBSD: tc.9,v 1.13 2017/07/03 21:28:48 wiz Exp $ 2f878fc99Sgmcgarry.\" 3f878fc99Sgmcgarry.\" Copyright (c) 2001 The NetBSD Foundation, Inc. 4f878fc99Sgmcgarry.\" All rights reserved. 5f878fc99Sgmcgarry.\" 6f878fc99Sgmcgarry.\" This code is derived from software contributed to The NetBSD Foundation 7f878fc99Sgmcgarry.\" by Gregory McGarry. 8f878fc99Sgmcgarry.\" 9f878fc99Sgmcgarry.\" Redistribution and use in source and binary forms, with or without 10f878fc99Sgmcgarry.\" modification, are permitted provided that the following conditions 11f878fc99Sgmcgarry.\" are met: 12f878fc99Sgmcgarry.\" 1. Redistributions of source code must retain the above copyright 13f878fc99Sgmcgarry.\" notice, this list of conditions and the following disclaimer. 14f878fc99Sgmcgarry.\" 2. Redistributions in binary form must reproduce the above copyright 15f878fc99Sgmcgarry.\" notice, this list of conditions and the following disclaimer in the 16f878fc99Sgmcgarry.\" documentation and/or other materials provided with the distribution. 17f878fc99Sgmcgarry.\" 18f878fc99Sgmcgarry.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 19f878fc99Sgmcgarry.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 20f878fc99Sgmcgarry.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21f878fc99Sgmcgarry.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22f878fc99Sgmcgarry.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23f878fc99Sgmcgarry.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24f878fc99Sgmcgarry.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25f878fc99Sgmcgarry.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26f878fc99Sgmcgarry.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27f878fc99Sgmcgarry.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28f878fc99Sgmcgarry.\" POSSIBILITY OF SUCH DAMAGE. 29f878fc99Sgmcgarry.\" 30f878fc99Sgmcgarry.Dd October 7, 2001 31f878fc99Sgmcgarry.Dt TC 9 32f878fc99Sgmcgarry.Os 33f878fc99Sgmcgarry.Sh NAME 34f878fc99Sgmcgarry.Nm TC , 35f878fc99Sgmcgarry.Nm tc_intr_establish , 36f878fc99Sgmcgarry.Nm tc_intr_disestablish , 37f878fc99Sgmcgarry.Nm tc_intr_evcnt . 38f878fc99Sgmcgarry.Nm tc_mb , 39f878fc99Sgmcgarry.Nm tc_wmb , 40f878fc99Sgmcgarry.Nm tc_syncbus , 41f878fc99Sgmcgarry.Nm tc_badaddr , 42f878fc99Sgmcgarry.Nm TC_DENSE_TO_SPARSE , 43f878fc99Sgmcgarry.Nm TC_PHYS_TO_UNCACHED 44305a93a1Sgmcgarry.Nd TURBOchannel bus 45f878fc99Sgmcgarry.Sh SYNOPSIS 465c997b3eSdyoung.In sys/bus.h 47472351e1Swiz.In dev/tc/tcvar.h 48472351e1Swiz.In dev/tc/tcdevs.h 49f878fc99Sgmcgarry.Ft void 50f878fc99Sgmcgarry.Fn tc_intr_establish "struct device *dev" "void *cookie" \ 51f878fc99Sgmcgarry"int level" "int (*handler)(void *)" "void *arg" 52f878fc99Sgmcgarry.Ft void 53f878fc99Sgmcgarry.Fn tc_intr_disestablish "struct device *dev" "void *cookie" 54f878fc99Sgmcgarry.Ft const struct evcnt * 55f878fc99Sgmcgarry.Fn tc_intr_evcnt "struct device *dev" "void *cookie" 56f878fc99Sgmcgarry.Ft void 57f878fc99Sgmcgarry.Fn tc_mb "" 58f878fc99Sgmcgarry.Ft void 59f878fc99Sgmcgarry.Fn tc_wmb "" 60f878fc99Sgmcgarry.Ft void 61f878fc99Sgmcgarry.Fn tc_syncbus "" 62f878fc99Sgmcgarry.Ft int 63f878fc99Sgmcgarry.Fn tc_badaddr "tc_addr_t tcaddr" 64f878fc99Sgmcgarry.Ft tc_addr_t 65f878fc99Sgmcgarry.Fn TC_DENSE_TO_SPARSE "tc_addr_t addr" 66f878fc99Sgmcgarry.Ft tc_addr_t 67f878fc99Sgmcgarry.Fn TC_PHYS_TO_UNCACHED "tc_addr_t addr" 68f878fc99Sgmcgarry.Sh DESCRIPTION 69f878fc99SgmcgarryThe 70f878fc99Sgmcgarry.Nm 71305a93a1Sgmcgarrydevice provides support for the DEC TURBOchannel bus found on all DEC 72f878fc99SgmcgarryTURBOchannel machines with MIPS (DECstation 5000 series, excluding the 73770eef21Swiz5000/200) and Alpha (3000-series) systems. 74770eef21SwizTURBOchannel is a 32-bit wide synchronous DMA-capable bus, running 75770eef21Swizat 25 MHz on higher-end machines and at 12.5 MHz on lower-end machines. 76f878fc99Sgmcgarry.Sh DATA TYPES 77305a93a1SgmcgarryDrivers for devices attached to the TURBOchannel bus will make use of 78f878fc99Sgmcgarrythe following data types: 79f878fc99Sgmcgarry.Bl -tag -width compact 80f878fc99Sgmcgarry.It Fa struct tc_attach_args 81305a93a1SgmcgarryA structure use to inform the driver of TURBOchannel bus properties. 82f878fc99SgmcgarryIt contains the following members: 83f878fc99Sgmcgarry.Bd -literal 84f878fc99Sgmcgarry bus_space_tag_t ta_memt; 85f878fc99Sgmcgarry bus_dma_tag_t ta_dmat; 86f878fc99Sgmcgarry char ta_modname[TC_ROM_LLEN+1]; 87f878fc99Sgmcgarry u_int ta_slot; 88f878fc99Sgmcgarry tc_offset_t ta_offset; 89f878fc99Sgmcgarry tc_addr_t ta_addr; 90f878fc99Sgmcgarry void *ta_cookie; 91f878fc99Sgmcgarry u_int ta_busspeed; 92f878fc99Sgmcgarry.Ed 93f878fc99Sgmcgarry.Pp 94f878fc99SgmcgarryThe 95f878fc99Sgmcgarry.Em ta_busspeed 96305a93a1Sgmcgarrymember specifies the TURBOchannel bus speed and is useful for 97770eef21Swiztime-related functions. 98770eef21SwizValues values are 99f878fc99Sgmcgarry.Em TC_SPEED_12_5_MHZ 100f878fc99Sgmcgarryfor the 12.5 MHz bus and 101f878fc99Sgmcgarry.Em TC_SPEED_25_MHZ 102f878fc99Sgmcgarryfor the 50 MHz bus. 103f878fc99Sgmcgarry.El 104f878fc99Sgmcgarry.Sh FUNCTIONS 105f878fc99Sgmcgarry.Bl -tag -width compact 106f878fc99Sgmcgarry.It Fn tc_intr_establish "dev" "cookie" "level" "handler" "arg" 107f878fc99SgmcgarryEstablish an interrupt handler with device 108f878fc99Sgmcgarry.Fa dev 109f878fc99Sgmcgarryfor the interrupt described completely by 110f878fc99Sgmcgarry.Fa cookie , 111f878fc99Sgmcgarrythe value passed to the driver in the 112f878fc99Sgmcgarry.Em ta_cookie 113f878fc99Sgmcgarrymember of the 114f878fc99Sgmcgarry.Em tc_attach_args 115f878fc99Sgmcgarrystructure. 116f878fc99SgmcgarryThe priority of the interrupt is specified by 117f878fc99Sgmcgarry.Fa level . 118f878fc99SgmcgarryWhen the interrupt occurs the function 119f878fc99Sgmcgarry.Fa handler 120f878fc99Sgmcgarryis called with argument 121f878fc99Sgmcgarry.Fa arg . 122f878fc99Sgmcgarry.It Fn tc_intr_disestablish "dev" "cookie" 123f878fc99SgmcgarryDis-establish the interrupt handler with device 124f878fc99Sgmcgarry.Fa dev 125f878fc99Sgmcgarryfor the interrupt described completely 126f878fc99Sgmcgarry.Fa cookie . 127f878fc99Sgmcgarry.It Fn tc_intr_evcnt "dev" "cookie" 128f878fc99SgmcgarryDo interrupt event counting with device 129f878fc99Sgmcgarry.Fa dev 130f878fc99Sgmcgarryfor the event described completely by 131f878fc99Sgmcgarry.Fa cookie . 132f878fc99Sgmcgarry.It Fn tc_mb "" 133770eef21SwizA read/write memory barrier. 134770eef21SwizAny CPU-to-memory reads/writes before the barrier must complete before 135770eef21Swizany CPU-to-memory reads/writes after it. 136f878fc99Sgmcgarry.It Fn tc_wmb "" 137770eef21SwizA write memory barrier. 138aae59958SrumbleAny CPU-to-memory writes before the barrier must complete 139770eef21Swizbefore any CPU-to-memory writes after it. 140f878fc99Sgmcgarry.It Fn tc_syncbus "" 141305a93a1SgmcgarrySynchronise writes on the TURBOchannel bus by ensuring CPU writes are 142305a93a1Sgmcgarrypropagated across the TURBOchannel bus. 143f878fc99Sgmcgarry.It Fn tc_badaddr "tcaddr" 144f878fc99SgmcgarryReturns non-zero if the given address 145f878fc99Sgmcgarry.Fa tcaddr 146f878fc99Sgmcgarryis invalid. 147f878fc99Sgmcgarry.It Fn TC_DENSE_TO_SPARSE "addr" 148f878fc99SgmcgarryConvert the given physical address 149f878fc99Sgmcgarry.Fa addr 150305a93a1Sgmcgarryin TURBOchannel dense space to the corresponding address in 151305a93a1SgmcgarryTURBOchannel sparse space. 152f878fc99Sgmcgarry.It Fn TC_PHYS_TO_UNCACHED "addr" 153f878fc99SgmcgarryConvert the given system memory physical address 154f878fc99Sgmcgarry.Fa addr 155f878fc99Sgmcgarryto the physical address of the corresponding region that is not 156f878fc99Sgmcgarrycached. 157f878fc99Sgmcgarry.El 158f878fc99Sgmcgarry.Sh AUTOCONFIGURATION 159770eef21SwizThe TURBOchannel bus is a direct-connection bus. 160770eef21SwizDuring autoconfiguration, the parent specifies the name of the found 161305a93a1SgmcgarryTURBOchannel module into the 162f878fc99Sgmcgarry.Fa ta_modname 163f878fc99Sgmcgarrymember of the 164f878fc99Sgmcgarry.Em tc_attach_args 165770eef21Swizstructure. 166770eef21SwizDrivers should match on this name. 167f878fc99Sgmcgarry.Sh DMA SUPPORT 168305a93a1SgmcgarryThe TURBOchannel bus supports 32-bit, bidirectional DMA transfers. 169f878fc99SgmcgarrySupport is provided by the standard 170f878fc99Sgmcgarry.Xr bus_dma 9 171f878fc99Sgmcgarryinterface. 172f878fc99Sgmcgarry.Sh CODE REFERENCES 1733bd93d8eSgmcgarryThe TURBOchannel subsystem itself is implemented within the file 174f878fc99Sgmcgarry.Pa sys/dev/tc/tc_subr.c . 175f878fc99SgmcgarryMachine-dependent portions can be found in 176*01869ca4Swiz.Pa sys/arch/<arch>/tc/tcbus.c . 177f878fc99Sgmcgarry.Sh SEE ALSO 178f878fc99Sgmcgarry.Xr tc 4 , 179f878fc99Sgmcgarry.Xr autoconf 9 , 180f878fc99Sgmcgarry.Xr bus_dma 9 , 181f878fc99Sgmcgarry.Xr bus_space 9 , 182f878fc99Sgmcgarry.Xr driver 9 183