summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcognet <cognet@FreeBSD.org>2007-01-17 00:58:25 +0000
committercognet <cognet@FreeBSD.org>2007-01-17 00:58:25 +0000
commit199c2180b10842922c716b5b4dd150d1628f2b88 (patch)
treebc40260a17f8b6391a2ca5f3d9437e1f46c0ec25
parentb0b19280da4b10f7deec622e6ba2614b495b4302 (diff)
downloadFreeBSD-src-199c2180b10842922c716b5b4dd150d1628f2b88.zip
FreeBSD-src-199c2180b10842922c716b5b4dd150d1628f2b88.tar.gz
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.
-rw-r--r--sys/arm/xscale/ixp425/if_npe.c12
-rw-r--r--sys/arm/xscale/ixp425/ixp425.c6
-rw-r--r--sys/arm/xscale/ixp425/ixp425_pci.c15
-rw-r--r--sys/arm/xscale/ixp425/ixp425var.h2
4 files changed, 31 insertions, 4 deletions
diff --git a/sys/arm/xscale/ixp425/if_npe.c b/sys/arm/xscale/ixp425/if_npe.c
index c63fc98..a963fb0 100644
--- a/sys/arm/xscale/ixp425/if_npe.c
+++ b/sys/arm/xscale/ixp425/if_npe.c
@@ -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);
diff --git a/sys/arm/xscale/ixp425/ixp425.c b/sys/arm/xscale/ixp425/ixp425.c
index fbbc707..f35db99 100644
--- a/sys/arm/xscale/ixp425/ixp425.c
+++ b/sys/arm/xscale/ixp425/ixp425.c
@@ -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 ||
diff --git a/sys/arm/xscale/ixp425/ixp425_pci.c b/sys/arm/xscale/ixp425/ixp425_pci.c
index adb9b16..cadb088 100644
--- a/sys/arm/xscale/ixp425/ixp425_pci.c
+++ b/sys/arm/xscale/ixp425/ixp425_pci.c
@@ -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) +
diff --git a/sys/arm/xscale/ixp425/ixp425var.h b/sys/arm/xscale/ixp425/ixp425var.h
index 91a163cd..35a2b7d 100644
--- a/sys/arm/xscale/ixp425/ixp425var.h
+++ b/sys/arm/xscale/ixp425/ixp425var.h
@@ -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) \
OpenPOWER on IntegriCloud