2 * Copyright 2015 Red Hat Inc.
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:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
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.
24 #include <engine/ce.h>
26 #include <core/engctx.h>
28 /*******************************************************************************
30 ******************************************************************************/
32 static struct nvkm_oclass
34 { 0xb0b5, &nvkm_object_ofuncs },
38 /*******************************************************************************
40 ******************************************************************************/
42 static struct nvkm_ofuncs
43 gm204_ce_context_ofuncs = {
44 .ctor = _nvkm_engctx_ctor,
45 .dtor = _nvkm_engctx_dtor,
46 .init = _nvkm_engctx_init,
47 .fini = _nvkm_engctx_fini,
48 .rd32 = _nvkm_engctx_rd32,
49 .wr32 = _nvkm_engctx_wr32,
52 static struct nvkm_oclass
54 .handle = NV_ENGCTX(CE0, 0x24),
55 .ofuncs = &gm204_ce_context_ofuncs,
58 /*******************************************************************************
59 * PCE engine/subdev functions
60 ******************************************************************************/
63 gm204_ce_intr(struct nvkm_subdev *subdev)
65 const int idx = nv_subidx(subdev) - NVDEV_ENGINE_CE0;
66 struct nvkm_engine *ce = (void *)subdev;
67 u32 stat = nv_rd32(ce, 0x104908 + (idx * 0x1000));
70 nv_warn(ce, "unhandled intr 0x%08x\n", stat);
71 nv_wr32(ce, 0x104908 + (idx * 0x1000), stat);
76 gm204_ce0_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
77 struct nvkm_oclass *oclass, void *data, u32 size,
78 struct nvkm_object **pobject)
80 struct nvkm_engine *ce;
83 ret = nvkm_engine_create(parent, engine, oclass, true,
85 *pobject = nv_object(ce);
89 nv_subdev(ce)->unit = 0x00000040;
90 nv_subdev(ce)->intr = gm204_ce_intr;
91 nv_engine(ce)->cclass = &gm204_ce_cclass;
92 nv_engine(ce)->sclass = gm204_ce_sclass;
97 gm204_ce1_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
98 struct nvkm_oclass *oclass, void *data, u32 size,
99 struct nvkm_object **pobject)
101 struct nvkm_engine *ce;
104 ret = nvkm_engine_create(parent, engine, oclass, true,
106 *pobject = nv_object(ce);
110 nv_subdev(ce)->unit = 0x00000080;
111 nv_subdev(ce)->intr = gm204_ce_intr;
112 nv_engine(ce)->cclass = &gm204_ce_cclass;
113 nv_engine(ce)->sclass = gm204_ce_sclass;
118 gm204_ce2_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
119 struct nvkm_oclass *oclass, void *data, u32 size,
120 struct nvkm_object **pobject)
122 struct nvkm_engine *ce;
125 ret = nvkm_engine_create(parent, engine, oclass, true,
127 *pobject = nv_object(ce);
131 nv_subdev(ce)->unit = 0x00200000;
132 nv_subdev(ce)->intr = gm204_ce_intr;
133 nv_engine(ce)->cclass = &gm204_ce_cclass;
134 nv_engine(ce)->sclass = gm204_ce_sclass;
140 .handle = NV_ENGINE(CE0, 0x24),
141 .ofuncs = &(struct nvkm_ofuncs) {
142 .ctor = gm204_ce0_ctor,
143 .dtor = _nvkm_engine_dtor,
144 .init = _nvkm_engine_init,
145 .fini = _nvkm_engine_fini,
151 .handle = NV_ENGINE(CE1, 0x24),
152 .ofuncs = &(struct nvkm_ofuncs) {
153 .ctor = gm204_ce1_ctor,
154 .dtor = _nvkm_engine_dtor,
155 .init = _nvkm_engine_init,
156 .fini = _nvkm_engine_fini,
162 .handle = NV_ENGINE(CE2, 0x24),
163 .ofuncs = &(struct nvkm_ofuncs) {
164 .ctor = gm204_ce2_ctor,
165 .dtor = _nvkm_engine_dtor,
166 .init = _nvkm_engine_init,
167 .fini = _nvkm_engine_fini,