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 64 |
#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 ("$BSDSUniX$") | |
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) | |
TUNABLE_INT ("debug.cpufreq.lowest",&cf_lowest_freq) | |
TUNABLE_INT ("debug.cpufreq.verbose",&cf_verbose) | |
static | SYSCTL_NODE (_debug, OID_AUTO, cpufreq, CTLFLAG_RD, NULL,"cpufreq debugging") |
SYSCTL_INT (_debug_cpufreq, OID_AUTO, lowest, CTLFLAG_RW,&cf_lowest_freq, 1,"Don't provide levels below this frequency.") | |
SYSCTL_INT (_debug_cpufreq, OID_AUTO, verbose, CTLFLAG_RW,&cf_verbose, 1,"Print verbose debugging messages") | |
int | cpufreq_register (device_t dev) |
int | cpufreq_unregister (device_t dev) |
int | cpufreq_settings_changed (device_t dev) |
Variables | |
struct cf_saved_freq | sys_getcontext |
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 95 of file kern_cpu.c.
Referenced by cf_get_method(), cf_levels_method(), cf_set_method(), cpufreq_attach(), cpufreq_detach(), cpufreq_dup_set(), cpufreq_expand_set(), and cpufreq_insert_abs().
#define CF_MAX_LEVELS 64 |
Definition at line 60 of file kern_cpu.c.
Referenced by cf_get_method(), cpufreq_attach(), cpufreq_curr_sysctl(), and cpufreq_levels_sysctl().
#define CF_MTX_ASSERT | ( | x | ) | sx_assert((x), SX_XLOCKED) |
Definition at line 93 of file kern_cpu.c.
Referenced by cpufreq_dup_set(), cpufreq_expand_set(), and cpufreq_insert_abs().
#define CF_MTX_INIT | ( | x | ) | sx_init((x), "cpufreq lock") |
Definition at line 90 of file kern_cpu.c.
Referenced by cpufreq_attach().
#define CF_MTX_LOCK | ( | x | ) | sx_xlock((x)) |
Definition at line 91 of file kern_cpu.c.
Referenced by cf_get_method(), cf_levels_method(), and cf_set_method().
#define CF_MTX_UNLOCK | ( | x | ) | sx_xunlock((x)) |
Definition at line 92 of file kern_cpu.c.
Referenced by cf_get_method(), cf_levels_method(), and cf_set_method().
__FBSDID | ( | "$BSDSUniX$" | ) |
|
static |
Definition at line 414 of file kern_cpu.c.
References CF_DEBUG, CF_MAX_LEVELS, CF_MTX_LOCK, CF_MTX_UNLOCK, count, cpufreq_softc::curr_level, device_get_children(), device_get_parent(), device_get_softc(), device_is_attached(), free(), levels, cpufreq_softc::lock, malloc(), printf(), and set.
|
static |
Definition at line 518 of file kern_cpu.c.
References CF_DEBUG, CF_MTX_LOCK, CF_MTX_UNLOCK, cf_setting_array::count, cpufreq_expand_set(), cpufreq_insert_abs(), device_get_children(), device_get_nameunit(), device_get_parent(), device_get_softc(), device_is_attached(), free(), cpufreq_softc::lock, malloc(), cf_setting_array::sets, sets, and type.
|
static |
Definition at line 241 of file kern_cpu.c.
References CF_DEBUG, 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(), cf_saved_freq::level, cpufreq_softc::lock, malloc(), mp_ncpus, cf_saved_freq::priority, sched_bind(), sched_unbind(), set, and smp_active.
|
static |
Definition at line 146 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, devclass_get_count(), 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 860 of file kern_cpu.c.
References CF_MAX_LEVELS, count, devclass_get_devices(), free(), levels, printf(), and sysctl_handle_int().
Referenced by cpufreq_attach().
|
static |
Definition at line 215 of file kern_cpu.c.
References CF_DEBUG, devclass_get_count(), device_get_nameunit(), device_get_softc(), free(), and sysctl_ctx_free().
|
static |
Definition at line 765 of file kern_cpu.c.
References CF_DEBUG, CF_MTX_ASSERT, device_get_nameunit(), free(), cpufreq_softc::lock, and malloc().
Referenced by cpufreq_expand_set().
|
static |
Definition at line 709 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 667 of file kern_cpu.c.
References CF_DEBUG, CF_MTX_ASSERT, count, cf_saved_freq::level, cpufreq_softc::lock, and malloc().
Referenced by cf_levels_method().
|
static |
Definition at line 915 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 992 of file kern_cpu.c.
References cpufreq_settings_sysctl(), device_find_child(), device_get_parent(), device_get_softc(), device_get_sysctl_ctx(), device_get_sysctl_tree(), device_probe_and_attach(), and device_quiet().
int cpufreq_settings_changed | ( | device_t | dev | ) |
Definition at line 1059 of file kern_cpu.c.
References device_get_parent(), and device_get_unit().
Referenced by cpufreq_startup_task().
|
static |
Definition at line 956 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 208 of file kern_cpu.c.
References cpufreq_settings_changed().
Referenced by cpufreq_attach().
int cpufreq_unregister | ( | device_t | dev | ) |
Definition at line 1024 of file kern_cpu.c.
References device_delete_child(), device_find_child(), device_get_children(), device_get_parent(), device_is_attached(), device_printf(), free(), and type.
DRIVER_MODULE | ( | cpufreq | , |
cpu | , | ||
cpufreq_driver | , | ||
cpufreq_dc | , | ||
0 | , | ||
0 | |||
) |
SYSCTL_INT | ( | _debug_cpufreq | , |
OID_AUTO | , | ||
lowest | , | ||
CTLFLAG_RW | , | ||
& | cf_lowest_freq, | ||
1 | , | ||
"Don't provide levels below this frequency." | |||
) |
SYSCTL_INT | ( | _debug_cpufreq | , |
OID_AUTO | , | ||
verbose | , | ||
CTLFLAG_RW | , | ||
& | cf_verbose, | ||
1 | , | ||
"Print verbose debugging messages" | |||
) |
|
static |
TAILQ_HEAD | ( | cf_setting_lst | , |
cf_setting_array | |||
) |
TUNABLE_INT | ( | "debug.cpufreq.lowest" | , |
& | cf_lowest_freq | ||
) |
TUNABLE_INT | ( | "debug.cpufreq.verbose" | , |
& | cf_verbose | ||
) |
|
static |
Definition at line 134 of file kern_cpu.c.
|
static |
Definition at line 135 of file kern_cpu.c.
|
static |
Definition at line 131 of file kern_cpu.c.
|
static |
Definition at line 128 of file kern_cpu.c.
|
static |
Definition at line 118 of file kern_cpu.c.
struct cf_saved_freq sys_getcontext |