Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
a1bfb29a
cloud-kernel
项目概览
openanolis
/
cloud-kernel
1 年多 前同步成功
通知
161
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看板
提交
a1bfb29a
编写于
8月 20, 2015
作者:
B
Ben Skeggs
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
drm/nouveau/device: split user device implementation out on its own
Signed-off-by:
N
Ben Skeggs
<
bskeggs@redhat.com
>
上级
0ac9d210
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
254 addition
and
223 deletion
+254
-223
drivers/gpu/drm/nouveau/nvkm/engine/device/Kbuild
drivers/gpu/drm/nouveau/nvkm/engine/device/Kbuild
+2
-0
drivers/gpu/drm/nouveau/nvkm/engine/device/base.c
drivers/gpu/drm/nouveau/nvkm/engine/device/base.c
+3
-223
drivers/gpu/drm/nouveau/nvkm/engine/device/priv.h
drivers/gpu/drm/nouveau/nvkm/engine/device/priv.h
+2
-0
drivers/gpu/drm/nouveau/nvkm/engine/device/user.c
drivers/gpu/drm/nouveau/nvkm/engine/device/user.c
+247
-0
未找到文件。
drivers/gpu/drm/nouveau/nvkm/engine/device/Kbuild
浏览文件 @
a1bfb29a
nvkm-y += nvkm/engine/device/acpi.o
nvkm-y += nvkm/engine/device/base.o
nvkm-y += nvkm/engine/device/ctrl.o
nvkm-y += nvkm/engine/device/user.o
nvkm-y += nvkm/engine/device/nv04.o
nvkm-y += nvkm/engine/device/nv10.o
nvkm-y += nvkm/engine/device/nv20.o
...
...
drivers/gpu/drm/nouveau/nvkm/engine/device/base.c
浏览文件 @
a1bfb29a
...
...
@@ -24,16 +24,10 @@
#include "priv.h"
#include "acpi.h"
#include <core/client.h>
#include <core/option.h>
#include <core/notify.h>
#include <core/parent.h>
#include <subdev/bios.h>
#include <subdev/fb.h>
#include <subdev/instmem.h>
#include <core/option.h>
#include <nvif/class.h>
#include <nvif/unpack.h>
#include <subdev/bios.h>
static
DEFINE_MUTEX
(
nv_devices_mutex
);
static
LIST_HEAD
(
nv_devices
);
...
...
@@ -67,220 +61,6 @@ nvkm_device_list(u64 *name, int size)
return
nr
;
}
/******************************************************************************
* nvkm_devobj (0x0080): class implementation
*****************************************************************************/
struct
nvkm_devobj
{
struct
nvkm_parent
base
;
};
static
int
nvkm_devobj_info
(
struct
nvkm_object
*
object
,
void
*
data
,
u32
size
)
{
struct
nvkm_device
*
device
=
nv_device
(
object
);
struct
nvkm_fb
*
fb
=
nvkm_fb
(
device
);
struct
nvkm_instmem
*
imem
=
nvkm_instmem
(
device
);
union
{
struct
nv_device_info_v0
v0
;
}
*
args
=
data
;
int
ret
;
nvif_ioctl
(
object
,
"device info size %d
\n
"
,
size
);
if
(
nvif_unpack
(
args
->
v0
,
0
,
0
,
false
))
{
nvif_ioctl
(
object
,
"device info vers %d
\n
"
,
args
->
v0
.
version
);
}
else
return
ret
;
switch
(
device
->
chipset
)
{
case
0x01a
:
case
0x01f
:
case
0x04c
:
case
0x04e
:
case
0x063
:
case
0x067
:
case
0x068
:
case
0x0aa
:
case
0x0ac
:
case
0x0af
:
args
->
v0
.
platform
=
NV_DEVICE_INFO_V0_IGP
;
break
;
default:
if
(
device
->
pdev
)
{
if
(
pci_find_capability
(
device
->
pdev
,
PCI_CAP_ID_AGP
))
args
->
v0
.
platform
=
NV_DEVICE_INFO_V0_AGP
;
else
if
(
pci_is_pcie
(
device
->
pdev
))
args
->
v0
.
platform
=
NV_DEVICE_INFO_V0_PCIE
;
else
args
->
v0
.
platform
=
NV_DEVICE_INFO_V0_PCI
;
}
else
{
args
->
v0
.
platform
=
NV_DEVICE_INFO_V0_SOC
;
}
break
;
}
switch
(
device
->
card_type
)
{
case
NV_04
:
args
->
v0
.
family
=
NV_DEVICE_INFO_V0_TNT
;
break
;
case
NV_10
:
case
NV_11
:
args
->
v0
.
family
=
NV_DEVICE_INFO_V0_CELSIUS
;
break
;
case
NV_20
:
args
->
v0
.
family
=
NV_DEVICE_INFO_V0_KELVIN
;
break
;
case
NV_30
:
args
->
v0
.
family
=
NV_DEVICE_INFO_V0_RANKINE
;
break
;
case
NV_40
:
args
->
v0
.
family
=
NV_DEVICE_INFO_V0_CURIE
;
break
;
case
NV_50
:
args
->
v0
.
family
=
NV_DEVICE_INFO_V0_TESLA
;
break
;
case
NV_C0
:
args
->
v0
.
family
=
NV_DEVICE_INFO_V0_FERMI
;
break
;
case
NV_E0
:
args
->
v0
.
family
=
NV_DEVICE_INFO_V0_KEPLER
;
break
;
case
GM100
:
args
->
v0
.
family
=
NV_DEVICE_INFO_V0_MAXWELL
;
break
;
default:
args
->
v0
.
family
=
0
;
break
;
}
args
->
v0
.
chipset
=
device
->
chipset
;
args
->
v0
.
revision
=
device
->
chiprev
;
if
(
fb
&&
fb
->
ram
)
args
->
v0
.
ram_size
=
args
->
v0
.
ram_user
=
fb
->
ram
->
size
;
else
args
->
v0
.
ram_size
=
args
->
v0
.
ram_user
=
0
;
if
(
imem
&&
args
->
v0
.
ram_size
>
0
)
args
->
v0
.
ram_user
=
args
->
v0
.
ram_user
-
imem
->
reserved
;
return
0
;
}
static
int
nvkm_devobj_mthd
(
struct
nvkm_object
*
object
,
u32
mthd
,
void
*
data
,
u32
size
)
{
switch
(
mthd
)
{
case
NV_DEVICE_V0_INFO
:
return
nvkm_devobj_info
(
object
,
data
,
size
);
default:
break
;
}
return
-
EINVAL
;
}
static
u8
nvkm_devobj_rd08
(
struct
nvkm_object
*
object
,
u64
addr
)
{
return
nvkm_rd08
(
object
->
engine
->
subdev
.
device
,
addr
);
}
static
u16
nvkm_devobj_rd16
(
struct
nvkm_object
*
object
,
u64
addr
)
{
return
nvkm_rd16
(
object
->
engine
->
subdev
.
device
,
addr
);
}
static
u32
nvkm_devobj_rd32
(
struct
nvkm_object
*
object
,
u64
addr
)
{
return
nvkm_rd32
(
object
->
engine
->
subdev
.
device
,
addr
);
}
static
void
nvkm_devobj_wr08
(
struct
nvkm_object
*
object
,
u64
addr
,
u8
data
)
{
nvkm_wr08
(
object
->
engine
->
subdev
.
device
,
addr
,
data
);
}
static
void
nvkm_devobj_wr16
(
struct
nvkm_object
*
object
,
u64
addr
,
u16
data
)
{
nvkm_wr16
(
object
->
engine
->
subdev
.
device
,
addr
,
data
);
}
static
void
nvkm_devobj_wr32
(
struct
nvkm_object
*
object
,
u64
addr
,
u32
data
)
{
nvkm_wr32
(
object
->
engine
->
subdev
.
device
,
addr
,
data
);
}
static
int
nvkm_devobj_map
(
struct
nvkm_object
*
object
,
u64
*
addr
,
u32
*
size
)
{
struct
nvkm_device
*
device
=
nv_device
(
object
);
*
addr
=
nv_device_resource_start
(
device
,
0
);
*
size
=
nv_device_resource_len
(
device
,
0
);
return
0
;
}
static
struct
nvkm_oclass
nvkm_devobj_oclass_super
=
{
.
handle
=
NV_DEVICE
,
.
ofuncs
=
&
(
struct
nvkm_ofuncs
)
{
.
dtor
=
_nvkm_parent_dtor
,
.
init
=
_nvkm_parent_init
,
.
fini
=
_nvkm_parent_fini
,
.
mthd
=
nvkm_devobj_mthd
,
.
map
=
nvkm_devobj_map
,
.
rd08
=
nvkm_devobj_rd08
,
.
rd16
=
nvkm_devobj_rd16
,
.
rd32
=
nvkm_devobj_rd32
,
.
wr08
=
nvkm_devobj_wr08
,
.
wr16
=
nvkm_devobj_wr16
,
.
wr32
=
nvkm_devobj_wr32
,
}
};
static
int
nvkm_devobj_ctor
(
struct
nvkm_object
*
parent
,
struct
nvkm_object
*
engine
,
struct
nvkm_oclass
*
oclass
,
void
*
data
,
u32
size
,
struct
nvkm_object
**
pobject
)
{
union
{
struct
nv_device_v0
v0
;
}
*
args
=
data
;
struct
nvkm_client
*
client
=
nv_client
(
parent
);
struct
nvkm_device
*
device
;
struct
nvkm_devobj
*
devobj
;
int
ret
;
nvif_ioctl
(
parent
,
"create device size %d
\n
"
,
size
);
if
(
nvif_unpack
(
args
->
v0
,
0
,
0
,
false
))
{
nvif_ioctl
(
parent
,
"create device v%d device %016llx
\n
"
,
args
->
v0
.
version
,
args
->
v0
.
device
);
}
else
return
ret
;
/* give priviledged clients register access */
if
(
client
->
super
)
oclass
=
&
nvkm_devobj_oclass_super
;
/* find the device subdev that matches what the client requested */
device
=
client
->
device
;
if
(
args
->
v0
.
device
!=
~
0
)
{
device
=
nvkm_device_find
(
args
->
v0
.
device
);
if
(
!
device
)
return
-
ENODEV
;
}
ret
=
nvkm_parent_create
(
parent
,
nv_object
(
device
),
oclass
,
0
,
nvkm_control_oclass
,
(
1ULL
<<
NVDEV_ENGINE_DMAOBJ
)
|
(
1ULL
<<
NVDEV_ENGINE_FIFO
)
|
(
1ULL
<<
NVDEV_ENGINE_DISP
)
|
(
1ULL
<<
NVDEV_ENGINE_PM
),
&
devobj
);
*
pobject
=
nv_object
(
devobj
);
if
(
ret
)
return
ret
;
return
0
;
}
static
struct
nvkm_ofuncs
nvkm_devobj_ofuncs
=
{
.
ctor
=
nvkm_devobj_ctor
,
.
dtor
=
_nvkm_parent_dtor
,
.
init
=
_nvkm_parent_init
,
.
fini
=
_nvkm_parent_fini
,
.
mthd
=
nvkm_devobj_mthd
,
};
/******************************************************************************
* nvkm_device: engine functions
*****************************************************************************/
struct
nvkm_device
*
nv_device
(
void
*
obj
)
{
...
...
@@ -301,7 +81,7 @@ nv_device(void *obj)
static
struct
nvkm_oclass
nvkm_device_sclass
[]
=
{
{
0x0080
,
&
nvkm_
devobj
_ofuncs
},
{
0x0080
,
&
nvkm_
udevice
_ofuncs
},
{}
};
...
...
drivers/gpu/drm/nouveau/nvkm/engine/device/priv.h
浏览文件 @
a1bfb29a
...
...
@@ -13,4 +13,6 @@ int nv50_identify(struct nvkm_device *);
int
gf100_identify
(
struct
nvkm_device
*
);
int
gk104_identify
(
struct
nvkm_device
*
);
int
gm100_identify
(
struct
nvkm_device
*
);
extern
struct
nvkm_ofuncs
nvkm_udevice_ofuncs
;
#endif
drivers/gpu/drm/nouveau/nvkm/engine/device/user.c
0 → 100644
浏览文件 @
a1bfb29a
/*
* Copyright 2012 Red Hat Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Authors: Ben Skeggs
*/
#include "priv.h"
#include <core/client.h>
#include <subdev/fb.h>
#include <subdev/instmem.h>
#include <nvif/class.h>
#include <nvif/unpack.h>
struct
nvkm_udevice
{
struct
nvkm_parent
base
;
struct
nvkm_device
*
device
;
};
static
int
nvkm_udevice_info
(
struct
nvkm_object
*
object
,
void
*
data
,
u32
size
)
{
struct
nvkm_udevice
*
udev
=
(
void
*
)
object
;
struct
nvkm_device
*
device
=
udev
->
device
;
struct
nvkm_fb
*
fb
=
device
->
fb
;
struct
nvkm_instmem
*
imem
=
device
->
imem
;
union
{
struct
nv_device_info_v0
v0
;
}
*
args
=
data
;
int
ret
;
nvif_ioctl
(
object
,
"device info size %d
\n
"
,
size
);
if
(
nvif_unpack
(
args
->
v0
,
0
,
0
,
false
))
{
nvif_ioctl
(
object
,
"device info vers %d
\n
"
,
args
->
v0
.
version
);
}
else
return
ret
;
switch
(
device
->
chipset
)
{
case
0x01a
:
case
0x01f
:
case
0x04c
:
case
0x04e
:
case
0x063
:
case
0x067
:
case
0x068
:
case
0x0aa
:
case
0x0ac
:
case
0x0af
:
args
->
v0
.
platform
=
NV_DEVICE_INFO_V0_IGP
;
break
;
default:
if
(
device
->
pdev
)
{
if
(
pci_find_capability
(
device
->
pdev
,
PCI_CAP_ID_AGP
))
args
->
v0
.
platform
=
NV_DEVICE_INFO_V0_AGP
;
else
if
(
pci_is_pcie
(
device
->
pdev
))
args
->
v0
.
platform
=
NV_DEVICE_INFO_V0_PCIE
;
else
args
->
v0
.
platform
=
NV_DEVICE_INFO_V0_PCI
;
}
else
{
args
->
v0
.
platform
=
NV_DEVICE_INFO_V0_SOC
;
}
break
;
}
switch
(
device
->
card_type
)
{
case
NV_04
:
args
->
v0
.
family
=
NV_DEVICE_INFO_V0_TNT
;
break
;
case
NV_10
:
case
NV_11
:
args
->
v0
.
family
=
NV_DEVICE_INFO_V0_CELSIUS
;
break
;
case
NV_20
:
args
->
v0
.
family
=
NV_DEVICE_INFO_V0_KELVIN
;
break
;
case
NV_30
:
args
->
v0
.
family
=
NV_DEVICE_INFO_V0_RANKINE
;
break
;
case
NV_40
:
args
->
v0
.
family
=
NV_DEVICE_INFO_V0_CURIE
;
break
;
case
NV_50
:
args
->
v0
.
family
=
NV_DEVICE_INFO_V0_TESLA
;
break
;
case
NV_C0
:
args
->
v0
.
family
=
NV_DEVICE_INFO_V0_FERMI
;
break
;
case
NV_E0
:
args
->
v0
.
family
=
NV_DEVICE_INFO_V0_KEPLER
;
break
;
case
GM100
:
args
->
v0
.
family
=
NV_DEVICE_INFO_V0_MAXWELL
;
break
;
default:
args
->
v0
.
family
=
0
;
break
;
}
args
->
v0
.
chipset
=
device
->
chipset
;
args
->
v0
.
revision
=
device
->
chiprev
;
if
(
fb
&&
fb
->
ram
)
args
->
v0
.
ram_size
=
args
->
v0
.
ram_user
=
fb
->
ram
->
size
;
else
args
->
v0
.
ram_size
=
args
->
v0
.
ram_user
=
0
;
if
(
imem
&&
args
->
v0
.
ram_size
>
0
)
args
->
v0
.
ram_user
=
args
->
v0
.
ram_user
-
imem
->
reserved
;
return
0
;
}
static
int
nvkm_udevice_mthd
(
struct
nvkm_object
*
object
,
u32
mthd
,
void
*
data
,
u32
size
)
{
switch
(
mthd
)
{
case
NV_DEVICE_V0_INFO
:
return
nvkm_udevice_info
(
object
,
data
,
size
);
default:
break
;
}
return
-
EINVAL
;
}
static
u8
nvkm_udevice_rd08
(
struct
nvkm_object
*
object
,
u64
addr
)
{
struct
nvkm_udevice
*
udev
=
(
void
*
)
object
;
return
nvkm_rd08
(
udev
->
device
,
addr
);
}
static
u16
nvkm_udevice_rd16
(
struct
nvkm_object
*
object
,
u64
addr
)
{
struct
nvkm_udevice
*
udev
=
(
void
*
)
object
;
return
nvkm_rd16
(
udev
->
device
,
addr
);
}
static
u32
nvkm_udevice_rd32
(
struct
nvkm_object
*
object
,
u64
addr
)
{
struct
nvkm_udevice
*
udev
=
(
void
*
)
object
;
return
nvkm_rd32
(
udev
->
device
,
addr
);
}
static
void
nvkm_udevice_wr08
(
struct
nvkm_object
*
object
,
u64
addr
,
u8
data
)
{
struct
nvkm_udevice
*
udev
=
(
void
*
)
object
;
nvkm_wr08
(
udev
->
device
,
addr
,
data
);
}
static
void
nvkm_udevice_wr16
(
struct
nvkm_object
*
object
,
u64
addr
,
u16
data
)
{
struct
nvkm_udevice
*
udev
=
(
void
*
)
object
;
nvkm_wr16
(
udev
->
device
,
addr
,
data
);
}
static
void
nvkm_udevice_wr32
(
struct
nvkm_object
*
object
,
u64
addr
,
u32
data
)
{
struct
nvkm_udevice
*
udev
=
(
void
*
)
object
;
nvkm_wr32
(
udev
->
device
,
addr
,
data
);
}
static
int
nvkm_udevice_map
(
struct
nvkm_object
*
object
,
u64
*
addr
,
u32
*
size
)
{
struct
nvkm_udevice
*
udev
=
(
void
*
)
object
;
struct
nvkm_device
*
device
=
udev
->
device
;
*
addr
=
nv_device_resource_start
(
device
,
0
);
*
size
=
nv_device_resource_len
(
device
,
0
);
return
0
;
}
static
struct
nvkm_oclass
nvkm_udevice_oclass_super
=
{
.
handle
=
NV_DEVICE
,
.
ofuncs
=
&
(
struct
nvkm_ofuncs
)
{
.
dtor
=
_nvkm_parent_dtor
,
.
init
=
_nvkm_parent_init
,
.
fini
=
_nvkm_parent_fini
,
.
mthd
=
nvkm_udevice_mthd
,
.
map
=
nvkm_udevice_map
,
.
rd08
=
nvkm_udevice_rd08
,
.
rd16
=
nvkm_udevice_rd16
,
.
rd32
=
nvkm_udevice_rd32
,
.
wr08
=
nvkm_udevice_wr08
,
.
wr16
=
nvkm_udevice_wr16
,
.
wr32
=
nvkm_udevice_wr32
,
}
};
static
int
nvkm_udevice_ctor
(
struct
nvkm_object
*
parent
,
struct
nvkm_object
*
engine
,
struct
nvkm_oclass
*
oclass
,
void
*
data
,
u32
size
,
struct
nvkm_object
**
pobject
)
{
union
{
struct
nv_device_v0
v0
;
}
*
args
=
data
;
struct
nvkm_client
*
client
=
nvkm_client
(
parent
);
struct
nvkm_device
*
device
;
struct
nvkm_udevice
*
udev
;
int
ret
;
nvif_ioctl
(
parent
,
"create device size %d
\n
"
,
size
);
if
(
nvif_unpack
(
args
->
v0
,
0
,
0
,
false
))
{
nvif_ioctl
(
parent
,
"create device v%d device %016llx
\n
"
,
args
->
v0
.
version
,
args
->
v0
.
device
);
}
else
return
ret
;
/* give priviledged clients register access */
if
(
client
->
super
)
oclass
=
&
nvkm_udevice_oclass_super
;
/* find the device subdev that matches what the client requested */
device
=
client
->
device
;
if
(
args
->
v0
.
device
!=
~
0
)
{
device
=
nvkm_device_find
(
args
->
v0
.
device
);
if
(
!
device
)
return
-
ENODEV
;
}
ret
=
nvkm_parent_create
(
parent
,
nv_object
(
device
),
oclass
,
0
,
nvkm_control_oclass
,
(
1ULL
<<
NVDEV_ENGINE_DMAOBJ
)
|
(
1ULL
<<
NVDEV_ENGINE_FIFO
)
|
(
1ULL
<<
NVDEV_ENGINE_DISP
)
|
(
1ULL
<<
NVDEV_ENGINE_PM
),
&
udev
);
*
pobject
=
nv_object
(
udev
);
if
(
ret
)
return
ret
;
udev
->
device
=
device
;
return
0
;
}
struct
nvkm_ofuncs
nvkm_udevice_ofuncs
=
{
.
ctor
=
nvkm_udevice_ctor
,
.
dtor
=
_nvkm_parent_dtor
,
.
init
=
_nvkm_parent_init
,
.
fini
=
_nvkm_parent_fini
,
.
mthd
=
nvkm_udevice_mthd
,
};
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录