svn commit: r290839 - projects/powernv/powerpc/powernv
Nathan Whitehorn
nwhitehorn at FreeBSD.org
Sun Nov 15 01:50:19 UTC 2015
Author: nwhitehorn
Date: Sun Nov 15 01:50:17 2015
New Revision: 290839
URL: https://svnweb.freebsd.org/changeset/base/290839
Log:
Deal with the IOMMU with a hammer: turn it off. Full booting now blocked by
the fact that non-IPI IRQs don't work for some reason.
Modified:
projects/powernv/powerpc/powernv/opal.h
projects/powernv/powerpc/powernv/opal_pci.c
Modified: projects/powernv/powerpc/powernv/opal.h
==============================================================================
--- projects/powernv/powerpc/powernv/opal.h Sat Nov 14 23:43:59 2015 (r290838)
+++ projects/powernv/powerpc/powernv/opal.h Sun Nov 15 01:50:17 2015 (r290839)
@@ -50,9 +50,16 @@ int opal_call(uint64_t token, ...);
#define OPAL_PCI_CONFIG_WRITE_WORD 18
#define OPAL_SET_XIVE 19
#define OPAL_GET_XIVE 20
+#define OPAL_PCI_SET_PE 31
#define OPAL_START_CPU 41
+#define OPAL_PCI_MAP_PE_DMA_WINDOW_REAL 45
+
+/* For OPAL_PCI_SET_PE */
+#define OPAL_UNMAP_PE 0
+#define OPAL_MAP_PE 1
#define OPAL_SUCCESS 0
+#define OPAL_PARAMETER -1
#define OPAL_BUSY_EVENT -12
#endif
Modified: projects/powernv/powerpc/powernv/opal_pci.c
==============================================================================
--- projects/powernv/powerpc/powernv/opal_pci.c Sat Nov 14 23:43:59 2015 (r290838)
+++ projects/powernv/powerpc/powernv/opal_pci.c Sun Nov 15 01:50:17 2015 (r290839)
@@ -124,6 +124,7 @@ opalpci_attach(device_t dev)
{
struct opalpci_softc *sc;
cell_t id[2];
+ int err;
sc = device_get_softc(dev);
@@ -142,6 +143,28 @@ opalpci_attach(device_t dev)
return (ENXIO);
}
+ /*
+ * Map all devices on the bus to partitionable endpoint zero until
+ * such time as we start wanting to do things like bhyve.
+ */
+ err = opal_call(OPAL_PCI_SET_PE, sc->phb_id, 0 /* Root PE */,
+ 0, 0, 0, 0, /* All devices */
+ OPAL_MAP_PE);
+ if (err != 0) {
+ device_printf(dev, "PE mapping failed: %d\n", err);
+ return (ENXIO);
+ }
+
+ /*
+ * Also disable the IOMMU for the time being for PE 0 (everything)
+ */
+ err = opal_call(OPAL_PCI_MAP_PE_DMA_WINDOW_REAL, sc->phb_id, 0, 0,
+ 0 /* start address */, roundup2(Maxmem, 16*1024*1024)/* all RAM */);
+ if (err != 0) {
+ device_printf(dev, "DMA mapping failed: %d\n", err);
+ return (ENXIO);
+ }
+
return (ofw_pci_attach(dev));
}
More information about the svn-src-projects
mailing list