Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
a58c9f3c
K
Kernel
项目概览
openeuler
/
Kernel
1 年多 前同步成功
通知
8
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
Kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
a58c9f3c
编写于
2月 22, 2007
作者:
D
David S. Miller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[SPARC64]: Synchronize RTC clock via timer just like x86.
Signed-off-by:
N
David S. Miller
<
davem@davemloft.net
>
上级
de46c337
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
48 addition
and
18 deletion
+48
-18
arch/sparc64/kernel/time.c
arch/sparc64/kernel/time.c
+48
-18
未找到文件。
arch/sparc64/kernel/time.c
浏览文件 @
a58c9f3c
...
...
@@ -435,22 +435,56 @@ static unsigned long timer_ticks_per_nsec_quotient __read_mostly;
#define TICK_SIZE (tick_nsec / 1000)
static
inline
void
timer_check_rtc
(
void
)
#define USEC_AFTER 500000
#define USEC_BEFORE 500000
static
void
sync_cmos_clock
(
unsigned
long
dummy
);
static
DEFINE_TIMER
(
sync_cmos_timer
,
sync_cmos_clock
,
0
,
0
);
static
void
sync_cmos_clock
(
unsigned
long
dummy
)
{
/* last time the cmos clock got updated */
static
long
last_rtc_update
;
/* Determine when to update the Mostek clock. */
if
(
ntp_synced
()
&&
xtime
.
tv_sec
>
last_rtc_update
+
660
&&
(
xtime
.
tv_nsec
/
1000
)
>=
500000
-
((
unsigned
)
TICK_SIZE
)
/
2
&&
(
xtime
.
tv_nsec
/
1000
)
<=
500000
+
((
unsigned
)
TICK_SIZE
)
/
2
)
{
if
(
set_rtc_mmss
(
xtime
.
tv_sec
)
==
0
)
last_rtc_update
=
xtime
.
tv_sec
;
else
last_rtc_update
=
xtime
.
tv_sec
-
600
;
/* do it again in 60 s */
struct
timeval
now
,
next
;
int
fail
=
1
;
/*
* If we have an externally synchronized Linux clock, then update
* CMOS clock accordingly every ~11 minutes. Set_rtc_mmss() has to be
* called as close as possible to 500 ms before the new second starts.
* This code is run on a timer. If the clock is set, that timer
* may not expire at the correct time. Thus, we adjust...
*/
if
(
!
ntp_synced
())
/*
* Not synced, exit, do not restart a timer (if one is
* running, let it run out).
*/
return
;
do_gettimeofday
(
&
now
);
if
(
now
.
tv_usec
>=
USEC_AFTER
-
((
unsigned
)
TICK_SIZE
)
/
2
&&
now
.
tv_usec
<=
USEC_BEFORE
+
((
unsigned
)
TICK_SIZE
)
/
2
)
fail
=
set_rtc_mmss
(
now
.
tv_sec
);
next
.
tv_usec
=
USEC_AFTER
-
now
.
tv_usec
;
if
(
next
.
tv_usec
<=
0
)
next
.
tv_usec
+=
USEC_PER_SEC
;
if
(
!
fail
)
next
.
tv_sec
=
659
;
else
next
.
tv_sec
=
0
;
if
(
next
.
tv_usec
>=
USEC_PER_SEC
)
{
next
.
tv_sec
++
;
next
.
tv_usec
-=
USEC_PER_SEC
;
}
mod_timer
(
&
sync_cmos_timer
,
jiffies
+
timeval_to_jiffies
(
&
next
));
}
void
notify_arch_cmos_timer
(
void
)
{
mod_timer
(
&
sync_cmos_timer
,
jiffies
+
1
);
}
irqreturn_t
timer_interrupt
(
int
irq
,
void
*
dev_id
)
...
...
@@ -483,8 +517,6 @@ irqreturn_t timer_interrupt(int irq, void *dev_id)
:
"r"
(
pstate
));
}
while
(
time_after_eq
(
ticks
,
compare
));
timer_check_rtc
();
write_sequnlock
(
&
xtime_lock
);
return
IRQ_HANDLED
;
...
...
@@ -497,8 +529,6 @@ void timer_tick_interrupt(struct pt_regs *regs)
do_timer
(
1
);
timer_check_rtc
();
write_sequnlock
(
&
xtime_lock
);
}
#endif
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录