summaryrefslogtreecommitdiffstats
path: root/sys/sparc64/sbus
diff options
context:
space:
mode:
authormarius <marius@FreeBSD.org>2007-08-05 11:56:44 +0000
committermarius <marius@FreeBSD.org>2007-08-05 11:56:44 +0000
commit5a1a2bd9cf95421a0c3026645d8824333a77a4cf (patch)
treec917da70660ade216479598d5e93f30e756eb31e /sys/sparc64/sbus
parent73b31fd6b229633176825dd2f203d59947b34938 (diff)
downloadFreeBSD-src-5a1a2bd9cf95421a0c3026645d8824333a77a4cf.zip
FreeBSD-src-5a1a2bd9cf95421a0c3026645d8824333a77a4cf.tar.gz
- Divorce the IOTSBs, which so far where handled via a global list
instead of per IOMMU, so we no longer need to program all of them identically in systems having multiple IOMMUs. This continues the rototilling of the nexus(4) done about 5 months ago, which amongst others changed nexus(4) and the drivers for host-to-foo bridges to provide bus_get_dma_tag methods, allowing to handle DMA tags in a hierarchical way and to link them with devices. This still doesn't move the silicon bug workarounds for Sabre (and in the uncommitted schizo(4) for Tomatillo) bridges into special bus_dma_tag_create() and bus_dmamap_sync() methods though, as w/o fully newbus'ified bus_dma_tag_create() and bus_dma_tag_destroy() this still requires too much hackery, i.e. per-child parent DMA tags in the parent driver. - Let the host-to-foo drivers supply the maximum physical address of the IOMMU accompanying the bridges. Previously iommu(4) hard- coded an upper limit of 16GB, which actually only applies to the IOMMUs of the Hummingbird and Sabre bridges. The Psycho variants as well as the U2S in fact can can translate to up to 2TB, i.e. translate to 41-bit physical addresses. According to the recently available Tomatillo documentation these bridges even translate to 43-bit physical addresses and hints at the Schizo bridges doing 43 bits as well. This fixes the issue the FreeBSD 6.0 todo list item "Max RAM on sparc64" was refering to and pretty much obsoletes the lack of support for bounce buffers on sparc64. Thanks to Nathan Whitehorn for pointing me at the Tomatillo manual. Approved by: re (kensmith)
Diffstat (limited to 'sys/sparc64/sbus')
-rw-r--r--sys/sparc64/sbus/sbus.c16
-rw-r--r--sys/sparc64/sbus/sbusreg.h4
2 files changed, 11 insertions, 9 deletions
diff --git a/sys/sparc64/sbus/sbus.c b/sys/sparc64/sbus/sbus.c
index c78468f..2f241d3 100644
--- a/sys/sparc64/sbus/sbus.c
+++ b/sys/sparc64/sbus/sbus.c
@@ -112,21 +112,20 @@ __FBSDID("$FreeBSD$");
#include <sys/malloc.h>
#include <sys/module.h>
#include <sys/pcpu.h>
+#include <sys/queue.h>
#include <sys/reboot.h>
+#include <sys/rman.h>
#include <dev/ofw/ofw_bus.h>
#include <dev/ofw/ofw_bus_subr.h>
#include <dev/ofw/openfirm.h>
#include <machine/bus.h>
+#include <machine/bus_common.h>
#include <machine/bus_private.h>
#include <machine/iommureg.h>
-#include <machine/bus_common.h>
-#include <machine/resource.h>
-
-#include <sys/rman.h>
-
#include <machine/iommuvar.h>
+#include <machine/resource.h>
#include <sparc64/sbus/ofw_sbus.h>
#include <sparc64/sbus/sbusreg.h>
@@ -380,6 +379,7 @@ sbus_attach(device_t dev)
/* initalise the IOMMU */
/* punch in our copies */
+ sc->sc_is.is_pmaxaddr = IOMMU_MAXADDR(SBUS_IOMMU_BITS);
sc->sc_is.is_bustag = rman_get_bustag(sc->sc_sysio_res);
sc->sc_is.is_bushandle = rman_get_bushandle(sc->sc_sysio_res);
sc->sc_is.is_iommu = SBR_IOMMU;
@@ -405,9 +405,9 @@ sbus_attach(device_t dev)
iommu_init(name, &sc->sc_is, 3, -1, 1);
/* Create the DMA tag. */
- if (bus_dma_tag_create(bus_get_dma_tag(dev), 8, 0, IOMMU_MAXADDR, ~0,
- NULL, NULL, IOMMU_MAXADDR, 0xff, 0xffffffff, 0, NULL, NULL,
- &sc->sc_cdmatag) != 0)
+ if (bus_dma_tag_create(bus_get_dma_tag(dev), 8, 0,
+ sc->sc_is.is_pmaxaddr, ~0, NULL, NULL, sc->sc_is.is_pmaxaddr,
+ 0xff, 0xffffffff, 0, NULL, NULL, &sc->sc_cdmatag) != 0)
panic("%s: bus_dma_tag_create failed", __func__);
/* Customize the tag. */
sc->sc_cdmatag->dt_cookie = &sc->sc_is;
diff --git a/sys/sparc64/sbus/sbusreg.h b/sys/sparc64/sbus/sbusreg.h
index 8b47d67..4dddce1 100644
--- a/sys/sparc64/sbus/sbusreg.h
+++ b/sys/sparc64/sbus/sbusreg.h
@@ -136,5 +136,7 @@
#define SBR_OBIO_DIAG 0x4808 /* OBIO and misc int state diag reg */
#define SBR_STRBUF_DIAG 0x5000 /* Streaming buffer diag regs */
-#endif /* _SPARC64_SBUS_SBUSREG_H_ */
+/* Width of the physical addresses the IOMMU translates to */
+#define SBUS_IOMMU_BITS 41
+#endif /* _SPARC64_SBUS_SBUSREG_H_ */
OpenPOWER on IntegriCloud