Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
6760d28b
K
Kernel
项目概览
openeuler
/
Kernel
大约 1 年 前同步成功
通知
5
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
6760d28b
编写于
6月 21, 2006
作者:
D
David S. Miller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[SPARC64]: Convert sun4v virtual-device layer to in-kernel PROM device tree.
Signed-off-by:
N
David S. Miller
<
davem@davemloft.net
>
上级
27cc64c7
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
56 addition
and
88 deletion
+56
-88
arch/sparc64/kernel/devices.c
arch/sparc64/kernel/devices.c
+35
-69
drivers/serial/sunhv.c
drivers/serial/sunhv.c
+18
-17
include/asm-sparc64/vdev.h
include/asm-sparc64/vdev.h
+3
-2
未找到文件。
arch/sparc64/kernel/devices.c
浏览文件 @
6760d28b
...
...
@@ -33,7 +33,7 @@ extern void cpu_probe(void);
extern
void
central_probe
(
void
);
u32
sun4v_vdev_devhandle
;
int
sun4v_vdev_root
;
struct
device_node
*
sun4v_vdev_root
;
struct
vdev_intmap
{
unsigned
int
phys
;
...
...
@@ -50,102 +50,68 @@ struct vdev_intmask {
static
struct
vdev_intmap
*
vdev_intmap
;
static
int
vdev_num_intmap
;
static
struct
vdev_intmask
vdev_intmask
;
static
struct
vdev_intmask
*
vdev_intmask
;
static
void
__init
sun4v_virtual_device_probe
(
void
)
{
struct
linux_prom64_registers
regs
;
struct
vdev_intmap
*
ip
;
int
node
,
sz
,
err
;
struct
linux_prom64_registers
*
regs
;
struct
property
*
prop
;
struct
device_node
*
dp
;
int
sz
;
if
(
tlb_type
!=
hypervisor
)
return
;
node
=
prom_getchild
(
prom_root_node
);
node
=
prom_searchsiblings
(
node
,
"virtual-devices"
);
if
(
!
node
)
{
dp
=
of_find_node_by_name
(
NULL
,
"virtual-devices"
);
if
(
!
dp
)
{
prom_printf
(
"SUN4V: Fatal error, no virtual-devices node.
\n
"
);
prom_halt
();
}
sun4v_vdev_root
=
node
;
sun4v_vdev_root
=
dp
;
prom_getproperty
(
node
,
"reg"
,
(
char
*
)
&
regs
,
sizeof
(
regs
));
sun4v_vdev_devhandle
=
(
regs
.
phys_addr
>>
32UL
)
&
0x0fffffff
;
prop
=
of_find_property
(
dp
,
"reg"
,
NULL
);
regs
=
prop
->
value
;
sun4v_vdev_devhandle
=
(
regs
[
0
].
phys_addr
>>
32UL
)
&
0x0fffffff
;
sz
=
prom_getproplen
(
node
,
"interrupt-map"
);
if
(
sz
<=
0
)
{
prom_printf
(
"SUN4V: Error, no vdev interrupt-map.
\n
"
);
prom_halt
();
}
if
((
sz
%
sizeof
(
*
ip
))
!=
0
)
{
prom_printf
(
"SUN4V: Bogus interrupt-map property size %d
\n
"
,
sz
);
prom_halt
();
}
vdev_intmap
=
ip
=
alloc_bootmem_low_pages
(
sz
);
if
(
!
vdev_intmap
)
{
prom_printf
(
"SUN4V: Error, cannot allocate vdev_intmap.
\n
"
);
prom_halt
();
}
err
=
prom_getproperty
(
node
,
"interrupt-map"
,
(
char
*
)
ip
,
sz
);
if
(
err
==
-
1
)
{
prom_printf
(
"SUN4V: Fatal error, no vdev interrupt-map.
\n
"
);
prom_halt
();
}
if
(
err
!=
sz
)
{
prom_printf
(
"SUN4V: Inconsistent interrupt-map size, "
"proplen(%d) vs getprop(%d).
\n
"
,
sz
,
err
);
prom_halt
();
}
vdev_num_intmap
=
err
/
sizeof
(
*
ip
);
prop
=
of_find_property
(
dp
,
"interrupt-map"
,
&
sz
);
vdev_intmap
=
prop
->
value
;
vdev_num_intmap
=
sz
/
sizeof
(
struct
vdev_intmap
);
err
=
prom_getproperty
(
node
,
"interrupt-map-mask"
,
(
char
*
)
&
vdev_intmask
,
sizeof
(
vdev_intmask
));
if
(
err
<=
0
)
{
prom_printf
(
"SUN4V: Fatal error, no vdev "
"interrupt-map-mask.
\n
"
);
prom_halt
();
}
if
(
err
%
sizeof
(
vdev_intmask
))
{
prom_printf
(
"SUN4V: Bogus interrupt-map-mask "
"property size %d
\n
"
,
err
);
prom_halt
();
}
prop
=
of_find_property
(
dp
,
"interrupt-map-mask"
,
NULL
);
vdev_intmask
=
prop
->
value
;
printk
(
"
SUN4V: virtual-device
s devhandle[%x]
\n
"
,
sun4v_vdev_devhandle
);
printk
(
"
%s: Virtual Device Bu
s devhandle[%x]
\n
"
,
dp
->
full_name
,
sun4v_vdev_devhandle
);
}
unsigned
int
sun4v_vdev_device_interrupt
(
unsigned
int
dev_node
)
unsigned
int
sun4v_vdev_device_interrupt
(
struct
device_node
*
dev_node
)
{
struct
property
*
prop
;
unsigned
int
irq
,
reg
;
int
err
,
i
;
int
i
;
err
=
prom_getproperty
(
dev_node
,
"interrupts"
,
(
char
*
)
&
irq
,
sizeof
(
irq
));
if
(
err
<=
0
)
{
prop
=
of_find_property
(
dev_node
,
"interrupts"
,
NULL
);
if
(
!
prop
)
{
printk
(
"VDEV: Cannot get
\"
interrupts
\"
"
"property for OBP node %x
\n
"
,
dev_node
);
"property for OBP node %s
\n
"
,
dev_node
->
full_name
);
return
0
;
}
irq
=
*
(
unsigned
int
*
)
prop
->
value
;
err
=
prom_getproperty
(
dev_node
,
"reg"
,
(
char
*
)
&
reg
,
sizeof
(
reg
));
if
(
err
<=
0
)
{
prop
=
of_find_property
(
dev_node
,
"reg"
,
NULL
);
if
(
!
prop
)
{
printk
(
"VDEV: Cannot get
\"
reg
\"
"
"property for OBP node %x
\n
"
,
dev_node
);
"property for OBP node %s
\n
"
,
dev_node
->
full_name
);
return
0
;
}
reg
=
*
(
unsigned
int
*
)
prop
->
value
;
for
(
i
=
0
;
i
<
vdev_num_intmap
;
i
++
)
{
if
(
vdev_intmap
[
i
].
phys
==
(
reg
&
vdev_intmask
.
phys
)
&&
vdev_intmap
[
i
].
irq
==
(
irq
&
vdev_intmask
.
interrupt
))
{
if
(
vdev_intmap
[
i
].
phys
==
(
reg
&
vdev_intmask
->
phys
)
&&
vdev_intmap
[
i
].
irq
==
(
irq
&
vdev_intmask
->
interrupt
))
{
irq
=
vdev_intmap
[
i
].
cinterrupt
;
break
;
}
...
...
@@ -153,7 +119,7 @@ unsigned int sun4v_vdev_device_interrupt(unsigned int dev_node)
if
(
i
==
vdev_num_intmap
)
{
printk
(
"VDEV: No matching interrupt map entry "
"for OBP node %
x
\n
"
,
dev_nod
e
);
"for OBP node %
s
\n
"
,
dev_node
->
full_nam
e
);
return
0
;
}
...
...
drivers/serial/sunhv.c
浏览文件 @
6760d28b
...
...
@@ -427,31 +427,32 @@ static int __init hv_console_compatible(char *buf, int len)
static
unsigned
int
__init
get_interrupt
(
void
)
{
const
char
*
cons_str
=
"console"
;
const
char
*
compat_str
=
"compatible"
;
int
node
=
prom_getchild
(
sun4v_vdev_root
);
char
buf
[
64
];
int
err
,
len
;
node
=
prom_searchsiblings
(
node
,
cons_str
);
if
(
!
node
)
return
0
;
struct
device_node
*
dev_node
;
len
=
prom_getproplen
(
node
,
compat_str
)
;
if
(
len
==
0
||
len
==
-
1
)
return
0
;
dev_node
=
sun4v_vdev_root
->
child
;
while
(
dev_node
!=
NULL
)
{
struct
property
*
prop
;
err
=
prom_getproperty
(
node
,
compat_str
,
buf
,
64
);
if
(
err
==
-
1
)
return
0
;
if
(
strcmp
(
dev_node
->
name
,
"console"
))
goto
next_sibling
;
prop
=
of_find_property
(
dev_node
,
"compatible"
,
NULL
);
if
(
!
prop
)
goto
next_sibling
;
if
(
!
hv_console_compatible
(
buf
,
len
))
if
(
hv_console_compatible
(
prop
->
value
,
prop
->
length
))
break
;
next_sibling:
dev_node
=
dev_node
->
sibling
;
}
if
(
!
dev_node
)
return
0
;
/* Ok, the this is the OBP node for the sun4v hypervisor
* console device. Decode the interrupt.
*/
return
sun4v_vdev_device_interrupt
(
node
);
return
sun4v_vdev_device_interrupt
(
dev_
node
);
}
static
int
__init
sunhv_init
(
void
)
...
...
include/asm-sparc64/vdev.h
浏览文件 @
6760d28b
...
...
@@ -7,10 +7,11 @@
#define _SPARC64_VDEV_H
#include <linux/types.h>
#include <asm/prom.h>
extern
u32
sun4v_vdev_devhandle
;
extern
int
sun4v_vdev_root
;
extern
struct
device_node
*
sun4v_vdev_root
;
extern
unsigned
int
sun4v_vdev_device_interrupt
(
unsigned
int
);
extern
unsigned
int
sun4v_vdev_device_interrupt
(
struct
device_node
*
dev_node
);
#endif
/* !(_SPARC64_VDEV_H) */
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录