From owner-svn-src-all@freebsd.org Tue Nov 22 09:39:32 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3156EC4F436; Tue, 22 Nov 2016 09:39:32 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0E7DCFA5; Tue, 22 Nov 2016 09:39:31 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAM9dVRU058743; Tue, 22 Nov 2016 09:39:31 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAM9dVOk058742; Tue, 22 Nov 2016 09:39:31 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201611220939.uAM9dVOk058742@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Tue, 22 Nov 2016 09:39:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308965 - head/sys/arm/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Nov 2016 09:39:32 -0000 Author: andrew Date: Tue Nov 22 09:39:31 2016 New Revision: 308965 URL: https://svnweb.freebsd.org/changeset/base/308965 Log: Split out the FDT parts of the pmu driver to make way for adding ACPI support. Obtained from: ABT Systems Ltd Sponsored by: The FreeBSD Foundation Modified: head/sys/arm/arm/pmu.c Modified: head/sys/arm/arm/pmu.c ============================================================================== --- head/sys/arm/arm/pmu.c Tue Nov 22 09:37:31 2016 (r308964) +++ head/sys/arm/arm/pmu.c Tue Nov 22 09:39:31 2016 (r308965) @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include "opt_hwpmc_hooks.h" +#include "opt_platform.h" #include #include @@ -49,9 +50,11 @@ __FBSDID("$FreeBSD$"); #include #include +#ifdef FDT #include #include #include +#endif #include #include @@ -69,22 +72,6 @@ struct pmu_softc { void *ih[MAX_RLEN]; }; -static struct ofw_compat_data compat_data[] = { - {"arm,armv8-pmuv3", 1}, - {"arm,cortex-a17-pmu", 1}, - {"arm,cortex-a15-pmu", 1}, - {"arm,cortex-a12-pmu", 1}, - {"arm,cortex-a9-pmu", 1}, - {"arm,cortex-a8-pmu", 1}, - {"arm,cortex-a7-pmu", 1}, - {"arm,cortex-a5-pmu", 1}, - {"arm,arm11mpcore-pmu", 1}, - {"arm,arm1176-pmu", 1}, - {"arm,arm1136-pmu", 1}, - {"qcom,krait-pmu", 1}, - {NULL, 0} -}; - static struct resource_spec pmu_spec[] = { { SYS_RES_IRQ, 0, RF_ACTIVE }, /* We don't currently handle pmu events, other than on cpu 0 */ @@ -144,21 +131,6 @@ pmu_intr(void *arg) } static int -pmu_probe(device_t dev) -{ - - if (!ofw_bus_status_okay(dev)) - return (ENXIO); - - if (ofw_bus_search_compatible(dev, compat_data)->ocd_data != 0) { - device_set_desc(dev, "Performance Monitoring Unit"); - return (BUS_PROBE_DEFAULT); - } - - return (ENXIO); -} - -static int pmu_attach(device_t dev) { struct pmu_softc *sc; @@ -206,18 +178,51 @@ pmu_attach(device_t dev) return (0); } -static device_method_t pmu_methods[] = { - DEVMETHOD(device_probe, pmu_probe), +#ifdef FDT +static struct ofw_compat_data compat_data[] = { + {"arm,armv8-pmuv3", 1}, + {"arm,cortex-a17-pmu", 1}, + {"arm,cortex-a15-pmu", 1}, + {"arm,cortex-a12-pmu", 1}, + {"arm,cortex-a9-pmu", 1}, + {"arm,cortex-a8-pmu", 1}, + {"arm,cortex-a7-pmu", 1}, + {"arm,cortex-a5-pmu", 1}, + {"arm,arm11mpcore-pmu", 1}, + {"arm,arm1176-pmu", 1}, + {"arm,arm1136-pmu", 1}, + {"qcom,krait-pmu", 1}, + {NULL, 0} +}; + +static int +pmu_fdt_probe(device_t dev) +{ + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data != 0) { + device_set_desc(dev, "Performance Monitoring Unit"); + return (BUS_PROBE_DEFAULT); + } + + return (ENXIO); +} + +static device_method_t pmu_fdt_methods[] = { + DEVMETHOD(device_probe, pmu_fdt_probe), DEVMETHOD(device_attach, pmu_attach), { 0, 0 } }; -static driver_t pmu_driver = { +static driver_t pmu_fdt_driver = { "pmu", - pmu_methods, + pmu_fdt_methods, sizeof(struct pmu_softc), }; -static devclass_t pmu_devclass; +static devclass_t pmu_fdt_devclass; -DRIVER_MODULE(pmu, simplebus, pmu_driver, pmu_devclass, 0, 0); +DRIVER_MODULE(pmu, simplebus, pmu_fdt_driver, pmu_fdt_devclass, 0, 0); +#endif