Make CPU children explicitly share parent unit numbers.
Before this device unit number match was coincidental and broke if I disabled some CPU device(s). Aside of cosmetics, for some drivers (may be considered broken) it caused talking to wrong CPUs.
This commit is contained in:
parent
0a35c4b3ca
commit
d3a8f98acb
@ -161,7 +161,8 @@ acpi_perf_identify(driver_t *driver, device_t parent)
|
||||
* We probe this child now so that other devices that depend
|
||||
* on it (i.e., for info about supported states) will see it.
|
||||
*/
|
||||
if ((dev = BUS_ADD_CHILD(parent, 0, "acpi_perf", -1)) != NULL)
|
||||
if ((dev = BUS_ADD_CHILD(parent, 0, "acpi_perf",
|
||||
device_get_unit(parent))) != NULL)
|
||||
device_probe_and_attach(dev);
|
||||
else
|
||||
device_printf(parent, "add acpi_perf child failed\n");
|
||||
|
@ -157,7 +157,8 @@ acpi_throttle_identify(driver_t *driver, device_t parent)
|
||||
obj = (ACPI_OBJECT *)buf.Pointer;
|
||||
if ((obj->Processor.PblkAddress && obj->Processor.PblkLength >= 4) ||
|
||||
ACPI_SUCCESS(AcpiEvaluateObject(handle, "_PTC", NULL, NULL))) {
|
||||
if (BUS_ADD_CHILD(parent, 0, "acpi_throttle", -1) == NULL)
|
||||
if (BUS_ADD_CHILD(parent, 0, "acpi_throttle",
|
||||
device_get_unit(parent)) == NULL)
|
||||
device_printf(parent, "add throttle child failed\n");
|
||||
}
|
||||
AcpiOsFree(obj);
|
||||
|
@ -263,7 +263,8 @@ amdtemp_identify(driver_t *driver, device_t parent)
|
||||
return;
|
||||
|
||||
if (amdtemp_match(parent, NULL)) {
|
||||
child = device_add_child(parent, "amdtemp", -1);
|
||||
child = device_add_child(parent, "amdtemp",
|
||||
device_get_unit(parent));
|
||||
if (child == NULL)
|
||||
device_printf(parent, "add amdtemp child failed\n");
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ coretemp_identify(driver_t *driver, device_t parent)
|
||||
* We add a child for each CPU since settings must be performed
|
||||
* on each CPU in the SMP case.
|
||||
*/
|
||||
child = device_add_child(parent, "coretemp", -1);
|
||||
child = device_add_child(parent, "coretemp", device_get_unit(parent));
|
||||
if (child == NULL)
|
||||
device_printf(parent, "add coretemp child failed\n");
|
||||
}
|
||||
|
@ -309,7 +309,8 @@ cpufreq_dt_identify(driver_t *driver, device_t parent)
|
||||
if (device_find_child(parent, "cpufreq_dt", -1) != NULL)
|
||||
return;
|
||||
|
||||
if (BUS_ADD_CHILD(parent, 0, "cpufreq_dt", -1) == NULL)
|
||||
if (BUS_ADD_CHILD(parent, 0, "cpufreq_dt", device_get_unit(parent))
|
||||
== NULL)
|
||||
device_printf(parent, "add cpufreq_dt child failed\n");
|
||||
}
|
||||
|
||||
|
@ -1103,7 +1103,7 @@ cpufreq_register(device_t dev)
|
||||
}
|
||||
|
||||
/* Add the child device and possibly sysctls. */
|
||||
cf_dev = BUS_ADD_CHILD(cpu_dev, 0, "cpufreq", -1);
|
||||
cf_dev = BUS_ADD_CHILD(cpu_dev, 0, "cpufreq", device_get_unit(cpu_dev));
|
||||
if (cf_dev == NULL)
|
||||
return (ENOMEM);
|
||||
device_quiet(cf_dev);
|
||||
|
@ -946,7 +946,7 @@ est_identify(driver_t *driver, device_t parent)
|
||||
* We add a child for each CPU since settings must be performed
|
||||
* on each CPU in the SMP case.
|
||||
*/
|
||||
child = BUS_ADD_CHILD(parent, 10, "est", -1);
|
||||
child = BUS_ADD_CHILD(parent, 10, "est", device_get_unit(parent));
|
||||
if (child == NULL)
|
||||
device_printf(parent, "add est child failed\n");
|
||||
}
|
||||
|
@ -341,7 +341,8 @@ hwpstate_identify(driver_t *driver, device_t parent)
|
||||
if (resource_disabled("hwpstate", 0))
|
||||
return;
|
||||
|
||||
if (BUS_ADD_CHILD(parent, 10, "hwpstate", -1) == NULL)
|
||||
if (BUS_ADD_CHILD(parent, 10, "hwpstate", device_get_unit(parent))
|
||||
== NULL)
|
||||
device_printf(parent, "hwpstate: add child failed\n");
|
||||
}
|
||||
|
||||
|
@ -351,11 +351,9 @@ intel_hwpstate_identify(driver_t *driver, device_t parent)
|
||||
if ((cpu_power_eax & CPUTPM1_HWP) == 0)
|
||||
return;
|
||||
|
||||
if (BUS_ADD_CHILD(parent, 10, "hwpstate_intel", -1) == NULL)
|
||||
return;
|
||||
|
||||
if (bootverbose)
|
||||
device_printf(parent, "hwpstate registered\n");
|
||||
if (BUS_ADD_CHILD(parent, 10, "hwpstate_intel", device_get_unit(parent))
|
||||
== NULL)
|
||||
device_printf(parent, "hwpstate_intel: add child failed\n");
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -135,7 +135,8 @@ p4tcc_identify(driver_t *driver, device_t parent)
|
||||
* of the IA32 Intel Architecture Software Developer's Manual,
|
||||
* Volume 3, for more info.
|
||||
*/
|
||||
if (BUS_ADD_CHILD(parent, 10, "p4tcc", -1) == NULL)
|
||||
if (BUS_ADD_CHILD(parent, 10, "p4tcc", device_get_unit(parent))
|
||||
== NULL)
|
||||
device_printf(parent, "add p4tcc child failed\n");
|
||||
}
|
||||
|
||||
|
@ -876,7 +876,8 @@ pn_identify(driver_t *driver, device_t parent)
|
||||
}
|
||||
if (device_find_child(parent, "powernow", -1) != NULL)
|
||||
return;
|
||||
if (BUS_ADD_CHILD(parent, 10, "powernow", -1) == NULL)
|
||||
if (BUS_ADD_CHILD(parent, 10, "powernow", device_get_unit(parent))
|
||||
== NULL)
|
||||
device_printf(parent, "powernow: add child failed\n");
|
||||
}
|
||||
|
||||
|
@ -311,7 +311,8 @@ smist_identify(driver_t *driver, device_t parent)
|
||||
|
||||
if (device_find_child(parent, "smist", -1) != NULL)
|
||||
return;
|
||||
if (BUS_ADD_CHILD(parent, 30, "smist", -1) == NULL)
|
||||
if (BUS_ADD_CHILD(parent, 30, "smist", device_get_unit(parent))
|
||||
== NULL)
|
||||
device_printf(parent, "smist: add child failed\n");
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user