ixp425_pci_dma.c revision 1.1 1 /* $NetBSD: ixp425_pci_dma.c,v 1.1 2003/09/25 14:11:18 ichiro Exp $ */
2
3 /*
4 * Copyright (c) 2003
5 * Ichiro FUKUHARA <ichiro (at) ichiro.org>.
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. All advertising materials mentioning features or use of this software
17 * must display the following acknowledgement:
18 * This product includes software developed by Ichiro FUKUHARA.
19 * 4. The name of the company nor the name of the author may be used to
20 * endorse or promote products derived from this software without specific
21 * prior written permission.
22 *
23 * THIS SOFTWARE IS PROVIDED BY ICHIRO FUKUHARA ``AS IS'' AND ANY EXPRESS OR
24 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
25 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
26 * IN NO EVENT SHALL ICHIRO FUKUHARA OR THE VOICES IN HIS HEAD BE LIABLE FOR
27 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * SUCH DAMAGE.
34 */
35
36 #include <sys/cdefs.h>
37 __KERNEL_RCSID(0, "$NetBSD: ixp425_pci_dma.c,v 1.1 2003/09/25 14:11:18 ichiro Exp $");
38
39 #include <sys/param.h>
40 #include <sys/systm.h>
41 #include <sys/device.h>
42 #include <sys/malloc.h>
43 #include <sys/mbuf.h>
44
45 #include <uvm/uvm_extern.h>
46
47 #define _ARM32_BUS_DMA_PRIVATE
48 #include <machine/bus.h>
49
50 #include <arm/xscale/ixp425reg.h>
51 #include <arm/xscale/ixp425var.h>
52
53 void
54 ixp425_pci_dma_init(struct ixp425_softc *sc)
55 {
56 extern paddr_t physical_start, physical_end;
57
58 bus_dma_tag_t dmat = &sc->ia_pci_dmat;
59 struct arm32_dma_range *dr = &sc->ia_pci_dma_range;
60
61 dmat->_ranges = dr;
62 dmat->_nranges = 1;
63
64 dr->dr_sysbase = physical_start;
65 dr->dr_busbase = PCI_MAPREG_MEM_ADDR(IXP425_PCI_MEM_VBASE +
66 physical_start);
67 dr->dr_busbase = physical_start;
68 dr->dr_len = physical_end - physical_start;
69
70 dmat->_dmamap_create = _bus_dmamap_create;
71 dmat->_dmamap_destroy = _bus_dmamap_destroy;
72 dmat->_dmamap_load = _bus_dmamap_load;
73 dmat->_dmamap_load_mbuf = _bus_dmamap_load_mbuf;
74 dmat->_dmamap_load_uio = _bus_dmamap_load_uio;
75 dmat->_dmamap_load_raw = _bus_dmamap_load_raw;
76 dmat->_dmamap_unload = _bus_dmamap_unload;
77 dmat->_dmamap_sync_pre = _bus_dmamap_sync;
78 dmat->_dmamap_sync_post = NULL;
79
80 dmat->_dmamem_alloc = _bus_dmamem_alloc;
81 dmat->_dmamem_free = _bus_dmamem_free;
82 dmat->_dmamem_map = _bus_dmamem_map;
83 dmat->_dmamem_unmap = _bus_dmamem_unmap;
84 dmat->_dmamem_mmap = _bus_dmamem_mmap;
85 }
86