Index: sys/arm/arm/gic.c =================================================================== --- sys/arm/arm/gic.c +++ sys/arm/arm/gic.c @@ -64,6 +64,7 @@ #ifdef FDT #include +#include #include #endif @@ -1049,6 +1050,11 @@ struct arm_gicv2m_softc *sc; uint32_t typer; int rid; +#ifdef FDT + phandle_t node; + pcell_t cell; + int rv; +#endif sc = device_get_softc(dev); @@ -1063,6 +1069,24 @@ typer = bus_read_4(sc->sc_mem, GICV2M_MSI_TYPER); sc->sc_spi_start = MSI_TYPER_SPI_BASE(typer); sc->sc_spi_count = MSI_TYPER_SPI_COUNT(typer); +#ifdef FDT + /* Check if SPI data should be overriden by DTS */ + node = ofw_bus_get_node(dev); + rv = OF_getencprop(node, "arm,msi-base-spi", &cell, sizeof(cell)); + if (rv > 0) { + if (bootverbose) + device_printf(dev, "overriding SPI_BASE to %ld\n", + (uint64_t)cell); + sc->sc_spi_start = (uint64_t)cell; + } + rv = OF_getencprop(node, "arm,msi-num-spis", &cell, sizeof(cell)); + if (rv > 0) { + if (bootverbose) + device_printf(dev, "overriding NUM_SPIS to %ld\n", + (uint64_t)cell); + sc->sc_spi_count = (uint64_t)cell; + } +#endif sc->sc_spi_end = sc->sc_spi_start + sc->sc_spi_count; /* Reserve these interrupts for MSI/MSI-X use */