Date: Mon, 25 Jan 2016 15:10:43 +0000 (UTC) From: Zbigniew Bodek <zbb@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r294730 - head/sys/arm64/arm64 Message-ID: <201601251510.u0PFAhdP031242@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: zbb Date: Mon Jan 25 15:10:43 2016 New Revision: 294730 URL: https://svnweb.freebsd.org/changeset/base/294730 Log: Create proper FDT attachment for GICv2m Avoid probing GICv2m to any parent bus/driver. Instead, match GICv2m driver with FDT complatible strings as not every GIC has a MSI controller in the form of GICv2m extension. Submitted by: Zbigniew Bodek <zbb@semihalf.com> Obtained from: Semihalf Sponsored by: Cavium Differential Revision: https://reviews.freebsd.org/D5015 Modified: head/sys/arm64/arm64/gic.c head/sys/arm64/arm64/gic.h head/sys/arm64/arm64/gic_fdt.c Modified: head/sys/arm64/arm64/gic.c ============================================================================== --- head/sys/arm64/arm64/gic.c Mon Jan 25 14:42:44 2016 (r294729) +++ head/sys/arm64/arm64/gic.c Mon Jan 25 15:10:43 2016 (r294730) @@ -355,22 +355,6 @@ DEFINE_CLASS_0(gic, arm_gic_driver, arm_ #define GICv2M_MSI_SETSPI_NS 0x040 #define GICV2M_MSI_IIDR 0xFCC -struct gicv2m_softc { - struct resource *sc_mem; - struct mtx sc_mutex; - u_int sc_spi_start; - u_int sc_spi_count; - u_int sc_spi_offset; -}; - -static int -gicv2m_probe(device_t dev) -{ - - device_set_desc(dev, "ARM Generic Interrupt Controller MSI/MSIX"); - return (BUS_PROBE_DEFAULT); -} - static int gicv2m_attach(device_t dev) { @@ -478,7 +462,6 @@ gicv2m_map_msi(device_t dev, device_t pc static device_method_t arm_gicv2m_methods[] = { /* Device interface */ - DEVMETHOD(device_probe, gicv2m_probe), DEVMETHOD(device_attach, gicv2m_attach), /* MSI/MSI-X */ @@ -489,9 +472,5 @@ static device_method_t arm_gicv2m_method { 0, 0 } }; -static devclass_t arm_gicv2m_devclass; - DEFINE_CLASS_0(gicv2m, arm_gicv2m_driver, arm_gicv2m_methods, sizeof(struct gicv2m_softc)); -EARLY_DRIVER_MODULE(gicv2m, gic, arm_gicv2m_driver, arm_gicv2m_devclass, - 0, 0, BUS_PASS_INTERRUPT + BUS_PASS_ORDER_MIDDLE); Modified: head/sys/arm64/arm64/gic.h ============================================================================== --- head/sys/arm64/arm64/gic.h Mon Jan 25 14:42:44 2016 (r294729) +++ head/sys/arm64/arm64/gic.h Mon Jan 25 15:10:43 2016 (r294730) @@ -51,6 +51,16 @@ struct arm_gic_softc { uint32_t nirqs; }; +DECLARE_CLASS(arm_gicv2m_driver); + +struct gicv2m_softc { + struct resource *sc_mem; + struct mtx sc_mutex; + u_int sc_spi_start; + u_int sc_spi_count; + u_int sc_spi_offset; +}; + int arm_gic_attach(device_t); #endif Modified: head/sys/arm64/arm64/gic_fdt.c ============================================================================== --- head/sys/arm64/arm64/gic_fdt.c Mon Jan 25 14:42:44 2016 (r294729) +++ head/sys/arm64/arm64/gic_fdt.c Mon Jan 25 15:10:43 2016 (r294730) @@ -290,3 +290,38 @@ EARLY_DRIVER_MODULE(gic, simplebus, arm_ arm_gic_fdt_devclass, 0, 0, BUS_PASS_INTERRUPT + BUS_PASS_ORDER_MIDDLE); EARLY_DRIVER_MODULE(gic, ofwbus, arm_gic_fdt_driver, arm_gic_fdt_devclass, 0, 0, BUS_PASS_INTERRUPT + BUS_PASS_ORDER_MIDDLE); + +static struct ofw_compat_data gicv2m_compat_data[] = { + {"arm,gic-v2m-frame", true}, + {NULL, false} +}; + +static int +arm_gicv2m_fdt_probe(device_t dev) +{ + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (!ofw_bus_search_compatible(dev, gicv2m_compat_data)->ocd_data) + return (ENXIO); + + device_set_desc(dev, "ARM Generic Interrupt Controller MSI/MSIX"); + return (BUS_PROBE_DEFAULT); +} + +static device_method_t arm_gicv2m_fdt_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, arm_gicv2m_fdt_probe), + + /* End */ + DEVMETHOD_END +}; + +DEFINE_CLASS_1(gicv2m, arm_gicv2m_fdt_driver, arm_gicv2m_fdt_methods, + sizeof(struct gicv2m_softc), arm_gicv2m_driver); + +static devclass_t arm_gicv2m_fdt_devclass; + +EARLY_DRIVER_MODULE(gicv2m, gic, arm_gicv2m_fdt_driver, + arm_gicv2m_fdt_devclass, 0, 0, BUS_PASS_INTERRUPT + BUS_PASS_ORDER_MIDDLE);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201601251510.u0PFAhdP031242>