bcm2835_cpufreq: Only attach driver if we correcly match on the machine

compatible string.
This commit is contained in:
Emmanuel Vadot 2016-09-30 10:00:57 +00:00
parent ef14f6a19e
commit e374c33592
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=306489

View File

@ -44,6 +44,11 @@ __FBSDID("$FreeBSD$");
#include <machine/cpu.h>
#include <machine/intr.h>
#include <dev/fdt/fdt_common.h>
#include <dev/ofw/ofw_bus.h>
#include <dev/ofw/ofw_bus_subr.h>
#include <arm/broadcom/bcm2835/bcm2835_mbox.h>
#include <arm/broadcom/bcm2835/bcm2835_mbox_prop.h>
#include <arm/broadcom/bcm2835/bcm2835_vcbus.h>
@ -119,6 +124,13 @@ struct bcm2835_cpufreq_softc {
struct intr_config_hook init_hook;
};
static struct ofw_compat_data compat_data[] = {
{ "broadcom,bcm2835-vc", 1 },
{ "broadcom,bcm2708-vc", 1 },
{ "brcm,bcm2709", 1 },
{ NULL, 0 }
};
static int cpufreq_verbose = 0;
TUNABLE_INT("hw.bcm2835.cpufreq.verbose", &cpufreq_verbose);
static int cpufreq_lowest_freq = DEFAULT_LOWEST_FREQ;
@ -1244,6 +1256,16 @@ bcm2835_cpufreq_init(void *arg)
static void
bcm2835_cpufreq_identify(driver_t *driver, device_t parent)
{
const struct ofw_compat_data *compat;
phandle_t root;
root = OF_finddevice("/");
for (compat = compat_data; compat->ocd_str != NULL; compat++)
if (fdt_is_compatible(root, compat->ocd_str))
break;
if (compat->ocd_data == 0)
return;
DPRINTF("driver=%p, parent=%p\n", driver, parent);
if (device_find_child(parent, "bcm2835_cpufreq", -1) != NULL)