diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2015-03-10 22:24:45 -0400 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2015-04-14 03:00:56 -0400 |
commit | b44881e453246d73bd419bd69e9ec67d923216f0 (patch) | |
tree | b6a9152f6d719c3fa0efddba8ac00251156ebe35 | |
parent | a1020afe88146ece4c1ae77c59b201e030116142 (diff) |
drm/nouveau/ce/gm204: initial support
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
-rw-r--r-- | drivers/gpu/drm/nouveau/include/nvkm/engine/ce.h | 3 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nvkm/engine/ce/Kbuild | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nvkm/engine/ce/gm204.c | 173 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nvkm/engine/device/gm100.c | 2 |
4 files changed, 178 insertions, 1 deletions
diff --git a/drivers/gpu/drm/nouveau/include/nvkm/engine/ce.h b/drivers/gpu/drm/nouveau/include/nvkm/engine/ce.h index 7e29c52617ea..e832f729e1b4 100644 --- a/drivers/gpu/drm/nouveau/include/nvkm/engine/ce.h +++ b/drivers/gpu/drm/nouveau/include/nvkm/engine/ce.h | |||
@@ -10,4 +10,7 @@ extern struct nvkm_oclass gf100_ce1_oclass; | |||
10 | extern struct nvkm_oclass gk104_ce0_oclass; | 10 | extern struct nvkm_oclass gk104_ce0_oclass; |
11 | extern struct nvkm_oclass gk104_ce1_oclass; | 11 | extern struct nvkm_oclass gk104_ce1_oclass; |
12 | extern struct nvkm_oclass gk104_ce2_oclass; | 12 | extern struct nvkm_oclass gk104_ce2_oclass; |
13 | extern struct nvkm_oclass gm204_ce0_oclass; | ||
14 | extern struct nvkm_oclass gm204_ce1_oclass; | ||
15 | extern struct nvkm_oclass gm204_ce2_oclass; | ||
13 | #endif | 16 | #endif |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/ce/Kbuild b/drivers/gpu/drm/nouveau/nvkm/engine/ce/Kbuild index 858797453e0b..fa8cda7058cd 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/ce/Kbuild +++ b/drivers/gpu/drm/nouveau/nvkm/engine/ce/Kbuild | |||
@@ -1,3 +1,4 @@ | |||
1 | nvkm-y += nvkm/engine/ce/gt215.o | 1 | nvkm-y += nvkm/engine/ce/gt215.o |
2 | nvkm-y += nvkm/engine/ce/gf100.o | 2 | nvkm-y += nvkm/engine/ce/gf100.o |
3 | nvkm-y += nvkm/engine/ce/gk104.o | 3 | nvkm-y += nvkm/engine/ce/gk104.o |
4 | nvkm-y += nvkm/engine/ce/gm204.o | ||
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/ce/gm204.c b/drivers/gpu/drm/nouveau/nvkm/engine/ce/gm204.c new file mode 100644 index 000000000000..577eb2eead05 --- /dev/null +++ b/drivers/gpu/drm/nouveau/nvkm/engine/ce/gm204.c | |||
@@ -0,0 +1,173 @@ | |||
1 | /* | ||
2 | * Copyright 2015 Red Hat Inc. | ||
3 | * | ||
4 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
5 | * copy of this software and associated documentation files (the "Software"), | ||
6 | * to deal in the Software without restriction, including without limitation | ||
7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
8 | * and/or sell copies of the Software, and to permit persons to whom the | ||
9 | * Software is furnished to do so, subject to the following conditions: | ||
10 | * | ||
11 | * The above copyright notice and this permission notice shall be included in | ||
12 | * all copies or substantial portions of the Software. | ||
13 | * | ||
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
17 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR | ||
18 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | ||
19 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
20 | * OTHER DEALINGS IN THE SOFTWARE. | ||
21 | * | ||
22 | * Authors: Ben Skeggs | ||
23 | */ | ||
24 | #include <engine/ce.h> | ||
25 | |||
26 | #include <core/engctx.h> | ||
27 | |||
28 | struct gm204_ce_priv { | ||
29 | struct nvkm_engine base; | ||
30 | }; | ||
31 | |||
32 | /******************************************************************************* | ||
33 | * Copy object classes | ||
34 | ******************************************************************************/ | ||
35 | |||
36 | static struct nvkm_oclass | ||
37 | gm204_ce_sclass[] = { | ||
38 | { 0xb0b5, &nvkm_object_ofuncs }, | ||
39 | {}, | ||
40 | }; | ||
41 | |||
42 | /******************************************************************************* | ||
43 | * PCE context | ||
44 | ******************************************************************************/ | ||
45 | |||
46 | static struct nvkm_ofuncs | ||
47 | gm204_ce_context_ofuncs = { | ||
48 | .ctor = _nvkm_engctx_ctor, | ||
49 | .dtor = _nvkm_engctx_dtor, | ||
50 | .init = _nvkm_engctx_init, | ||
51 | .fini = _nvkm_engctx_fini, | ||
52 | .rd32 = _nvkm_engctx_rd32, | ||
53 | .wr32 = _nvkm_engctx_wr32, | ||
54 | }; | ||
55 | |||
56 | static struct nvkm_oclass | ||
57 | gm204_ce_cclass = { | ||
58 | .handle = NV_ENGCTX(CE0, 0x24), | ||
59 | .ofuncs = &gm204_ce_context_ofuncs, | ||
60 | }; | ||
61 | |||
62 | /******************************************************************************* | ||
63 | * PCE engine/subdev functions | ||
64 | ******************************************************************************/ | ||
65 | |||
66 | static void | ||
67 | gm204_ce_intr(struct nvkm_subdev *subdev) | ||
68 | { | ||
69 | const int ce = nv_subidx(subdev) - NVDEV_ENGINE_CE0; | ||
70 | struct gm204_ce_priv *priv = (void *)subdev; | ||
71 | u32 stat = nv_rd32(priv, 0x104908 + (ce * 0x1000)); | ||
72 | |||
73 | if (stat) { | ||
74 | nv_warn(priv, "unhandled intr 0x%08x\n", stat); | ||
75 | nv_wr32(priv, 0x104908 + (ce * 0x1000), stat); | ||
76 | } | ||
77 | } | ||
78 | |||
79 | static int | ||
80 | gm204_ce0_ctor(struct nvkm_object *parent, struct nvkm_object *engine, | ||
81 | struct nvkm_oclass *oclass, void *data, u32 size, | ||
82 | struct nvkm_object **pobject) | ||
83 | { | ||
84 | struct gm204_ce_priv *priv; | ||
85 | int ret; | ||
86 | |||
87 | ret = nvkm_engine_create(parent, engine, oclass, true, | ||
88 | "PCE0", "ce0", &priv); | ||
89 | *pobject = nv_object(priv); | ||
90 | if (ret) | ||
91 | return ret; | ||
92 | |||
93 | nv_subdev(priv)->unit = 0x00000040; | ||
94 | nv_subdev(priv)->intr = gm204_ce_intr; | ||
95 | nv_engine(priv)->cclass = &gm204_ce_cclass; | ||
96 | nv_engine(priv)->sclass = gm204_ce_sclass; | ||
97 | return 0; | ||
98 | } | ||
99 | |||
100 | static int | ||
101 | gm204_ce1_ctor(struct nvkm_object *parent, struct nvkm_object *engine, | ||
102 | struct nvkm_oclass *oclass, void *data, u32 size, | ||
103 | struct nvkm_object **pobject) | ||
104 | { | ||
105 | struct gm204_ce_priv *priv; | ||
106 | int ret; | ||
107 | |||
108 | ret = nvkm_engine_create(parent, engine, oclass, true, | ||
109 | "PCE1", "ce1", &priv); | ||
110 | *pobject = nv_object(priv); | ||
111 | if (ret) | ||
112 | return ret; | ||
113 | |||
114 | nv_subdev(priv)->unit = 0x00000080; | ||
115 | nv_subdev(priv)->intr = gm204_ce_intr; | ||
116 | nv_engine(priv)->cclass = &gm204_ce_cclass; | ||
117 | nv_engine(priv)->sclass = gm204_ce_sclass; | ||
118 | return 0; | ||
119 | } | ||
120 | |||
121 | static int | ||
122 | gm204_ce2_ctor(struct nvkm_object *parent, struct nvkm_object *engine, | ||
123 | struct nvkm_oclass *oclass, void *data, u32 size, | ||
124 | struct nvkm_object **pobject) | ||
125 | { | ||
126 | struct gm204_ce_priv *priv; | ||
127 | int ret; | ||
128 | |||
129 | ret = nvkm_engine_create(parent, engine, oclass, true, | ||
130 | "PCE2", "ce2", &priv); | ||
131 | *pobject = nv_object(priv); | ||
132 | if (ret) | ||
133 | return ret; | ||
134 | |||
135 | nv_subdev(priv)->unit = 0x00200000; | ||
136 | nv_subdev(priv)->intr = gm204_ce_intr; | ||
137 | nv_engine(priv)->cclass = &gm204_ce_cclass; | ||
138 | nv_engine(priv)->sclass = gm204_ce_sclass; | ||
139 | return 0; | ||
140 | } | ||
141 | |||
142 | struct nvkm_oclass | ||
143 | gm204_ce0_oclass = { | ||
144 | .handle = NV_ENGINE(CE0, 0x24), | ||
145 | .ofuncs = &(struct nvkm_ofuncs) { | ||
146 | .ctor = gm204_ce0_ctor, | ||
147 | .dtor = _nvkm_engine_dtor, | ||
148 | .init = _nvkm_engine_init, | ||
149 | .fini = _nvkm_engine_fini, | ||
150 | }, | ||
151 | }; | ||
152 | |||
153 | struct nvkm_oclass | ||
154 | gm204_ce1_oclass = { | ||
155 | .handle = NV_ENGINE(CE1, 0x24), | ||
156 | .ofuncs = &(struct nvkm_ofuncs) { | ||
157 | .ctor = gm204_ce1_ctor, | ||
158 | .dtor = _nvkm_engine_dtor, | ||
159 | .init = _nvkm_engine_init, | ||
160 | .fini = _nvkm_engine_fini, | ||
161 | }, | ||
162 | }; | ||
163 | |||
164 | struct nvkm_oclass | ||
165 | gm204_ce2_oclass = { | ||
166 | .handle = NV_ENGINE(CE2, 0x24), | ||
167 | .ofuncs = &(struct nvkm_ofuncs) { | ||
168 | .ctor = gm204_ce2_ctor, | ||
169 | .dtor = _nvkm_engine_dtor, | ||
170 | .init = _nvkm_engine_init, | ||
171 | .fini = _nvkm_engine_fini, | ||
172 | }, | ||
173 | }; | ||
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/device/gm100.c b/drivers/gpu/drm/nouveau/nvkm/engine/device/gm100.c index 7f4248271915..b66b1c6d5b25 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/device/gm100.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/device/gm100.c | |||
@@ -133,10 +133,10 @@ gm100_identify(struct nvkm_device *device) | |||
133 | device->oclass[NVDEV_ENGINE_GR ] = gm107_gr_oclass; | 133 | device->oclass[NVDEV_ENGINE_GR ] = gm107_gr_oclass; |
134 | #endif | 134 | #endif |
135 | device->oclass[NVDEV_ENGINE_DISP ] = gm204_disp_oclass; | 135 | device->oclass[NVDEV_ENGINE_DISP ] = gm204_disp_oclass; |
136 | #if 0 | ||
137 | device->oclass[NVDEV_ENGINE_CE0 ] = &gm204_ce0_oclass; | 136 | device->oclass[NVDEV_ENGINE_CE0 ] = &gm204_ce0_oclass; |
138 | device->oclass[NVDEV_ENGINE_CE1 ] = &gm204_ce1_oclass; | 137 | device->oclass[NVDEV_ENGINE_CE1 ] = &gm204_ce1_oclass; |
139 | device->oclass[NVDEV_ENGINE_CE2 ] = &gm204_ce2_oclass; | 138 | device->oclass[NVDEV_ENGINE_CE2 ] = &gm204_ce2_oclass; |
139 | #if 0 | ||
140 | device->oclass[NVDEV_ENGINE_MSVLD ] = &gk104_msvld_oclass; | 140 | device->oclass[NVDEV_ENGINE_MSVLD ] = &gk104_msvld_oclass; |
141 | device->oclass[NVDEV_ENGINE_MSPDEC ] = &gk104_mspdec_oclass; | 141 | device->oclass[NVDEV_ENGINE_MSPDEC ] = &gk104_mspdec_oclass; |
142 | device->oclass[NVDEV_ENGINE_MSPPP ] = &gf100_msppp_oclass; | 142 | device->oclass[NVDEV_ENGINE_MSPPP ] = &gf100_msppp_oclass; |