Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
raspberrypi-kernel
提交
41790e04
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看板
提交
41790e04
编写于
17年前
作者:
R
Ralf Baechle
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[MIPS] RP: Pass number of TCs available to RP program in $2.
Signed-off-by:
N
Ralf Baechle
<
ralf@linux-mips.org
>
上级
07cc0c9e
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
73 addition
and
9 deletion
+73
-9
arch/mips/kernel/vpe.c
arch/mips/kernel/vpe.c
+73
-9
未找到文件。
arch/mips/kernel/vpe.c
浏览文件 @
41790e04
...
...
@@ -64,6 +64,10 @@ typedef void *vpe_handle;
/* If this is set, the section belongs in the init part of the module */
#define INIT_OFFSET_MASK (1UL << (BITS_PER_LONG-1))
/*
* The number of TCs and VPEs physically available on the core
*/
static
int
hw_tcs
,
hw_vpes
;
static
char
module_name
[]
=
"vpe"
;
static
int
major
;
static
const
int
minor
=
1
;
/* fixed for now */
...
...
@@ -126,6 +130,8 @@ struct vpe {
/* the list of who wants to know when something major happens */
struct
list_head
notify
;
unsigned
int
ntcs
;
};
struct
tc
{
...
...
@@ -738,6 +744,7 @@ static int vpe_run(struct vpe * v)
* here... Or set $a3 to zero and define DFLT_STACK_SIZE and
* DFLT_HEAP_SIZE when you compile your program
*/
mttgpr
(
6
,
v
->
ntcs
);
mttgpr
(
7
,
physical_memsize
);
/* set up VPE1 */
...
...
@@ -1333,16 +1340,60 @@ static void kspd_sp_exit( int sp_id)
}
#endif
static
struct
device
*
vpe_dev
;
static
ssize_t
show_ntcs
(
struct
class_device
*
cd
,
char
*
buf
)
{
struct
vpe
*
vpe
=
get_vpe
(
tclimit
);
return
sprintf
(
buf
,
"%d
\n
"
,
vpe
->
ntcs
);
}
static
ssize_t
store_ntcs
(
struct
class_device
*
dev
,
const
char
*
buf
,
size_t
len
)
{
struct
vpe
*
vpe
=
get_vpe
(
tclimit
);
unsigned
long
new
;
char
*
endp
;
new
=
simple_strtoul
(
buf
,
&
endp
,
0
);
if
(
endp
==
buf
)
goto
out_einval
;
if
(
new
==
0
||
new
>
(
hw_tcs
-
tclimit
))
goto
out_einval
;
vpe
->
ntcs
=
new
;
return
len
;
out_einval:
return
-
EINVAL
;;
}
static
struct
class_device_attribute
vpe_class_attributes
[]
=
{
__ATTR
(
ntcs
,
S_IRUGO
|
S_IWUSR
,
show_ntcs
,
store_ntcs
),
{}
};
static
void
vpe_class_device_release
(
struct
class_device
*
cd
)
{
kfree
(
cd
);
}
struct
class
vpe_class
=
{
.
name
=
"vpe"
,
.
owner
=
THIS_MODULE
,
.
release
=
vpe_class_device_release
,
.
class_dev_attrs
=
vpe_class_attributes
,
};
struct
class_device
vpe_device
;
static
int
__init
vpe_module_init
(
void
)
{
unsigned
int
mtflags
,
vpflags
;
int
hw_tcs
,
hw_vpes
,
tc
,
err
=
0
;
unsigned
long
flags
,
val
;
struct
vpe
*
v
=
NULL
;
struct
device
*
dev
;
struct
tc
*
t
;
int
tc
,
err
;
if
(
!
cpu_has_mipsmt
)
{
printk
(
"VPE loader: not a MIPS MT capable processor
\n
"
);
...
...
@@ -1371,13 +1422,22 @@ static int __init vpe_module_init(void)
return
major
;
}
dev
=
device_create
(
mt_class
,
NULL
,
MKDEV
(
major
,
minor
),
"vpe%d"
,
minor
);
if
(
IS_ERR
(
dev
))
{
err
=
PTR_ERR
(
dev
);
err
=
class_register
(
&
vpe_class
);
if
(
err
)
{
printk
(
KERN_ERR
"vpe_class registration failed
\n
"
);
goto
out_chrdev
;
}
vpe_dev
=
dev
;
class_device_initialize
(
&
vpe_device
);
vpe_device
.
class
=
&
vpe_class
,
vpe_device
.
parent
=
NULL
,
strlcpy
(
vpe_device
.
class_id
,
"vpe1"
,
BUS_ID_SIZE
);
vpe_device
.
devt
=
MKDEV
(
major
,
minor
);
err
=
class_device_add
(
&
vpe_device
);
if
(
err
)
{
printk
(
KERN_ERR
"Adding vpe_device failed
\n
"
);
goto
out_class
;
}
local_irq_save
(
flags
);
mtflags
=
dmt
();
...
...
@@ -1422,6 +1482,8 @@ static int __init vpe_module_init(void)
goto
out_reenable
;
}
v
->
ntcs
=
hw_tcs
-
tclimit
;
/* add the tc to the list of this vpe's tc's. */
list_add
(
&
t
->
tc
,
&
v
->
tc
);
...
...
@@ -1497,6 +1559,8 @@ static int __init vpe_module_init(void)
#endif
return
0
;
out_class:
class_unregister
(
&
vpe_class
);
out_chrdev:
unregister_chrdev
(
major
,
module_name
);
...
...
@@ -1514,7 +1578,7 @@ static void __exit vpe_module_exit(void)
}
}
device_destroy
(
mt_class
,
MKDEV
(
major
,
minor
)
);
class_device_del
(
&
vpe_device
);
unregister_chrdev
(
major
,
module_name
);
}
...
...
This diff is collapsed.
Click to expand it.
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录
新手
引导
客服
返回
顶部