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
e9e4f3bb
Commit
e9e4f3bb
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] convert powernow-k8 to use frequency tables [5/5]
Move the table verification to an extra function.
parent
d2b89b91
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
38 deletions
+44
-38
arch/i386/kernel/cpu/cpufreq/powernow-k8.c
arch/i386/kernel/cpu/cpufreq/powernow-k8.c
+44
-38
No files found.
arch/i386/kernel/cpu/cpufreq/powernow-k8.c
View file @
e9e4f3bb
...
@@ -72,9 +72,6 @@ so this is not actually a restriction.
...
@@ -72,9 +72,6 @@ so this is not actually a restriction.
static
u32
batps
;
/* limit on the number of p states when on battery */
static
u32
batps
;
/* limit on the number of p states when on battery */
/* - set by BIOS in the PSB/PST */
/* - set by BIOS in the PSB/PST */
#define SEARCH_UP 1
#define SEARCH_DOWN 0
/* Return a frequency in MHz, given an input fid */
/* Return a frequency in MHz, given an input fid */
static
u32
find_freq_from_fid
(
u32
fid
)
static
u32
find_freq_from_fid
(
u32
fid
)
{
{
...
@@ -494,14 +491,55 @@ check_supported_cpu(void)
...
@@ -494,14 +491,55 @@ check_supported_cpu(void)
return
1
;
return
1
;
}
}
static
int
check_pst_table
(
struct
pst_s
*
pst
,
u8
maxvid
)
{
unsigned
int
j
;
u8
lastfid
=
0xFF
;
for
(
j
=
0
;
j
<
numps
;
j
++
)
{
if
(
pst
[
j
].
vid
>
LEAST_VID
)
{
printk
(
KERN_ERR
PFX
"vid %d invalid : 0x%x
\n
"
,
j
,
pst
[
j
].
vid
);
return
-
EINVAL
;
}
if
(
pst
[
j
].
vid
<
rvo
)
{
/* vid + rvo >= 0 */
printk
(
KERN_ERR
PFX
"BIOS error - 0 vid exceeded with pstate %d
\n
"
,
j
);
return
-
ENODEV
;
}
if
(
pst
[
j
].
vid
<
maxvid
+
rvo
)
{
/* vid + rvo >= maxvid */
printk
(
KERN_ERR
PFX
"BIOS error - maxvid exceeded with pstate %d
\n
"
,
j
);
return
-
ENODEV
;
}
if
((
pst
[
j
].
fid
>
MAX_FID
)
||
(
pst
[
j
].
fid
&
1
)
||
(
pst
[
j
].
fid
<
HI_FID_TABLE_BOTTOM
)){
printk
(
KERN_ERR
PFX
"fid %d invalid : 0x%x
\n
"
,
j
,
pst
[
j
].
fid
);
return
-
EINVAL
;
}
if
(
pst
[
j
].
fid
<
lastfid
)
lastfid
=
pst
[
j
].
fid
;
}
if
(
lastfid
&
1
)
{
printk
(
KERN_ERR
PFX
"lastfid invalid
\n
"
);
return
-
EINVAL
;
}
if
(
lastfid
>
LO_FID_TABLE_TOP
)
{
printk
(
KERN_INFO
PFX
"first fid not from lo freq table
\n
"
);
}
return
0
;
}
/* Find and validate the PSB/PST table in BIOS. */
/* Find and validate the PSB/PST table in BIOS. */
static
inline
int
static
inline
int
find_psb_table
(
void
)
find_psb_table
(
void
)
{
{
struct
psb_s
*
psb
;
struct
psb_s
*
psb
;
struct
pst_s
*
pst
;
struct
pst_s
*
pst
;
unsigned
i
,
j
;
unsigned
int
i
,
j
;
u32
lastfid
;
u32
mvs
;
u32
mvs
;
u8
maxvid
;
u8
maxvid
;
...
@@ -597,40 +635,8 @@ find_psb_table(void)
...
@@ -597,40 +635,8 @@ find_psb_table(void)
}
}
pst
=
(
struct
pst_s
*
)
(
psb
+
1
);
pst
=
(
struct
pst_s
*
)
(
psb
+
1
);
lastfid
=
0xFFFFFFFF
;
if
(
check_pst_table
(
pst
,
maxvid
))
for
(
j
=
0
;
j
<
numps
;
j
++
)
{
if
(
pst
[
j
].
vid
>
LEAST_VID
)
{
printk
(
KERN_ERR
PFX
"vid invalid : 0x%x
\n
"
,
pst
[
j
].
vid
);
return
-
EINVAL
;
}
if
(
pst
[
j
].
vid
<
rvo
)
{
/* vid + rvo >= 0 */
printk
(
KERN_ERR
PFX
"BIOS error - 0 vid exceeded with pstate %d
\n
"
,
j
);
return
-
ENODEV
;
}
if
(
pst
[
j
].
vid
<
maxvid
+
rvo
)
{
/* vid + rvo >= maxvid */
printk
(
KERN_ERR
PFX
"BIOS error - maxvid exceeded with pstate %d
\n
"
,
j
);
return
-
ENODEV
;
}
if
((
pst
[
j
].
fid
>
MAX_FID
)
||
(
pst
[
j
].
fid
&
1
)
||
(
pst
[
j
].
fid
<
HI_FID_TABLE_BOTTOM
)){
printk
(
KERN_ERR
PFX
"fid invalid : 0x%x
\n
"
,
pst
[
j
].
fid
);
return
-
EINVAL
;
}
if
(
pst
[
j
].
fid
<
lastfid
)
lastfid
=
pst
[
j
].
fid
;
}
if
(
lastfid
&
1
)
{
printk
(
KERN_ERR
PFX
"lastfid invalid
\n
"
);
return
-
EINVAL
;
return
-
EINVAL
;
}
if
(
lastfid
>
LO_FID_TABLE_TOP
)
{
printk
(
KERN_INFO
PFX
"first fid not from lo freq table
\n
"
);
}
powernow_table
=
kmalloc
((
sizeof
(
struct
cpufreq_frequency_table
)
*
(
numps
+
1
)),
GFP_KERNEL
);
powernow_table
=
kmalloc
((
sizeof
(
struct
cpufreq_frequency_table
)
*
(
numps
+
1
)),
GFP_KERNEL
);
if
(
!
powernow_table
)
{
if
(
!
powernow_table
)
{
...
...
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