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
nexedi
linux
Commits
17d5007f
Commit
17d5007f
authored
Apr 21, 2004
by
Linus Torvalds
Browse files
Options
Browse Files
Download
Plain Diff
Merge
bk://linux-dj.bkbits.net/cpufreq
into ppc970.osdl.org:/home/torvalds/v2.6/linux
parents
4918451f
ad4c196a
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
302 additions
and
57 deletions
+302
-57
arch/i386/kernel/cpu/cpufreq/acpi.c
arch/i386/kernel/cpu/cpufreq/acpi.c
+39
-6
arch/i386/kernel/cpu/cpufreq/powernow-k7.c
arch/i386/kernel/cpu/cpufreq/powernow-k7.c
+232
-25
arch/i386/kernel/cpu/cpufreq/powernow-k8.c
arch/i386/kernel/cpu/cpufreq/powernow-k8.c
+3
-3
arch/i386/kernel/cpu/cpufreq/powernow-k8.h
arch/i386/kernel/cpu/cpufreq/powernow-k8.h
+1
-1
arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c
arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c
+16
-15
drivers/cpufreq/cpufreq.c
drivers/cpufreq/cpufreq.c
+8
-4
drivers/cpufreq/cpufreq_userspace.c
drivers/cpufreq/cpufreq_userspace.c
+3
-3
No files found.
arch/i386/kernel/cpu/cpufreq/acpi.c
View file @
17d5007f
...
@@ -238,6 +238,34 @@ acpi_cpufreq_verify (
...
@@ -238,6 +238,34 @@ acpi_cpufreq_verify (
}
}
static
unsigned
long
acpi_cpufreq_guess_freq
(
struct
cpufreq_acpi_io
*
data
,
unsigned
int
cpu
)
{
if
(
cpu_khz
)
{
/* search the closest match to cpu_khz */
unsigned
int
i
;
unsigned
long
freq
;
unsigned
long
freqn
=
data
->
acpi_data
.
states
[
0
].
core_frequency
*
1000
;
for
(
i
=
0
;
i
<
(
data
->
acpi_data
.
state_count
-
1
);
i
++
)
{
freq
=
freqn
;
freqn
=
data
->
acpi_data
.
states
[
i
+
1
].
core_frequency
*
1000
;
if
((
2
*
cpu_khz
)
>
(
freqn
+
freq
))
{
data
->
acpi_data
.
state
=
i
;
return
(
freq
);
}
}
data
->
acpi_data
.
state
=
data
->
acpi_data
.
state_count
-
1
;
return
(
freqn
);
}
else
/* assume CPU is at P0... */
data
->
acpi_data
.
state
=
0
;
return
data
->
acpi_data
.
states
[
0
].
core_frequency
*
1000
;
}
static
int
static
int
acpi_cpufreq_cpu_init
(
acpi_cpufreq_cpu_init
(
struct
cpufreq_policy
*
policy
)
struct
cpufreq_policy
*
policy
)
...
@@ -290,11 +318,8 @@ acpi_cpufreq_cpu_init (
...
@@ -290,11 +318,8 @@ acpi_cpufreq_cpu_init (
}
}
policy
->
governor
=
CPUFREQ_DEFAULT_GOVERNOR
;
policy
->
governor
=
CPUFREQ_DEFAULT_GOVERNOR
;
/*
/* The current speed is unknown and not detectable by ACPI... */
* The current speed is unknown and not detectable by ACPI... argh! Assume
policy
->
cur
=
acpi_cpufreq_guess_freq
(
data
,
policy
->
cpu
);
* it's P0, it will be set to this value later during initialization.
*/
policy
->
cur
=
data
->
acpi_data
.
states
[
0
].
core_frequency
*
1000
;
/* table init */
/* table init */
for
(
i
=
0
;
i
<=
data
->
acpi_data
.
state_count
;
i
++
)
for
(
i
=
0
;
i
<=
data
->
acpi_data
.
state_count
;
i
++
)
...
@@ -306,7 +331,7 @@ acpi_cpufreq_cpu_init (
...
@@ -306,7 +331,7 @@ acpi_cpufreq_cpu_init (
data
->
freq_table
[
i
].
frequency
=
CPUFREQ_TABLE_END
;
data
->
freq_table
[
i
].
frequency
=
CPUFREQ_TABLE_END
;
}
}
result
=
cpufreq_frequency_table_cpuinfo
(
policy
,
&
data
->
freq_table
[
0
]
);
result
=
cpufreq_frequency_table_cpuinfo
(
policy
,
data
->
freq_table
);
if
(
result
)
{
if
(
result
)
{
goto
err_freqfree
;
goto
err_freqfree
;
}
}
...
@@ -321,6 +346,7 @@ acpi_cpufreq_cpu_init (
...
@@ -321,6 +346,7 @@ acpi_cpufreq_cpu_init (
(
u32
)
data
->
acpi_data
.
states
[
i
].
power
,
(
u32
)
data
->
acpi_data
.
states
[
i
].
power
,
(
u32
)
data
->
acpi_data
.
states
[
i
].
transition_latency
);
(
u32
)
data
->
acpi_data
.
states
[
i
].
transition_latency
);
cpufreq_frequency_table_get_attr
(
data
->
freq_table
,
policy
->
cpu
);
return_VALUE
(
result
);
return_VALUE
(
result
);
err_freqfree:
err_freqfree:
...
@@ -345,6 +371,7 @@ acpi_cpufreq_cpu_exit (
...
@@ -345,6 +371,7 @@ acpi_cpufreq_cpu_exit (
ACPI_FUNCTION_TRACE
(
"acpi_cpufreq_cpu_exit"
);
ACPI_FUNCTION_TRACE
(
"acpi_cpufreq_cpu_exit"
);
if
(
data
)
{
if
(
data
)
{
cpufreq_frequency_table_put_attr
(
policy
->
cpu
);
acpi_io_data
[
policy
->
cpu
]
=
NULL
;
acpi_io_data
[
policy
->
cpu
]
=
NULL
;
acpi_processor_unregister_performance
(
&
data
->
acpi_data
,
policy
->
cpu
);
acpi_processor_unregister_performance
(
&
data
->
acpi_data
,
policy
->
cpu
);
kfree
(
data
);
kfree
(
data
);
...
@@ -354,6 +381,11 @@ acpi_cpufreq_cpu_exit (
...
@@ -354,6 +381,11 @@ acpi_cpufreq_cpu_exit (
}
}
static
struct
freq_attr
*
acpi_cpufreq_attr
[]
=
{
&
cpufreq_freq_attr_scaling_available_freqs
,
NULL
,
};
static
struct
cpufreq_driver
acpi_cpufreq_driver
=
{
static
struct
cpufreq_driver
acpi_cpufreq_driver
=
{
.
verify
=
acpi_cpufreq_verify
,
.
verify
=
acpi_cpufreq_verify
,
.
target
=
acpi_cpufreq_target
,
.
target
=
acpi_cpufreq_target
,
...
@@ -361,6 +393,7 @@ static struct cpufreq_driver acpi_cpufreq_driver = {
...
@@ -361,6 +393,7 @@ static struct cpufreq_driver acpi_cpufreq_driver = {
.
exit
=
acpi_cpufreq_cpu_exit
,
.
exit
=
acpi_cpufreq_cpu_exit
,
.
name
=
"acpi-cpufreq"
,
.
name
=
"acpi-cpufreq"
,
.
owner
=
THIS_MODULE
,
.
owner
=
THIS_MODULE
,
.
attr
=
acpi_cpufreq_attr
,
};
};
...
...
arch/i386/kernel/cpu/cpufreq/powernow-k7.c
View file @
17d5007f
This diff is collapsed.
Click to expand it.
arch/i386/kernel/cpu/cpufreq/powernow-k8.c
View file @
17d5007f
...
@@ -32,7 +32,7 @@
...
@@ -32,7 +32,7 @@
#include <asm/io.h>
#include <asm/io.h>
#include <asm/delay.h>
#include <asm/delay.h>
#ifdef CONFIG_
X86_POWERNOW_K8_ACPI
#ifdef CONFIG_
ACPI_PROCESSOR
#include <linux/acpi.h>
#include <linux/acpi.h>
#include <acpi/processor.h>
#include <acpi/processor.h>
#endif
#endif
...
@@ -269,7 +269,7 @@ static int core_voltage_pre_transition(struct powernow_k8_data *data, u32 reqvid
...
@@ -269,7 +269,7 @@ static int core_voltage_pre_transition(struct powernow_k8_data *data, u32 reqvid
dprintk
(
KERN_DEBUG
PFX
dprintk
(
KERN_DEBUG
PFX
"ph1 (cpu%d): start, currfid 0x%x, currvid 0x%x, reqvid 0x%x, rvo 0x%x
\n
"
,
"ph1 (cpu%d): start, currfid 0x%x, currvid 0x%x, reqvid 0x%x, rvo 0x%x
\n
"
,
smp_processor_id
()
;
smp_processor_id
()
,
data
->
currfid
,
data
->
currvid
,
reqvid
,
data
->
rvo
);
data
->
currfid
,
data
->
currvid
,
reqvid
,
data
->
rvo
);
while
(
data
->
currvid
>
reqvid
)
{
while
(
data
->
currvid
>
reqvid
)
{
...
@@ -666,7 +666,7 @@ static int find_psb_table(struct powernow_k8_data *data)
...
@@ -666,7 +666,7 @@ static int find_psb_table(struct powernow_k8_data *data)
return
-
ENODEV
;
return
-
ENODEV
;
}
}
#ifdef CONFIG_
X86_POWERNOW_K8_ACPI
#ifdef CONFIG_
ACPI_PROCESSOR
static
void
powernow_k8_acpi_pst_values
(
struct
powernow_k8_data
*
data
,
unsigned
int
index
)
static
void
powernow_k8_acpi_pst_values
(
struct
powernow_k8_data
*
data
,
unsigned
int
index
)
{
{
if
(
!
data
->
acpi_data
.
state_count
)
if
(
!
data
->
acpi_data
.
state_count
)
...
...
arch/i386/kernel/cpu/cpufreq/powernow-k8.h
View file @
17d5007f
...
@@ -29,7 +29,7 @@ struct powernow_k8_data {
...
@@ -29,7 +29,7 @@ struct powernow_k8_data {
* frequency is in kHz */
* frequency is in kHz */
struct
cpufreq_frequency_table
*
powernow_table
;
struct
cpufreq_frequency_table
*
powernow_table
;
#ifdef CONFIG_
X86_POWERNOW_K8_ACPI
#ifdef CONFIG_
ACPI_PROCESSOR
/* the acpi table needs to be kept. it's only available if ACPI was
/* the acpi table needs to be kept. it's only available if ACPI was
* used to determine valid frequency/vid/fid states */
* used to determine valid frequency/vid/fid states */
struct
acpi_processor_performance
acpi_data
;
struct
acpi_processor_performance
acpi_data
;
...
...
arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c
View file @
17d5007f
...
@@ -195,21 +195,6 @@ static int centrino_cpu_init_table(struct cpufreq_policy *policy)
...
@@ -195,21 +195,6 @@ static int centrino_cpu_init_table(struct cpufreq_policy *policy)
struct
cpuinfo_x86
*
cpu
=
&
cpu_data
[
policy
->
cpu
];
struct
cpuinfo_x86
*
cpu
=
&
cpu_data
[
policy
->
cpu
];
struct
cpu_model
*
model
;
struct
cpu_model
*
model
;
if
(
!
cpu_has
(
cpu
,
X86_FEATURE_EST
))
return
-
ENODEV
;
/* Only Intel Pentium M stepping 5 for now - add new CPUs as
they appear after making sure they use PERF_CTL in the same
way. */
if
(
cpu
->
x86_vendor
!=
X86_VENDOR_INTEL
||
cpu
->
x86
!=
6
||
cpu
->
x86_model
!=
9
||
cpu
->
x86_mask
!=
5
)
{
printk
(
KERN_INFO
PFX
"found unsupported CPU with Enhanced SpeedStep: "
"send /proc/cpuinfo to "
MAINTAINER
"
\n
"
);
return
-
ENODEV
;
}
for
(
model
=
models
;
model
->
model_name
!=
NULL
;
model
++
)
for
(
model
=
models
;
model
->
model_name
!=
NULL
;
model
++
)
if
(
strcmp
(
cpu
->
x86_model_id
,
model
->
model_name
)
==
0
)
if
(
strcmp
(
cpu
->
x86_model_id
,
model
->
model_name
)
==
0
)
break
;
break
;
...
@@ -361,6 +346,7 @@ static inline int centrino_cpu_init_acpi(struct cpufreq_policy *policy) { return
...
@@ -361,6 +346,7 @@ static inline int centrino_cpu_init_acpi(struct cpufreq_policy *policy) { return
static
int
centrino_cpu_init
(
struct
cpufreq_policy
*
policy
)
static
int
centrino_cpu_init
(
struct
cpufreq_policy
*
policy
)
{
{
struct
cpuinfo_x86
*
cpu
=
&
cpu_data
[
policy
->
cpu
];
unsigned
freq
;
unsigned
freq
;
unsigned
l
,
h
;
unsigned
l
,
h
;
int
ret
;
int
ret
;
...
@@ -368,6 +354,21 @@ static int centrino_cpu_init(struct cpufreq_policy *policy)
...
@@ -368,6 +354,21 @@ static int centrino_cpu_init(struct cpufreq_policy *policy)
if
(
policy
->
cpu
!=
0
)
if
(
policy
->
cpu
!=
0
)
return
-
ENODEV
;
return
-
ENODEV
;
if
(
!
cpu_has
(
cpu
,
X86_FEATURE_EST
))
return
-
ENODEV
;
/* Only Intel Pentium M stepping 5 for now - add new CPUs as
they appear after making sure they use PERF_CTL in the same
way. */
if
(
cpu
->
x86_vendor
!=
X86_VENDOR_INTEL
||
cpu
->
x86
!=
6
||
cpu
->
x86_model
!=
9
||
cpu
->
x86_mask
!=
5
)
{
printk
(
KERN_INFO
PFX
"found unsupported CPU with Enhanced SpeedStep: "
"send /proc/cpuinfo to "
MAINTAINER
"
\n
"
);
return
-
ENODEV
;
}
if
(
centrino_cpu_init_acpi
(
policy
))
{
if
(
centrino_cpu_init_acpi
(
policy
))
{
if
(
centrino_cpu_init_table
(
policy
))
{
if
(
centrino_cpu_init_table
(
policy
))
{
return
-
ENODEV
;
return
-
ENODEV
;
...
...
drivers/cpufreq/cpufreq.c
View file @
17d5007f
...
@@ -360,8 +360,10 @@ static int cpufreq_add_dev (struct sys_device * sys_dev)
...
@@ -360,8 +360,10 @@ static int cpufreq_add_dev (struct sys_device * sys_dev)
return
-
EINVAL
;
return
-
EINVAL
;
policy
=
kmalloc
(
sizeof
(
struct
cpufreq_policy
),
GFP_KERNEL
);
policy
=
kmalloc
(
sizeof
(
struct
cpufreq_policy
),
GFP_KERNEL
);
if
(
!
policy
)
if
(
!
policy
)
{
return
-
ENOMEM
;
ret
=
-
ENOMEM
;
goto
nomem_out
;
}
memset
(
policy
,
0
,
sizeof
(
struct
cpufreq_policy
));
memset
(
policy
,
0
,
sizeof
(
struct
cpufreq_policy
));
policy
->
cpu
=
cpu
;
policy
->
cpu
=
cpu
;
...
@@ -410,7 +412,7 @@ static int cpufreq_add_dev (struct sys_device * sys_dev)
...
@@ -410,7 +412,7 @@ static int cpufreq_add_dev (struct sys_device * sys_dev)
return
0
;
return
0
;
err_out_unregister:
err_out_unregister:
spin_lock_irqsave
(
&
cpufreq_driver_lock
,
flags
);
spin_lock_irqsave
(
&
cpufreq_driver_lock
,
flags
);
cpufreq_cpu_data
[
cpu
]
=
NULL
;
cpufreq_cpu_data
[
cpu
]
=
NULL
;
spin_unlock_irqrestore
(
&
cpufreq_driver_lock
,
flags
);
spin_unlock_irqrestore
(
&
cpufreq_driver_lock
,
flags
);
...
@@ -418,8 +420,10 @@ static int cpufreq_add_dev (struct sys_device * sys_dev)
...
@@ -418,8 +420,10 @@ static int cpufreq_add_dev (struct sys_device * sys_dev)
kobject_unregister
(
&
policy
->
kobj
);
kobject_unregister
(
&
policy
->
kobj
);
wait_for_completion
(
&
policy
->
kobj_unregister
);
wait_for_completion
(
&
policy
->
kobj_unregister
);
err_out:
err_out:
kfree
(
policy
);
kfree
(
policy
);
nomem_out:
module_put
(
cpufreq_driver
->
owner
);
module_put
(
cpufreq_driver
->
owner
);
return
ret
;
return
ret
;
}
}
...
...
drivers/cpufreq/cpufreq_userspace.c
View file @
17d5007f
...
@@ -167,8 +167,8 @@ cpufreq_procctl(ctl_table *ctl, int write, struct file *filp,
...
@@ -167,8 +167,8 @@ cpufreq_procctl(ctl_table *ctl, int write, struct file *filp,
void
__user
*
buffer
,
size_t
*
lenp
)
void
__user
*
buffer
,
size_t
*
lenp
)
{
{
char
buf
[
16
],
*
p
;
char
buf
[
16
],
*
p
;
int
cpu
=
(
int
)
ctl
->
extra1
;
int
cpu
=
(
long
)
ctl
->
extra1
;
int
len
,
left
=
*
lenp
;
unsigned
int
len
,
left
=
*
lenp
;
if
(
!
left
||
(
filp
->
f_pos
&&
!
write
)
||
!
cpu_online
(
cpu
))
{
if
(
!
left
||
(
filp
->
f_pos
&&
!
write
)
||
!
cpu_online
(
cpu
))
{
*
lenp
=
0
;
*
lenp
=
0
;
...
@@ -205,7 +205,7 @@ cpufreq_sysctl(ctl_table *table, int __user *name, int nlen,
...
@@ -205,7 +205,7 @@ cpufreq_sysctl(ctl_table *table, int __user *name, int nlen,
void
__user
*
oldval
,
size_t
__user
*
oldlenp
,
void
__user
*
oldval
,
size_t
__user
*
oldlenp
,
void
__user
*
newval
,
size_t
newlen
,
void
**
context
)
void
__user
*
newval
,
size_t
newlen
,
void
**
context
)
{
{
int
cpu
=
(
int
)
table
->
extra1
;
int
cpu
=
(
long
)
table
->
extra1
;
if
(
!
cpu_online
(
cpu
))
if
(
!
cpu_online
(
cpu
))
return
-
EINVAL
;
return
-
EINVAL
;
...
...
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