Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/kern_cpu.c
Show All 12 Lines | |||||
return (0); | return (0); | ||||
CF_DEBUG("initializing one-time data for %s\n", | CF_DEBUG("initializing one-time data for %s\n", | ||||
device_get_nameunit(dev)); | device_get_nameunit(dev)); | ||||
sc->levels_buf = malloc(CF_MAX_LEVELS * sizeof(*sc->levels_buf), | sc->levels_buf = malloc(CF_MAX_LEVELS * sizeof(*sc->levels_buf), | ||||
M_DEVBUF, M_WAITOK); | M_DEVBUF, M_WAITOK); | ||||
SYSCTL_ADD_PROC(&sc->sysctl_ctx, | SYSCTL_ADD_PROC(&sc->sysctl_ctx, | ||||
SYSCTL_CHILDREN(device_get_sysctl_tree(parent)), | SYSCTL_CHILDREN(device_get_sysctl_tree(parent)), | ||||
OID_AUTO, "freq", CTLTYPE_INT | CTLFLAG_RW, sc, 0, | OID_AUTO, "freq", | ||||
CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, sc, 0, | |||||
cpufreq_curr_sysctl, "I", "Current CPU frequency"); | cpufreq_curr_sysctl, "I", "Current CPU frequency"); | ||||
SYSCTL_ADD_PROC(&sc->sysctl_ctx, | SYSCTL_ADD_PROC(&sc->sysctl_ctx, | ||||
SYSCTL_CHILDREN(device_get_sysctl_tree(parent)), | SYSCTL_CHILDREN(device_get_sysctl_tree(parent)), | ||||
OID_AUTO, "freq_levels", CTLTYPE_STRING | CTLFLAG_RD, sc, 0, | OID_AUTO, "freq_levels", | ||||
CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_NEEDGIANT, sc, 0, | |||||
cpufreq_levels_sysctl, "A", "CPU frequency levels"); | cpufreq_levels_sysctl, "A", "CPU frequency levels"); | ||||
/* | /* | ||||
* Queue a one-shot broadcast that levels have changed. | * Queue a one-shot broadcast that levels have changed. | ||||
* It will run once the system has completed booting. | * It will run once the system has completed booting. | ||||
*/ | */ | ||||
TASK_INIT(&sc->startup_task, 0, cpufreq_startup_task, dev); | TASK_INIT(&sc->startup_task, 0, cpufreq_startup_task, dev); | ||||
taskqueue_enqueue(taskqueue_thread, &sc->startup_task); | taskqueue_enqueue(taskqueue_thread, &sc->startup_task); | ||||
Show All 24 Lines | |||||
cpufreq_register(device_t dev) | cpufreq_register(device_t dev) | ||||
{ | { | ||||
struct cpufreq_softc *sc; | struct cpufreq_softc *sc; | ||||
device_t cf_dev, cpu_dev; | device_t cf_dev, cpu_dev; | ||||
/* Add a sysctl to get each driver's settings separately. */ | /* Add a sysctl to get each driver's settings separately. */ | ||||
SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), | SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), | ||||
SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), | SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), | ||||
OID_AUTO, "freq_settings", CTLTYPE_STRING | CTLFLAG_RD, dev, 0, | OID_AUTO, "freq_settings", | ||||
CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_NEEDGIANT, dev, 0, | |||||
cpufreq_settings_sysctl, "A", "CPU frequency driver settings"); | cpufreq_settings_sysctl, "A", "CPU frequency driver settings"); | ||||
/* | /* | ||||
* Add only one cpufreq device to each CPU. Currently, all CPUs | * Add only one cpufreq device to each CPU. Currently, all CPUs | ||||
* must offer the same levels and be switched at the same time. | * must offer the same levels and be switched at the same time. | ||||
*/ | */ | ||||
cpu_dev = device_get_parent(dev); | cpu_dev = device_get_parent(dev); | ||||
if ((cf_dev = device_find_child(cpu_dev, "cpufreq", -1))) { | if ((cf_dev = device_find_child(cpu_dev, "cpufreq", -1))) { | ||||
Show All 12 Lines |