Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 22 Nov 2016 09:39:31 +0000 (UTC)
From:      Andrew Turner <andrew@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r308965 - head/sys/arm/arm
Message-ID:  <201611220939.uAM9dVOk058742@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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 <sys/param.h>
 #include <sys/systm.h>
@@ -49,9 +50,11 @@ __FBSDID("$FreeBSD$");
 #include <sys/pmc.h>
 #include <sys/pmckern.h>
 
+#ifdef FDT
 #include <dev/ofw/openfirm.h>
 #include <dev/ofw/ofw_bus.h>
 #include <dev/ofw/ofw_bus_subr.h>
+#endif
 
 #include <machine/bus.h>
 #include <machine/cpu.h>
@@ -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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201611220939.uAM9dVOk058742>