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
aa9aa621
Commit
aa9aa621
authored
Mar 18, 2004
by
Richard Henderson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[TRIVIAL] Tighten sanity in time_init to 250 ppm.
From: "Bailey, Scott" <scott.bailey@eds.com>
parent
35ef4b70
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
4 deletions
+6
-4
arch/alpha/kernel/time.c
arch/alpha/kernel/time.c
+6
-4
No files found.
arch/alpha/kernel/time.c
View file @
aa9aa621
...
@@ -24,6 +24,8 @@
...
@@ -24,6 +24,8 @@
* 2000-08-13 Jan-Benedict Glaw <jbglaw@lug-owl.de>
* 2000-08-13 Jan-Benedict Glaw <jbglaw@lug-owl.de>
* Fixed time_init to be aware of epoches != 1900. This prevents
* Fixed time_init to be aware of epoches != 1900. This prevents
* booting up in 2048 for me;) Code is stolen from rtc.c.
* booting up in 2048 for me;) Code is stolen from rtc.c.
* 2003-06-03 R. Scott Bailey <scott.bailey@eds.com>
* Tighten sanity in time_init from 1% (10,000 PPM) to 250 PPM
*/
*/
#include <linux/config.h>
#include <linux/config.h>
#include <linux/errno.h>
#include <linux/errno.h>
...
@@ -306,7 +308,7 @@ void __init
...
@@ -306,7 +308,7 @@ void __init
time_init
(
void
)
time_init
(
void
)
{
{
unsigned
int
year
,
mon
,
day
,
hour
,
min
,
sec
,
cc1
,
cc2
,
epoch
;
unsigned
int
year
,
mon
,
day
,
hour
,
min
,
sec
,
cc1
,
cc2
,
epoch
;
unsigned
long
cycle_freq
,
one_percent
;
unsigned
long
cycle_freq
,
tolerance
;
long
diff
;
long
diff
;
/* Calibrate CPU clock -- attempt #1. */
/* Calibrate CPU clock -- attempt #1. */
...
@@ -324,13 +326,13 @@ time_init(void)
...
@@ -324,13 +326,13 @@ time_init(void)
cycle_freq
=
hwrpb
->
cycle_freq
;
cycle_freq
=
hwrpb
->
cycle_freq
;
if
(
est_cycle_freq
)
{
if
(
est_cycle_freq
)
{
/* If the given value is within
1% of what we calculated,
/* If the given value is within
250 PPM of what we calculated,
accept it. Otherwise, use what we found. */
accept it. Otherwise, use what we found. */
one_percent
=
cycle_freq
/
1
00
;
tolerance
=
cycle_freq
/
40
00
;
diff
=
cycle_freq
-
est_cycle_freq
;
diff
=
cycle_freq
-
est_cycle_freq
;
if
(
diff
<
0
)
if
(
diff
<
0
)
diff
=
-
diff
;
diff
=
-
diff
;
if
((
unsigned
long
)
diff
>
one_percent
)
{
if
((
unsigned
long
)
diff
>
tolerance
)
{
cycle_freq
=
est_cycle_freq
;
cycle_freq
=
est_cycle_freq
;
printk
(
"HWRPB cycle frequency bogus. "
printk
(
"HWRPB cycle frequency bogus. "
"Estimated %lu Hz
\n
"
,
cycle_freq
);
"Estimated %lu Hz
\n
"
,
cycle_freq
);
...
...
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