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
057ea4e1
Commit
057ea4e1
authored
Sep 13, 2003
by
Dave Jones
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[CPUFREQ] CodingStyle fixes for speedstep-smi
parent
5f27f461
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
49 deletions
+49
-49
arch/i386/kernel/cpu/cpufreq/speedstep-smi.c
arch/i386/kernel/cpu/cpufreq/speedstep-smi.c
+49
-49
No files found.
arch/i386/kernel/cpu/cpufreq/speedstep-smi.c
View file @
057ea4e1
...
@@ -65,43 +65,45 @@ static struct cpufreq_frequency_table speedstep_freqs[] = {
...
@@ -65,43 +65,45 @@ static struct cpufreq_frequency_table speedstep_freqs[] = {
*/
*/
static
int
speedstep_smi_ownership
(
void
)
static
int
speedstep_smi_ownership
(
void
)
{
{
u32
command
,
result
,
magic
;
u32
command
,
result
,
magic
;
u32
function
=
GET_SPEEDSTEP_OWNER
;
u32
function
=
GET_SPEEDSTEP_OWNER
;
unsigned
char
magic_data
[]
=
"Copyright (c) 1999 Intel Corporation"
;
unsigned
char
magic_data
[]
=
"Copyright (c) 1999 Intel Corporation"
;
command
=
(
smi_sig
&
0xffffff00
)
|
(
smi_cmd
&
0xff
);
command
=
(
smi_sig
&
0xffffff00
)
|
(
smi_cmd
&
0xff
);
magic
=
virt_to_phys
(
magic_data
);
magic
=
virt_to_phys
(
magic_data
);
__asm__
__volatile__
(
__asm__
__volatile__
(
"out %%al, (%%dx)
\n
"
"out %%al, (%%dx)
\n
"
:
"=D"
(
result
)
:
"=D"
(
result
)
:
"a"
(
command
),
"b"
(
function
),
"c"
(
0
),
"d"
(
smi_port
),
"D"
(
0
),
"S"
(
magic
)
:
"a"
(
command
),
"b"
(
function
),
"c"
(
0
),
"d"
(
smi_port
),
"D"
(
0
),
"S"
(
magic
)
);
);
return
result
;
return
result
;
}
}
/**
/**
* speedstep_smi_get_freqs - get SpeedStep preferred & current freq.
* speedstep_smi_get_freqs - get SpeedStep preferred & current freq.
*
*
*/
*/
static
int
speedstep_smi_get_freqs
(
unsigned
int
*
low
,
unsigned
int
*
high
)
static
int
speedstep_smi_get_freqs
(
unsigned
int
*
low
,
unsigned
int
*
high
)
{
{
u32
command
,
result
,
edi
,
high_mhz
,
low_mhz
;
u32
command
,
result
,
edi
,
high_mhz
,
low_mhz
;
u32
state
=
0
;
u32
state
=
0
;
u32
function
=
GET_SPEEDSTEP_FREQS
;
u32
function
=
GET_SPEEDSTEP_FREQS
;
command
=
(
smi_sig
&
0xffffff00
)
|
(
smi_cmd
&
0xff
);
command
=
(
smi_sig
&
0xffffff00
)
|
(
smi_cmd
&
0xff
);
__asm__
__volatile__
(
"movl $0, %%edi
\n
"
__asm__
__volatile__
(
"movl $0, %%edi
\n
"
"out %%al, (%%dx)
\n
"
"out %%al, (%%dx)
\n
"
:
"=a"
(
result
),
"=b"
(
high_mhz
),
"=c"
(
low_mhz
),
"=d"
(
state
),
"=D"
(
edi
)
:
"=a"
(
result
),
"=b"
(
high_mhz
),
"=c"
(
low_mhz
),
"=d"
(
state
),
"=D"
(
edi
)
:
"a"
(
command
),
"b"
(
function
),
"c"
(
state
),
"d"
(
smi_port
),
"S"
(
0
)
:
"a"
(
command
),
"b"
(
function
),
"c"
(
state
),
"d"
(
smi_port
),
"S"
(
0
)
);
);
*
high
=
high_mhz
*
1000
;
*
high
=
high_mhz
*
1000
;
*
low
=
low_mhz
*
1000
;
*
low
=
low_mhz
*
1000
;
return
result
;
return
result
;
}
}
/**
/**
* speedstep_get_state - set the SpeedStep state
* speedstep_get_state - set the SpeedStep state
* @state: processor frequency state (SPEEDSTEP_LOW or SPEEDSTEP_HIGH)
* @state: processor frequency state (SPEEDSTEP_LOW or SPEEDSTEP_HIGH)
...
@@ -109,17 +111,17 @@ static int speedstep_smi_get_freqs (unsigned int *low, unsigned int *high)
...
@@ -109,17 +111,17 @@ static int speedstep_smi_get_freqs (unsigned int *low, unsigned int *high)
*/
*/
static
int
speedstep_get_state
(
void
)
static
int
speedstep_get_state
(
void
)
{
{
u32
function
=
GET_SPEEDSTEP_STATE
;
u32
function
=
GET_SPEEDSTEP_STATE
;
u32
result
,
state
,
edi
,
command
;
u32
result
,
state
,
edi
,
command
;
command
=
(
smi_sig
&
0xffffff00
)
|
(
smi_cmd
&
0xff
);
command
=
(
smi_sig
&
0xffffff00
)
|
(
smi_cmd
&
0xff
);
__asm__
__volatile__
(
"movl $0, %%edi
\n
"
"out %%al, (%%dx)
\n
"
:
"=a"
(
result
),
"=b"
(
state
),
"=D"
(
edi
)
:
"a"
(
command
),
"b"
(
function
),
"c"
(
0
),
"d"
(
smi_port
),
"S"
(
0
)
);
__asm__
__volatile__
(
"movl $0, %%edi
\n
"
"out %%al, (%%dx)
\n
"
:
"=a"
(
result
),
"=b"
(
state
),
"=D"
(
edi
)
:
"a"
(
command
),
"b"
(
function
),
"c"
(
0
),
"d"
(
smi_port
),
"S"
(
0
)
);
return
state
;
return
state
;
}
}
...
@@ -130,10 +132,10 @@ static int speedstep_get_state (void)
...
@@ -130,10 +132,10 @@ static int speedstep_get_state (void)
*/
*/
static
void
speedstep_set_state
(
unsigned
int
state
,
unsigned
int
notify
)
static
void
speedstep_set_state
(
unsigned
int
state
,
unsigned
int
notify
)
{
{
unsigned
int
old_state
,
result
,
command
,
new_state
;
unsigned
int
old_state
,
result
,
command
,
new_state
;
unsigned
long
flags
;
unsigned
long
flags
;
struct
cpufreq_freqs
freqs
;
struct
cpufreq_freqs
freqs
;
unsigned
int
function
=
SET_SPEEDSTEP_STATE
;
unsigned
int
function
=
SET_SPEEDSTEP_STATE
;
if
(
state
>
0x1
)
if
(
state
>
0x1
)
return
;
return
;
...
@@ -142,7 +144,7 @@ static void speedstep_set_state (unsigned int state, unsigned int notify)
...
@@ -142,7 +144,7 @@ static void speedstep_set_state (unsigned int state, unsigned int notify)
freqs
.
old
=
speedstep_freqs
[
old_state
].
frequency
;
freqs
.
old
=
speedstep_freqs
[
old_state
].
frequency
;
freqs
.
new
=
speedstep_freqs
[
state
].
frequency
;
freqs
.
new
=
speedstep_freqs
[
state
].
frequency
;
freqs
.
cpu
=
0
;
/* speedstep.c is UP only driver */
freqs
.
cpu
=
0
;
/* speedstep.c is UP only driver */
if
(
old_state
==
state
)
if
(
old_state
==
state
)
return
;
return
;
...
@@ -152,13 +154,13 @@ static void speedstep_set_state (unsigned int state, unsigned int notify)
...
@@ -152,13 +154,13 @@ static void speedstep_set_state (unsigned int state, unsigned int notify)
/* Disable IRQs */
/* Disable IRQs */
local_irq_save
(
flags
);
local_irq_save
(
flags
);
command
=
(
smi_sig
&
0xffffff00
)
|
(
smi_cmd
&
0xff
);
command
=
(
smi_sig
&
0xffffff00
)
|
(
smi_cmd
&
0xff
);
__asm__
__volatile__
(
__asm__
__volatile__
(
"movl $0, %%edi
\n
"
"movl $0, %%edi
\n
"
"out %%al, (%%dx)
\n
"
"out %%al, (%%dx)
\n
"
:
"=b"
(
new_state
),
"=D"
(
result
)
:
"=b"
(
new_state
),
"=D"
(
result
)
:
"a"
(
command
),
"b"
(
function
),
"c"
(
state
),
"d"
(
smi_port
),
"S"
(
0
)
:
"a"
(
command
),
"b"
(
function
),
"c"
(
state
),
"d"
(
smi_port
),
"S"
(
0
)
);
);
/* enable IRQs */
/* enable IRQs */
local_irq_restore
(
flags
);
local_irq_restore
(
flags
);
...
@@ -185,10 +187,9 @@ static void speedstep_set_state (unsigned int state, unsigned int notify)
...
@@ -185,10 +187,9 @@ static void speedstep_set_state (unsigned int state, unsigned int notify)
* Sets a new CPUFreq policy/freq.
* Sets a new CPUFreq policy/freq.
*/
*/
static
int
speedstep_target
(
struct
cpufreq_policy
*
policy
,
static
int
speedstep_target
(
struct
cpufreq_policy
*
policy
,
unsigned
int
target_freq
,
unsigned
int
target_freq
,
unsigned
int
relation
)
unsigned
int
relation
)
{
{
unsigned
int
newstate
=
0
;
unsigned
int
newstate
=
0
;
if
(
cpufreq_frequency_table_target
(
policy
,
&
speedstep_freqs
[
0
],
target_freq
,
relation
,
&
newstate
))
if
(
cpufreq_frequency_table_target
(
policy
,
&
speedstep_freqs
[
0
],
target_freq
,
relation
,
&
newstate
))
return
-
EINVAL
;
return
-
EINVAL
;
...
@@ -214,8 +215,8 @@ static int speedstep_verify (struct cpufreq_policy *policy)
...
@@ -214,8 +215,8 @@ static int speedstep_verify (struct cpufreq_policy *policy)
static
int
speedstep_cpu_init
(
struct
cpufreq_policy
*
policy
)
static
int
speedstep_cpu_init
(
struct
cpufreq_policy
*
policy
)
{
{
int
result
;
int
result
;
unsigned
int
speed
,
state
;
unsigned
int
speed
,
state
;
/* capability check */
/* capability check */
if
(
policy
->
cpu
!=
0
)
if
(
policy
->
cpu
!=
0
)
...
@@ -228,7 +229,7 @@ static int speedstep_cpu_init(struct cpufreq_policy *policy)
...
@@ -228,7 +229,7 @@ static int speedstep_cpu_init(struct cpufreq_policy *policy)
/* detect low and high frequency */
/* detect low and high frequency */
result
=
speedstep_smi_get_freqs
(
&
speedstep_freqs
[
SPEEDSTEP_LOW
].
frequency
,
result
=
speedstep_smi_get_freqs
(
&
speedstep_freqs
[
SPEEDSTEP_LOW
].
frequency
,
&
speedstep_freqs
[
SPEEDSTEP_HIGH
].
frequency
);
&
speedstep_freqs
[
SPEEDSTEP_HIGH
].
frequency
);
if
(
result
)
{
if
(
result
)
{
/* fall back to speedstep_lib.c dection mechanism: try both states out */
/* fall back to speedstep_lib.c dection mechanism: try both states out */
unsigned
int
speedstep_processor
=
speedstep_detect_processor
();
unsigned
int
speedstep_processor
=
speedstep_detect_processor
();
...
@@ -238,9 +239,9 @@ static int speedstep_cpu_init(struct cpufreq_policy *policy)
...
@@ -238,9 +239,9 @@ static int speedstep_cpu_init(struct cpufreq_policy *policy)
return
-
ENODEV
;
return
-
ENODEV
;
result
=
speedstep_get_freqs
(
speedstep_processor
,
result
=
speedstep_get_freqs
(
speedstep_processor
,
&
speedstep_freqs
[
SPEEDSTEP_LOW
].
frequency
,
&
speedstep_freqs
[
SPEEDSTEP_LOW
].
frequency
,
&
speedstep_freqs
[
SPEEDSTEP_HIGH
].
frequency
,
&
speedstep_freqs
[
SPEEDSTEP_HIGH
].
frequency
,
&
speedstep_set_state
);
&
speedstep_set_state
);
if
(
result
)
{
if
(
result
)
{
dprintk
(
KERN_INFO
"speedstep-smi: could not detect two different speeds -- aborting.
\n
"
);
dprintk
(
KERN_INFO
"speedstep-smi: could not detect two different speeds -- aborting.
\n
"
);
...
@@ -294,7 +295,6 @@ static struct cpufreq_driver speedstep_driver = {
...
@@ -294,7 +295,6 @@ static struct cpufreq_driver speedstep_driver = {
*/
*/
static
int
__init
speedstep_init
(
void
)
static
int
__init
speedstep_init
(
void
)
{
{
dprintk
(
"speedstep-smi: signature:0%.8lx, command:0lx%.8lx, event:0x%.8lx, perf_level:0x%.8lx.
\n
"
,
dprintk
(
"speedstep-smi: signature:0%.8lx, command:0lx%.8lx, event:0x%.8lx, perf_level:0x%.8lx.
\n
"
,
ist_info
.
signature
,
ist_info
.
command
,
ist_info
.
event
,
ist_info
.
perf_level
);
ist_info
.
signature
,
ist_info
.
command
,
ist_info
.
event
,
ist_info
.
perf_level
);
...
...
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