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
27e45c6a
Commit
27e45c6a
authored
Feb 10, 2004
by
Dave Jones
Committed by
Dave Jones
Feb 10, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[CPUFREQ] powernow-k8 printk cleanups from Pavel.
parent
e9e4f3bb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
50 deletions
+38
-50
arch/i386/kernel/cpu/cpufreq/powernow-k8.c
arch/i386/kernel/cpu/cpufreq/powernow-k8.c
+38
-50
No files found.
arch/i386/kernel/cpu/cpufreq/powernow-k8.c
View file @
27e45c6a
...
@@ -31,7 +31,7 @@
...
@@ -31,7 +31,7 @@
#define PFX "powernow-k8: "
#define PFX "powernow-k8: "
#define BFX PFX "BIOS error: "
#define BFX PFX "BIOS error: "
#define VERSION "version 1.00.08
- September 26, 2003
"
#define VERSION "version 1.00.08
a
"
#include "powernow-k8.h"
#include "powernow-k8.h"
#ifdef CONFIG_PREEMPT
#ifdef CONFIG_PREEMPT
...
@@ -90,25 +90,27 @@ convert_fid_to_vco_fid(u32 fid)
...
@@ -90,25 +90,27 @@ convert_fid_to_vco_fid(u32 fid)
}
}
}
}
/* Return 1 if the pending bit is set. Unless we are actually just told the */
/*
/* processor to transition a state, seeing this bit set is really bad news. */
* Return 1 if the pending bit is set. Unless we are actually just told the
* processor to transition a state, seeing this bit set is really bad news.
*/
static
inline
int
static
inline
int
pending_bit_stuck
(
void
)
pending_bit_stuck
(
void
)
{
{
u32
lo
;
u32
lo
,
hi
;
u32
hi
;
rdmsr
(
MSR_FIDVID_STATUS
,
lo
,
hi
);
rdmsr
(
MSR_FIDVID_STATUS
,
lo
,
hi
);
return
lo
&
MSR_S_LO_CHANGE_PENDING
?
1
:
0
;
return
lo
&
MSR_S_LO_CHANGE_PENDING
?
1
:
0
;
}
}
/* Update the global current fid / vid values from the status msr. Returns 1 */
/*
/* on error. */
* Update the global current fid / vid values from the status msr. Returns 1
* on error.
*/
static
int
static
int
query_current_values_with_pending_wait
(
void
)
query_current_values_with_pending_wait
(
void
)
{
{
u32
lo
;
u32
lo
,
hi
;
u32
hi
;
u32
i
=
0
;
u32
i
=
0
;
lo
=
MSR_S_LO_CHANGE_PENDING
;
lo
=
MSR_S_LO_CHANGE_PENDING
;
...
@@ -223,9 +225,11 @@ write_new_vid(u32 vid)
...
@@ -223,9 +225,11 @@ write_new_vid(u32 vid)
return
0
;
return
0
;
}
}
/* Reduce the vid by the max of step or reqvid. */
/*
/* Decreasing vid codes represent increasing voltages : */
* Reduce the vid by the max of step or reqvid.
/* vid of 0 is 1.550V, vid of 0x1e is 0.800V, vid of 0x1f is off. */
* Decreasing vid codes represent increasing voltages:
* vid of 0 is 1.550V, vid of 0x1e is 0.800V, vid of 0x1f is off.
*/
static
int
static
int
decrease_vid_code_by_step
(
u32
reqvid
,
u32
step
)
decrease_vid_code_by_step
(
u32
reqvid
,
u32
step
)
{
{
...
@@ -268,8 +272,10 @@ transition_fid_vid(u32 reqfid, u32 reqvid)
...
@@ -268,8 +272,10 @@ transition_fid_vid(u32 reqfid, u32 reqvid)
return
0
;
return
0
;
}
}
/* Phase 1 - core voltage transition ... setup appropriate voltage for the */
/*
/* fid transition. */
* Phase 1 - core voltage transition ... setup appropriate voltage for the
* fid transition.
*/
static
inline
int
static
inline
int
core_voltage_pre_transition
(
u32
reqvid
)
core_voltage_pre_transition
(
u32
reqvid
)
{
{
...
@@ -452,7 +458,9 @@ check_supported_cpu(void)
...
@@ -452,7 +458,9 @@ check_supported_cpu(void)
}
}
if
(
c
->
x86_vendor
!=
X86_VENDOR_AMD
)
{
if
(
c
->
x86_vendor
!=
X86_VENDOR_AMD
)
{
#ifdef MODULE
printk
(
KERN_INFO
PFX
"Not an AMD processor
\n
"
);
printk
(
KERN_INFO
PFX
"Not an AMD processor
\n
"
);
#endif
return
0
;
return
0
;
}
}
...
@@ -485,9 +493,7 @@ check_supported_cpu(void)
...
@@ -485,9 +493,7 @@ check_supported_cpu(void)
return
0
;
return
0
;
}
}
printk
(
KERN_INFO
PFX
"Found AMD Athlon 64 / Opteron processor "
printk
(
KERN_INFO
PFX
"Found AMD64 processor supporting PowerNow ("
VERSION
")
\n
"
);
"supporting p-state transitions
\n
"
);
return
1
;
return
1
;
}
}
...
@@ -566,33 +572,19 @@ find_psb_table(void)
...
@@ -566,33 +572,19 @@ find_psb_table(void)
}
}
vstable
=
psb
->
voltagestabilizationtime
;
vstable
=
psb
->
voltagestabilizationtime
;
printk
(
KERN_INFO
PFX
"voltage stable time: %d (units 20us)
\n
"
,
vstable
);
dprintk
(
KERN_DEBUG
PFX
"flags2: 0x%x
\n
"
,
psb
->
flags2
);
dprintk
(
KERN_DEBUG
PFX
"flags2: 0x%x
\n
"
,
psb
->
flags2
);
rvo
=
psb
->
flags2
&
3
;
rvo
=
psb
->
flags2
&
3
;
irt
=
((
psb
->
flags2
)
>>
2
)
&
3
;
irt
=
((
psb
->
flags2
)
>>
2
)
&
3
;
mvs
=
((
psb
->
flags2
)
>>
4
)
&
3
;
mvs
=
((
psb
->
flags2
)
>>
4
)
&
3
;
vidmvs
=
1
<<
mvs
;
vidmvs
=
1
<<
mvs
;
batps
=
((
psb
->
flags2
)
>>
6
)
&
3
;
batps
=
((
psb
->
flags2
)
>>
6
)
&
3
;
printk
(
KERN_INFO
PFX
"p states on battery: %d "
,
batps
);
switch
(
batps
)
{
printk
(
KERN_INFO
PFX
"voltage stable in %d usec"
,
vstable
*
20
);
case
0
:
if
(
batps
)
printk
(
"- all available
\n
"
);
printk
(
", only %d lowest states on battery"
,
batps
);
break
;
printk
(
", ramp voltage offset: %d"
,
rvo
);
case
1
:
printk
(
", isochronous relief time: %d"
,
irt
);
printk
(
"- only the minimum
\n
"
);
printk
(
", maximum voltage step: %d
\n
"
,
mvs
);
break
;
case
2
:
printk
(
"- only the 2 lowest
\n
"
);
break
;
case
3
:
printk
(
"- only the 3 lowest
\n
"
);
break
;
}
printk
(
KERN_INFO
PFX
"ramp voltage offset: %d
\n
"
,
rvo
);
printk
(
KERN_INFO
PFX
"isochronous relief time: %d
\n
"
,
irt
);
printk
(
KERN_INFO
PFX
"maximum voltage step: %d
\n
"
,
mvs
);
dprintk
(
KERN_DEBUG
PFX
"numpst: 0x%x
\n
"
,
psb
->
numpst
);
dprintk
(
KERN_DEBUG
PFX
"numpst: 0x%x
\n
"
,
psb
->
numpst
);
if
(
psb
->
numpst
!=
1
)
{
if
(
psb
->
numpst
!=
1
)
{
...
@@ -603,14 +595,13 @@ find_psb_table(void)
...
@@ -603,14 +595,13 @@ find_psb_table(void)
dprintk
(
KERN_DEBUG
PFX
"cpuid: 0x%x
\n
"
,
psb
->
cpuid
);
dprintk
(
KERN_DEBUG
PFX
"cpuid: 0x%x
\n
"
,
psb
->
cpuid
);
plllock
=
psb
->
plllocktime
;
plllock
=
psb
->
plllocktime
;
printk
(
KERN_INFO
PFX
"pll lock time: 0x%x
\n
"
,
plllock
);
printk
(
KERN_INFO
PFX
"pll lock time: 0x%x
,
"
,
plllock
);
maxvid
=
psb
->
maxvid
;
maxvid
=
psb
->
maxvid
;
printk
(
KERN_INFO
PFX
"maxfid: 0x%x
\n
"
,
psb
->
maxfid
);
printk
(
"maxfid 0x%x (%d MHz), maxvid 0x%x
\n
"
,
printk
(
KERN_INFO
PFX
"maxvid: 0x%x
\n
"
,
maxvid
);
psb
->
maxfid
,
find_freq_from_fid
(
psb
->
maxfid
)
,
maxvid
);
numps
=
psb
->
numpstates
;
numps
=
psb
->
numpstates
;
printk
(
KERN_INFO
PFX
"numpstates: 0x%x
\n
"
,
numps
);
if
(
numps
<
2
)
{
if
(
numps
<
2
)
{
printk
(
KERN_ERR
BFX
"no p states to transition
\n
"
);
printk
(
KERN_ERR
BFX
"no p states to transition
\n
"
);
return
-
ENODEV
;
return
-
ENODEV
;
...
@@ -629,7 +620,7 @@ find_psb_table(void)
...
@@ -629,7 +620,7 @@ find_psb_table(void)
"%d p-states
\n
"
,
numps
);
"%d p-states
\n
"
,
numps
);
}
}
if
(
(
numps
<=
1
)
||
(
batps
<=
1
)
)
{
if
(
numps
<=
1
)
{
printk
(
KERN_ERR
PFX
"only 1 p-state to transition
\n
"
);
printk
(
KERN_ERR
PFX
"only 1 p-state to transition
\n
"
);
return
-
ENODEV
;
return
-
ENODEV
;
}
}
...
@@ -645,9 +636,8 @@ find_psb_table(void)
...
@@ -645,9 +636,8 @@ find_psb_table(void)
}
}
for
(
j
=
0
;
j
<
numps
;
j
++
)
{
for
(
j
=
0
;
j
<
numps
;
j
++
)
{
printk
(
KERN_INFO
PFX
printk
(
KERN_INFO
PFX
" %d : fid 0x%x (%d MHz), vid 0x%x
\n
"
,
j
,
" %d : fid 0x%x, vid 0x%x
\n
"
,
j
,
pst
[
j
].
fid
,
find_freq_from_fid
(
pst
[
j
].
fid
),
pst
[
j
].
vid
);
pst
[
j
].
fid
,
pst
[
j
].
vid
);
powernow_table
[
j
].
index
=
pst
[
j
].
fid
;
/* lower 8 bits */
powernow_table
[
j
].
index
=
pst
[
j
].
fid
;
/* lower 8 bits */
powernow_table
[
j
].
index
|=
(
pst
[
j
].
vid
<<
8
);
/* upper 8 bits */
powernow_table
[
j
].
index
|=
(
pst
[
j
].
vid
<<
8
);
/* upper 8 bits */
powernow_table
[
j
].
frequency
=
find_freq_from_fid
(
pst
[
j
].
fid
);
powernow_table
[
j
].
frequency
=
find_freq_from_fid
(
pst
[
j
].
fid
);
...
@@ -660,8 +650,8 @@ find_psb_table(void)
...
@@ -660,8 +650,8 @@ find_psb_table(void)
return
-
EIO
;
return
-
EIO
;
}
}
printk
(
KERN_INFO
PFX
"currfid 0x%x, currvid 0x%x
\n
"
,
printk
(
KERN_INFO
PFX
"currfid 0x%x
(%d MHz)
, currvid 0x%x
\n
"
,
currfid
,
currvid
);
currfid
,
find_freq_from_fid
(
currfid
),
currvid
);
for
(
j
=
0
;
j
<
numps
;
j
++
)
for
(
j
=
0
;
j
<
numps
;
j
++
)
if
((
pst
[
j
].
fid
==
currfid
)
&&
(
pst
[
j
].
vid
==
currvid
))
if
((
pst
[
j
].
fid
==
currfid
)
&&
(
pst
[
j
].
vid
==
currvid
))
...
@@ -844,8 +834,6 @@ powernowk8_init(void)
...
@@ -844,8 +834,6 @@ powernowk8_init(void)
{
{
int
rc
;
int
rc
;
printk
(
KERN_INFO
PFX
VERSION
"
\n
"
);
if
(
check_supported_cpu
()
==
0
)
if
(
check_supported_cpu
()
==
0
)
return
-
ENODEV
;
return
-
ENODEV
;
...
...
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