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
9d733b04
Commit
9d733b04
authored
Apr 21, 2003
by
David S. Miller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[SPARC]: CLOCK_MONOTONIC fixes, from x86.
parent
d28fea3f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
63 additions
and
13 deletions
+63
-13
arch/sparc/kernel/pcic.c
arch/sparc/kernel/pcic.c
+17
-3
arch/sparc/kernel/time.c
arch/sparc/kernel/time.c
+24
-5
arch/sparc64/kernel/time.c
arch/sparc64/kernel/time.c
+22
-5
No files found.
arch/sparc/kernel/pcic.c
View file @
9d733b04
...
...
@@ -828,13 +828,27 @@ static void pci_do_settimeofday(struct timeval *tv)
* made, and then undo it!
*/
tv
->
tv_usec
-=
do_gettimeoffset
();
tv
->
tv_usec
-=
(
jiffies
-
wall_jiffies
)
*
(
1000000
/
HZ
);
tv
->
tv_usec
-=
(
jiffies
-
wall_jiffies
)
*
(
USEC_PER_SEC
/
HZ
);
while
(
tv
->
tv_usec
<
0
)
{
tv
->
tv_usec
+=
1000000
;
tv
->
tv_usec
+=
USEC_PER_SEC
;
tv
->
tv_sec
--
;
}
tv
->
tv_usec
*=
NSEC_PER_USEC
;
wall_to_monotonic
.
tv_sec
+=
xtime
.
tv_sec
-
tv
->
tv_sec
;
wall_to_monotonic
.
tv_nsec
+=
xtime
.
tv_nsec
-
tv
->
tv_usec
;
if
(
wall_to_monotonic
.
tv_nsec
>
NSEC_PER_SEC
)
{
wall_to_monotonic
.
tv_nsec
-=
NSEC_PER_SEC
;
wall_to_monotonic
.
tv_sec
++
;
}
if
(
wall_to_monotonic
.
tv_nsec
<
0
)
{
wall_to_monotonic
.
tv_nsec
+=
NSEC_PER_SEC
;
wall_to_monotonic
.
tv_sec
--
;
}
xtime
.
tv_sec
=
tv
->
tv_sec
;
xtime
.
tv_nsec
=
(
tv
->
tv_usec
*
1000
)
;
xtime
.
tv_nsec
=
tv
->
tv_usec
;
time_adjust
=
0
;
/* stop active adjtime() */
time_status
|=
STA_UNSYNC
;
time_maxerror
=
NTP_PHASE_LIMIT
;
...
...
arch/sparc/kernel/time.c
View file @
9d733b04
...
...
@@ -408,7 +408,9 @@ void __init sbus_time_init(void)
mon
=
MSTK_REG_MONTH
(
mregs
);
year
=
MSTK_CVT_YEAR
(
MSTK_REG_YEAR
(
mregs
)
);
xtime
.
tv_sec
=
mktime
(
year
,
mon
,
day
,
hour
,
min
,
sec
);
xtime
.
tv_nsec
=
0
;
wall_to_monotonic
.
tv_sec
=
-
xtime
.
tv_sec
+
INITIAL_JIFFIES
/
HZ
;
xtime
.
tv_nsec
=
(
INITIAL_JIFFIES
%
HZ
)
*
(
NSEC_PER_SEC
/
HZ
);
wall_to_monotonic
.
tv_nsec
=
0
;
mregs
->
creg
&=
~
MSTK_CREG_READ
;
spin_unlock_irq
(
&
mostek_lock
);
#ifdef CONFIG_SUN4
...
...
@@ -439,7 +441,9 @@ void __init sbus_time_init(void)
intersil_start
(
iregs
);
xtime
.
tv_sec
=
mktime
(
year
,
mon
,
day
,
hour
,
min
,
sec
);
xtime
.
tv_nsec
=
0
;
wall_to_monotonic
.
tv_sec
=
-
xtime
.
tv_sec
+
INITIAL_JIFFIES
/
HZ
;
xtime
.
tv_nsec
=
(
INITIAL_JIFFIES
%
HZ
)
*
(
NSEC_PER_SEC
/
HZ
);
wall_to_monotonic
.
tv_nsec
=
0
;
printk
(
"%u/%u/%u %u:%u:%u
\n
"
,
day
,
mon
,
year
,
hour
,
min
,
sec
);
}
#endif
...
...
@@ -512,13 +516,28 @@ static void sbus_do_settimeofday(struct timeval *tv)
* made, and then undo it!
*/
tv
->
tv_usec
-=
do_gettimeoffset
();
tv
->
tv_usec
-=
(
jiffies
-
wall_jiffies
)
*
(
1000000
/
HZ
);
tv
->
tv_usec
-=
(
jiffies
-
wall_jiffies
)
*
(
USEC_PER_SEC
/
HZ
);
while
(
tv
->
tv_usec
<
0
)
{
tv
->
tv_usec
+=
1000000
;
tv
->
tv_usec
+=
USEC_PER_SEC
;
tv
->
tv_sec
--
;
}
tv
->
tv_usec
*=
NSEC_PER_USEC
;
wall_to_monotonic
.
tv_sec
+=
xtime
.
tv_sec
-
tv
->
tv_sec
;
wall_to_monotonic
.
tv_nsec
+=
xtime
.
tv_nsec
-
tv
->
tv_usec
;
if
(
wall_to_monotonic
.
tv_nsec
>
NSEC_PER_SEC
)
{
wall_to_monotonic
.
tv_nsec
-=
NSEC_PER_SEC
;
wall_to_monotonic
.
tv_sec
++
;
}
if
(
wall_to_monotonic
.
tv_nsec
<
0
)
{
wall_to_monotonic
.
tv_nsec
+=
NSEC_PER_SEC
;
wall_to_monotonic
.
tv_sec
--
;
}
xtime
.
tv_sec
=
tv
->
tv_sec
;
xtime
.
tv_nsec
=
(
tv
->
tv_usec
*
1000
)
;
xtime
.
tv_nsec
=
tv
->
tv_usec
;
time_adjust
=
0
;
/* stop active adjtime() */
time_status
|=
STA_UNSYNC
;
time_maxerror
=
NTP_PHASE_LIMIT
;
...
...
arch/sparc64/kernel/time.c
View file @
9d733b04
...
...
@@ -703,7 +703,9 @@ static void __init set_system_time(void)
}
xtime
.
tv_sec
=
mktime
(
year
,
mon
,
day
,
hour
,
min
,
sec
);
xtime
.
tv_nsec
=
0
;
wall_to_monotonic
.
tv_sec
=
-
xtime
.
tv_sec
+
INITIAL_JIFFIES
/
HZ
;
xtime
.
tv_nsec
=
(
INITIAL_JIFFIES
%
HZ
)
*
(
NSEC_PER_SEC
/
HZ
);
wall_to_monotonic
.
tv_nsec
=
0
;
if
(
mregs
)
{
tmp
=
mostek_read
(
mregs
+
MOSTEK_CREG
);
...
...
@@ -741,7 +743,9 @@ void __init clock_probe(void)
(
unsigned
int
)
(
long
)
&
unix_tod
);
prom_feval
(
obp_gettod
);
xtime
.
tv_sec
=
unix_tod
;
xtime
.
tv_nsec
=
0
;
wall_to_monotonic
.
tv_sec
=
-
xtime
.
tv_sec
+
INITIAL_JIFFIES
/
HZ
;
xtime
.
tv_nsec
=
(
INITIAL_JIFFIES
%
HZ
)
*
(
NSEC_PER_SEC
/
HZ
);
wall_to_monotonic
.
tv_nsec
=
0
;
return
;
}
...
...
@@ -1097,15 +1101,28 @@ void do_settimeofday(struct timeval *tv)
* made, and then undo it!
*/
tv
->
tv_usec
-=
do_gettimeoffset
();
tv
->
tv_usec
-=
(
jiffies
-
wall_jiffies
)
*
(
1000000
/
HZ
);
tv
->
tv_usec
-=
(
jiffies
-
wall_jiffies
)
*
(
USEC_PER_SEC
/
HZ
);
while
(
tv
->
tv_usec
<
0
)
{
tv
->
tv_usec
+=
1000000
;
tv
->
tv_usec
+=
USEC_PER_SEC
;
tv
->
tv_sec
--
;
}
tv
->
tv_usec
*=
NSEC_PER_USEC
;
wall_to_monotonic
.
tv_sec
+=
xtime
.
tv_sec
-
tv
->
tv_sec
;
wall_to_monotonic
.
tv_nsec
+=
xtime
.
tv_nsec
-
tv
->
tv_usec
;
if
(
wall_to_monotonic
.
tv_nsec
>
NSEC_PER_SEC
)
{
wall_to_monotonic
.
tv_nsec
-=
NSEC_PER_SEC
;
wall_to_monotonic
.
tv_sec
++
;
}
if
(
wall_to_monotonic
.
tv_nsec
<
0
)
{
wall_to_monotonic
.
tv_nsec
+=
NSEC_PER_SEC
;
wall_to_monotonic
.
tv_sec
--
;
}
xtime
.
tv_sec
=
tv
->
tv_sec
;
xtime
.
tv_nsec
=
(
tv
->
tv_usec
*
1000
)
;
xtime
.
tv_nsec
=
tv
->
tv_usec
;
time_adjust
=
0
;
/* stop active adjtime() */
time_status
|=
STA_UNSYNC
;
time_maxerror
=
NTP_PHASE_LIMIT
;
...
...
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