Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
raspberrypi-kernel
提交
cfdc4c44
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看板
提交
cfdc4c44
编写于
8月 20, 2015
作者:
B
Ben Skeggs
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
drm/nouveau/core: wrap direct use of object accessor functions
Signed-off-by:
N
Ben Skeggs
<
bskeggs@redhat.com
>
上级
572fb13d
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
97 addition
and
38 deletion
+97
-38
drivers/gpu/drm/nouveau/include/nvkm/core/object.h
drivers/gpu/drm/nouveau/include/nvkm/core/object.h
+7
-0
drivers/gpu/drm/nouveau/nvkm/core/ioctl.c
drivers/gpu/drm/nouveau/nvkm/core/ioctl.c
+21
-38
drivers/gpu/drm/nouveau/nvkm/core/object.c
drivers/gpu/drm/nouveau/nvkm/core/object.c
+69
-0
未找到文件。
drivers/gpu/drm/nouveau/include/nvkm/core/object.h
浏览文件 @
cfdc4c44
...
...
@@ -26,6 +26,13 @@ struct nvkm_object {
#endif
};
int
nvkm_object_rd08
(
struct
nvkm_object
*
,
u64
addr
,
u8
*
data
);
int
nvkm_object_rd16
(
struct
nvkm_object
*
,
u64
addr
,
u16
*
data
);
int
nvkm_object_rd32
(
struct
nvkm_object
*
,
u64
addr
,
u32
*
data
);
int
nvkm_object_wr08
(
struct
nvkm_object
*
,
u64
addr
,
u8
data
);
int
nvkm_object_wr16
(
struct
nvkm_object
*
,
u64
addr
,
u16
data
);
int
nvkm_object_wr32
(
struct
nvkm_object
*
,
u64
addr
,
u32
data
);
static
inline
struct
nvkm_object
*
nv_object
(
void
*
obj
)
{
...
...
drivers/gpu/drm/nouveau/nvkm/core/ioctl.c
浏览文件 @
cfdc4c44
...
...
@@ -224,10 +224,14 @@ static int
nvkm_ioctl_rd
(
struct
nvkm_handle
*
handle
,
void
*
data
,
u32
size
)
{
struct
nvkm_object
*
object
=
handle
->
object
;
struct
nvkm_ofuncs
*
ofuncs
=
object
->
oclass
->
ofuncs
;
union
{
struct
nvif_ioctl_rd_v0
v0
;
}
*
args
=
data
;
union
{
u8
b08
;
u16
b16
;
u32
b32
;
}
v
;
int
ret
;
nvif_ioctl
(
object
,
"rd size %d
\n
"
,
size
);
...
...
@@ -236,22 +240,16 @@ nvkm_ioctl_rd(struct nvkm_handle *handle, void *data, u32 size)
args
->
v0
.
version
,
args
->
v0
.
size
,
args
->
v0
.
addr
);
switch
(
args
->
v0
.
size
)
{
case
1
:
if
(
ret
=
-
ENODEV
,
ofuncs
->
rd08
)
{
args
->
v0
.
data
=
nv_ro08
(
object
,
args
->
v0
.
addr
);
ret
=
0
;
}
ret
=
nvkm_object_rd08
(
object
,
args
->
v0
.
addr
,
&
v
.
b08
);
args
->
v0
.
data
=
v
.
b08
;
break
;
case
2
:
if
(
ret
=
-
ENODEV
,
ofuncs
->
rd16
)
{
args
->
v0
.
data
=
nv_ro16
(
object
,
args
->
v0
.
addr
);
ret
=
0
;
}
ret
=
nvkm_object_rd16
(
object
,
args
->
v0
.
addr
,
&
v
.
b16
);
args
->
v0
.
data
=
v
.
b16
;
break
;
case
4
:
if
(
ret
=
-
ENODEV
,
ofuncs
->
rd32
)
{
args
->
v0
.
data
=
nv_ro32
(
object
,
args
->
v0
.
addr
);
ret
=
0
;
}
ret
=
nvkm_object_rd32
(
object
,
args
->
v0
.
addr
,
&
v
.
b32
);
args
->
v0
.
data
=
v
.
b32
;
break
;
default:
ret
=
-
EINVAL
;
...
...
@@ -266,7 +264,6 @@ static int
nvkm_ioctl_wr
(
struct
nvkm_handle
*
handle
,
void
*
data
,
u32
size
)
{
struct
nvkm_object
*
object
=
handle
->
object
;
struct
nvkm_ofuncs
*
ofuncs
=
object
->
oclass
->
ofuncs
;
union
{
struct
nvif_ioctl_wr_v0
v0
;
}
*
args
=
data
;
...
...
@@ -278,32 +275,18 @@ nvkm_ioctl_wr(struct nvkm_handle *handle, void *data, u32 size)
"wr vers %d size %d addr %016llx data %08x
\n
"
,
args
->
v0
.
version
,
args
->
v0
.
size
,
args
->
v0
.
addr
,
args
->
v0
.
data
);
switch
(
args
->
v0
.
size
)
{
case
1
:
if
(
ret
=
-
ENODEV
,
ofuncs
->
wr08
)
{
nv_wo08
(
object
,
args
->
v0
.
addr
,
args
->
v0
.
data
);
ret
=
0
;
}
break
;
case
2
:
if
(
ret
=
-
ENODEV
,
ofuncs
->
wr16
)
{
nv_wo16
(
object
,
args
->
v0
.
addr
,
args
->
v0
.
data
);
ret
=
0
;
}
break
;
case
4
:
if
(
ret
=
-
ENODEV
,
ofuncs
->
wr32
)
{
nv_wo32
(
object
,
args
->
v0
.
addr
,
args
->
v0
.
data
);
ret
=
0
;
}
break
;
default:
ret
=
-
EINVAL
;
break
;
}
}
else
return
ret
;
switch
(
args
->
v0
.
size
)
{
case
1
:
return
nvkm_object_wr08
(
object
,
args
->
v0
.
addr
,
args
->
v0
.
data
);
case
2
:
return
nvkm_object_wr16
(
object
,
args
->
v0
.
addr
,
args
->
v0
.
data
);
case
4
:
return
nvkm_object_wr32
(
object
,
args
->
v0
.
addr
,
args
->
v0
.
data
);
default:
break
;
}
return
ret
;
return
-
EINVAL
;
}
static
int
...
...
drivers/gpu/drm/nouveau/nvkm/core/object.c
浏览文件 @
cfdc4c44
...
...
@@ -24,6 +24,75 @@
#include <core/object.h>
#include <core/engine.h>
int
nvkm_object_rd08
(
struct
nvkm_object
*
object
,
u64
addr
,
u8
*
data
)
{
const
struct
nvkm_oclass
*
oclass
=
object
->
oclass
;
if
(
oclass
->
ofuncs
&&
oclass
->
ofuncs
->
rd08
)
{
*
data
=
oclass
->
ofuncs
->
rd08
(
object
,
addr
);
return
0
;
}
*
data
=
0x00
;
return
-
ENODEV
;
}
int
nvkm_object_rd16
(
struct
nvkm_object
*
object
,
u64
addr
,
u16
*
data
)
{
const
struct
nvkm_oclass
*
oclass
=
object
->
oclass
;
if
(
oclass
->
ofuncs
&&
oclass
->
ofuncs
->
rd16
)
{
*
data
=
oclass
->
ofuncs
->
rd16
(
object
,
addr
);
return
0
;
}
*
data
=
0x0000
;
return
-
ENODEV
;
}
int
nvkm_object_rd32
(
struct
nvkm_object
*
object
,
u64
addr
,
u32
*
data
)
{
const
struct
nvkm_oclass
*
oclass
=
object
->
oclass
;
if
(
oclass
->
ofuncs
&&
oclass
->
ofuncs
->
rd32
)
{
*
data
=
oclass
->
ofuncs
->
rd32
(
object
,
addr
);
return
0
;
}
*
data
=
0x0000
;
return
-
ENODEV
;
}
int
nvkm_object_wr08
(
struct
nvkm_object
*
object
,
u64
addr
,
u8
data
)
{
const
struct
nvkm_oclass
*
oclass
=
object
->
oclass
;
if
(
oclass
->
ofuncs
&&
oclass
->
ofuncs
->
wr08
)
{
oclass
->
ofuncs
->
wr08
(
object
,
addr
,
data
);
return
0
;
}
return
-
ENODEV
;
}
int
nvkm_object_wr16
(
struct
nvkm_object
*
object
,
u64
addr
,
u16
data
)
{
const
struct
nvkm_oclass
*
oclass
=
object
->
oclass
;
if
(
oclass
->
ofuncs
&&
oclass
->
ofuncs
->
wr16
)
{
oclass
->
ofuncs
->
wr16
(
object
,
addr
,
data
);
return
0
;
}
return
-
ENODEV
;
}
int
nvkm_object_wr32
(
struct
nvkm_object
*
object
,
u64
addr
,
u32
data
)
{
const
struct
nvkm_oclass
*
oclass
=
object
->
oclass
;
if
(
oclass
->
ofuncs
&&
oclass
->
ofuncs
->
wr32
)
{
oclass
->
ofuncs
->
wr32
(
object
,
addr
,
data
);
return
0
;
}
return
-
ENODEV
;
}
int
nvkm_object_create_
(
struct
nvkm_object
*
parent
,
struct
nvkm_object
*
engine
,
struct
nvkm_oclass
*
oclass
,
u32
pclass
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录