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
b82db9f3
Commit
b82db9f3
authored
Jun 14, 2003
by
Andrew Morton
Committed by
Linus Torvalds
Jun 14, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] sparc: fix do_settimeofday() for new API
parent
2e508205
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
21 deletions
+30
-21
arch/sparc/kernel/pcic.c
arch/sparc/kernel/pcic.c
+12
-9
arch/sparc/kernel/time.c
arch/sparc/kernel/time.c
+17
-11
include/asm-sparc/timer.h
include/asm-sparc/timer.h
+1
-1
No files found.
arch/sparc/kernel/pcic.c
View file @
b82db9f3
...
...
@@ -191,7 +191,7 @@ volatile int pcic_speculative;
volatile
int
pcic_trapped
;
static
void
pci_do_gettimeofday
(
struct
timeval
*
tv
);
static
void
pci_do_settimeofday
(
struct
timeval
*
tv
);
static
int
pci_do_settimeofday
(
struct
timespec
*
tv
);
#define CONFIG_CMD(bus, device_fn, where) (0x80000000 | (((unsigned int)bus) << 16) | (((unsigned int)device_fn) << 8) | (where & ~3))
...
...
@@ -819,24 +819,26 @@ static void pci_do_gettimeofday(struct timeval *tv)
tv
->
tv_usec
=
usec
;
}
static
void
pci_do_settimeofday
(
struct
timeval
*
tv
)
static
int
pci_do_settimeofday
(
struct
timespec
*
tv
)
{
if
((
unsigned
long
)
tv
->
tv_nsec
>=
NSEC_PER_SEC
)
return
-
EINVAL
;
/*
* This is revolting. We need to set "xtime" correctly. However, the
* value in this location is the value at the most recent update of
* wall time. Discover what correction gettimeofday() would have
* made, and then undo it!
*/
tv
->
tv_
usec
-=
do_gettimeoffset
();
tv
->
tv_usec
-=
(
jiffies
-
wall_jiffies
)
*
(
USEC_PER_SEC
/
HZ
);
while
(
tv
->
tv_
u
sec
<
0
)
{
tv
->
tv_
usec
+=
U
SEC_PER_SEC
;
tv
->
tv_
nsec
-=
1000
*
(
do_gettimeoffset
()
+
(
jiffies
-
wall_jiffies
)
*
(
USEC_PER_SEC
/
HZ
)
);
while
(
tv
->
tv_
n
sec
<
0
)
{
tv
->
tv_
nsec
+=
N
SEC_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_
u
sec
;
wall_to_monotonic
.
tv_nsec
+=
xtime
.
tv_nsec
-
tv
->
tv_
n
sec
;
if
(
wall_to_monotonic
.
tv_nsec
>
NSEC_PER_SEC
)
{
wall_to_monotonic
.
tv_nsec
-=
NSEC_PER_SEC
;
...
...
@@ -848,11 +850,12 @@ static void pci_do_settimeofday(struct timeval *tv)
}
xtime
.
tv_sec
=
tv
->
tv_sec
;
xtime
.
tv_nsec
=
tv
->
tv_
u
sec
;
xtime
.
tv_nsec
=
tv
->
tv_
n
sec
;
time_adjust
=
0
;
/* stop active adjtime() */
time_status
|=
STA_UNSYNC
;
time_maxerror
=
NTP_PHASE_LIMIT
;
time_esterror
=
NTP_PHASE_LIMIT
;
return
0
;
}
#if 0
...
...
arch/sparc/kernel/time.c
View file @
b82db9f3
...
...
@@ -53,7 +53,7 @@ spinlock_t mostek_lock = SPIN_LOCK_UNLOCKED;
unsigned
long
mstk48t02_regs
=
0UL
;
static
struct
mostek48t08
*
mstk48t08_regs
=
0
;
static
int
set_rtc_mmss
(
unsigned
long
);
static
void
sbus_do_settimeofday
(
struct
timeval
*
tv
);
static
int
sbus_do_settimeofday
(
struct
timespec
*
tv
);
#ifdef CONFIG_SUN4
struct
intersil
*
intersil_clock
;
...
...
@@ -500,32 +500,37 @@ void do_gettimeofday(struct timeval *tv)
tv
->
tv_usec
=
usec
;
}
void
do_settimeofday
(
struct
timeval
*
tv
)
int
do_settimeofday
(
struct
timespec
*
tv
)
{
int
ret
;
write_seqlock_irq
(
&
xtime_lock
);
bus_do_settimeofday
(
tv
);
ret
=
bus_do_settimeofday
(
tv
);
write_sequnlock_irq
(
&
xtime_lock
);
return
ret
;
}
static
void
sbus_do_settimeofday
(
struct
timeval
*
tv
)
static
int
sbus_do_settimeofday
(
struct
timespec
*
tv
)
{
if
((
unsigned
long
)
tv
->
tv_nsec
>=
NSEC_PER_SEC
)
return
-
EINVAL
;
/*
* This is revolting. We need to set "xtime" correctly. However, the
* value in this location is the value at the most recent update of
* wall time. Discover what correction gettimeofday() would have
* made, and then undo it!
*/
tv
->
tv_
usec
-=
do_gettimeoffset
();
tv
->
tv_usec
-=
(
jiffies
-
wall_jiffies
)
*
(
USEC_PER_SEC
/
HZ
);
tv
->
tv_
nsec
-=
1000
*
(
do_gettimeoffset
()
+
(
jiffies
-
wall_jiffies
)
*
(
USEC_PER_SEC
/
HZ
)
);
while
(
tv
->
tv_
u
sec
<
0
)
{
tv
->
tv_
usec
+=
U
SEC_PER_SEC
;
while
(
tv
->
tv_
n
sec
<
0
)
{
tv
->
tv_
nsec
+=
N
SEC_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_
u
sec
;
wall_to_monotonic
.
tv_nsec
+=
xtime
.
tv_nsec
-
tv
->
tv_
n
sec
;
if
(
wall_to_monotonic
.
tv_nsec
>
NSEC_PER_SEC
)
{
wall_to_monotonic
.
tv_nsec
-=
NSEC_PER_SEC
;
...
...
@@ -537,11 +542,12 @@ static void sbus_do_settimeofday(struct timeval *tv)
}
xtime
.
tv_sec
=
tv
->
tv_sec
;
xtime
.
tv_nsec
=
tv
->
tv_
u
sec
;
xtime
.
tv_nsec
=
tv
->
tv_
n
sec
;
time_adjust
=
0
;
/* stop active adjtime() */
time_status
|=
STA_UNSYNC
;
time_maxerror
=
NTP_PHASE_LIMIT
;
time_esterror
=
NTP_PHASE_LIMIT
;
return
0
;
}
/*
...
...
include/asm-sparc/timer.h
View file @
b82db9f3
...
...
@@ -104,7 +104,7 @@ extern __volatile__ unsigned int *master_l10_counter;
extern
__volatile__
unsigned
int
*
master_l10_limit
;
/* FIXME: Make do_[gs]ettimeofday btfixup calls */
BTFIXUPDEF_CALL
(
void
,
bus_do_settimeofday
,
struct
timeval
*
tv
)
BTFIXUPDEF_CALL
(
int
,
bus_do_settimeofday
,
struct
timespec
*
tv
)
#define bus_do_settimeofday(tv) BTFIXUP_CALL(bus_do_settimeofday)(tv)
#endif
/* !(_SPARC_TIMER_H) */
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