Move the DMA tag initialization functions into i80321.c.

This commit is contained in:
thorpej 2002-08-01 19:40:07 +00:00
parent f660736fac
commit f546baba66
5 changed files with 76 additions and 175 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: files.i80321,v 1.5 2002/07/29 18:40:04 thorpej Exp $
# $NetBSD: files.i80321,v 1.6 2002/08/01 19:40:07 thorpej Exp $
#
# Configuration info for Intel i80321 XScale I/O Processor support
#
@ -12,9 +12,7 @@ device iopxs {}: pcibus, bus_space_generic
# Board-specific front-end provides attachment.
file arch/arm/xscale/i80321.c iopxs
file arch/arm/xscale/i80321_pci.c iopxs
file arch/arm/xscale/i80321_pci_dma.c iopxs
file arch/arm/xscale/i80321_space.c iopxs
file arch/arm/xscale/i80321_local_dma.c iopxs
# Watchdog timer
device iopwdog: sysmon_wdog

View File

@ -1,4 +1,4 @@
/* $NetBSD: i80321.c,v 1.5 2002/07/31 17:34:25 thorpej Exp $ */
/* $NetBSD: i80321.c,v 1.6 2002/08/01 19:40:08 thorpej Exp $ */
/*
* Copyright (c) 2002 Wasabi Systems, Inc.
@ -43,6 +43,7 @@
#include <sys/systm.h>
#include <sys/device.h>
#define _ARM32_BUS_DMA_PRIVATE
#include <machine/bus.h>
#include <arm/xscale/i80321reg.h>
@ -61,8 +62,8 @@ struct bus_space i80321_bs_tag;
*/
struct i80321_softc *i80321_softc;
int i80321_iopxs_print(void *, const char *);
int i80321_pcibus_print(void *, const char *);
static int i80321_iopxs_print(void *, const char *);
static int i80321_pcibus_print(void *, const char *);
/* Built-in devices. */
static const struct iopxs_device {
@ -77,6 +78,9 @@ static const struct iopxs_device {
{ NULL, 0, 0 }
};
static void i80321_pci_dma_init(struct i80321_softc *);
static void i80321_local_dma_init(struct i80321_softc *);
/*
* i80321_attach:
*
@ -204,8 +208,8 @@ i80321_attach(struct i80321_softc *sc)
i80321_pci_init(&sc->sc_pci_chipset, sc);
/* Initialize the DMA tags. */
i80321_pci_dma_init(&sc->sc_pci_dmat, sc);
i80321_local_dma_init(&sc->sc_local_dmat, sc);
i80321_pci_dma_init(sc);
i80321_local_dma_init(sc);
/*
* Attach all the IOP built-ins.
@ -248,7 +252,7 @@ i80321_attach(struct i80321_softc *sc)
* Autoconfiguration cfprint routine when attaching
* to the "iopxs" device.
*/
int
static int
i80321_iopxs_print(void *aux, const char *pnp)
{
@ -261,7 +265,7 @@ i80321_iopxs_print(void *aux, const char *pnp)
* Autoconfiguration cfprint routine when attaching
* to the "pcibus" attribute.
*/
int
static int
i80321_pcibus_print(void *aux, const char *pnp)
{
struct pcibus_attach_args *pba = aux;
@ -273,3 +277,66 @@ i80321_pcibus_print(void *aux, const char *pnp)
return (UNCONF);
}
/*
* i80321_pci_dma_init:
*
* Initialize the PCI DMA tag.
*/
static void
i80321_pci_dma_init(struct i80321_softc *sc)
{
bus_dma_tag_t dmat = &sc->sc_pci_dmat;
struct arm32_dma_range *dr = &sc->sc_pci_dma_range;
dr->dr_sysbase = sc->sc_iwin[2].iwin_xlate;
dr->dr_busbase = PCI_MAPREG_MEM_ADDR(sc->sc_iwin[2].iwin_base_lo);
dr->dr_len = sc->sc_iwin[2].iwin_size;
dmat->_ranges = dr;
dmat->_nranges = 1;
dmat->_dmamap_create = _bus_dmamap_create;
dmat->_dmamap_destroy = _bus_dmamap_destroy;
dmat->_dmamap_load = _bus_dmamap_load;
dmat->_dmamap_load_mbuf = _bus_dmamap_load_mbuf;
dmat->_dmamap_load_uio = _bus_dmamap_load_uio;
dmat->_dmamap_load_raw = _bus_dmamap_load_raw;
dmat->_dmamap_unload = _bus_dmamap_unload;
dmat->_dmamap_sync = _bus_dmamap_sync;
dmat->_dmamem_alloc = _bus_dmamem_alloc;
dmat->_dmamem_free = _bus_dmamem_free;
dmat->_dmamem_map = _bus_dmamem_map;
dmat->_dmamem_unmap = _bus_dmamem_unmap;
dmat->_dmamem_mmap = _bus_dmamem_mmap;
}
/*
* i80321_local_dma_init:
*
* Initialize the local DMA tag.
*/
static void
i80321_local_dma_init(struct i80321_softc *sc)
{
bus_dma_tag_t dmat = &sc->sc_local_dmat;
dmat->_ranges = NULL;
dmat->_nranges = 0;
dmat->_dmamap_create = _bus_dmamap_create;
dmat->_dmamap_destroy = _bus_dmamap_destroy;
dmat->_dmamap_load = _bus_dmamap_load;
dmat->_dmamap_load_mbuf = _bus_dmamap_load_mbuf;
dmat->_dmamap_load_uio = _bus_dmamap_load_uio;
dmat->_dmamap_load_raw = _bus_dmamap_load_raw;
dmat->_dmamap_unload = _bus_dmamap_unload;
dmat->_dmamap_sync = _bus_dmamap_sync;
dmat->_dmamem_alloc = _bus_dmamem_alloc;
dmat->_dmamem_free = _bus_dmamem_free;
dmat->_dmamem_map = _bus_dmamem_map;
dmat->_dmamem_unmap = _bus_dmamem_unmap;
dmat->_dmamem_mmap = _bus_dmamem_mmap;
}

View File

@ -1,77 +0,0 @@
/* $NetBSD: i80321_local_dma.c,v 1.3 2002/07/31 17:34:25 thorpej Exp $ */
/*
* Copyright (c) 2001, 2002 Wasabi Systems, Inc.
* All rights reserved.
*
* Written by Jason R. Thorpe for Wasabi Systems, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed for the NetBSD Project by
* Wasabi Systems, Inc.
* 4. The name of Wasabi Systems, Inc. may not be used to endorse
* or promote products derived from this software without specific prior
* written permission.
*
* THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/*
* Local DMA support for i80321 I/O Processor chip.
*/
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/device.h>
#include <sys/malloc.h>
#include <sys/mbuf.h>
#include <uvm/uvm_extern.h>
#define _ARM32_BUS_DMA_PRIVATE
#include <machine/bus.h>
#include <arm/xscale/i80321reg.h>
#include <arm/xscale/i80321var.h>
void
i80321_local_dma_init(bus_dma_tag_t dmat, void *cookie)
{
dmat->_ranges = NULL;
dmat->_nranges = 0;
dmat->_dmamap_create = _bus_dmamap_create;
dmat->_dmamap_destroy = _bus_dmamap_destroy;
dmat->_dmamap_load = _bus_dmamap_load;
dmat->_dmamap_load_mbuf = _bus_dmamap_load_mbuf;
dmat->_dmamap_load_uio = _bus_dmamap_load_uio;
dmat->_dmamap_load_raw = _bus_dmamap_load_raw;
dmat->_dmamap_unload = _bus_dmamap_unload;
dmat->_dmamap_sync = _bus_dmamap_sync;
dmat->_dmamem_alloc = _bus_dmamem_alloc;
dmat->_dmamem_free = _bus_dmamem_free;
dmat->_dmamem_map = _bus_dmamem_map;
dmat->_dmamem_unmap = _bus_dmamem_unmap;
dmat->_dmamem_mmap = _bus_dmamem_mmap;
}

View File

@ -1,83 +0,0 @@
/* $NetBSD: i80321_pci_dma.c,v 1.5 2002/07/31 17:34:25 thorpej Exp $ */
/*
* Copyright (c) 2001, 2002 Wasabi Systems, Inc.
* All rights reserved.
*
* Written by Jason R. Thorpe for Wasabi Systems, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed for the NetBSD Project by
* Wasabi Systems, Inc.
* 4. The name of Wasabi Systems, Inc. may not be used to endorse
* or promote products derived from this software without specific prior
* written permission.
*
* THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/*
* PCI DMA support for i80321 I/O Processor chip.
*/
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/device.h>
#include <sys/malloc.h>
#include <sys/mbuf.h>
#include <uvm/uvm_extern.h>
#define _ARM32_BUS_DMA_PRIVATE
#include <machine/bus.h>
#include <arm/xscale/i80321reg.h>
#include <arm/xscale/i80321var.h>
void
i80321_pci_dma_init(bus_dma_tag_t dmat, void *cookie)
{
struct i80321_softc *sc = cookie;
struct arm32_dma_range *dr = &sc->sc_pci_dma_range;
dr->dr_sysbase = sc->sc_iwin[2].iwin_xlate;
dr->dr_busbase = PCI_MAPREG_MEM_ADDR(sc->sc_iwin[2].iwin_base_lo);
dr->dr_len = sc->sc_iwin[2].iwin_size;
dmat->_ranges = dr;
dmat->_nranges = 1;
dmat->_dmamap_create = _bus_dmamap_create;
dmat->_dmamap_destroy = _bus_dmamap_destroy;
dmat->_dmamap_load = _bus_dmamap_load;
dmat->_dmamap_load_mbuf = _bus_dmamap_load_mbuf;
dmat->_dmamap_load_uio = _bus_dmamap_load_uio;
dmat->_dmamap_load_raw = _bus_dmamap_load_raw;
dmat->_dmamap_unload = _bus_dmamap_unload;
dmat->_dmamap_sync = _bus_dmamap_sync;
dmat->_dmamem_alloc = _bus_dmamem_alloc;
dmat->_dmamem_free = _bus_dmamem_free;
dmat->_dmamem_map = _bus_dmamem_map;
dmat->_dmamem_unmap = _bus_dmamem_unmap;
dmat->_dmamem_mmap = _bus_dmamem_mmap;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: i80321var.h,v 1.5 2002/07/31 17:34:25 thorpej Exp $ */
/* $NetBSD: i80321var.h,v 1.6 2002/08/01 19:40:08 thorpej Exp $ */
/*
* Copyright (c) 2002 Wasabi Systems, Inc.
@ -171,10 +171,6 @@ void i80321_bs_init(bus_space_tag_t, void *);
void i80321_io_bs_init(bus_space_tag_t, void *);
void i80321_mem_bs_init(bus_space_tag_t, void *);
void i80321_local_dma_init(bus_dma_tag_t, void *);
void i80321_pci_dma_init(bus_dma_tag_t, void *);
void i80321_pci_init(pci_chipset_tag_t, void *);
void i80321_attach(struct i80321_softc *);