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
33ab1d91
Commit
33ab1d91
authored
Feb 09, 2004
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
7b080b4c
0211af97
Changes
7
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
242 additions
and
362 deletions
+242
-362
arch/i386/kernel/cpu/cpufreq/gx-suspmod.c
arch/i386/kernel/cpu/cpufreq/gx-suspmod.c
+44
-45
arch/i386/kernel/cpu/cpufreq/p4-clockmod.c
arch/i386/kernel/cpu/cpufreq/p4-clockmod.c
+1
-1
arch/i386/kernel/cpu/cpufreq/powernow-k7.c
arch/i386/kernel/cpu/cpufreq/powernow-k7.c
+3
-8
arch/i386/kernel/cpu/cpufreq/powernow-k8.c
arch/i386/kernel/cpu/cpufreq/powernow-k8.c
+139
-294
arch/i386/kernel/cpu/cpufreq/powernow-k8.h
arch/i386/kernel/cpu/cpufreq/powernow-k8.h
+0
-4
arch/i386/kernel/cpu/cpufreq/speedstep-lib.c
arch/i386/kernel/cpu/cpufreq/speedstep-lib.c
+46
-8
drivers/cpufreq/cpufreq_userspace.c
drivers/cpufreq/cpufreq_userspace.c
+9
-2
No files found.
arch/i386/kernel/cpu/cpufreq/gx-suspmod.c
View file @
33ab1d91
...
...
@@ -28,30 +28,34 @@
* with 'Suspend Modulation OFF Count Register'
* and 'Suspend Modulation ON Count Register'.
* These registers are 8bit counters that represent the number of
* 32us intervals which the SUSP# pin is asserted
/de-asserted to the
* processor.
* 32us intervals which the SUSP# pin is asserted
(ON)/de-asserted(OFF)
*
to the
processor.
*
* These counters define a ratio which is the effective frequency
* of operation of the system.
*
* O
n
Count
* O
FF
Count
* F_eff = Fgx * ----------------------
* O
n Count + Off
Count
* O
FF Count + ON
Count
*
* 0 <= On Count, Off Count <= 255
*
* From these limits, we can get register values
*
* o
n_duration + off
_duration <= MAX_DURATION
* o
ff_duration = on
_duration * (stock_freq - freq) / freq
* o
ff_duration + on
_duration <= MAX_DURATION
* o
n_duration = off
_duration * (stock_freq - freq) / freq
*
* o
n
_duration = (freq * DURATION) / stock_freq
* o
ff_duration = DURATION - on
_duration
* o
ff
_duration = (freq * DURATION) / stock_freq
* o
n_duration = DURATION - off
_duration
*
*
*---------------------------------------------------------------------------
*
* ChangeLog:
* Dec. 12, 2003 Hiroshi Miura <miura@da-cha.org>
* - fix on/off register mistake
* - fix cpu_khz calc when it stops cpu modulation.
*
* Dec. 11, 2002 Hiroshi Miura <miura@da-cha.org>
* - rewrite for Cyrix MediaGX Cx5510/5520 and
* NatSemi Geode Cs5530(A).
...
...
@@ -233,13 +237,13 @@ static unsigned int gx_validate_speed(unsigned int khz, u8 *on_duration, u8 *off
int
old_tmp_freq
=
stock_freq
;
int
tmp_freq
;
*
o
n
_duration
=
1
;
*
o
ff
_duration
=
0
;
*
o
ff
_duration
=
1
;
*
o
n
_duration
=
0
;
for
(
i
=
max_duration
;
i
>
0
;
i
--
)
{
tmp_o
n
=
((
khz
*
i
)
/
stock_freq
)
&
0xff
;
tmp_o
ff
=
i
-
tmp_on
;
tmp_freq
=
(
stock_freq
*
tmp_o
n
)
/
i
;
tmp_o
ff
=
((
khz
*
i
)
/
stock_freq
)
&
0xff
;
tmp_o
n
=
i
-
tmp_off
;
tmp_freq
=
(
stock_freq
*
tmp_o
ff
)
/
i
;
/* if this relation is closer to khz, use this. If it's equal,
* prefer it, too - lower latency */
if
(
abs
(
tmp_freq
-
khz
)
<=
abs
(
old_tmp_freq
-
khz
))
{
...
...
@@ -273,20 +277,10 @@ static void gx_set_cpuspeed(unsigned int khz)
freqs
.
new
=
new_khz
;
if
(
new_khz
==
stock_freq
)
{
/* if new khz == 100% of CPU speed, it is special case */
local_irq_save
(
flags
);
cpufreq_notify_transition
(
&
freqs
,
CPUFREQ_PRECHANGE
);
pci_write_config_byte
(
gx_params
->
cs55x0
,
PCI_SUSCFG
,
(
gx_params
->
pci_suscfg
&
~
(
SUSMOD
)));
pci_read_config_byte
(
gx_params
->
cs55x0
,
PCI_SUSCFG
,
&
(
gx_params
->
pci_suscfg
));
local_irq_restore
(
flags
);
dprintk
(
"suspend modulation disabled: cpu runs 100 percent speed.
\n
"
);
cpufreq_notify_transition
(
&
freqs
,
CPUFREQ_POSTCHANGE
);
return
;
}
cpufreq_notify_transition
(
&
freqs
,
CPUFREQ_PRECHANGE
);
local_irq_save
(
flags
);
if
(
new_khz
!=
stock_freq
)
{
/* if new khz == 100% of CPU speed, it is special case */
switch
(
gx_params
->
cs55x0
->
device
)
{
case
PCI_DEVICE_ID_CYRIX_5530_LEGACY
:
pmer1
=
gx_params
->
pci_pmer1
|
IRQ_SPDUP
|
VID_SPDUP
;
...
...
@@ -304,12 +298,17 @@ static void gx_set_cpuspeed(unsigned int khz)
case
PCI_DEVICE_ID_CYRIX_5520
:
case
PCI_DEVICE_ID_CYRIX_5510
:
suscfg
=
gx_params
->
pci_suscfg
|
SUSMOD
;
break
;
default:
local_irq_restore
(
flags
);
dprintk
(
"fatal: try to set unknown chipset.
\n
"
);
return
;
}
}
else
{
suscfg
=
gx_params
->
pci_suscfg
&
~
(
SUSMOD
);
gx_params
->
off_duration
=
0
;
gx_params
->
on_duration
=
0
;
dprintk
(
"suspend modulation disabled: cpu runs 100 percent speed.
\n
"
);
}
pci_write_config_byte
(
gx_params
->
cs55x0
,
PCI_MODOFF
,
gx_params
->
off_duration
);
pci_write_config_byte
(
gx_params
->
cs55x0
,
PCI_MODON
,
gx_params
->
on_duration
);
...
...
arch/i386/kernel/cpu/cpufreq/p4-clockmod.c
View file @
33ab1d91
...
...
@@ -246,7 +246,7 @@ static int cpufreq_p4_cpu_init(struct cpufreq_policy *policy)
static
int
cpufreq_p4_cpu_exit
(
struct
cpufreq_policy
*
policy
)
{
cpufreq_frequency_table_put_attr
(
policy
->
cpu
);
return
cpufreq_p4_setdc
(
policy
->
cpu
,
DC_DISABLE
)
;
return
0
;
}
static
struct
freq_attr
*
p4clockmod_attr
[]
=
{
...
...
arch/i386/kernel/cpu/cpufreq/powernow-k7.c
View file @
33ab1d91
...
...
@@ -91,18 +91,13 @@ static int check_powernow(void)
struct
cpuinfo_x86
*
c
=
cpu_data
;
unsigned
int
maxei
,
eax
,
ebx
,
ecx
,
edx
;
if
(
c
->
x86_vendor
!=
X86_VENDOR_AMD
)
{
printk
(
KERN_INFO
PFX
"AMD processor not detected.
\n
"
);
return
0
;
}
if
(
c
->
x86
!=
6
)
{
if
((
c
->
x86_vendor
!=
X86_VENDOR_AMD
)
||
(
c
->
x86
!=
6
))
{
#ifdef MODULE
printk
(
KERN_INFO
PFX
"This module only works with AMD K7 CPUs
\n
"
);
#endif
return
0
;
}
printk
(
KERN_INFO
PFX
"AMD K7 CPU detected.
\n
"
);
if
((
c
->
x86_model
==
6
)
&&
(
c
->
x86_mask
==
0
))
{
printk
(
KERN_INFO
PFX
"K7 660[A0] core detected, enabling errata workarounds
\n
"
);
have_a0
=
1
;
...
...
arch/i386/kernel/cpu/cpufreq/powernow-k8.c
View file @
33ab1d91
This diff is collapsed.
Click to expand it.
arch/i386/kernel/cpu/cpufreq/powernow-k8.h
View file @
33ab1d91
...
...
@@ -120,7 +120,3 @@ struct pst_s {
static
inline
int
core_voltage_pre_transition
(
u32
reqvid
);
static
inline
int
core_voltage_post_transition
(
u32
reqvid
);
static
inline
int
core_frequency_transition
(
u32
reqfid
);
static
int
powernowk8_verify
(
struct
cpufreq_policy
*
pol
);
static
int
powernowk8_target
(
struct
cpufreq_policy
*
pol
,
unsigned
targfreq
,
unsigned
relation
);
static
int
__init
powernowk8_cpu_init
(
struct
cpufreq_policy
*
pol
);
arch/i386/kernel/cpu/cpufreq/speedstep-lib.c
View file @
33ab1d91
...
...
@@ -207,17 +207,55 @@ unsigned int speedstep_detect_processor (void)
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
;
dprintk
(
KERN_INFO
"ebx value is %x, x86_mask is %x
\n
"
,
ebx
,
c
->
86
_mask
);
switch
(
c
->
x86_mask
)
{
case
4
:
/*
* B-stepping [M-P4-M]
* sample has ebx = 0x0f, production has 0x0e.
*/
if
((
ebx
==
0x0e
)
||
(
ebx
==
0x0f
))
return
SPEEDSTEP_PROCESSOR_P4M
;
break
;
case
7
:
/*
* C-stepping [M-P4-M]
* needs to have ebx=0x0e, else it's a celeron:
* cf. 25130917.pdf / page 7, footnote 5 even
* though 25072120.pdf / page 7 doesn't say
* samples are only of B-stepping...
*/
if
(
ebx
==
0x0e
)
return
SPEEDSTEP_PROCESSOR_P4M
;
break
;
case
9
:
/*
* D-stepping [M-P4-M or M-P4/533]
*
* this is totally strange: CPUID 0x0F29 is
* used by M-P4-M, M-P4/533 and(!) Celeron CPUs.
* The latter need to be sorted out as they don't
* support speedstep.
* Celerons with CPUID 0x0F29 may have either
* ebx=0x8 or 0xf -- 25130917.pdf doesn't say anything
* specific.
* M-P4-Ms may have either ebx=0xe or 0xf [see above]
* M-P4/533 have either ebx=0xe or 0xf. [25317607.pdf]
* So, how to distinguish all those processors with
* ebx=0xf? I don't know. Sort them out, and wait
* for someone to complain.
*/
if
(
ebx
==
0x0e
)
return
SPEEDSTEP_PROCESSOR_P4M
;
break
;
default:
break
;
}
return
0
;
}
switch
(
c
->
x86_model
)
{
...
...
drivers/cpufreq/cpufreq_userspace.c
View file @
33ab1d91
...
...
@@ -2,7 +2,7 @@
* linux/drivers/cpufreq/cpufreq_userspace.c
*
* Copyright (C) 2001 Russell King
* (C) 2002 - 200
3
Dominik Brodowski <linux@brodo.de>
* (C) 2002 - 200
4
Dominik Brodowski <linux@brodo.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
...
...
@@ -112,7 +112,14 @@ int cpufreq_set(unsigned int freq, unsigned int cpu)
if
(
freq
>
cpu_max_freq
[
cpu
])
freq
=
cpu_max_freq
[
cpu
];
ret
=
cpufreq_driver_target
(
&
current_policy
[
cpu
],
freq
,
/*
* We're safe from concurrent calls to ->target() here
* as we hold the userspace_sem lock. If we were calling
* cpufreq_driver_target, a deadlock situation might occur:
* A: cpufreq_set (lock userspace_sem) -> cpufreq_driver_target(lock policy->lock)
* B: cpufreq_set_policy(lock policy->lock) -> __cpufreq_governor -> cpufreq_governor_userspace (lock userspace_sem)
*/
ret
=
__cpufreq_driver_target
(
&
current_policy
[
cpu
],
freq
,
CPUFREQ_RELATION_L
);
err:
...
...
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