Commit dae78db1 authored by Dave Jones's avatar Dave Jones Committed by Dave Jones

[CPUFREQ] Convert Longhaul v1 over to bitfields too.

parent 94db5ad4
...@@ -285,7 +285,7 @@ static int longhaul_get_cpu_mult (void) ...@@ -285,7 +285,7 @@ static int longhaul_get_cpu_mult (void)
/** /**
* longhaul_set_cpu_frequency() * longhaul_set_cpu_frequency()
* @clock_ratio_index : index of clock_ratio[] for new frequency * @clock_ratio_index : bitpattern of the new multiplier.
* *
* Sets a new clock ratio, and -if applicable- a new Front Side Bus * Sets a new clock ratio, and -if applicable- a new Front Side Bus
*/ */
...@@ -295,6 +295,7 @@ static void longhaul_setstate (unsigned int clock_ratio_index) ...@@ -295,6 +295,7 @@ static void longhaul_setstate (unsigned int clock_ratio_index)
int vidindex, i; int vidindex, i;
struct cpufreq_freqs freqs; struct cpufreq_freqs freqs;
union msr_longhaul longhaul; union msr_longhaul longhaul;
union msr_bcr2 bcr2;
if (clock_ratio[clock_ratio_index] == -1) if (clock_ratio[clock_ratio_index] == -1)
return; return;
...@@ -312,25 +313,20 @@ static void longhaul_setstate (unsigned int clock_ratio_index) ...@@ -312,25 +313,20 @@ static void longhaul_setstate (unsigned int clock_ratio_index)
dprintk (KERN_INFO PFX "FSB:%d Mult(x10):%d\n", dprintk (KERN_INFO PFX "FSB:%d Mult(x10):%d\n",
fsb * 100, clock_ratio[clock_ratio_index]); fsb * 100, clock_ratio[clock_ratio_index]);
/* "bits" contains the bitpattern of the new multiplier.
we now need to transform it to the desired format. */
switch (longhaul_version) { switch (longhaul_version) {
case 1: case 1:
// rdmsr (MSR_VIA_BCR2, lo, hi); rdmsrl (MSR_VIA_BCR2, bcr2.val);
/* Enable software clock multiplier */ /* Enable software clock multiplier */
// lo |= (1<<19); bcr2.bits.ESOFTBF = 1;
/* desired multiplier */ bcr2.bits.CLOCKMUL = clock_ratio_index;
// lo &= ~(1<<23|1<<24|1<<25|1<<26); wrmsrl (MSR_VIA_BCR2, bcr2.val);
// lo |= (bits<<23);
// wrmsr (MSR_VIA_BCR2, lo, hi);
__hlt(); __hlt();
/* Disable software clock multiplier */ /* Disable software clock multiplier */
// rdmsr (MSR_VIA_BCR2, lo, hi); rdmsrl (MSR_VIA_BCR2, bcr2.val);
// lo &= ~(1<<19); bcr2.bits.ESOFTBF = 0;
// wrmsr (MSR_VIA_BCR2, lo, hi); wrmsrl (MSR_VIA_BCR2, bcr2.val);
break; break;
case 2: case 2:
......
...@@ -7,6 +7,17 @@ ...@@ -7,6 +7,17 @@
* VIA-specific information * VIA-specific information
*/ */
union msr_bcr2 {
struct {
unsigned Reseved:19, // 18:0
ESOFTBF:1, // 19
Reserved2:3, // 22:20
CLOCKMUL:4, // 26:23
Reserved3:5; // 31:27
} bits;
unsigned long val;
};
union msr_longhaul { union msr_longhaul {
struct { struct {
unsigned RevisionID:4, // 3:0 unsigned RevisionID:4, // 3:0
...@@ -35,3 +46,4 @@ union msr_longhaul { ...@@ -35,3 +46,4 @@ union msr_longhaul {
} bits; } bits;
unsigned long long val; unsigned long long val;
}; };
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment