1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-20 11:11:24 +00:00

Do not register a event handler for CPU freqency changes when it is found

P-state invariant.  This is continuation of r216274.
This commit is contained in:
Jung-uk Kim 2010-12-07 22:34:51 +00:00
parent 4a9c4056dc
commit 1bcc28295b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=216275
2 changed files with 32 additions and 8 deletions

View File

@ -109,6 +109,8 @@ static int hw_clockrate;
SYSCTL_INT(_hw, OID_AUTO, clockrate, CTLFLAG_RD,
&hw_clockrate, 0, "CPU instruction clock rate");
static eventhandler_tag tsc_post_tag;
static char cpu_brand[48];
static struct {
@ -433,21 +435,31 @@ panicifcpuunsupported(void)
/* Update TSC freq with the value indicated by the caller. */
static void
tsc_freq_changed(void *arg, const struct cf_level *level, int status)
tsc_freq_changed(void *arg __unused, const struct cf_level *level, int status)
{
/*
* If there was an error during the transition or
* TSC is P-state invariant, don't do anything.
*/
if (status != 0 || tsc_is_invariant)
if (status != 0)
return;
/* Total setting for this level gives the new frequency in MHz. */
hw_clockrate = level->total_set.freq;
}
EVENTHANDLER_DEFINE(cpufreq_post_change, tsc_freq_changed, NULL,
EVENTHANDLER_PRI_ANY);
static void
hook_tsc_freq(void *arg __unused)
{
if (tsc_is_invariant)
return;
tsc_post_tag = EVENTHANDLER_REGISTER(cpufreq_post_change,
tsc_freq_changed, NULL, EVENTHANDLER_PRI_ANY);
}
SYSINIT(hook_tsc_freq, SI_SUB_CONFIGURE, SI_ORDER_ANY, hook_tsc_freq, NULL);
/*
* Final stage of CPU identification.

View File

@ -100,6 +100,8 @@ static int hw_clockrate;
SYSCTL_INT(_hw, OID_AUTO, clockrate, CTLFLAG_RD,
&hw_clockrate, 0, "CPU instruction clock rate");
static eventhandler_tag tsc_post_tag;
static char cpu_brand[48];
#define MAX_BRAND_INDEX 8
@ -1049,21 +1051,31 @@ identifycyrix(void)
/* Update TSC freq with the value indicated by the caller. */
static void
tsc_freq_changed(void *arg, const struct cf_level *level, int status)
tsc_freq_changed(void *arg __unused, const struct cf_level *level, int status)
{
/*
* If there was an error during the transition or
* TSC is P-state invariant, don't do anything.
*/
if (status != 0 || tsc_is_invariant)
if (status != 0)
return;
/* Total setting for this level gives the new frequency in MHz. */
hw_clockrate = level->total_set.freq;
}
EVENTHANDLER_DEFINE(cpufreq_post_change, tsc_freq_changed, NULL,
EVENTHANDLER_PRI_ANY);
static void
hook_tsc_freq(void *arg __unused)
{
if (tsc_is_invariant)
return;
tsc_post_tag = EVENTHANDLER_REGISTER(cpufreq_post_change,
tsc_freq_changed, NULL, EVENTHANDLER_PRI_ANY);
}
SYSINIT(hook_tsc_freq, SI_SUB_CONFIGURE, SI_ORDER_ANY, hook_tsc_freq, NULL);
/*
* Final stage of CPU identification. -- Should I check TI?