Create bus dma tags for both the PCI bus and the IXP425 root bus. Set the

PCI bus' one as the default one, and explicitely use the other one for
non-PCI devices.
This is needed because the PCI bus can only address 64MB of RAM, while some
IXP425 boards have 128MB or more, and most of the PCI drivers do not bother
providing the parent dma tag.
This commit is contained in:
Olivier Houchard 2007-01-17 00:58:25 +00:00
parent 47010239a8
commit ebfaa05056
4 changed files with 31 additions and 4 deletions

View File

@ -88,6 +88,12 @@ __FBSDID("$FreeBSD$");
#include "miibus_if.h"
/*
* XXX: For the main bus dma tag. Can go away if the new method to get the
* dma tag from the parent got MFC'd into RELENG_6.
*/
extern struct ixp425_softc *ixp425_softc;
struct npebuf {
struct npebuf *ix_next; /* chain to next buffer */
void *ix_m; /* backpointer to mbuf */
@ -447,7 +453,7 @@ npe_dma_setup(struct npe_softc *sc, struct npedma *dma,
dma->nbuf = nbuf;
/* DMA tag for mapped mbufs */
error = bus_dma_tag_create(NULL, 1, 0,
error = bus_dma_tag_create(ixp425_softc->sc_dmat, 1, 0,
BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL,
MCLBYTES, maxseg, MCLBYTES, 0,
busdma_lock_mutex, &sc->sc_mtx, &dma->mtag);
@ -458,7 +464,7 @@ npe_dma_setup(struct npe_softc *sc, struct npedma *dma,
}
/* DMA tag and map for the NPE buffers */
error = bus_dma_tag_create(NULL, sizeof(uint32_t), 0,
error = bus_dma_tag_create(ixp425_softc->sc_dmat, sizeof(uint32_t), 0,
BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL,
nbuf * sizeof(struct npehwbuf), 1,
nbuf * sizeof(struct npehwbuf), 0,
@ -582,7 +588,7 @@ npe_activate(device_t dev)
return error;
/* setup statistics block */
error = bus_dma_tag_create(NULL, sizeof(uint32_t), 0,
error = bus_dma_tag_create(ixp425_softc->sc_dmat, sizeof(uint32_t), 0,
BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL,
sizeof(struct npestats), 1, sizeof(struct npestats), 0,
busdma_lock_mutex, &sc->sc_mtx, &sc->sc_stats_tag);

View File

@ -149,6 +149,7 @@ arm_mask_irq(uintptr_t nb)
void
arm_unmask_irq(uintptr_t nb)
{
intr_enabled |= (1 << nb);
ixp425_set_intrmask();
}
@ -211,6 +212,11 @@ ixp425_attach(device_t dev)
ixp425_set_intrmask();
ixp425_set_intrsteer();
if (bus_dma_tag_create(NULL, 1, 0, BUS_SPACE_MAXADDR_32BIT,
BUS_SPACE_MAXADDR, NULL, NULL, 0xffffffff, 0xff, 0xffffffff, 0,
NULL, NULL, &sc->sc_dmat))
panic("couldn't create the IXP425 dma tag !");
sc->sc_irq_rman.rm_type = RMAN_ARRAY;
sc->sc_irq_rman.rm_descr = "IXP425 IRQs";
if (rman_init(&sc->sc_irq_rman) != 0 ||

View File

@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/malloc.h>
#define _ARM32_BUS_DMA_PRIVATE
#include <sys/bus.h>
#include <sys/kernel.h>
#include <sys/module.h>
@ -129,6 +130,19 @@ ixppcib_attach(device_t dev)
if (sc->sc_mem == NULL)
panic("cannot allocate PCI MEM space");
#define AHB_OFFSET 0x10000000UL
if (bus_dma_tag_create(NULL, 1, 0, AHB_OFFSET + 64 * 1024 * 1024,
BUS_SPACE_MAXADDR, NULL, NULL, 0xffffffff, 0xff, 0xffffffff, 0,
NULL, NULL, &sc->sc_dmat))
panic("couldn't create the PCI dma tag !");
/*
* The PCI bus can only address 64MB. However, due to the way our
* implementation of busdma works, busdma can't tell if a device
* is a PCI device or not. So defaults to the PCI dma tag, which
* restrict the DMA'able memory to the first 64MB, and explicitely
* create less restrictive tags for non-PCI devices.
*/
arm_root_dma_tag = sc->sc_dmat;
/*
* Initialize the bus space tags.
*/
@ -158,7 +172,6 @@ ixppcib_attach(device_t dev)
* PCI->AHB address translation
* begin at the physical memory start + OFFSET
*/
#define AHB_OFFSET 0x10000000UL
PCI_CSR_WRITE_4(sc, PCI_AHBMEMBASE,
(AHB_OFFSET & 0xFF000000) +
((AHB_OFFSET & 0xFF000000) >> 8) +

View File

@ -57,6 +57,7 @@ struct ixp425_softc {
struct rman sc_irq_rman;
struct rman sc_mem_rman;
bus_dma_tag_t sc_dmat;
};
struct ixppcib_softc {
@ -73,6 +74,7 @@ struct ixppcib_softc {
struct bus_space sc_pci_memt;
struct bus_space sc_pci_iot;
bus_dma_tag_t sc_dmat;
};
#define EXP_BUS_WRITE_4(sc, reg, data) \