Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
b04d73e8
Commit
b04d73e8
authored
Jun 25, 2003
by
Linus Torvalds
Browse files
Options
Browse Files
Download
Plain Diff
Merge
bk://linux-dj.bkbits.net/cpufreq
into home.osdl.org:/home/torvalds/v2.5/linux
parents
508e50ca
91151ea2
Changes
7
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
410 additions
and
465 deletions
+410
-465
Documentation/cpu-freq/user-guide.txt
Documentation/cpu-freq/user-guide.txt
+3
-7
arch/i386/kernel/cpu/cpufreq/Kconfig
arch/i386/kernel/cpu/cpufreq/Kconfig
+5
-0
arch/i386/kernel/cpu/cpufreq/Makefile
arch/i386/kernel/cpu/cpufreq/Makefile
+1
-0
arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c
arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c
+1
-1
arch/i386/kernel/cpu/cpufreq/speedstep-ich.c
arch/i386/kernel/cpu/cpufreq/speedstep-ich.c
+84
-457
arch/i386/kernel/cpu/cpufreq/speedstep-lib.c
arch/i386/kernel/cpu/cpufreq/speedstep-lib.c
+275
-0
arch/i386/kernel/cpu/cpufreq/speedstep-lib.h
arch/i386/kernel/cpu/cpufreq/speedstep-lib.h
+41
-0
No files found.
Documentation/cpu-freq/user-guide.txt
View file @
b04d73e8
...
@@ -56,19 +56,15 @@ AMD mobile K6-3+
...
@@ -56,19 +56,15 @@ AMD mobile K6-3+
AMD mobile Duron
AMD mobile Duron
AMD mobile Athlon
AMD mobile Athlon
Cyrix Media GXm
Cyrix Media GXm
Intel mobile PIII
[*]
and Intel mobile PIII-M on certain chipsets
Intel mobile PIII and Intel mobile PIII-M on certain chipsets
Intel Pentium 4, Intel Xeon
Intel Pentium 4, Intel Xeon
Intel Pentium M (Centrino)
Intel Pentium M (Centrino)
National Semiconductors Geode GX
National Semiconductors Geode GX
Transmeta Crusoe
Transmeta Crusoe
VIA Cyrix 3 / C3
VIA Cyrix 3 / C3
various processors on some ACPI 2.0-compatible systems [*
*
]
various processors on some ACPI 2.0-compatible systems [*]
[*] only certain Intel mobile PIII processors are supported. If you
[*] Only if "ACPI Processor Performance States" are available
know that you own a speedstep-capable processor, pass the option
"speedstep_coppermine=1" to the module speedstep.o
[**] Only if "ACPI Processor Performance States" are available
to the ACPI<->BIOS interface.
to the ACPI<->BIOS interface.
...
...
arch/i386/kernel/cpu/cpufreq/Kconfig
View file @
b04d73e8
...
@@ -123,6 +123,11 @@ config X86_SPEEDSTEP_CENTRINO
...
@@ -123,6 +123,11 @@ config X86_SPEEDSTEP_CENTRINO
If in doubt, say N.
If in doubt, say N.
config X86_SPEEDSTEP_LIB
tristate
depends on X86_SPEEDSTEP_ICH
default X86_SPEEDSTEP_ICH
config X86_P4_CLOCKMOD
config X86_P4_CLOCKMOD
tristate "Intel Pentium 4 clock modulation"
tristate "Intel Pentium 4 clock modulation"
depends on CPU_FREQ_TABLE
depends on CPU_FREQ_TABLE
...
...
arch/i386/kernel/cpu/cpufreq/Makefile
View file @
b04d73e8
...
@@ -8,6 +8,7 @@ obj-$(CONFIG_X86_GX_SUSPMOD) += gx-suspmod.o
...
@@ -8,6 +8,7 @@ obj-$(CONFIG_X86_GX_SUSPMOD) += gx-suspmod.o
obj-$(CONFIG_X86_ACPI_CPUFREQ)
+=
acpi.o
obj-$(CONFIG_X86_ACPI_CPUFREQ)
+=
acpi.o
obj-$(CONFIG_X86_SPEEDSTEP_ICH)
+=
speedstep-ich.o
obj-$(CONFIG_X86_SPEEDSTEP_ICH)
+=
speedstep-ich.o
obj-$(CONFIG_X86_SPEEDSTEP_CENTRINO)
+=
speedstep-centrino.o
obj-$(CONFIG_X86_SPEEDSTEP_CENTRINO)
+=
speedstep-centrino.o
obj-$(CONFIG_X86_SPEEDSTEP_LIB)
+=
speedstep-lib.o
ifdef
CONFIG_X86_ACPI_CPUFREQ
ifdef
CONFIG_X86_ACPI_CPUFREQ
ifdef
CONFIG_ACPI_DEBUG
ifdef
CONFIG_ACPI_DEBUG
...
...
arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c
View file @
b04d73e8
...
@@ -29,7 +29,7 @@
...
@@ -29,7 +29,7 @@
#define PFX "speedstep-centrino: "
#define PFX "speedstep-centrino: "
#define MAINTAINER "Jeremy Fitzhardinge <jeremy@goop.org>"
#define MAINTAINER "Jeremy Fitzhardinge <jeremy@goop.org>"
#define CENTRINO_DEBUG
/*#define CENTRINO_DEBUG*/
#ifdef CENTRINO_DEBUG
#ifdef CENTRINO_DEBUG
#define dprintk(msg...) printk(msg)
#define dprintk(msg...) printk(msg)
...
...
arch/i386/kernel/cpu/cpufreq/speedstep-ich.c
View file @
b04d73e8
This diff is collapsed.
Click to expand it.
arch/i386/kernel/cpu/cpufreq/speedstep-lib.c
0 → 100644
View file @
b04d73e8
/*
* (C) 2002 - 2003 Dominik Brodowski <linux@brodo.de>
*
* Licensed under the terms of the GNU GPL License version 2.
*
* Library for common functions for Intel SpeedStep v.1 and v.2 support
*
* BIG FAT DISCLAIMER: Work in progress code. Possibly *dangerous*
*/
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/cpufreq.h>
#include <linux/pci.h>
#include <linux/slab.h>
#include <asm/msr.h>
#include "speedstep-lib.h"
/* DEBUG
* Define it if you want verbose debug output, e.g. for bug reporting
*/
//#define SPEEDSTEP_DEBUG
#ifdef SPEEDSTEP_DEBUG
#define dprintk(msg...) printk(msg)
#else
#define dprintk(msg...) do { } while(0)
#endif
/*********************************************************************
* GET PROCESSOR CORE SPEED IN KHZ *
*********************************************************************/
static
unsigned
int
pentium3_get_frequency
(
unsigned
int
processor
)
{
/* See table 14 of p3_ds.pdf and table 22 of 29834003.pdf */
struct
{
unsigned
int
ratio
;
/* Frequency Multiplier (x10) */
u8
bitmap
;
/* power on configuration bits
[27, 25:22] (in MSR 0x2a) */
}
msr_decode_mult
[]
=
{
{
30
,
0x01
},
{
35
,
0x05
},
{
40
,
0x02
},
{
45
,
0x06
},
{
50
,
0x00
},
{
55
,
0x04
},
{
60
,
0x0b
},
{
65
,
0x0f
},
{
70
,
0x09
},
{
75
,
0x0d
},
{
80
,
0x0a
},
{
85
,
0x26
},
{
90
,
0x20
},
{
100
,
0x2b
},
{
0
,
0xff
}
/* error or unknown value */
};
/* PIII(-M) FSB settings: see table b1-b of 24547206.pdf */
struct
{
unsigned
int
value
;
/* Front Side Bus speed in MHz */
u8
bitmap
;
/* power on configuration bits [18: 19]
(in MSR 0x2a) */
}
msr_decode_fsb
[]
=
{
{
66
,
0x0
},
{
100
,
0x2
},
{
133
,
0x1
},
{
0
,
0xff
}
};
u32
msr_lo
,
msr_tmp
;
int
i
=
0
,
j
=
0
;
/* read MSR 0x2a - we only need the low 32 bits */
rdmsr
(
MSR_IA32_EBL_CR_POWERON
,
msr_lo
,
msr_tmp
);
dprintk
(
KERN_DEBUG
"speedstep-lib: P3 - MSR_IA32_EBL_CR_POWERON: 0x%x 0x%x
\n
"
,
msr_lo
,
msr_tmp
);
msr_tmp
=
msr_lo
;
/* decode the FSB */
msr_tmp
&=
0x00c0000
;
msr_tmp
>>=
18
;
while
(
msr_tmp
!=
msr_decode_fsb
[
i
].
bitmap
)
{
if
(
msr_decode_fsb
[
i
].
bitmap
==
0xff
)
return
0
;
i
++
;
}
/* decode the multiplier */
if
(
processor
==
SPEEDSTEP_PROCESSOR_PIII_C_EARLY
)
msr_lo
&=
0x03c00000
;
else
msr_lo
&=
0x0bc00000
;
msr_lo
>>=
22
;
while
(
msr_lo
!=
msr_decode_mult
[
j
].
bitmap
)
{
if
(
msr_decode_mult
[
j
].
bitmap
==
0xff
)
return
0
;
j
++
;
}
return
(
msr_decode_mult
[
j
].
ratio
*
msr_decode_fsb
[
i
].
value
*
100
);
}
static
unsigned
int
pentium4_get_frequency
(
void
)
{
u32
msr_lo
,
msr_hi
;
rdmsr
(
0x2c
,
msr_lo
,
msr_hi
);
dprintk
(
KERN_DEBUG
"speedstep-lib: P4 - MSR_EBC_FREQUENCY_ID: 0x%x 0x%x
\n
"
,
msr_lo
,
msr_hi
);
msr_lo
>>=
24
;
return
(
msr_lo
*
100000
);
}
unsigned
int
speedstep_get_processor_frequency
(
unsigned
int
processor
)
{
switch
(
processor
)
{
case
SPEEDSTEP_PROCESSOR_P4M
:
return
pentium4_get_frequency
();
case
SPEEDSTEP_PROCESSOR_PIII_T
:
case
SPEEDSTEP_PROCESSOR_PIII_C
:
case
SPEEDSTEP_PROCESSOR_PIII_C_EARLY
:
return
pentium3_get_frequency
(
processor
);
default:
return
0
;
};
return
0
;
}
EXPORT_SYMBOL_GPL
(
speedstep_get_processor_frequency
);
/*********************************************************************
* DETECT SPEEDSTEP-CAPABLE PROCESSOR *
*********************************************************************/
unsigned
int
speedstep_detect_processor
(
void
)
{
struct
cpuinfo_x86
*
c
=
cpu_data
;
u32
ebx
,
msr_lo
,
msr_hi
;
if
((
c
->
x86_vendor
!=
X86_VENDOR_INTEL
)
||
((
c
->
x86
!=
6
)
&&
(
c
->
x86
!=
0xF
)))
return
0
;
if
(
c
->
x86
==
0xF
)
{
/* Intel Mobile Pentium 4-M
* or Intel Mobile Pentium 4 with 533 MHz FSB */
if
(
c
->
x86_model
!=
2
)
return
0
;
if
((
c
->
x86_mask
!=
4
)
&&
/* B-stepping [M-P4-M] */
(
c
->
x86_mask
!=
7
)
&&
/* C-stepping [M-P4-M] */
(
c
->
x86_mask
!=
9
))
/* D-stepping [M-P4-M or M-P4/533] */
return
0
;
ebx
=
cpuid_ebx
(
0x00000001
);
ebx
&=
0x000000FF
;
if
((
ebx
!=
0x0e
)
&&
(
ebx
!=
0x0f
))
return
0
;
return
SPEEDSTEP_PROCESSOR_P4M
;
}
switch
(
c
->
x86_model
)
{
case
0x0B
:
/* Intel PIII [Tualatin] */
/* cpuid_ebx(1) is 0x04 for desktop PIII,
0x06 for mobile PIII-M */
ebx
=
cpuid_ebx
(
0x00000001
);
ebx
&=
0x000000FF
;
if
(
ebx
!=
0x06
)
return
0
;
/* So far all PIII-M processors support SpeedStep. See
* Intel's 24540640.pdf of June 2003
*/
return
SPEEDSTEP_PROCESSOR_PIII_T
;
case
0x08
:
/* Intel PIII [Coppermine] */
/* all mobile PIII Coppermines have FSB 100 MHz
* ==> sort out a few desktop PIIIs. */
rdmsr
(
MSR_IA32_EBL_CR_POWERON
,
msr_lo
,
msr_hi
);
dprintk
(
KERN_DEBUG
"cpufreq: Coppermine: MSR_IA32_EBL_CR_POWERON is 0x%x, 0x%x
\n
"
,
msr_lo
,
msr_hi
);
msr_lo
&=
0x00c0000
;
if
(
msr_lo
!=
0x0080000
)
return
0
;
/*
* If the processor is a mobile version,
* platform ID has bit 50 set
* it has SpeedStep technology if either
* bit 56 or 57 is set
*/
rdmsr
(
MSR_IA32_PLATFORM_ID
,
msr_lo
,
msr_hi
);
dprintk
(
KERN_DEBUG
"cpufreq: Coppermine: MSR_IA32_PLATFORM ID is 0x%x, 0x%x
\n
"
,
msr_lo
,
msr_hi
);
if
((
msr_hi
&
(
1
<<
18
))
&&
(
msr_hi
&
(
3
<<
24
)))
{
if
(
c
->
x86_mask
==
0x01
)
return
SPEEDSTEP_PROCESSOR_PIII_C_EARLY
;
else
return
SPEEDSTEP_PROCESSOR_PIII_C
;
}
default:
return
0
;
}
}
EXPORT_SYMBOL_GPL
(
speedstep_detect_processor
);
/*********************************************************************
* DETECT SPEEDSTEP SPEEDS *
*********************************************************************/
unsigned
int
speedstep_get_freqs
(
unsigned
int
processor
,
unsigned
int
*
low_speed
,
unsigned
int
*
high_speed
,
void
(
*
set_state
)
(
unsigned
int
state
,
unsigned
int
notify
)
)
{
unsigned
int
prev_speed
;
unsigned
int
ret
=
0
;
unsigned
long
flags
;
if
((
!
processor
)
||
(
!
low_speed
)
||
(
!
high_speed
)
||
(
!
set_state
))
return
EINVAL
;
/* get current speed */
prev_speed
=
speedstep_get_processor_frequency
(
processor
);
if
(
!
prev_speed
)
return
EIO
;
local_irq_save
(
flags
);
/* switch to low state */
set_state
(
SPEEDSTEP_LOW
,
0
);
*
low_speed
=
speedstep_get_processor_frequency
(
processor
);
if
(
!*
low_speed
)
{
ret
=
EIO
;
goto
out
;
}
/* switch to high state */
set_state
(
SPEEDSTEP_HIGH
,
0
);
*
high_speed
=
speedstep_get_processor_frequency
(
processor
);
if
(
!*
high_speed
)
{
ret
=
EIO
;
goto
out
;
}
if
(
*
low_speed
==
*
high_speed
)
{
ret
=
ENODEV
;
goto
out
;
}
/* switch to previous state, if necessary */
if
(
*
high_speed
!=
prev_speed
)
set_state
(
SPEEDSTEP_LOW
,
0
);
out:
local_irq_restore
(
flags
);
return
(
ret
);
}
EXPORT_SYMBOL_GPL
(
speedstep_get_freqs
);
MODULE_AUTHOR
(
"Dominik Brodowski <linux@brodo.de>"
);
MODULE_DESCRIPTION
(
"Library for Intel SpeedStep 1 or 2 cpufreq drivers."
);
MODULE_LICENSE
(
"GPL"
);
arch/i386/kernel/cpu/cpufreq/speedstep-lib.h
0 → 100644
View file @
b04d73e8
/*
* (C) 2002 - 2003 Dominik Brodowski <linux@brodo.de>
*
* Licensed under the terms of the GNU GPL License version 2.
*
* Library for common functions for Intel SpeedStep v.1 and v.2 support
*
* BIG FAT DISCLAIMER: Work in progress code. Possibly *dangerous*
*/
/* processors */
#define SPEEDSTEP_PROCESSOR_PIII_C_EARLY 0x00000001
/* Coppermine core */
#define SPEEDSTEP_PROCESSOR_PIII_C 0x00000002
/* Coppermine core */
#define SPEEDSTEP_PROCESSOR_PIII_T 0x00000003
/* Tualatin core */
#define SPEEDSTEP_PROCESSOR_P4M 0x00000004
/* P4-M with 100 MHz FSB */
/* speedstep states -- only two of them */
#define SPEEDSTEP_HIGH 0x00000000
#define SPEEDSTEP_LOW 0x00000001
/* detect a speedstep-capable processor */
extern
unsigned
int
speedstep_detect_processor
(
void
);
/* detect the current speed (in khz) of the processor */
extern
unsigned
int
speedstep_get_processor_frequency
(
unsigned
int
processor
);
/* detect the low and high speeds of the processor. The callback
* set_state"'s first argument is either SPEEDSTEP_HIGH or
* SPEEDSTEP_LOW; the second argument is zero so that no
* cpufreq_notify_transition calls are initiated.
*/
extern
unsigned
int
speedstep_get_freqs
(
unsigned
int
processor
,
unsigned
int
*
low_speed
,
unsigned
int
*
high_speed
,
void
(
*
set_state
)
(
unsigned
int
state
,
unsigned
int
notify
));
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment