aboutsummaryrefslogtreecommitdiff
path: root/sys/sparc64/pci
diff options
context:
space:
mode:
authorMarius Strobl <marius@FreeBSD.org>2007-08-05 11:56:44 +0000
committerMarius Strobl <marius@FreeBSD.org>2007-08-05 11:56:44 +0000
commit6bbb5a106c8d1c62df9da585e14cbea28c8ae7cc (patch)
treec917da70660ade216479598d5e93f30e756eb31e /sys/sparc64/pci
parent82a67a70a2e64e1bba16a291b6aff5332de33b81 (diff)
downloadsrc-6bbb5a106c8d1c62df9da585e14cbea28c8ae7cc.tar.gz
src-6bbb5a106c8d1c62df9da585e14cbea28c8ae7cc.zip
- 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)
Notes
Notes: svn path=/head/; revision=171730
Diffstat (limited to 'sys/sparc64/pci')
-rw-r--r--sys/sparc64/pci/psycho.c19
-rw-r--r--sys/sparc64/pci/psychoreg.h4
2 files changed, 16 insertions, 7 deletions
diff --git a/sys/sparc64/pci/psycho.c b/sys/sparc64/pci/psycho.c
index 6ecc6c819646..e40967028ee8 100644
--- a/sys/sparc64/pci/psycho.c
+++ b/sys/sparc64/pci/psycho.c
@@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$");
#include <sys/mutex.h>
#include <sys/pcpu.h>
#include <sys/reboot.h>
+#include <sys/rman.h>
#include <dev/ofw/ofw_bus.h>
#include <dev/ofw/ofw_pci.h>
@@ -66,8 +67,6 @@ __FBSDID("$FreeBSD$");
#include <machine/resource.h>
#include <machine/ver.h>
-#include <sys/rman.h>
-
#include <dev/pci/pcireg.h>
#include <dev/pci/pcivar.h>
@@ -557,9 +556,15 @@ psycho_attach(device_t dev)
* For the moment, 32KB should be more than enough.
*/
sc->sc_is = malloc(sizeof(struct iommu_state), M_DEVBUF,
- M_NOWAIT);
+ M_NOWAIT | M_ZERO);
if (sc->sc_is == NULL)
panic("%s: malloc iommu_state failed", __func__);
+ if (sc->sc_mode == PSYCHO_MODE_SABRE)
+ sc->sc_is->is_pmaxaddr =
+ IOMMU_MAXADDR(SABRE_IOMMU_BITS);
+ else
+ sc->sc_is->is_pmaxaddr =
+ IOMMU_MAXADDR(PSYCHO_IOMMU_BITS);
sc->sc_is->is_sb[0] = 0;
sc->sc_is->is_sb[1] = 0;
if (OF_getproplen(node, "no-streaming-cache") < 0)
@@ -577,9 +582,9 @@ psycho_attach(device_t dev)
sc->sc_pci_memt = psycho_alloc_bus_tag(sc, PCI_MEMORY_BUS_SPACE);
sc->sc_pci_iot = psycho_alloc_bus_tag(sc, PCI_IO_BUS_SPACE);
sc->sc_pci_cfgt = psycho_alloc_bus_tag(sc, PCI_CONFIG_BUS_SPACE);
- 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_pci_dmat) != 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_pci_dmat) != 0)
panic("%s: bus_dma_tag_create failed", __func__);
/* Customize the tag. */
sc->sc_pci_dmat->dt_cookie = sc->sc_is;
@@ -1075,7 +1080,7 @@ psycho_setup_intr(device_t dev, device_t child, struct resource *ires,
* XXX installing the workaround for an affected device and the
* actual workaround in psycho_intr_stub() should be moved to
* psycho(4)-specific bus_dma_tag_create() and bus_dmamap_sync()
- * methods, respectively, once we make use of BUS_GET_DMA_TAG(),
+ * methods, respectively, once DMA tag creation is newbus'ified,
* so the workaround isn't only applied for interrupt handlers
* but also for polling(4) callbacks.
*/
diff --git a/sys/sparc64/pci/psychoreg.h b/sys/sparc64/pci/psychoreg.h
index 1bf300ffaf92..b15e3d9e3db8 100644
--- a/sys/sparc64/pci/psychoreg.h
+++ b/sys/sparc64/pci/psychoreg.h
@@ -299,4 +299,8 @@
#define PCSR_SECBUS 0x40 /* Secondary bus number register */
#define PCSR_SUBBUS 0x41 /* Subordinate bus number register */
+/* Width of the physical addresses the IOMMU translates to */
+#define PSYCHO_IOMMU_BITS 41
+#define SABRE_IOMMU_BITS 34
+
#endif /* !_SPARC64_PCI_PSYCHOREG_H_ */