Home | History | Annotate | Line # | Download | only in xscale
i80321.c revision 1.13.2.1
      1  1.13.2.1    skrll /*	$NetBSD: i80321.c,v 1.13.2.1 2004/08/03 10:32:58 skrll Exp $	*/
      2       1.1  thorpej 
      3       1.1  thorpej /*
      4       1.1  thorpej  * Copyright (c) 2002 Wasabi Systems, Inc.
      5       1.1  thorpej  * All rights reserved.
      6       1.1  thorpej  *
      7       1.1  thorpej  * Written by Jason R. Thorpe for Wasabi Systems, Inc.
      8       1.1  thorpej  *
      9       1.1  thorpej  * Redistribution and use in source and binary forms, with or without
     10       1.1  thorpej  * modification, are permitted provided that the following conditions
     11       1.1  thorpej  * are met:
     12       1.1  thorpej  * 1. Redistributions of source code must retain the above copyright
     13       1.1  thorpej  *    notice, this list of conditions and the following disclaimer.
     14       1.1  thorpej  * 2. Redistributions in binary form must reproduce the above copyright
     15       1.1  thorpej  *    notice, this list of conditions and the following disclaimer in the
     16       1.1  thorpej  *    documentation and/or other materials provided with the distribution.
     17       1.1  thorpej  * 3. All advertising materials mentioning features or use of this software
     18       1.1  thorpej  *    must display the following acknowledgement:
     19       1.1  thorpej  *	This product includes software developed for the NetBSD Project by
     20       1.1  thorpej  *	Wasabi Systems, Inc.
     21       1.1  thorpej  * 4. The name of Wasabi Systems, Inc. may not be used to endorse
     22       1.1  thorpej  *    or promote products derived from this software without specific prior
     23       1.1  thorpej  *    written permission.
     24       1.1  thorpej  *
     25       1.1  thorpej  * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
     26       1.1  thorpej  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     27       1.1  thorpej  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     28       1.1  thorpej  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL WASABI SYSTEMS, INC
     29       1.1  thorpej  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     30       1.1  thorpej  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     31       1.1  thorpej  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     32       1.1  thorpej  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     33       1.1  thorpej  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     34       1.1  thorpej  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     35       1.1  thorpej  * POSSIBILITY OF SUCH DAMAGE.
     36       1.1  thorpej  */
     37       1.1  thorpej 
     38       1.1  thorpej /*
     39       1.1  thorpej  * Autoconfiguration support for the Intel i80321 I/O Processor.
     40       1.1  thorpej  */
     41       1.1  thorpej 
     42  1.13.2.1    skrll #include <sys/cdefs.h>
     43  1.13.2.1    skrll __KERNEL_RCSID(0, "$NetBSD: i80321.c,v 1.13.2.1 2004/08/03 10:32:58 skrll Exp $");
     44  1.13.2.1    skrll 
     45       1.1  thorpej #include <sys/param.h>
     46       1.1  thorpej #include <sys/systm.h>
     47       1.1  thorpej #include <sys/device.h>
     48       1.1  thorpej 
     49       1.6  thorpej #define	_ARM32_BUS_DMA_PRIVATE
     50       1.1  thorpej #include <machine/bus.h>
     51       1.1  thorpej 
     52       1.1  thorpej #include <arm/xscale/i80321reg.h>
     53       1.1  thorpej #include <arm/xscale/i80321var.h>
     54       1.1  thorpej 
     55       1.1  thorpej /*
     56       1.1  thorpej  * Statically-allocated bus_space stucture used to access the
     57       1.1  thorpej  * i80321's own registers.
     58       1.1  thorpej  */
     59       1.1  thorpej struct bus_space i80321_bs_tag;
     60       1.1  thorpej 
     61       1.1  thorpej /*
     62       1.1  thorpej  * There can be only one i80321, so we keep a global pointer to
     63       1.1  thorpej  * the softc, so board-specific code can use features of the
     64       1.1  thorpej  * i80321 without having to have a handle on the softc itself.
     65       1.1  thorpej  */
     66       1.1  thorpej struct i80321_softc *i80321_softc;
     67       1.1  thorpej 
     68       1.6  thorpej static int i80321_iopxs_print(void *, const char *);
     69       1.6  thorpej static int i80321_pcibus_print(void *, const char *);
     70       1.1  thorpej 
     71       1.4  thorpej /* Built-in devices. */
     72       1.4  thorpej static const struct iopxs_device {
     73       1.4  thorpej 	const char *id_name;
     74       1.4  thorpej 	bus_addr_t id_offset;
     75       1.4  thorpej 	bus_size_t id_size;
     76       1.4  thorpej } iopxs_devices[] = {
     77       1.4  thorpej 	{ "iopaau",	VERDE_AAU_BASE,		VERDE_AAU_SIZE },
     78  1.13.2.1    skrll /*	{ "iopdma",	VERDE_DMA_BASE0,	VERDE_DMA_CHSIZE },	*/
     79  1.13.2.1    skrll /*	{ "iopdma",	VERDE_DMA_BASE1,	VERDE_DMA_CHSIZE },	*/
     80  1.13.2.1    skrll 	{ "iopiic",	VERDE_I2C_BASE0,	VERDE_I2C_CHSIZE },
     81  1.13.2.1    skrll 	{ "iopiic",	VERDE_I2C_BASE1,	VERDE_I2C_CHSIZE },
     82  1.13.2.1    skrll /*	{ "iopssp",	VERDE_SSP_BASE,		VERDE_SSP_SIZE },	*/
     83      1.12   briggs 	{ "iopmu",	VERDE_MU_BASE,		VERDE_MU_SIZE },
     84       1.4  thorpej 	{ "iopwdog",	0,			0 },
     85       1.4  thorpej 	{ NULL,		0,			0 }
     86       1.4  thorpej };
     87       1.4  thorpej 
     88       1.6  thorpej static void i80321_pci_dma_init(struct i80321_softc *);
     89       1.6  thorpej 
     90       1.1  thorpej /*
     91       1.1  thorpej  * i80321_attach:
     92       1.1  thorpej  *
     93       1.1  thorpej  *	Board-independent attach routine for the i80321.
     94       1.1  thorpej  */
     95       1.1  thorpej void
     96       1.1  thorpej i80321_attach(struct i80321_softc *sc)
     97       1.1  thorpej {
     98       1.1  thorpej 	struct pcibus_attach_args pba;
     99       1.4  thorpej 	const struct iopxs_device *id;
    100       1.4  thorpej 	struct iopxs_attach_args ia;
    101       1.1  thorpej 	pcireg_t preg;
    102       1.1  thorpej 
    103       1.1  thorpej 	i80321_softc = sc;
    104       1.1  thorpej 
    105       1.1  thorpej 	/*
    106       1.1  thorpej 	 * Slice off some useful subregion handles.
    107       1.1  thorpej 	 */
    108       1.1  thorpej 
    109       1.1  thorpej 	if (bus_space_subregion(sc->sc_st, sc->sc_sh, VERDE_ATU_BASE,
    110       1.1  thorpej 	    VERDE_ATU_SIZE, &sc->sc_atu_sh))
    111       1.8   provos 		panic("%s: unable to subregion ATU registers",
    112       1.1  thorpej 		    sc->sc_dev.dv_xname);
    113       1.1  thorpej 
    114       1.1  thorpej 	/* We expect the Memory Controller to be already sliced off. */
    115       1.1  thorpej 
    116       1.1  thorpej 	/*
    117       1.1  thorpej 	 * Program the Inbound windows.
    118       1.1  thorpej 	 */
    119      1.10   briggs 	bus_space_write_4(sc->sc_st, sc->sc_atu_sh, ATU_IALR0,
    120      1.10   briggs 	    (0xffffffff - (sc->sc_iwin[0].iwin_size - 1)) & 0xffffffc0);
    121      1.10   briggs 	bus_space_write_4(sc->sc_st, sc->sc_atu_sh, ATU_IATVR0,
    122      1.10   briggs 	    sc->sc_iwin[0].iwin_xlate);
    123       1.1  thorpej 	if (sc->sc_is_host) {
    124       1.1  thorpej 		bus_space_write_4(sc->sc_st, sc->sc_atu_sh,
    125       1.1  thorpej 		    PCI_MAPREG_START, sc->sc_iwin[0].iwin_base_lo);
    126       1.1  thorpej 		bus_space_write_4(sc->sc_st, sc->sc_atu_sh,
    127       1.1  thorpej 		    PCI_MAPREG_START + 0x04, sc->sc_iwin[0].iwin_base_hi);
    128      1.12   briggs 	} else {
    129      1.12   briggs 		sc->sc_iwin[0].iwin_base_lo = bus_space_read_4(sc->sc_st,
    130      1.12   briggs 		    sc->sc_atu_sh, PCI_MAPREG_START);
    131      1.12   briggs 		sc->sc_iwin[0].iwin_base_hi = bus_space_read_4(sc->sc_st,
    132      1.12   briggs 		    sc->sc_atu_sh, PCI_MAPREG_START + 0x04);
    133      1.12   briggs 		sc->sc_iwin[0].iwin_base_lo =
    134      1.12   briggs 		    PCI_MAPREG_MEM_ADDR(sc->sc_iwin[0].iwin_base_lo);
    135       1.1  thorpej 	}
    136       1.1  thorpej 
    137      1.10   briggs 	bus_space_write_4(sc->sc_st, sc->sc_atu_sh, ATU_IALR1,
    138      1.10   briggs 	    (0xffffffff - (sc->sc_iwin[1].iwin_size - 1)) & 0xffffffc0);
    139      1.10   briggs 	/* no xlate for window 1 */
    140       1.1  thorpej 	if (sc->sc_is_host) {
    141       1.1  thorpej 		bus_space_write_4(sc->sc_st, sc->sc_atu_sh,
    142       1.1  thorpej 		    PCI_MAPREG_START + 0x08, sc->sc_iwin[1].iwin_base_lo);
    143       1.1  thorpej 		bus_space_write_4(sc->sc_st, sc->sc_atu_sh,
    144       1.1  thorpej 		    PCI_MAPREG_START + 0x0c, sc->sc_iwin[1].iwin_base_hi);
    145      1.12   briggs 	} else {
    146      1.12   briggs 		sc->sc_iwin[1].iwin_base_lo = bus_space_read_4(sc->sc_st,
    147      1.12   briggs 		    sc->sc_atu_sh, PCI_MAPREG_START + 0x08);
    148      1.12   briggs 		sc->sc_iwin[1].iwin_base_hi = bus_space_read_4(sc->sc_st,
    149      1.12   briggs 		    sc->sc_atu_sh, PCI_MAPREG_START + 0x0c);
    150      1.12   briggs 		sc->sc_iwin[1].iwin_base_lo =
    151      1.12   briggs 		    PCI_MAPREG_MEM_ADDR(sc->sc_iwin[1].iwin_base_lo);
    152       1.1  thorpej 	}
    153       1.1  thorpej 
    154      1.10   briggs 	bus_space_write_4(sc->sc_st, sc->sc_atu_sh, ATU_IALR2,
    155      1.10   briggs 	    (0xffffffff - (sc->sc_iwin[2].iwin_size - 1)) & 0xffffffc0);
    156      1.10   briggs 	bus_space_write_4(sc->sc_st, sc->sc_atu_sh, ATU_IATVR2,
    157      1.10   briggs 	    sc->sc_iwin[2].iwin_xlate);
    158       1.1  thorpej 	if (sc->sc_is_host) {
    159       1.1  thorpej 		bus_space_write_4(sc->sc_st, sc->sc_atu_sh,
    160       1.1  thorpej 		    PCI_MAPREG_START + 0x10, sc->sc_iwin[2].iwin_base_lo);
    161       1.1  thorpej 		bus_space_write_4(sc->sc_st, sc->sc_atu_sh,
    162       1.1  thorpej 		    PCI_MAPREG_START + 0x14, sc->sc_iwin[2].iwin_base_hi);
    163      1.12   briggs 	} else {
    164      1.12   briggs 		sc->sc_iwin[2].iwin_base_lo = bus_space_read_4(sc->sc_st,
    165      1.12   briggs 		    sc->sc_atu_sh, PCI_MAPREG_START + 0x10);
    166      1.12   briggs 		sc->sc_iwin[2].iwin_base_hi = bus_space_read_4(sc->sc_st,
    167      1.12   briggs 		    sc->sc_atu_sh, PCI_MAPREG_START + 0x14);
    168      1.12   briggs 		sc->sc_iwin[2].iwin_base_lo =
    169      1.12   briggs 		    PCI_MAPREG_MEM_ADDR(sc->sc_iwin[2].iwin_base_lo);
    170       1.1  thorpej 	}
    171       1.1  thorpej 
    172      1.10   briggs 	bus_space_write_4(sc->sc_st, sc->sc_atu_sh, ATU_IALR3,
    173      1.10   briggs 	    (0xffffffff - (sc->sc_iwin[3].iwin_size - 1)) & 0xffffffc0);
    174      1.10   briggs 	bus_space_write_4(sc->sc_st, sc->sc_atu_sh, ATU_IATVR3,
    175      1.10   briggs 	    sc->sc_iwin[3].iwin_xlate);
    176       1.1  thorpej 	if (sc->sc_is_host) {
    177       1.1  thorpej 		bus_space_write_4(sc->sc_st, sc->sc_atu_sh,
    178       1.1  thorpej 		    ATU_IABAR3, sc->sc_iwin[3].iwin_base_lo);
    179       1.1  thorpej 		bus_space_write_4(sc->sc_st, sc->sc_atu_sh,
    180       1.1  thorpej 		    ATU_IAUBAR3, sc->sc_iwin[3].iwin_base_hi);
    181      1.12   briggs 	} else {
    182      1.12   briggs 		sc->sc_iwin[3].iwin_base_lo = bus_space_read_4(sc->sc_st,
    183      1.12   briggs 		    sc->sc_atu_sh, ATU_IABAR3);
    184      1.12   briggs 		sc->sc_iwin[3].iwin_base_hi = bus_space_read_4(sc->sc_st,
    185      1.12   briggs 		    sc->sc_atu_sh, ATU_IAUBAR3);
    186      1.12   briggs 		sc->sc_iwin[3].iwin_base_lo =
    187      1.12   briggs 		    PCI_MAPREG_MEM_ADDR(sc->sc_iwin[3].iwin_base_lo);
    188       1.1  thorpej 	}
    189       1.1  thorpej 
    190       1.1  thorpej 	/*
    191       1.1  thorpej 	 * Mask (disable) the ATU interrupt sources.
    192       1.1  thorpej 	 * XXX May want to revisit this if we encounter
    193       1.1  thorpej 	 * XXX an application that wants it.
    194       1.1  thorpej 	 */
    195       1.1  thorpej 	bus_space_write_4(sc->sc_st, sc->sc_atu_sh,
    196       1.1  thorpej 	    ATU_ATUIMR,
    197       1.1  thorpej 	    ATUIMR_IMW1BU|ATUIMR_ISCEM|ATUIMR_RSCEM|ATUIMR_PST|
    198       1.1  thorpej 	    ATUIMR_DPE|ATUIMR_P_SERR_ASRT|ATUIMR_PMA|ATUIMR_PTAM|
    199       1.1  thorpej 	    ATUIMR_PTAT|ATUIMR_PMPE);
    200       1.1  thorpej 
    201       1.1  thorpej 	/*
    202       1.1  thorpej 	 * Program the outbound windows.
    203       1.1  thorpej 	 */
    204       1.1  thorpej 	bus_space_write_4(sc->sc_st, sc->sc_atu_sh,
    205       1.1  thorpej 	    ATU_OIOWTVR, sc->sc_ioout_xlate);
    206       1.1  thorpej 
    207      1.12   briggs 	if (!sc->sc_is_host) {
    208      1.12   briggs 		sc->sc_owin[0].owin_xlate_lo = sc->sc_iwin[1].iwin_base_lo;
    209      1.12   briggs 		sc->sc_owin[0].owin_xlate_hi = sc->sc_iwin[1].iwin_base_hi;
    210      1.12   briggs 	}
    211       1.1  thorpej 	bus_space_write_4(sc->sc_st, sc->sc_atu_sh,
    212       1.1  thorpej 	    ATU_OMWTVR0, sc->sc_owin[0].owin_xlate_lo);
    213       1.1  thorpej 	bus_space_write_4(sc->sc_st, sc->sc_atu_sh,
    214       1.1  thorpej 	    ATU_OUMWTVR0, sc->sc_owin[0].owin_xlate_hi);
    215       1.1  thorpej 
    216       1.1  thorpej 	bus_space_write_4(sc->sc_st, sc->sc_atu_sh,
    217       1.1  thorpej 	    ATU_OMWTVR1, sc->sc_owin[1].owin_xlate_lo);
    218       1.1  thorpej 	bus_space_write_4(sc->sc_st, sc->sc_atu_sh,
    219       1.1  thorpej 	    ATU_OUMWTVR1, sc->sc_owin[1].owin_xlate_hi);
    220       1.1  thorpej 
    221       1.1  thorpej 	/*
    222       1.1  thorpej 	 * Set up the ATU configuration register.  All we do
    223       1.1  thorpej 	 * right now is enable Outbound Windows.
    224       1.1  thorpej 	 */
    225       1.1  thorpej 	bus_space_write_4(sc->sc_st, sc->sc_atu_sh, ATU_ATUCR,
    226       1.1  thorpej 	    ATUCR_OUT_EN);
    227       1.1  thorpej 
    228       1.1  thorpej 	/*
    229       1.1  thorpej 	 * Enable bus mastering, memory access, SERR, and parity
    230       1.1  thorpej 	 * checking on the ATU.
    231       1.1  thorpej 	 */
    232       1.1  thorpej 	if (sc->sc_is_host) {
    233       1.1  thorpej 		preg = bus_space_read_4(sc->sc_st, sc->sc_atu_sh,
    234       1.1  thorpej 		    PCI_COMMAND_STATUS_REG);
    235       1.1  thorpej 		preg |= PCI_COMMAND_MEM_ENABLE | PCI_COMMAND_MASTER_ENABLE |
    236       1.1  thorpej 		    PCI_COMMAND_PARITY_ENABLE | PCI_COMMAND_SERR_ENABLE;
    237       1.1  thorpej 		bus_space_write_4(sc->sc_st, sc->sc_atu_sh,
    238       1.1  thorpej 		    PCI_COMMAND_STATUS_REG, preg);
    239       1.1  thorpej 	}
    240       1.1  thorpej 
    241       1.5  thorpej 	/* Initialize the bus space tags. */
    242       1.1  thorpej 	i80321_io_bs_init(&sc->sc_pci_iot, sc);
    243       1.1  thorpej 	i80321_mem_bs_init(&sc->sc_pci_memt, sc);
    244       1.5  thorpej 
    245       1.5  thorpej 	/* Initialize the PCI chipset tag. */
    246       1.5  thorpej 	i80321_pci_init(&sc->sc_pci_chipset, sc);
    247       1.5  thorpej 
    248       1.5  thorpej 	/* Initialize the DMA tags. */
    249       1.6  thorpej 	i80321_pci_dma_init(sc);
    250       1.6  thorpej 	i80321_local_dma_init(sc);
    251       1.1  thorpej 
    252       1.1  thorpej 	/*
    253       1.4  thorpej 	 * Attach all the IOP built-ins.
    254       1.4  thorpej 	 */
    255       1.4  thorpej 	for (id = iopxs_devices; id->id_name != NULL; id++) {
    256       1.4  thorpej 		ia.ia_name = id->id_name;
    257       1.4  thorpej 		ia.ia_st = sc->sc_st;
    258       1.4  thorpej 		ia.ia_sh = sc->sc_sh;
    259       1.4  thorpej 		ia.ia_dmat = &sc->sc_local_dmat;
    260       1.4  thorpej 		ia.ia_offset = id->id_offset;
    261       1.4  thorpej 		ia.ia_size = id->id_size;
    262       1.4  thorpej 
    263       1.4  thorpej 		(void) config_found(&sc->sc_dev, &ia, i80321_iopxs_print);
    264       1.4  thorpej 	}
    265       1.4  thorpej 
    266       1.4  thorpej 	/*
    267       1.1  thorpej 	 * Attach the PCI bus.
    268       1.1  thorpej 	 */
    269       1.1  thorpej 	preg = bus_space_read_4(sc->sc_st, sc->sc_atu_sh, ATU_PCIXSR);
    270       1.1  thorpej 	preg = PCIXSR_BUSNO(preg);
    271       1.1  thorpej 	if (preg == 0xff)
    272       1.1  thorpej 		preg = 0;
    273       1.1  thorpej 	pba.pba_busname = "pci";
    274       1.1  thorpej 	pba.pba_iot = &sc->sc_pci_iot;
    275       1.1  thorpej 	pba.pba_memt = &sc->sc_pci_memt;
    276       1.1  thorpej 	pba.pba_dmat = &sc->sc_pci_dmat;
    277      1.13     fvdl 	pba.pba_dmat64 = NULL;
    278       1.1  thorpej 	pba.pba_pc = &sc->sc_pci_chipset;
    279       1.1  thorpej 	pba.pba_bus = preg;
    280       1.2  thorpej 	pba.pba_bridgetag = NULL;
    281       1.1  thorpej 	pba.pba_intrswiz = 0;	/* XXX what if busno != 0? */
    282       1.1  thorpej 	pba.pba_intrtag = 0;
    283       1.1  thorpej 	pba.pba_flags = PCI_FLAGS_IO_ENABLED | PCI_FLAGS_MEM_ENABLED |
    284       1.1  thorpej 	    PCI_FLAGS_MRL_OKAY | PCI_FLAGS_MRM_OKAY | PCI_FLAGS_MWI_OKAY;
    285       1.1  thorpej 	(void) config_found(&sc->sc_dev, &pba, i80321_pcibus_print);
    286       1.4  thorpej }
    287       1.4  thorpej 
    288       1.4  thorpej /*
    289       1.4  thorpej  * i80321_iopxs_print:
    290       1.4  thorpej  *
    291       1.4  thorpej  *	Autoconfiguration cfprint routine when attaching
    292       1.4  thorpej  *	to the "iopxs" device.
    293       1.4  thorpej  */
    294       1.6  thorpej static int
    295       1.4  thorpej i80321_iopxs_print(void *aux, const char *pnp)
    296       1.4  thorpej {
    297       1.4  thorpej 
    298       1.4  thorpej 	return (QUIET);
    299       1.1  thorpej }
    300       1.1  thorpej 
    301       1.1  thorpej /*
    302       1.1  thorpej  * i80321_pcibus_print:
    303       1.1  thorpej  *
    304       1.1  thorpej  *	Autoconfiguration cfprint routine when attaching
    305       1.1  thorpej  *	to the "pcibus" attribute.
    306       1.1  thorpej  */
    307       1.6  thorpej static int
    308       1.1  thorpej i80321_pcibus_print(void *aux, const char *pnp)
    309       1.1  thorpej {
    310       1.1  thorpej 	struct pcibus_attach_args *pba = aux;
    311       1.1  thorpej 
    312       1.1  thorpej 	if (pnp)
    313       1.9  thorpej 		aprint_normal("%s at %s", pba->pba_busname, pnp);
    314       1.1  thorpej 
    315       1.9  thorpej 	aprint_normal(" bus %d", pba->pba_bus);
    316       1.1  thorpej 
    317       1.1  thorpej 	return (UNCONF);
    318       1.6  thorpej }
    319       1.6  thorpej 
    320       1.6  thorpej /*
    321       1.6  thorpej  * i80321_pci_dma_init:
    322       1.6  thorpej  *
    323       1.6  thorpej  *	Initialize the PCI DMA tag.
    324       1.6  thorpej  */
    325       1.6  thorpej static void
    326       1.6  thorpej i80321_pci_dma_init(struct i80321_softc *sc)
    327       1.6  thorpej {
    328       1.6  thorpej 	bus_dma_tag_t dmat = &sc->sc_pci_dmat;
    329       1.6  thorpej 	struct arm32_dma_range *dr = &sc->sc_pci_dma_range;
    330       1.6  thorpej 
    331      1.12   briggs 	dr->dr_sysbase = sc->sc_iwin[2].iwin_xlate;
    332      1.12   briggs 	dr->dr_busbase = PCI_MAPREG_MEM_ADDR(sc->sc_iwin[2].iwin_base_lo);
    333      1.12   briggs 	dr->dr_len = sc->sc_iwin[2].iwin_size;
    334       1.6  thorpej 
    335       1.6  thorpej 	dmat->_ranges = dr;
    336       1.6  thorpej 	dmat->_nranges = 1;
    337       1.6  thorpej 
    338       1.6  thorpej 	dmat->_dmamap_create = _bus_dmamap_create;
    339       1.6  thorpej 	dmat->_dmamap_destroy = _bus_dmamap_destroy;
    340       1.6  thorpej 	dmat->_dmamap_load = _bus_dmamap_load;
    341       1.6  thorpej 	dmat->_dmamap_load_mbuf = _bus_dmamap_load_mbuf;
    342       1.6  thorpej 	dmat->_dmamap_load_uio = _bus_dmamap_load_uio;
    343       1.6  thorpej 	dmat->_dmamap_load_raw = _bus_dmamap_load_raw;
    344       1.6  thorpej 	dmat->_dmamap_unload = _bus_dmamap_unload;
    345       1.7  thorpej 	dmat->_dmamap_sync_pre = _bus_dmamap_sync;
    346       1.7  thorpej 	dmat->_dmamap_sync_post = NULL;
    347       1.6  thorpej 
    348       1.6  thorpej 	dmat->_dmamem_alloc = _bus_dmamem_alloc;
    349       1.6  thorpej 	dmat->_dmamem_free = _bus_dmamem_free;
    350       1.6  thorpej 	dmat->_dmamem_map = _bus_dmamem_map;
    351       1.6  thorpej 	dmat->_dmamem_unmap = _bus_dmamem_unmap;
    352       1.6  thorpej 	dmat->_dmamem_mmap = _bus_dmamem_mmap;
    353       1.6  thorpej }
    354       1.6  thorpej 
    355       1.6  thorpej /*
    356       1.6  thorpej  * i80321_local_dma_init:
    357       1.6  thorpej  *
    358       1.6  thorpej  *	Initialize the local DMA tag.
    359       1.6  thorpej  */
    360      1.12   briggs void
    361       1.6  thorpej i80321_local_dma_init(struct i80321_softc *sc)
    362       1.6  thorpej {
    363       1.6  thorpej 	bus_dma_tag_t dmat = &sc->sc_local_dmat;
    364       1.6  thorpej 
    365       1.6  thorpej 	dmat->_ranges = NULL;
    366       1.6  thorpej 	dmat->_nranges = 0;
    367       1.6  thorpej 
    368       1.6  thorpej 	dmat->_dmamap_create = _bus_dmamap_create;
    369       1.6  thorpej 	dmat->_dmamap_destroy = _bus_dmamap_destroy;
    370       1.6  thorpej 	dmat->_dmamap_load = _bus_dmamap_load;
    371       1.6  thorpej 	dmat->_dmamap_load_mbuf = _bus_dmamap_load_mbuf;
    372       1.6  thorpej 	dmat->_dmamap_load_uio = _bus_dmamap_load_uio;
    373       1.6  thorpej 	dmat->_dmamap_load_raw = _bus_dmamap_load_raw;
    374       1.6  thorpej 	dmat->_dmamap_unload = _bus_dmamap_unload;
    375       1.7  thorpej 	dmat->_dmamap_sync_pre = _bus_dmamap_sync;
    376       1.7  thorpej 	dmat->_dmamap_sync_post = NULL;
    377       1.6  thorpej 
    378       1.6  thorpej 	dmat->_dmamem_alloc = _bus_dmamem_alloc;
    379       1.6  thorpej 	dmat->_dmamem_free = _bus_dmamem_free;
    380       1.6  thorpej 	dmat->_dmamem_map = _bus_dmamem_map;
    381       1.6  thorpej 	dmat->_dmamem_unmap = _bus_dmamem_unmap;
    382       1.6  thorpej 	dmat->_dmamem_mmap = _bus_dmamem_mmap;
    383       1.1  thorpej }
    384