Annotation of sys/arch/alpha/pci/irongate_dma.c, Revision 1.1
1.1 ! nbrk 1: /* $OpenBSD: irongate_dma.c,v 1.4 2001/11/06 19:53:13 miod Exp $ */
! 2: /* $NetBSD: irongate_dma.c,v 1.3 2000/06/29 08:58:47 mrg Exp $ */
! 3:
! 4: /*-
! 5: * Copyright (c) 2000 The NetBSD Foundation, Inc.
! 6: * All rights reserved.
! 7: *
! 8: * This code is derived from software contributed to The NetBSD Foundation
! 9: * by Jason R. Thorpe.
! 10: *
! 11: * Redistribution and use in source and binary forms, with or without
! 12: * modification, are permitted provided that the following conditions
! 13: * are met:
! 14: * 1. Redistributions of source code must retain the above copyright
! 15: * notice, this list of conditions and the following disclaimer.
! 16: * 2. Redistributions in binary form must reproduce the above copyright
! 17: * notice, this list of conditions and the following disclaimer in the
! 18: * documentation and/or other materials provided with the distribution.
! 19: * 3. All advertising materials mentioning features or use of this software
! 20: * must display the following acknowledgement:
! 21: * This product includes software developed by the NetBSD
! 22: * Foundation, Inc. and its contributors.
! 23: * 4. Neither the name of The NetBSD Foundation nor the names of its
! 24: * contributors may be used to endorse or promote products derived
! 25: * from this software without specific prior written permission.
! 26: *
! 27: * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
! 28: * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
! 29: * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
! 30: * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
! 31: * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
! 32: * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
! 33: * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
! 34: * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
! 35: * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
! 36: * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
! 37: * POSSIBILITY OF SUCH DAMAGE.
! 38: */
! 39:
! 40: /*
! 41: * DMA support for the AMD 751 (``Irongate'') core logic chipset.
! 42: *
! 43: * The AMD 751 is really unlike all of the other Alpha PCI core logic
! 44: * chipsets. Instead, it looks like a normal PC chipset (not surprising,
! 45: * since it is used for Athlon processors).
! 46: *
! 47: * Because of this, it lacks all of the SGMAP hardware normally present
! 48: * on an Alpha system, and there are no DMA windows. Instead, a memory
! 49: * bus address is a PCI DMA address, and ISA DMA above 16M has to be
! 50: * bounced (this is not unlike the Jensen, actually).
! 51: */
! 52:
! 53: /*
! 54: * XXX - We should define this before including bus.h, but since other stuff
! 55: * pulls in bus.h we must do this here.
! 56: */
! 57: #define _ALPHA_BUS_DMA_PRIVATE
! 58:
! 59: #include <sys/param.h>
! 60: #include <sys/systm.h>
! 61: #include <sys/kernel.h>
! 62: #include <sys/device.h>
! 63: #include <sys/malloc.h>
! 64:
! 65: #include <uvm/uvm_extern.h>
! 66:
! 67: #include <machine/bus.h>
! 68:
! 69: #include <dev/pci/pcireg.h>
! 70: #include <dev/pci/pcivar.h>
! 71:
! 72: #include <alpha/pci/irongatereg.h>
! 73: #include <alpha/pci/irongatevar.h>
! 74:
! 75: #include <dev/isa/isareg.h>
! 76: #include <dev/isa/isavar.h>
! 77:
! 78: #include "isadma.h"
! 79:
! 80: bus_dma_tag_t irongate_dma_get_tag(bus_dma_tag_t, alpha_bus_t);
! 81:
! 82: void
! 83: irongate_dma_init(struct irongate_config *icp)
! 84: {
! 85: bus_dma_tag_t t;
! 86:
! 87: /*
! 88: * Initialize the DMA tag used for PCI DMA.
! 89: */
! 90: t = &icp->ic_dmat_pci;
! 91: t->_cookie = icp;
! 92: t->_wbase = 0;
! 93: t->_wsize = 0x100000000UL;
! 94: t->_next_window = NULL;
! 95: t->_boundary = 0;
! 96: t->_sgmap = NULL;
! 97: t->_get_tag = irongate_dma_get_tag;
! 98: t->_dmamap_create = _bus_dmamap_create;
! 99: t->_dmamap_destroy = _bus_dmamap_destroy;
! 100: t->_dmamap_load = _bus_dmamap_load_direct;
! 101: t->_dmamap_load_mbuf = _bus_dmamap_load_mbuf_direct;
! 102: t->_dmamap_load_uio = _bus_dmamap_load_uio_direct;
! 103: t->_dmamap_load_raw = _bus_dmamap_load_raw_direct;
! 104: t->_dmamap_unload = _bus_dmamap_unload;
! 105: t->_dmamap_sync = _bus_dmamap_sync;
! 106:
! 107: t->_dmamem_alloc = _bus_dmamem_alloc;
! 108: t->_dmamem_free = _bus_dmamem_free;
! 109: t->_dmamem_map = _bus_dmamem_map;
! 110: t->_dmamem_unmap = _bus_dmamem_unmap;
! 111: t->_dmamem_mmap = _bus_dmamem_mmap;
! 112:
! 113: #if NISADMA > 0
! 114: /*
! 115: * Initialize the DMA tag used for ISA DMA.
! 116: */
! 117: t = &icp->ic_dmat_isa;
! 118: t->_cookie = icp;
! 119: t->_wbase = 0;
! 120: t->_wsize = 0x1000000;
! 121: t->_next_window = NULL;
! 122: t->_boundary = 0;
! 123: t->_sgmap = NULL;
! 124: t->_get_tag = irongate_dma_get_tag;
! 125: t->_dmamap_create = isadma_bounce_dmamap_create;
! 126: t->_dmamap_destroy = isadma_bounce_dmamap_destroy;
! 127: t->_dmamap_load = isadma_bounce_dmamap_load;
! 128: t->_dmamap_load_mbuf = isadma_bounce_dmamap_load_mbuf;
! 129: t->_dmamap_load_uio = isadma_bounce_dmamap_load_uio;
! 130: t->_dmamap_load_raw = isadma_bounce_dmamap_load_raw;
! 131: t->_dmamap_unload = isadma_bounce_dmamap_unload;
! 132: t->_dmamap_sync = isadma_bounce_dmamap_sync;
! 133:
! 134: t->_dmamem_alloc = isadma_bounce_dmamem_alloc;
! 135: t->_dmamem_free = _bus_dmamem_free;
! 136: t->_dmamem_map = _bus_dmamem_map;
! 137: t->_dmamem_unmap = _bus_dmamem_unmap;
! 138: t->_dmamem_mmap = _bus_dmamem_mmap;
! 139: #endif
! 140:
! 141: /* XXX XXX BEGIN XXX XXX */
! 142: { /* XXX */
! 143: extern paddr_t alpha_XXX_dmamap_or; /* XXX */
! 144: alpha_XXX_dmamap_or = 0; /* XXX */
! 145: } /* XXX */
! 146: /* XXX XXX END XXX XXX */
! 147: }
! 148:
! 149: /*
! 150: * Return the bus dma tag to be used for the specified bus type.
! 151: * INTERNAL USE ONLY!
! 152: */
! 153: bus_dma_tag_t
! 154: irongate_dma_get_tag(bus_dma_tag_t t, alpha_bus_t bustype)
! 155: {
! 156: struct irongate_config *icp = t->_cookie;
! 157:
! 158: switch (bustype) {
! 159: case ALPHA_BUS_PCI:
! 160: case ALPHA_BUS_EISA:
! 161: /*
! 162: * Busses capable of 32-bit DMA get the PCI DMA tag.
! 163: */
! 164: return (&icp->ic_dmat_pci);
! 165:
! 166: case ALPHA_BUS_ISA:
! 167: /*
! 168: * Lame 24-bit busses have to bounce.
! 169: */
! 170: return (&icp->ic_dmat_isa);
! 171:
! 172: default:
! 173: panic("irongate_dma_get_tag: shouldn't be here, really...");
! 174: }
! 175: }
CVSweb