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
4bdff414
Commit
4bdff414
authored
Feb 11, 2006
by
David S. Miller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[SPARC64]: Fetch bootup time of day from Hypervisor.
Signed-off-by:
David S. Miller
<
davem@davemloft.net
>
parent
36a68e77
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
8 deletions
+50
-8
arch/sparc64/kernel/time.c
arch/sparc64/kernel/time.c
+50
-8
No files found.
arch/sparc64/kernel/time.c
View file @
4bdff414
...
...
@@ -683,6 +683,48 @@ static void __init set_system_time(void)
}
}
/* davem suggests we keep this within the 4M locked kernel image */
static
u32
starfire_get_time
(
void
)
{
static
char
obp_gettod
[
32
];
static
u32
unix_tod
;
sprintf
(
obp_gettod
,
"h# %08x unix-gettod"
,
(
unsigned
int
)
(
long
)
&
unix_tod
);
prom_feval
(
obp_gettod
);
return
unix_tod
;
}
static
u32
hypervisor_get_time
(
void
)
{
register
unsigned
long
func
asm
(
"%o5"
);
register
unsigned
long
arg0
asm
(
"%o0"
);
register
unsigned
long
arg1
asm
(
"%o1"
);
int
retries
=
10000
;
retry:
func
=
HV_FAST_TOD_GET
;
arg0
=
0
;
arg1
=
0
;
__asm__
__volatile__
(
"ta %6"
:
"=&r"
(
func
),
"=&r"
(
arg0
),
"=&r"
(
arg1
)
:
"0"
(
func
),
"1"
(
arg0
),
"2"
(
arg1
),
"i"
(
HV_FAST_TRAP
));
if
(
arg0
==
HV_EOK
)
return
arg1
;
if
(
arg0
==
HV_EWOULDBLOCK
)
{
if
(
--
retries
>
0
)
{
udelay
(
100
);
goto
retry
;
}
printk
(
KERN_WARNING
"SUN4V: tod_get() timed out.
\n
"
);
return
0
;
}
printk
(
KERN_WARNING
"SUN4V: tod_get() not supported.
\n
"
);
return
0
;
}
void
__init
clock_probe
(
void
)
{
struct
linux_prom_registers
clk_reg
[
2
];
...
...
@@ -702,14 +744,14 @@ void __init clock_probe(void)
if
(
this_is_starfire
)
{
/* davem suggests we keep this within the 4M locked kernel image */
static
char
obp_gettod
[
256
]
;
s
tatic
u32
unix_tod
;
sprintf
(
obp_gettod
,
"h# %08x unix-gettod"
,
(
unsigned
int
)
(
long
)
&
unix_tod
);
prom_feval
(
obp_gettod
);
xtime
.
tv_sec
=
unix_tod
;
xtime
.
tv_sec
=
starfire_get_time
();
xtime
.
tv_nsec
=
(
INITIAL_JIFFIES
%
HZ
)
*
(
NSEC_PER_SEC
/
HZ
)
;
s
et_normalized_timespec
(
&
wall_to_monotonic
,
-
xtime
.
tv_sec
,
-
xtime
.
tv_nsec
);
return
;
}
if
(
tlb_type
==
hypervisor
)
{
xtime
.
tv_sec
=
hypervisor_get_time
()
;
xtime
.
tv_nsec
=
(
INITIAL_JIFFIES
%
HZ
)
*
(
NSEC_PER_SEC
/
HZ
);
set_normalized_timespec
(
&
wall_to_monotonic
,
-
xtime
.
tv_sec
,
-
xtime
.
tv_nsec
);
...
...
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