Home | History | Annotate | Line # | Download | only in pci
tsp_dma.c revision 1.4.22.2
      1  1.4.22.1    skrll /* $NetBSD: tsp_dma.c,v 1.4.22.2 2004/09/18 14:31:13 skrll Exp $ */
      2       1.1     ross 
      3       1.1     ross /*-
      4       1.1     ross  * Copyright (c) 1999 by Ross Harvey.  All rights reserved.
      5       1.1     ross  *
      6       1.1     ross  * Redistribution and use in source and binary forms, with or without
      7       1.1     ross  * modification, are permitted provided that the following conditions
      8       1.1     ross  * are met:
      9       1.1     ross  * 1. Redistributions of source code must retain the above copyright
     10       1.1     ross  *    notice, this list of conditions and the following disclaimer.
     11       1.1     ross  * 2. Redistributions in binary form must reproduce the above copyright
     12       1.1     ross  *    notice, this list of conditions and the following disclaimer in the
     13       1.1     ross  *    documentation and/or other materials provided with the distribution.
     14       1.1     ross  * 3. All advertising materials mentioning features or use of this software
     15       1.1     ross  *    must display the following acknowledgement:
     16       1.1     ross  *	This product includes software developed by Ross Harvey.
     17       1.1     ross  * 4. The name of Ross Harvey may not be used to endorse or promote products
     18       1.1     ross  *    derived from this software without specific prior written permission.
     19       1.1     ross  *
     20       1.1     ross  * THIS SOFTWARE IS PROVIDED BY ROSS HARVEY ``AS IS'' AND ANY EXPRESS
     21       1.1     ross  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
     22       1.1     ross  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURP0SE
     23       1.1     ross  * ARE DISCLAIMED.  IN NO EVENT SHALL ROSS HARVEY BE LIABLE FOR ANY
     24       1.1     ross  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     25       1.1     ross  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     26       1.1     ross  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     27       1.1     ross  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     28       1.1     ross  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     29       1.1     ross  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     30       1.1     ross  * SUCH DAMAGE.
     31       1.1     ross  *
     32       1.1     ross  */
     33       1.1     ross 
     34       1.1     ross /*-
     35       1.1     ross  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
     36       1.1     ross  * All rights reserved.
     37       1.1     ross  *
     38       1.1     ross  * This code is derived from software contributed to The NetBSD Foundation
     39       1.1     ross  * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
     40       1.1     ross  * NASA Ames Research Center.
     41       1.1     ross  *
     42       1.1     ross  * Redistribution and use in source and binary forms, with or without
     43       1.1     ross  * modification, are permitted provided that the following conditions
     44       1.1     ross  * are met:
     45       1.1     ross  * 1. Redistributions of source code must retain the above copyright
     46       1.1     ross  *    notice, this list of conditions and the following disclaimer.
     47       1.1     ross  * 2. Redistributions in binary form must reproduce the above copyright
     48       1.1     ross  *    notice, this list of conditions and the following disclaimer in the
     49       1.1     ross  *    documentation and/or other materials provided with the distribution.
     50       1.1     ross  * 3. All advertising materials mentioning features or use of this software
     51       1.1     ross  *    must display the following acknowledgement:
     52       1.1     ross  *	This product includes software developed by the NetBSD
     53       1.1     ross  *	Foundation, Inc. and its contributors.
     54       1.1     ross  * 4. Neither the name of The NetBSD Foundation nor the names of its
     55       1.1     ross  *    contributors may be used to endorse or promote products derived
     56       1.1     ross  *    from this software without specific prior written permission.
     57       1.1     ross  *
     58       1.1     ross  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     59       1.1     ross  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     60       1.1     ross  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     61       1.1     ross  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     62       1.1     ross  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     63       1.1     ross  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     64       1.1     ross  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     65       1.1     ross  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     66       1.1     ross  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     67       1.1     ross  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     68       1.1     ross  * POSSIBILITY OF SUCH DAMAGE.
     69       1.1     ross  */
     70       1.1     ross 
     71  1.4.22.1    skrll #include <sys/cdefs.h>
     72  1.4.22.1    skrll __KERNEL_RCSID(0, "$NetBSD: tsp_dma.c,v 1.4.22.2 2004/09/18 14:31:13 skrll Exp $");
     73  1.4.22.1    skrll 
     74       1.1     ross #include <sys/param.h>
     75       1.1     ross #include <sys/systm.h>
     76       1.1     ross #include <sys/kernel.h>
     77       1.1     ross #include <sys/device.h>
     78       1.1     ross #include <sys/malloc.h>
     79       1.2      mrg 
     80       1.2      mrg #include <uvm/uvm_extern.h>
     81       1.1     ross 
     82       1.1     ross #include <machine/autoconf.h>
     83       1.1     ross #define _ALPHA_BUS_DMA_PRIVATE
     84       1.1     ross #include <machine/bus.h>
     85       1.1     ross #include <machine/rpb.h>
     86       1.1     ross 
     87       1.1     ross #include <dev/pci/pcireg.h>
     88       1.1     ross #include <dev/pci/pcivar.h>
     89       1.1     ross #include <alpha/pci/tsreg.h>
     90       1.1     ross #include <alpha/pci/tsvar.h>
     91       1.1     ross 
     92       1.1     ross #define tsp_dma() { Generate ctags(1) key. }
     93       1.1     ross 
     94       1.1     ross #define	EDIFF(a, b) (((a) | WSBA_ENA | WSBA_SG)	!= ((b) | WSBA_ENA | WSBA_SG))
     95       1.1     ross 
     96       1.1     ross bus_dma_tag_t tsp_dma_get_tag __P((bus_dma_tag_t, alpha_bus_t));
     97       1.1     ross 
     98       1.1     ross int	tsp_bus_dmamap_load_sgmap __P((bus_dma_tag_t, bus_dmamap_t, void *,
     99       1.1     ross 	    bus_size_t, struct proc *, int));
    100       1.1     ross 
    101       1.1     ross int	tsp_bus_dmamap_load_mbuf_sgmap __P((bus_dma_tag_t, bus_dmamap_t,
    102       1.1     ross 	    struct mbuf *, int));
    103       1.1     ross 
    104       1.1     ross int	tsp_bus_dmamap_load_uio_sgmap __P((bus_dma_tag_t, bus_dmamap_t,
    105       1.1     ross 	    struct uio *, int));
    106       1.1     ross 
    107       1.1     ross int	tsp_bus_dmamap_load_raw_sgmap __P((bus_dma_tag_t, bus_dmamap_t,
    108       1.1     ross 	    bus_dma_segment_t *, int, bus_size_t, int));
    109       1.1     ross 
    110       1.1     ross void	tsp_bus_dmamap_unload_sgmap __P((bus_dma_tag_t, bus_dmamap_t));
    111       1.1     ross 
    112       1.1     ross void	tsp_tlb_invalidate __P((struct tsp_config *));
    113       1.1     ross 
    114       1.4  thorpej /*
    115       1.4  thorpej  * XXX Need to figure out what this is, if any.  Initialize it to
    116       1.4  thorpej  * XXX something that should be safe.
    117       1.4  thorpej  */
    118       1.4  thorpej #define	TSP_SGMAP_PFTHRESH	256
    119       1.4  thorpej 
    120       1.1     ross void
    121       1.1     ross tsp_dma_init(pcp)
    122       1.1     ross 	struct tsp_config *pcp;
    123       1.1     ross {
    124       1.1     ross 	int i;
    125       1.1     ross 	bus_dma_tag_t t;
    126       1.1     ross 	struct ts_pchip *pccsr = pcp->pc_csr;
    127       1.1     ross 	bus_addr_t dwbase, dwlen, sgwbase, sgwlen, tbase;
    128       1.1     ross 	static struct map_expected {
    129       1.1     ross 		u_int32_t base, mask, enables;
    130       1.1     ross 	} premap[4] = {
    131       1.1     ross 		{ 0x800000, 		   0x700000, WSBA_ENA | WSBA_SG },
    132       1.1     ross 		{ 0x80000000 | WSBA_ENA, 0x3ff00000, WSBA_ENA           },
    133       1.1     ross 		{ 0, 0 },
    134       1.1     ross 		{ 0, 0 }
    135       1.1     ross 	};
    136       1.1     ross 
    137       1.1     ross 	alpha_mb();
    138       1.1     ross 	for(i = 0; i < 4; ++i) {
    139       1.1     ross 		if (EDIFF(pccsr->tsp_wsba[i].tsg_r, premap[i].base) ||
    140       1.1     ross 		    EDIFF(pccsr->tsp_wsm[i].tsg_r, premap[i].mask))
    141       1.1     ross 			printf("tsp%d: window %d: %lx/base %lx/mask %lx"
    142       1.1     ross 			    " reinitialized\n",
    143       1.1     ross 			    pcp->pc_pslot, i,
    144       1.1     ross 			    pccsr->tsp_wsba[i].tsg_r,
    145       1.1     ross 			    pccsr->tsp_wsm[i].tsg_r,
    146       1.1     ross 			    pccsr->tsp_tba[i].tsg_r);
    147       1.1     ross 		pccsr->tsp_wsba[i].tsg_r = premap[i].base | premap[i].enables;
    148       1.1     ross 		pccsr->tsp_wsm[i].tsg_r = premap[i].mask;
    149       1.1     ross 	}
    150       1.1     ross 	alpha_mb();
    151       1.1     ross 
    152       1.1     ross 	/*
    153       1.1     ross 	 * Initialize the DMA tag used for direct-mapped DMA.
    154       1.1     ross 	 */
    155       1.1     ross 	t = &pcp->pc_dmat_direct;
    156       1.1     ross 	t->_cookie = pcp;
    157       1.1     ross 	t->_wbase = dwbase = WSBA_ADDR(pccsr->tsp_wsba[1].tsg_r);
    158       1.1     ross 	t->_wsize = dwlen = WSM_LEN(pccsr->tsp_wsm[1].tsg_r);
    159       1.1     ross 	t->_next_window = &pcp->pc_dmat_sgmap;
    160       1.1     ross 	t->_boundary = 0;
    161       1.1     ross 	t->_sgmap = NULL;
    162       1.1     ross 	t->_get_tag = tsp_dma_get_tag;
    163       1.1     ross 	t->_dmamap_create = _bus_dmamap_create;
    164       1.1     ross 	t->_dmamap_destroy = _bus_dmamap_destroy;
    165       1.1     ross 	t->_dmamap_load = _bus_dmamap_load_direct;
    166       1.1     ross 	t->_dmamap_load_mbuf = _bus_dmamap_load_mbuf_direct;
    167       1.1     ross 	t->_dmamap_load_uio = _bus_dmamap_load_uio_direct;
    168       1.1     ross 	t->_dmamap_load_raw = _bus_dmamap_load_raw_direct;
    169       1.1     ross 	t->_dmamap_unload = _bus_dmamap_unload;
    170       1.1     ross 	t->_dmamap_sync = _bus_dmamap_sync;
    171       1.1     ross 
    172       1.1     ross 	t->_dmamem_alloc = _bus_dmamem_alloc;
    173       1.1     ross 	t->_dmamem_free = _bus_dmamem_free;
    174       1.1     ross 	t->_dmamem_map = _bus_dmamem_map;
    175       1.1     ross 	t->_dmamem_unmap = _bus_dmamem_unmap;
    176       1.1     ross 	t->_dmamem_mmap = _bus_dmamem_mmap;
    177       1.1     ross 
    178       1.1     ross 	/*
    179       1.1     ross 	 * Initialize the DMA tag used for sgmap-mapped DMA.
    180       1.1     ross 	 */
    181       1.1     ross 	t = &pcp->pc_dmat_sgmap;
    182       1.1     ross 	t->_cookie = pcp;
    183       1.1     ross 	t->_wbase = sgwbase = WSBA_ADDR(pccsr->tsp_wsba[0].tsg_r);
    184       1.1     ross 	t->_wsize = sgwlen = WSM_LEN(pccsr->tsp_wsm[0].tsg_r);
    185       1.1     ross 	t->_next_window = NULL;
    186       1.1     ross 	t->_boundary = 0;
    187       1.1     ross 	t->_sgmap = &pcp->pc_sgmap;
    188       1.4  thorpej 	t->_pfthresh = TSP_SGMAP_PFTHRESH;
    189       1.1     ross 	t->_get_tag = tsp_dma_get_tag;
    190       1.3  thorpej 	t->_dmamap_create = alpha_sgmap_dmamap_create;
    191       1.3  thorpej 	t->_dmamap_destroy = alpha_sgmap_dmamap_destroy;
    192       1.1     ross 	t->_dmamap_load = tsp_bus_dmamap_load_sgmap;
    193       1.1     ross 	t->_dmamap_load_mbuf = tsp_bus_dmamap_load_mbuf_sgmap;
    194       1.1     ross 	t->_dmamap_load_uio = tsp_bus_dmamap_load_uio_sgmap;
    195       1.1     ross 	t->_dmamap_load_raw = tsp_bus_dmamap_load_raw_sgmap;
    196       1.1     ross 	t->_dmamap_unload = tsp_bus_dmamap_unload_sgmap;
    197       1.1     ross 	t->_dmamap_sync = _bus_dmamap_sync;
    198       1.1     ross 
    199       1.1     ross 	t->_dmamem_alloc = _bus_dmamem_alloc;
    200       1.1     ross 	t->_dmamem_free = _bus_dmamem_free;
    201       1.1     ross 	t->_dmamem_map = _bus_dmamem_map;
    202       1.1     ross 	t->_dmamem_unmap = _bus_dmamem_unmap;
    203       1.1     ross 	t->_dmamem_mmap = _bus_dmamem_mmap;
    204       1.1     ross 
    205       1.1     ross 	/*
    206       1.1     ross 	 * Initialize the SGMAP.  Align page table to 32k in case
    207       1.1     ross 	 * window is somewhat larger than expected.
    208       1.1     ross 	 */
    209       1.1     ross 	alpha_sgmap_init(t, &pcp->pc_sgmap, "tsp_sgmap",
    210       1.1     ross 	    sgwbase, 0, sgwlen, sizeof(u_int64_t), NULL, (32*1024));
    211       1.1     ross 
    212       1.1     ross 	/*
    213       1.1     ross 	 * Enable window 0 and enable SG PTE mapping.
    214       1.1     ross 	 */
    215       1.1     ross 	alpha_mb();
    216       1.1     ross 	pccsr->tsp_wsba[0].tsg_r |= WSBA_SG | WSBA_ENA;
    217       1.1     ross 	alpha_mb();
    218       1.1     ross 
    219       1.1     ross 	/*
    220       1.1     ross 	 * Check windows for sanity, especially if we later decide to
    221       1.1     ross 	 * use the firmware's initialization in some cases.
    222       1.1     ross 	 */
    223       1.1     ross 	if ((sgwbase <= dwbase && dwbase < sgwbase + sgwlen) ||
    224       1.1     ross 	    (dwbase <= sgwbase && sgwbase < dwbase + dwlen))
    225       1.1     ross 		panic("tsp_dma_init: overlap");
    226       1.1     ross 
    227       1.1     ross 	tbase = pcp->pc_sgmap.aps_ptpa;
    228       1.1     ross 	if (tbase & ~0x7fffffc00UL)
    229       1.1     ross 		panic("tsp_dma_init: bad page table address");
    230       1.1     ross 	alpha_mb();
    231       1.1     ross 	pccsr->tsp_tba[0].tsg_r = tbase;
    232       1.1     ross 	alpha_mb();
    233       1.1     ross 
    234       1.1     ross 	tsp_tlb_invalidate(pcp);
    235       1.1     ross 	alpha_mb();
    236       1.1     ross 
    237       1.1     ross 	/* XXX XXX BEGIN XXX XXX */
    238       1.1     ross 	{							/* XXX */
    239       1.1     ross 		extern paddr_t alpha_XXX_dmamap_or;		/* XXX */
    240       1.1     ross 		alpha_XXX_dmamap_or = dwbase;			/* XXX */
    241       1.1     ross 	}							/* XXX */
    242       1.1     ross 	/* XXX XXX END XXX XXX */
    243       1.1     ross }
    244       1.1     ross 
    245       1.1     ross /*
    246       1.1     ross  * Return the bus dma tag to be used for the specified bus type.
    247       1.1     ross  * INTERNAL USE ONLY!
    248       1.1     ross  */
    249       1.1     ross bus_dma_tag_t
    250       1.1     ross tsp_dma_get_tag(t, bustype)
    251       1.1     ross 	bus_dma_tag_t t;
    252       1.1     ross 	alpha_bus_t bustype;
    253       1.1     ross {
    254       1.1     ross 	struct tsp_config *pcp = t->_cookie;
    255       1.1     ross 
    256       1.1     ross 	switch (bustype) {
    257       1.1     ross 	case ALPHA_BUS_PCI:
    258       1.1     ross 	case ALPHA_BUS_EISA:
    259       1.1     ross 		/*
    260       1.1     ross 		 * The direct mapped window will work for most systems,
    261       1.1     ross 		 * most of the time. When it doesn't, we chain to the sgmap
    262       1.1     ross 		 * window automatically.
    263       1.1     ross 		 */
    264       1.1     ross 		return (&pcp->pc_dmat_direct);
    265       1.1     ross 
    266       1.1     ross 	case ALPHA_BUS_ISA:
    267       1.1     ross 		/*
    268       1.1     ross 		 * ISA doesn't have enough address bits to use
    269       1.1     ross 		 * the direct-mapped DMA window, so we must use
    270       1.1     ross 		 * SGMAPs.
    271       1.1     ross 		 */
    272       1.1     ross 		return (&pcp->pc_dmat_sgmap);
    273       1.1     ross 
    274       1.1     ross 	default:
    275       1.1     ross 		panic("tsp_dma_get_tag: shouldn't be here, really...");
    276       1.1     ross 	}
    277       1.1     ross }
    278       1.1     ross 
    279       1.1     ross /*
    280       1.1     ross  * Load a TSP SGMAP-mapped DMA map with a linear buffer.
    281       1.1     ross  */
    282       1.1     ross int
    283       1.1     ross tsp_bus_dmamap_load_sgmap(t, map, buf, buflen, p, flags)
    284       1.1     ross 	bus_dma_tag_t t;
    285       1.1     ross 	bus_dmamap_t map;
    286       1.1     ross 	void *buf;
    287       1.1     ross 	bus_size_t buflen;
    288       1.1     ross 	struct proc *p;
    289       1.1     ross 	int flags;
    290       1.1     ross {
    291       1.1     ross 	int error;
    292       1.1     ross 
    293       1.1     ross 	error = pci_sgmap_pte64_load(t, map, buf, buflen, p, flags,
    294       1.1     ross 	    t->_sgmap);
    295       1.1     ross 	if (error == 0)
    296       1.1     ross 		tsp_tlb_invalidate(t->_cookie);
    297       1.1     ross 
    298       1.1     ross 	return (error);
    299       1.1     ross }
    300       1.1     ross 
    301       1.1     ross /*
    302       1.1     ross  * Load a TSP SGMAP-mapped DMA map with an mbuf chain.
    303       1.1     ross  */
    304       1.1     ross int
    305       1.1     ross tsp_bus_dmamap_load_mbuf_sgmap(t, map, m, flags)
    306       1.1     ross 	bus_dma_tag_t t;
    307       1.1     ross 	bus_dmamap_t map;
    308       1.1     ross 	struct mbuf *m;
    309       1.1     ross 	int flags;
    310       1.1     ross {
    311       1.1     ross 	int error;
    312       1.1     ross 
    313       1.1     ross 	error = pci_sgmap_pte64_load_mbuf(t, map, m, flags, t->_sgmap);
    314       1.1     ross 	if (error == 0)
    315       1.1     ross 		tsp_tlb_invalidate(t->_cookie);
    316       1.1     ross 
    317       1.1     ross 	return (error);
    318       1.1     ross }
    319       1.1     ross 
    320       1.1     ross /*
    321       1.1     ross  * Load a TSP SGMAP-mapped DMA map with a uio.
    322       1.1     ross  */
    323       1.1     ross int
    324       1.1     ross tsp_bus_dmamap_load_uio_sgmap(t, map, uio, flags)
    325       1.1     ross 	bus_dma_tag_t t;
    326       1.1     ross 	bus_dmamap_t map;
    327       1.1     ross 	struct uio *uio;
    328       1.1     ross 	int flags;
    329       1.1     ross {
    330       1.1     ross 	int error;
    331       1.1     ross 
    332       1.1     ross 	error = pci_sgmap_pte64_load_uio(t, map, uio, flags, t->_sgmap);
    333       1.1     ross 	if (error == 0)
    334       1.1     ross 		tsp_tlb_invalidate(t->_cookie);
    335       1.1     ross 
    336       1.1     ross 	return (error);
    337       1.1     ross }
    338       1.1     ross 
    339       1.1     ross /*
    340       1.1     ross  * Load a TSP SGMAP-mapped DMA map with raw memory.
    341       1.1     ross  */
    342       1.1     ross int
    343       1.1     ross tsp_bus_dmamap_load_raw_sgmap(t, map, segs, nsegs, size, flags)
    344       1.1     ross 	bus_dma_tag_t t;
    345       1.1     ross 	bus_dmamap_t map;
    346       1.1     ross 	bus_dma_segment_t *segs;
    347       1.1     ross 	int nsegs;
    348       1.1     ross 	bus_size_t size;
    349       1.1     ross 	int flags;
    350       1.1     ross {
    351       1.1     ross 	int error;
    352       1.1     ross 
    353       1.1     ross 	error = pci_sgmap_pte64_load_raw(t, map, segs, nsegs, size, flags,
    354       1.1     ross 	    t->_sgmap);
    355       1.1     ross 	if (error == 0)
    356       1.1     ross 		tsp_tlb_invalidate(t->_cookie);
    357       1.1     ross 
    358       1.1     ross 	return (error);
    359       1.1     ross }
    360       1.1     ross 
    361       1.1     ross /*
    362       1.1     ross  * Unload a TSP DMA map.
    363       1.1     ross  */
    364       1.1     ross void
    365       1.1     ross tsp_bus_dmamap_unload_sgmap(t, map)
    366       1.1     ross 	bus_dma_tag_t t;
    367       1.1     ross 	bus_dmamap_t map;
    368       1.1     ross {
    369       1.1     ross 
    370       1.1     ross 	/*
    371       1.1     ross 	 * Invalidate any SGMAP page table entries used by this
    372       1.1     ross 	 * mapping.
    373       1.1     ross 	 */
    374       1.1     ross 	pci_sgmap_pte64_unload(t, map, t->_sgmap);
    375       1.1     ross 	tsp_tlb_invalidate(t->_cookie);
    376       1.1     ross 
    377       1.1     ross 	/*
    378       1.1     ross 	 * Do the generic bits of the unload.
    379       1.1     ross 	 */
    380       1.1     ross 	_bus_dmamap_unload(t, map);
    381       1.1     ross }
    382       1.1     ross 
    383       1.1     ross /*
    384       1.1     ross  * Flush the TSP scatter/gather TLB.
    385       1.1     ross  */
    386       1.1     ross void
    387       1.1     ross tsp_tlb_invalidate(pcp)
    388       1.1     ross 	struct tsp_config *pcp;
    389       1.1     ross {
    390       1.1     ross 
    391       1.1     ross 	alpha_mb();
    392       1.1     ross 	pcp->pc_csr->tsp_tlbia.tsg_r = 0;
    393       1.1     ross 	alpha_mb();
    394       1.1     ross }
    395