Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
raspberrypi-kernel
提交
06d428d7
R
raspberrypi-kernel
项目概览
openeuler
/
raspberrypi-kernel
通知
13
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
raspberrypi-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
06d428d7
编写于
10月 22, 2007
作者:
R
Ralf Baechle
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[MIPS] time: SMP/NUMA-proofing of IP27 HUB RT timer code.
Signed-off-by:
N
Ralf Baechle
<
ralf@linux-mips.org
>
上级
508a775a
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
72 addition
and
64 deletion
+72
-64
arch/mips/sgi-ip27/ip27-init.c
arch/mips/sgi-ip27/ip27-init.c
+1
-1
arch/mips/sgi-ip27/ip27-timer.c
arch/mips/sgi-ip27/ip27-timer.c
+71
-63
未找到文件。
arch/mips/sgi-ip27/ip27-init.c
浏览文件 @
06d428d7
...
...
@@ -110,7 +110,7 @@ static void __init per_hub_init(cnodeid_t cnode)
}
}
void
__init
per_cpu_init
(
void
)
void
__
cpu
init
per_cpu_init
(
void
)
{
int
cpu
=
smp_processor_id
();
int
slice
=
LOCAL_HUB_L
(
PI_CPU_NUM
);
...
...
arch/mips/sgi-ip27/ip27-timer.c
浏览文件 @
06d428d7
...
...
@@ -111,8 +111,24 @@ unsigned long read_persistent_clock(void)
return
mktime
(
year
,
month
,
date
,
hour
,
min
,
sec
);
}
static
int
rt_set_next_event
(
unsigned
long
delta
,
struct
clock_event_device
*
evt
)
static
void
enable_rt_irq
(
unsigned
int
irq
)
{
}
static
void
disable_rt_irq
(
unsigned
int
irq
)
{
}
static
struct
irq_chip
rt_irq_type
=
{
.
name
=
"SN HUB RT timer"
,
.
ack
=
disable_rt_irq
,
.
mask
=
disable_rt_irq
,
.
mask_ack
=
disable_rt_irq
,
.
unmask
=
enable_rt_irq
,
.
eoi
=
enable_rt_irq
,
};
static
int
rt_next_event
(
unsigned
long
delta
,
struct
clock_event_device
*
evt
)
{
unsigned
int
cpu
=
smp_processor_id
();
int
slice
=
cputoslice
(
cpu
)
==
0
;
...
...
@@ -129,50 +145,24 @@ static void rt_set_mode(enum clock_event_mode mode,
struct
clock_event_device
*
evt
)
{
switch
(
mode
)
{
case
CLOCK_EVT_MODE_
PERIODIC
:
case
CLOCK_EVT_MODE_
ONESHOT
:
/* The only mode supported */
break
;
case
CLOCK_EVT_MODE_PERIODIC
:
case
CLOCK_EVT_MODE_UNUSED
:
case
CLOCK_EVT_MODE_SHUTDOWN
:
case
CLOCK_EVT_MODE_ONESHOT
:
case
CLOCK_EVT_MODE_RESUME
:
/* Nothing to do */
break
;
}
}
struct
clock_event_device
rt_clock_event_device
=
{
.
name
=
"HUB-RT"
,
.
features
=
CLOCK_EVT_FEAT_ONESHOT
,
.
rating
=
300
,
.
set_next_event
=
rt_set_next_event
,
.
set_mode
=
rt_set_mode
,
};
static
void
enable_rt_irq
(
unsigned
int
irq
)
{
}
static
void
disable_rt_irq
(
unsigned
int
irq
)
{
}
static
struct
irq_chip
rt_irq_type
=
{
.
name
=
"SN HUB RT timer"
,
.
ack
=
disable_rt_irq
,
.
mask
=
disable_rt_irq
,
.
mask_ack
=
disable_rt_irq
,
.
unmask
=
enable_rt_irq
,
.
eoi
=
enable_rt_irq
,
};
unsigned
int
rt_timer_irq
;
static
irqreturn_t
ip27_rt_timer_interrupt
(
int
irq
,
void
*
dev_id
)
static
irqreturn_t
hub_rt_counter_handler
(
int
irq
,
void
*
dev_id
)
{
struct
clock_event_device
*
cd
=
&
rt_clock_event_device
;
struct
clock_event_device
*
cd
=
dev_id
;
unsigned
int
cpu
=
smp_processor_id
();
int
slice
=
cputoslice
(
cpu
)
==
0
;
...
...
@@ -182,11 +172,10 @@ static irqreturn_t ip27_rt_timer_interrupt(int irq, void *dev_id)
return
IRQ_HANDLED
;
}
static
struct
irqaction
rt_irqaction
=
{
.
handler
=
(
irq_handler_t
)
ip27_rt_timer_interrupt
,
.
flags
=
IRQF_DISABLED
,
.
mask
=
CPU_MASK_NONE
,
.
name
=
"timer"
struct
irqaction
hub_rt_irqaction
=
{
.
handler
=
hub_rt_counter_handler
,
.
flags
=
IRQF_DISABLED
|
IRQF_PERCPU
,
.
name
=
"hub-rt"
,
};
/*
...
...
@@ -200,32 +189,48 @@ static struct irqaction rt_irqaction = {
#define NSEC_PER_CYCLE 800
#define CYCLES_PER_SEC (NSEC_PER_SEC / NSEC_PER_CYCLE)
static
void
__init
ip27_rt_clock_event_init
(
void
)
static
DEFINE_PER_CPU
(
struct
clock_event_device
,
hub_rt_clockevent
);
static
DEFINE_PER_CPU
(
char
[
11
],
hub_rt_name
);
static
void
__cpuinit
hub_rt_clock_event_init
(
void
)
{
struct
clock_event_device
*
cd
=
&
rt_clock_event_device
;
unsigned
int
cpu
=
smp_processor_id
();
int
irq
=
allocate_irqno
();
if
(
irq
<
0
)
panic
(
"Can't allocate interrupt number for timer interrupt"
);
rt_timer_irq
=
irq
;
struct
clock_event_device
*
cd
=
&
per_cpu
(
hub_rt_clockevent
,
cpu
);
unsigned
char
*
name
=
per_cpu
(
hub_rt_name
,
cpu
);
int
irq
=
rt_timer_irq
;
sprintf
(
name
,
"hub-rt %d"
,
cpu
);
cd
->
name
=
"HUB-RT"
,
cd
->
features
=
CLOCK_EVT_FEAT_ONESHOT
,
clockevent_set_clock
(
cd
,
CYCLES_PER_SEC
);
cd
->
max_delta_ns
=
clockevent_delta2ns
(
0xfffffffffffff
,
cd
);
cd
->
min_delta_ns
=
clockevent_delta2ns
(
0x300
,
cd
);
cd
->
rating
=
200
,
cd
->
irq
=
irq
,
cd
->
cpumask
=
cpumask_of_cpu
(
cpu
),
/*
* Calculate the min / max delta
*/
cd
->
mult
=
div_sc
((
unsigned
long
)
CYCLES_PER_SEC
,
NSEC_PER_SEC
,
32
);
cd
->
shift
=
32
;
cd
->
max_delta_ns
=
clockevent_delta2ns
(
0x7fffffff
,
cd
);
cd
->
min_delta_ns
=
clockevent_delta2ns
(
0x300
,
cd
);
cd
->
rating
=
300
,
cd
->
set_next_event
=
rt_next_event
,
cd
->
set_mode
=
rt_set_mode
,
clockevents_register_device
(
cd
);
}
static
void
__init
hub_rt_clock_event_global_init
(
void
)
{
unsigned
int
irq
;
do
{
smp_wmb
();
irq
=
rt_timer_irq
;
if
(
irq
)
break
;
irq
=
allocate_irqno
();
if
(
irq
<
0
)
panic
(
"Allocation of irq number for timer failed"
);
}
while
(
xchg
(
&
rt_timer_irq
,
irq
));
set_irq_chip_and_handler
(
irq
,
&
rt_irq_type
,
handle_percpu_irq
);
setup_irq
(
irq
,
&
rt_irqaction
);
setup_irq
(
irq
,
&
hub_
rt_irqaction
);
}
static
cycle_t
hub_rt_read
(
void
)
...
...
@@ -233,27 +238,29 @@ static cycle_t hub_rt_read(void)
return
REMOTE_HUB_L
(
cputonasid
(
0
),
PI_RT_COUNT
);
}
struct
clocksource
h
t
_rt_clocksource
=
{
struct
clocksource
h
ub
_rt_clocksource
=
{
.
name
=
"HUB-RT"
,
.
rating
=
200
,
.
read
=
hub_rt_read
,
.
mask
=
CLOCKSOURCE_MASK
(
52
),
.
shift
=
32
,
.
flags
=
CLOCK_SOURCE_IS_CONTINUOUS
,
};
static
void
__init
ip27
_rt_clocksource_init
(
void
)
static
void
__init
hub
_rt_clocksource_init
(
void
)
{
clocksource_register
(
&
ht_rt_clocksource
);
struct
clocksource
*
cs
=
&
hub_rt_clocksource
;
clocksource_set_clock
(
cs
,
CYCLES_PER_SEC
);
clocksource_register
(
cs
);
}
void
__init
plat_time_init
(
void
)
{
ip27_rt_clock_event
_init
();
ip27_rt_clocksource
_init
();
hub_rt_clocksource
_init
();
hub_rt_clock_event_global
_init
();
}
void
__init
cpu_time_init
(
void
)
void
__
cpu
init
cpu_time_init
(
void
)
{
lboard_t
*
board
;
klcpu_t
*
cpu
;
...
...
@@ -271,6 +278,7 @@ void __init cpu_time_init(void)
printk
(
"CPU %d clock is %dMHz.
\n
"
,
smp_processor_id
(),
cpu
->
cpu_speed
);
hub_rt_clock_event_init
();
set_c0_status
(
SRB_TIMOCLK
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录