FreeBSD kernel kern code
|
#include <sys/cdefs.h>
#include <sys/param.h>
#include <sys/bus.h>
#include <sys/cpu.h>
#include <sys/eventhandler.h>
#include <sys/kernel.h>
#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/module.h>
#include <sys/proc.h>
#include <sys/queue.h>
#include <sys/sbuf.h>
#include <sys/sched.h>
#include <sys/smp.h>
#include <sys/sysctl.h>
#include <sys/systm.h>
#include <sys/sx.h>
#include <sys/timetc.h>
#include <sys/taskqueue.h>
#include "cpufreq_if.h"
Go to the source code of this file.
Data Structures | |
struct | cf_saved_freq |
struct | cpufreq_softc |
struct | cf_setting_array |
Macros | |
#define | CF_MAX_LEVELS 256 |
#define | CF_MTX_INIT(x) sx_init((x), "cpufreq lock") |
#define | CF_MTX_LOCK(x) sx_xlock((x)) |
#define | CF_MTX_UNLOCK(x) sx_xunlock((x)) |
#define | CF_MTX_ASSERT(x) sx_assert((x), SX_XLOCKED) |
#define | CF_DEBUG(msg...) |
Functions | |
__FBSDID ("$FreeBSD$") | |
TAILQ_HEAD (cf_setting_lst, cf_setting_array) | |
static int | cpufreq_attach (device_t dev) |
static void | cpufreq_startup_task (void *ctx, int pending) |
static int | cpufreq_detach (device_t dev) |
static int | cf_set_method (device_t dev, const struct cf_level *level, int priority) |
static int | cf_get_method (device_t dev, struct cf_level *level) |
static int | cf_levels_method (device_t dev, struct cf_level *levels, int *count) |
static int | cpufreq_insert_abs (struct cpufreq_softc *sc, struct cf_setting *sets, int count) |
static int | cpufreq_expand_set (struct cpufreq_softc *sc, struct cf_setting_array *set_arr) |
static struct cf_level * | cpufreq_dup_set (struct cpufreq_softc *sc, struct cf_level *dup, struct cf_setting *set) |
static int | cpufreq_curr_sysctl (SYSCTL_HANDLER_ARGS) |
static int | cpufreq_levels_sysctl (SYSCTL_HANDLER_ARGS) |
static int | cpufreq_settings_sysctl (SYSCTL_HANDLER_ARGS) |
DRIVER_MODULE (cpufreq, cpu, cpufreq_driver, cpufreq_dc, 0, 0) | |
static | SYSCTL_NODE (_debug, OID_AUTO, cpufreq, CTLFLAG_RD|CTLFLAG_MPSAFE, NULL, "cpufreq debugging") |
SYSCTL_INT (_debug_cpufreq, OID_AUTO, lowest, CTLFLAG_RWTUN, &cf_lowest_freq, 1, "Don't provide levels below this frequency.") | |
SYSCTL_INT (_debug_cpufreq, OID_AUTO, verbose, CTLFLAG_RWTUN, &cf_verbose, 1, "Print verbose debugging messages") | |
static int | cpufreq_get_frequency (device_t dev) |
static int | cpufreq_get_level (device_t dev, struct cf_level *levels, int count) |
static int | cpufreq_add_levels (device_t cf_dev, struct cf_setting_lst *rel_sets) |
static void | cpufreq_add_freq_driver_sysctl (device_t cf_dev) |
int | cpufreq_register (device_t dev) |
int | cpufreq_unregister (device_t dev) |
int | cpufreq_settings_changed (device_t dev) |
Variables | |
static device_method_t | cpufreq_methods [] |
static driver_t | cpufreq_driver |
static devclass_t | cpufreq_dc |
static int | cf_lowest_freq |
static int | cf_verbose |
#define CF_DEBUG | ( | msg... | ) |
Definition at line 98 of file kern_cpu.c.
#define CF_MAX_LEVELS 256 |
Definition at line 62 of file kern_cpu.c.
#define CF_MTX_ASSERT | ( | x | ) | sx_assert((x), SX_XLOCKED) |
Definition at line 96 of file kern_cpu.c.
#define CF_MTX_INIT | ( | x | ) | sx_init((x), "cpufreq lock") |
Definition at line 93 of file kern_cpu.c.
#define CF_MTX_LOCK | ( | x | ) | sx_xlock((x)) |
Definition at line 94 of file kern_cpu.c.
#define CF_MTX_UNLOCK | ( | x | ) | sx_xunlock((x)) |
Definition at line 95 of file kern_cpu.c.
__FBSDID | ( | "$FreeBSD$" | ) |
|
static |
Definition at line 455 of file kern_cpu.c.
References CF_DEBUG, CF_MAX_LEVELS, CF_MTX_LOCK, CF_MTX_UNLOCK, count, cpufreq_get_level(), cpufreq_softc::curr_level, device_get_nameunit(), device_get_softc(), free(), level, levels, cpufreq_softc::lock, malloc(), printf(), set, and type.
|
static |
Definition at line 633 of file kern_cpu.c.
References CF_DEBUG, cf_lowest_freq, CF_MTX_LOCK, CF_MTX_UNLOCK, count, cpufreq_add_levels(), cpufreq_expand_set(), cpufreq_insert_abs(), device_get_softc(), free(), levels, cpufreq_softc::lock, and set.
|
static |
Definition at line 233 of file kern_cpu.c.
References CF_DEBUG, cf_lowest_freq, CF_MTX_LOCK, CF_MTX_UNLOCK, cpufreq_softc::curr_level, cpufreq_softc::curr_priority, device_get_nameunit(), device_get_softc(), device_is_attached(), device_printf(), free(), level, cf_saved_freq::level, cpufreq_softc::lock, malloc(), mp_ncpus, priority, cf_saved_freq::priority, sched_bind(), sched_prio(), sched_unbind(), set, and smp_started.
|
static |
Definition at line 1068 of file kern_cpu.c.
References device_get_nameunit(), device_get_softc(), and device_get_sysctl_tree().
Referenced by cpufreq_register().
|
static |
Definition at line 570 of file kern_cpu.c.
References CF_DEBUG, cf_setting_array::count, cpufreq_insert_abs(), device_get_nameunit(), device_get_softc(), device_is_attached(), free(), malloc(), sets, cf_setting_array::sets, and type.
Referenced by cf_levels_method().
|
static |
Definition at line 152 of file kern_cpu.c.
References CF_DEBUG, CF_MAX_LEVELS, CF_MTX_INIT, cpufreq_curr_sysctl(), cpufreq_levels_sysctl(), cpufreq_startup_task(), cpufreq_softc::curr_level, device_get_nameunit(), device_get_parent(), device_get_softc(), device_get_sysctl_tree(), cpufreq_softc::lock, malloc(), parent, sysctl_ctx_init(), and taskqueue_enqueue().
|
static |
Definition at line 936 of file kern_cpu.c.
References CF_MAX_LEVELS, count, cpufreq_dc, devclass_get_devices(), free(), levels, printf(), and sysctl_handle_int().
Referenced by cpufreq_attach().
|
static |
Definition at line 213 of file kern_cpu.c.
References CF_DEBUG, device_get_nameunit(), device_get_softc(), free(), and sysctl_ctx_free().
|
static |
Definition at line 841 of file kern_cpu.c.
References CF_DEBUG, CF_MTX_ASSERT, device_get_nameunit(), free(), cpufreq_softc::lock, malloc(), and set.
Referenced by cpufreq_expand_set().
|
static |
Definition at line 785 of file kern_cpu.c.
References CF_DEBUG, CF_MTX_ASSERT, cf_setting_array::count, cpufreq_dup_set(), cpufreq_softc::lock, set, and cf_setting_array::sets.
Referenced by cf_levels_method().
|
static |
Definition at line 423 of file kern_cpu.c.
References set.
Referenced by cpufreq_get_level().
|
static |
Definition at line 435 of file kern_cpu.c.
References count, cpufreq_get_frequency(), and levels.
Referenced by cf_get_method().
|
static |
Definition at line 731 of file kern_cpu.c.
References CF_DEBUG, CF_MTX_ASSERT, count, level, cpufreq_softc::lock, malloc(), and sets.
Referenced by cf_levels_method(), and cpufreq_add_levels().
|
static |
Definition at line 991 of file kern_cpu.c.
References CF_MAX_LEVELS, count, levels, printf(), sbuf_cpy(), sbuf_data(), sbuf_delete(), sbuf_finish(), sbuf_len(), sbuf_new(), sbuf_printf(), sbuf_trim(), set, and sysctl_handle_string().
Referenced by cpufreq_attach().
int cpufreq_register | ( | device_t | dev | ) |
Definition at line 1080 of file kern_cpu.c.
References cpufreq_add_freq_driver_sysctl(), cpufreq_settings_sysctl(), device_find_child(), device_get_parent(), device_get_softc(), device_get_sysctl_ctx(), device_get_sysctl_tree(), device_get_unit(), device_probe_and_attach(), and device_quiet().
int cpufreq_settings_changed | ( | device_t | dev | ) |
Definition at line 1146 of file kern_cpu.c.
References device_get_parent(), and device_get_unit().
Referenced by cpufreq_startup_task().
|
static |
Definition at line 1032 of file kern_cpu.c.
References free(), malloc(), sbuf_cpy(), sbuf_data(), sbuf_delete(), sbuf_finish(), sbuf_len(), sbuf_new(), sbuf_printf(), sbuf_trim(), sets, and sysctl_handle_string().
Referenced by cpufreq_register().
|
static |
Definition at line 206 of file kern_cpu.c.
References cpufreq_settings_changed().
Referenced by cpufreq_attach().
int cpufreq_unregister | ( | device_t | dev | ) |
Definition at line 1122 of file kern_cpu.c.
References device_delete_child(), device_find_child(), device_get_parent(), device_get_softc(), and device_printf().
DRIVER_MODULE | ( | cpufreq | , |
cpu | , | ||
cpufreq_driver | , | ||
cpufreq_dc | , | ||
0 | , | ||
0 | |||
) |
SYSCTL_INT | ( | _debug_cpufreq | , |
OID_AUTO | , | ||
lowest | , | ||
CTLFLAG_RWTUN | , | ||
& | cf_lowest_freq, | ||
1 | , | ||
"Don't provide levels below this frequency." | |||
) |
SYSCTL_INT | ( | _debug_cpufreq | , |
OID_AUTO | , | ||
verbose | , | ||
CTLFLAG_RWTUN | , | ||
& | cf_verbose, | ||
1 | , | ||
"Print verbose debugging messages" | |||
) |
|
static |
TAILQ_HEAD | ( | cf_setting_lst | , |
cf_setting_array | |||
) |
|
static |
Definition at line 137 of file kern_cpu.c.
Referenced by cf_levels_method(), and cf_set_method().
|
static |
Definition at line 138 of file kern_cpu.c.
|
static |
Definition at line 134 of file kern_cpu.c.
Referenced by cpufreq_curr_sysctl().
|
static |
Definition at line 131 of file kern_cpu.c.
|
static |
Definition at line 121 of file kern_cpu.c.