Move the DMA tag initialization functions into i80312.c.

This commit is contained in:
thorpej 2002-08-01 19:55:02 +00:00
parent f546baba66
commit e3e6d7dfa5
4 changed files with 49 additions and 96 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: files.i80312,v 1.5 2002/04/12 19:02:30 thorpej Exp $
# $NetBSD: files.i80312,v 1.6 2002/08/01 19:55:03 thorpej Exp $
#
# Configuration info for Intel i80312 Companion I/O support
#
@ -10,5 +10,4 @@ device iopxs: pcibus, bus_space_generic
file arch/arm/xscale/i80312.c iopxs
file arch/arm/xscale/i80312_gpio.c iopxs
file arch/arm/xscale/i80312_pci.c iopxs
file arch/arm/xscale/i80312_pci_dma.c iopxs
file arch/arm/xscale/i80312_space.c iopxs

View File

@ -1,7 +1,7 @@
/* $NetBSD: i80312.c,v 1.9 2002/05/16 01:01:33 thorpej Exp $ */
/* $NetBSD: i80312.c,v 1.10 2002/08/01 19:55:03 thorpej Exp $ */
/*
* Copyright (c) 2001 Wasabi Systems, Inc.
* Copyright (c) 2001, 2002 Wasabi Systems, Inc.
* All rights reserved.
*
* Written by Jason R. Thorpe for 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/i80312reg.h>
@ -63,7 +64,9 @@ struct bus_space i80312_bs_tag;
*/
struct i80312_softc *i80312_softc;
int i80312_pcibus_print(void *, const char *);
static void i80312_pci_dma_init(struct i80312_softc *);
static int i80312_pcibus_print(void *, const char *);
/*
* i80312_attach:
@ -251,14 +254,16 @@ i80312_attach(struct i80312_softc *sc)
(1 << PCI_BRIDGE_BUS_SUBORDINATE_SHIFT));
}
/*
* Initialize the bus space and DMA tags and the PCI chipset tag.
*/
/* Initialize the bus space tags. */
i80312_io_bs_init(&sc->sc_pci_iot, sc);
i80312_mem_bs_init(&sc->sc_pci_memt, sc);
i80312_pci_dma_init(&sc->sc_pci_dmat, sc);
/* Initialize the PCI chipset tag. */
i80312_pci_init(&sc->sc_pci_chipset, sc);
/* Initialize the DMA tags. */
i80312_pci_dma_init(sc);
/*
* Attach the PCI bus.
*
@ -288,7 +293,7 @@ i80312_attach(struct i80312_softc *sc)
* Autoconfiguration cfprint routine when attaching
* to the "pcibus" attribute.
*/
int
static int
i80312_pcibus_print(void *aux, const char *pnp)
{
struct pcibus_attach_args *pba = aux;
@ -300,3 +305,37 @@ i80312_pcibus_print(void *aux, const char *pnp)
return (UNCONF);
}
/*
* i80312_pci_dma_init:
*
* Initialize the PCI DMA tag.
*/
static void
i80312_pci_dma_init(struct i80312_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_sin_xlate;
dr->dr_busbase = sc->sc_sin_base;
dr->dr_len = sc->sc_sin_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,83 +0,0 @@
/* $NetBSD: i80312_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 i80312 Companion I/O 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/i80312reg.h>
#include <arm/xscale/i80312var.h>
void
i80312_pci_dma_init(bus_dma_tag_t dmat, void *cookie)
{
struct i80312_softc *sc = cookie;
struct arm32_dma_range *dr = &sc->sc_pci_dma_range;
dr->dr_sysbase = sc->sc_sin_xlate;
dr->dr_busbase = sc->sc_sin_base;
dr->dr_len = sc->sc_sin_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: i80312var.h,v 1.6 2002/07/31 17:34:25 thorpej Exp $ */
/* $NetBSD: i80312var.h,v 1.7 2002/08/01 19:55:03 thorpej Exp $ */
/*
* Copyright (c) 2001, 2002 Wasabi Systems, Inc.
@ -176,8 +176,6 @@ void i80312_gpio_set_direction(uint8_t, uint8_t);
void i80312_gpio_set_val(uint8_t, uint8_t);
uint8_t i80312_gpio_get_val(void);
void i80312_pci_dma_init(bus_dma_tag_t, void *);
void i80312_pci_init(pci_chipset_tag_t, void *);
#endif /* _ARM_XSCALE_I80312VAR_H_ */