Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
529d0e40
cloud-kernel
项目概览
openanolis
/
cloud-kernel
11 个月 前同步成功
通知
150
Star
36
Fork
7
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
10
列表
看板
标记
里程碑
合并请求
2
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
cloud-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
10
Issue
10
列表
看板
标记
里程碑
合并请求
2
合并请求
2
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
529d0e40
编写于
8月 15, 2008
作者:
I
Ingo Molnar
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'x86/geode' into x86/urgent
上级
66d4bdf2
0d5cdc97
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
39 addition
and
16 deletion
+39
-16
arch/x86/kernel/mfgpt_32.c
arch/x86/kernel/mfgpt_32.c
+37
-15
include/asm-x86/geode.h
include/asm-x86/geode.h
+2
-1
未找到文件。
arch/x86/kernel/mfgpt_32.c
浏览文件 @
529d0e40
...
...
@@ -33,6 +33,8 @@
#include <linux/module.h>
#include <asm/geode.h>
#define MFGPT_DEFAULT_IRQ 7
static
struct
mfgpt_timer_t
{
unsigned
int
avail
:
1
;
}
mfgpt_timers
[
MFGPT_MAX_TIMERS
];
...
...
@@ -157,29 +159,48 @@ int geode_mfgpt_toggle_event(int timer, int cmp, int event, int enable)
}
EXPORT_SYMBOL_GPL
(
geode_mfgpt_toggle_event
);
int
geode_mfgpt_set_irq
(
int
timer
,
int
cmp
,
int
irq
,
int
enable
)
int
geode_mfgpt_set_irq
(
int
timer
,
int
cmp
,
int
*
irq
,
int
enable
)
{
u32
val
,
dummy
;
int
offse
t
;
u32
zsel
,
lpc
,
dummy
;
int
shif
t
;
if
(
timer
<
0
||
timer
>=
MFGPT_MAX_TIMERS
)
return
-
EIO
;
if
(
geode_mfgpt_toggle_event
(
timer
,
cmp
,
MFGPT_EVENT_IRQ
,
enable
))
/*
* Unfortunately, MFGPTs come in pairs sharing their IRQ lines. If VSA
* is using the same CMP of the timer's Siamese twin, the IRQ is set to
* 2, and we mustn't use nor change it.
* XXX: Likewise, 2 Linux drivers might clash if the 2nd overwrites the
* IRQ of the 1st. This can only happen if forcing an IRQ, calling this
* with *irq==0 is safe. Currently there _are_ no 2 drivers.
*/
rdmsr
(
MSR_PIC_ZSEL_LOW
,
zsel
,
dummy
);
shift
=
((
cmp
==
MFGPT_CMP1
?
0
:
4
)
+
timer
%
4
)
*
4
;
if
(((
zsel
>>
shift
)
&
0xF
)
==
2
)
return
-
EIO
;
rdmsr
(
MSR_PIC_ZSEL_LOW
,
val
,
dummy
);
/* Choose IRQ: if none supplied, keep IRQ already set or use default */
if
(
!*
irq
)
*
irq
=
(
zsel
>>
shift
)
&
0xF
;
if
(
!*
irq
)
*
irq
=
MFGPT_DEFAULT_IRQ
;
offset
=
(
timer
%
4
)
*
4
;
val
&=
~
((
0xF
<<
offset
)
|
(
0xF
<<
(
offset
+
16
)));
/* Can't use IRQ if it's 0 (=disabled), 2, or routed to LPC */
if
(
*
irq
<
1
||
*
irq
==
2
||
*
irq
>
15
)
return
-
EIO
;
rdmsr
(
MSR_PIC_IRQM_LPC
,
lpc
,
dummy
);
if
(
lpc
&
(
1
<<
*
irq
))
return
-
EIO
;
/* All chosen and checked - go for it */
if
(
geode_mfgpt_toggle_event
(
timer
,
cmp
,
MFGPT_EVENT_IRQ
,
enable
))
return
-
EIO
;
if
(
enable
)
{
val
|=
(
irq
&
0x0F
)
<<
(
offse
t
);
val
|=
(
irq
&
0x0F
)
<<
(
offset
+
16
);
zsel
=
(
zsel
&
~
(
0xF
<<
shift
))
|
(
*
irq
<<
shif
t
);
wrmsr
(
MSR_PIC_ZSEL_LOW
,
zsel
,
dummy
);
}
wrmsr
(
MSR_PIC_ZSEL_LOW
,
val
,
dummy
);
return
0
;
}
...
...
@@ -242,7 +263,7 @@ EXPORT_SYMBOL_GPL(geode_mfgpt_alloc_timer);
static
unsigned
int
mfgpt_tick_mode
=
CLOCK_EVT_MODE_SHUTDOWN
;
static
u16
mfgpt_event_clock
;
static
int
irq
=
7
;
static
int
irq
;
static
int
__init
mfgpt_setup
(
char
*
str
)
{
get_option
(
&
str
,
&
irq
);
...
...
@@ -346,7 +367,7 @@ int __init mfgpt_timer_setup(void)
mfgpt_event_clock
=
timer
;
/* Set up the IRQ on the MFGPT side */
if
(
geode_mfgpt_setup_irq
(
mfgpt_event_clock
,
MFGPT_CMP2
,
irq
))
{
if
(
geode_mfgpt_setup_irq
(
mfgpt_event_clock
,
MFGPT_CMP2
,
&
irq
))
{
printk
(
KERN_ERR
"mfgpt-timer: Could not set up IRQ %d
\n
"
,
irq
);
return
-
EIO
;
}
...
...
@@ -374,13 +395,14 @@ int __init mfgpt_timer_setup(void)
&
mfgpt_clockevent
);
printk
(
KERN_INFO
"mfgpt-timer: registering the MFGPT timer as a clock event.
\n
"
);
"mfgpt-timer: Registering MFGPT timer %d as a clock event, using IRQ %d
\n
"
,
timer
,
irq
);
clockevents_register_device
(
&
mfgpt_clockevent
);
return
0
;
err:
geode_mfgpt_release_irq
(
mfgpt_event_clock
,
MFGPT_CMP2
,
irq
);
geode_mfgpt_release_irq
(
mfgpt_event_clock
,
MFGPT_CMP2
,
&
irq
);
printk
(
KERN_ERR
"mfgpt-timer: Unable to set up the MFGPT clock source
\n
"
);
return
-
EIO
;
...
...
include/asm-x86/geode.h
浏览文件 @
529d0e40
...
...
@@ -50,6 +50,7 @@ extern int geode_get_dev_base(unsigned int dev);
#define MSR_PIC_YSEL_HIGH 0x51400021
#define MSR_PIC_ZSEL_LOW 0x51400022
#define MSR_PIC_ZSEL_HIGH 0x51400023
#define MSR_PIC_IRQM_LPC 0x51400025
#define MSR_MFGPT_IRQ 0x51400028
#define MSR_MFGPT_NR 0x51400029
...
...
@@ -237,7 +238,7 @@ static inline u16 geode_mfgpt_read(int timer, u16 reg)
}
extern
int
geode_mfgpt_toggle_event
(
int
timer
,
int
cmp
,
int
event
,
int
enable
);
extern
int
geode_mfgpt_set_irq
(
int
timer
,
int
cmp
,
int
irq
,
int
enable
);
extern
int
geode_mfgpt_set_irq
(
int
timer
,
int
cmp
,
int
*
irq
,
int
enable
);
extern
int
geode_mfgpt_alloc_timer
(
int
timer
,
int
domain
);
#define geode_mfgpt_setup_irq(t, c, i) geode_mfgpt_set_irq((t), (c), (i), 1)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录