Commit 19fef52d authored by Ben Skeggs's avatar Ben Skeggs

drm/nouveau/dma: split user classes out from engine implementations

Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent 0e29998a
......@@ -133,7 +133,7 @@ struct nvkm_device {
struct nvkm_engine *ce[3];
struct nvkm_engine *cipher;
struct nvkm_disp *disp;
struct nvkm_dmaeng *dma;
struct nvkm_dma *dma;
struct nvkm_fifo *fifo;
struct nvkm_gr *gr;
struct nvkm_engine *ifb;
......@@ -193,7 +193,7 @@ struct nvkm_device_chip {
int (*ce[3] )(struct nvkm_device *, int idx, struct nvkm_engine **);
int (*cipher )(struct nvkm_device *, int idx, struct nvkm_engine **);
int (*disp )(struct nvkm_device *, int idx, struct nvkm_disp **);
int (*dma )(struct nvkm_device *, int idx, struct nvkm_dmaeng **);
int (*dma )(struct nvkm_device *, int idx, struct nvkm_dma **);
int (*fifo )(struct nvkm_device *, int idx, struct nvkm_fifo **);
int (*gr )(struct nvkm_device *, int idx, struct nvkm_gr **);
int (*ifb )(struct nvkm_device *, int idx, struct nvkm_engine **);
......
#ifndef __NVKM_DMAOBJ_H__
#define __NVKM_DMAOBJ_H__
#ifndef __NVKM_DMA_H__
#define __NVKM_DMA_H__
#include <core/engine.h>
struct nvkm_gpuobj;
......@@ -11,7 +11,7 @@ struct nvkm_dmaobj {
u64 limit;
};
struct nvkm_dmaeng {
struct nvkm_dma {
struct nvkm_engine engine;
/* creates a "physical" dma object from a struct nvkm_dmaobj */
......
......@@ -6,7 +6,7 @@ include $(src)/nvkm/engine/ce/Kbuild
include $(src)/nvkm/engine/cipher/Kbuild
include $(src)/nvkm/engine/device/Kbuild
include $(src)/nvkm/engine/disp/Kbuild
include $(src)/nvkm/engine/dmaobj/Kbuild
include $(src)/nvkm/engine/dma/Kbuild
include $(src)/nvkm/engine/fifo/Kbuild
include $(src)/nvkm/engine/gr/Kbuild
include $(src)/nvkm/engine/mpeg/Kbuild
......
......@@ -26,7 +26,7 @@
#include <engine/ce.h>
#include <engine/cipher.h>
#include <engine/disp.h>
#include <engine/dmaobj.h>
#include <engine/dma.h>
#include <engine/fifo.h>
#include <engine/gr.h>
#include <engine/mpeg.h>
......
......@@ -30,10 +30,6 @@
#include <subdev/fb.h>
#include <subdev/instmem.h>
#include <subdev/timer.h>
#include <engine/disp.h>
#include <engine/dmaobj.h>
#include <engine/fifo.h>
#include <engine/pm.h>
#include <nvif/class.h>
#include <nvif/unpack.h>
......
......@@ -30,7 +30,7 @@
#include <core/enum.h>
#include <core/handle.h>
#include <core/ramht.h>
#include <engine/dmaobj.h>
#include <engine/dma.h>
#include <subdev/bios.h>
#include <subdev/bios/dcb.h>
#include <subdev/bios/disp.h>
......
nvkm-y += nvkm/engine/dma/base.o
nvkm-y += nvkm/engine/dma/nv04.o
nvkm-y += nvkm/engine/dma/nv50.o
nvkm-y += nvkm/engine/dma/gf100.o
nvkm-y += nvkm/engine/dma/gf110.o
nvkm-y += nvkm/engine/dma/user.o
nvkm-y += nvkm/engine/dma/usernv04.o
nvkm-y += nvkm/engine/dma/usernv50.o
nvkm-y += nvkm/engine/dma/usergf100.o
nvkm-y += nvkm/engine/dma/usergf110.o
/*
* 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 <core/gpuobj.h>
struct hack {
struct nvkm_gpuobj object;
struct nvkm_gpuobj *parent;
};
static void
dtor(struct nvkm_object *object)
{
struct hack *hack = (void *)object;
nvkm_gpuobj_del(&hack->parent);
nvkm_object_destroy(&hack->object.object);
}
static struct nvkm_oclass
hack = {
.handle = NV_GPUOBJ_CLASS,
.ofuncs = &(struct nvkm_ofuncs) {
.dtor = dtor,
.init = _nvkm_object_init,
.fini = _nvkm_object_fini,
},
};
static int
nvkm_dmaobj_bind(struct nvkm_dmaobj *dmaobj, struct nvkm_gpuobj *pargpu,
struct nvkm_gpuobj **pgpuobj)
{
const struct nvkm_dma_impl *impl = (void *)
nv_oclass(nv_object(dmaobj)->engine);
int ret = 0;
if (&dmaobj->base == &pargpu->object) { /* ctor bind */
struct nvkm_object *parent = (void *)pargpu;
struct hack *object;
if (parent->parent->parent == &nvkm_client(parent)->object) {
/* delayed, or no, binding */
return 0;
}
pargpu = (void *)nv_pclass((void *)pargpu, NV_GPUOBJ_CLASS);
ret = nvkm_object_create(parent, NULL, &hack, NV_GPUOBJ_CLASS, &object);
if (ret == 0) {
nvkm_object_ref(NULL, &parent);
*pgpuobj = &object->object;
ret = impl->bind(dmaobj, pargpu, &object->parent);
if (ret)
return ret;
object->object.node = object->parent->node;
object->object.addr = object->parent->addr;
object->object.size = object->parent->size;
return 0;
}
return ret;
}
return impl->bind(dmaobj, pargpu, pgpuobj);
}
int
_nvkm_dma_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
struct nvkm_oclass *oclass, void *data, u32 size,
struct nvkm_object **pobject)
{
const struct nvkm_dma_impl *impl = (void *)oclass;
struct nvkm_dma *dmaeng;
int ret;
ret = nvkm_engine_create(parent, engine, oclass, true, "DMAOBJ",
"dmaobj", &dmaeng);
*pobject = nv_object(dmaeng);
if (ret)
return ret;
nv_engine(dmaeng)->sclass = impl->sclass;
dmaeng->bind = nvkm_dmaobj_bind;
return 0;
}
/*
* 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 "user.h"
struct nvkm_oclass *
gf100_dmaeng_oclass = &(struct nvkm_dma_impl) {
.base.handle = NV_ENGINE(DMAOBJ, 0xc0),
.base.ofuncs = &(struct nvkm_ofuncs) {
.ctor = _nvkm_dma_ctor,
.dtor = _nvkm_dma_dtor,
.init = _nvkm_dma_init,
.fini = _nvkm_dma_fini,
},
.sclass = gf100_dmaeng_sclass,
.bind = gf100_dmaobj_bind,
}.base;
/*
* 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 "user.h"
struct nvkm_oclass *
gf110_dmaeng_oclass = &(struct nvkm_dma_impl) {
.base.handle = NV_ENGINE(DMAOBJ, 0xd0),
.base.ofuncs = &(struct nvkm_ofuncs) {
.ctor = _nvkm_dma_ctor,
.dtor = _nvkm_dma_dtor,
.init = _nvkm_dma_init,
.fini = _nvkm_dma_fini,
},
.sclass = gf110_dmaeng_sclass,
.bind = gf110_dmaobj_bind,
}.base;
/*
* 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 "user.h"
struct nvkm_oclass *
nv04_dmaeng_oclass = &(struct nvkm_dma_impl) {
.base.handle = NV_ENGINE(DMAOBJ, 0x04),
.base.ofuncs = &(struct nvkm_ofuncs) {
.ctor = _nvkm_dma_ctor,
.dtor = _nvkm_dma_dtor,
.init = _nvkm_dma_init,
.fini = _nvkm_dma_fini,
},
.sclass = nv04_dmaeng_sclass,
.bind = nv04_dmaobj_bind,
}.base;
/*
* 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 "user.h"
struct nvkm_oclass *
nv50_dmaeng_oclass = &(struct nvkm_dma_impl) {
.base.handle = NV_ENGINE(DMAOBJ, 0x50),
.base.ofuncs = &(struct nvkm_ofuncs) {
.ctor = _nvkm_dma_ctor,
.dtor = _nvkm_dma_dtor,
.init = _nvkm_dma_init,
.fini = _nvkm_dma_fini,
},
.sclass = nv50_dmaeng_sclass,
.bind = nv50_dmaobj_bind,
}.base;
#ifndef __NVKM_DMA_PRIV_H__
#define __NVKM_DMA_PRIV_H__
#include <engine/dma.h>
int _nvkm_dma_ctor(struct nvkm_object *, struct nvkm_object *,
struct nvkm_oclass *, void *, u32,
struct nvkm_object **);
#define _nvkm_dma_dtor _nvkm_engine_dtor
#define _nvkm_dma_init _nvkm_engine_init
#define _nvkm_dma_fini _nvkm_engine_fini
struct nvkm_dma_impl {
struct nvkm_oclass base;
struct nvkm_oclass *sclass;
int (*bind)(struct nvkm_dmaobj *, struct nvkm_gpuobj *,
struct nvkm_gpuobj **);
};
#endif
......@@ -21,79 +21,15 @@
*
* Authors: Ben Skeggs
*/
#include "priv.h"
#include "user.h"
#include <core/client.h>
#include <core/gpuobj.h>
#include <subdev/fb.h>
#include <subdev/instmem.h>
#include <nvif/class.h>
#include <nvif/unpack.h>
struct hack {
struct nvkm_gpuobj object;
struct nvkm_gpuobj *parent;
};
static void
dtor(struct nvkm_object *object)
{
struct hack *hack = (void *)object;
nvkm_gpuobj_del(&hack->parent);
nvkm_object_destroy(&hack->object.object);
}
static struct nvkm_oclass
hack = {
.handle = NV_GPUOBJ_CLASS,
.ofuncs = &(struct nvkm_ofuncs) {
.dtor = dtor,
.init = _nvkm_object_init,
.fini = _nvkm_object_fini,
},
};
static int
nvkm_dmaobj_bind(struct nvkm_dmaobj *dmaobj, struct nvkm_gpuobj *pargpu,
struct nvkm_gpuobj **pgpuobj)
{
const struct nvkm_dmaeng_impl *impl = (void *)
nv_oclass(nv_object(dmaobj)->engine);
int ret = 0;
if (&dmaobj->base == &pargpu->object) { /* ctor bind */
struct nvkm_object *parent = (void *)pargpu;
struct hack *object;
if (parent->parent->parent == &nvkm_client(parent)->object) {
/* delayed, or no, binding */
return 0;
}
pargpu = (void *)nv_pclass((void *)pargpu, NV_GPUOBJ_CLASS);
ret = nvkm_object_create(parent, NULL, &hack, NV_GPUOBJ_CLASS, &object);
if (ret == 0) {
nvkm_object_ref(NULL, &parent);
*pgpuobj = &object->object;
ret = impl->bind(dmaobj, pargpu, &object->parent);
if (ret)
return ret;
object->object.node = object->parent->node;
object->object.addr = object->parent->addr;
object->object.size = object->parent->size;
return 0;
}
return ret;
}
return impl->bind(dmaobj, pargpu, pgpuobj);
}
int
nvkm_dmaobj_create_(struct nvkm_object *parent,
struct nvkm_object *engine,
......@@ -183,23 +119,3 @@ nvkm_dmaobj_create_(struct nvkm_object *parent,
return ret;
}
int
_nvkm_dmaeng_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
struct nvkm_oclass *oclass, void *data, u32 size,
struct nvkm_object **pobject)
{
const struct nvkm_dmaeng_impl *impl = (void *)oclass;
struct nvkm_dmaeng *dmaeng;
int ret;
ret = nvkm_engine_create(parent, engine, oclass, true, "DMAOBJ",
"dmaobj", &dmaeng);
*pobject = nv_object(dmaeng);
if (ret)
return ret;
nv_engine(dmaeng)->sclass = impl->sclass;
dmaeng->bind = nvkm_dmaobj_bind;
return 0;
}
#ifndef __NVKM_DMAOBJ_PRIV_H__
#define __NVKM_DMAOBJ_PRIV_H__
#include <engine/dmaobj.h>
#ifndef __NVKM_DMA_USER_H__
#define __NVKM_DMA_USER_H__
#include "priv.h"
#define nvkm_dmaobj_create(p,e,c,pa,sa,d) \
nvkm_dmaobj_create_((p), (e), (c), (pa), (sa), sizeof(**d), (void **)d)
......@@ -12,17 +12,18 @@ int nvkm_dmaobj_create_(struct nvkm_object *, struct nvkm_object *,
#define _nvkm_dmaobj_init _nvkm_object_init
#define _nvkm_dmaobj_fini _nvkm_object_fini
int _nvkm_dmaeng_ctor(struct nvkm_object *, struct nvkm_object *,
struct nvkm_oclass *, void *, u32,
struct nvkm_object **);
#define _nvkm_dmaeng_dtor _nvkm_engine_dtor
#define _nvkm_dmaeng_init _nvkm_engine_init
#define _nvkm_dmaeng_fini _nvkm_engine_fini
extern struct nvkm_oclass nv04_dmaeng_sclass[];
extern struct nvkm_oclass nv50_dmaeng_sclass[];
extern struct nvkm_oclass gf100_dmaeng_sclass[];
extern struct nvkm_oclass gf110_dmaeng_sclass[];
int nv04_dmaobj_bind(struct nvkm_dmaobj *, struct nvkm_gpuobj *,
struct nvkm_gpuobj **);
int nv50_dmaobj_bind(struct nvkm_dmaobj *, struct nvkm_gpuobj *,
struct nvkm_gpuobj **);
int gf100_dmaobj_bind(struct nvkm_dmaobj *, struct nvkm_gpuobj *,
struct nvkm_gpuobj **);
int gf110_dmaobj_bind(struct nvkm_dmaobj *, struct nvkm_gpuobj *,
struct nvkm_gpuobj **);
struct nvkm_dmaeng_impl {
struct nvkm_oclass base;
struct nvkm_oclass *sclass;
int (*bind)(struct nvkm_dmaobj *, struct nvkm_gpuobj *,
struct nvkm_gpuobj **);
};
#endif
......@@ -21,7 +21,7 @@
*
* Authors: Ben Skeggs
*/
#include "priv.h"
#include "user.h"
#include <core/client.h>
#include <core/gpuobj.h>
......@@ -36,7 +36,7 @@ struct gf100_dmaobj {
u32 flags5;
};
static int
int
gf100_dmaobj_bind(struct nvkm_dmaobj *obj, struct nvkm_gpuobj *parent,
struct nvkm_gpuobj **pgpuobj)
{
......@@ -65,7 +65,7 @@ gf100_dmaobj_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
struct nvkm_oclass *oclass, void *data, u32 size,
struct nvkm_object **pobject)
{
struct nvkm_dmaeng *dmaeng = (void *)engine;
struct nvkm_dma *dmaeng = (void *)engine;
union {
struct gf100_dma_v0 v0;
} *args;
......@@ -146,23 +146,10 @@ gf100_dmaobj_ofuncs = {
.fini = _nvkm_dmaobj_fini,
};
static struct nvkm_oclass
struct nvkm_oclass
gf100_dmaeng_sclass[] = {
{ NV_DMA_FROM_MEMORY, &gf100_dmaobj_ofuncs },
{ NV_DMA_TO_MEMORY, &gf100_dmaobj_ofuncs },
{ NV_DMA_IN_MEMORY, &gf100_dmaobj_ofuncs },
{}
};
struct nvkm_oclass *
gf100_dmaeng_oclass = &(struct nvkm_dmaeng_impl) {
.base.handle = NV_ENGINE(DMAOBJ, 0xc0),
.base.ofuncs = &(struct nvkm_ofuncs) {
.ctor = _nvkm_dmaeng_ctor,
.dtor = _nvkm_dmaeng_dtor,
.init = _nvkm_dmaeng_init,
.fini = _nvkm_dmaeng_fini,
},
.sclass = gf100_dmaeng_sclass,
.bind = gf100_dmaobj_bind,
}.base;
......@@ -21,7 +21,7 @@
*
* Authors: Ben Skeggs
*/
#include "priv.h"
#include "user.h"
#include <core/client.h>
#include <core/gpuobj.h>
......@@ -35,7 +35,7 @@ struct gf110_dmaobj {
u32 flags0;
};
static int
int
gf110_dmaobj_bind(struct nvkm_dmaobj *obj, struct nvkm_gpuobj *parent,
struct nvkm_gpuobj **pgpuobj)
{
......@@ -63,7 +63,7 @@ gf110_dmaobj_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
struct nvkm_oclass *oclass, void *data, u32 size,
struct nvkm_object **pobject)
{
struct nvkm_dmaeng *dmaeng = (void *)engine;
struct nvkm_dma *dmaeng = (void *)engine;
union {
struct gf110_dma_v0 v0;
} *args;
......@@ -128,23 +128,10 @@ gf110_dmaobj_ofuncs = {
.fini = _nvkm_dmaobj_fini,
};
static struct nvkm_oclass
struct nvkm_oclass
gf110_dmaeng_sclass[] = {
{ NV_DMA_FROM_MEMORY, &gf110_dmaobj_ofuncs },
{ NV_DMA_TO_MEMORY, &gf110_dmaobj_ofuncs },
{ NV_DMA_IN_MEMORY, &gf110_dmaobj_ofuncs },
{}
};
struct nvkm_oclass *
gf110_dmaeng_oclass = &(struct nvkm_dmaeng_impl) {
.base.handle = NV_ENGINE(DMAOBJ, 0xd0),
.base.ofuncs = &(struct nvkm_ofuncs) {
.ctor = _nvkm_dmaeng_ctor,
.dtor = _nvkm_dmaeng_dtor,
.init = _nvkm_dmaeng_init,
.fini = _nvkm_dmaeng_fini,
},
.sclass = gf110_dmaeng_sclass,
.bind = gf110_dmaobj_bind,
}.base;
......@@ -21,7 +21,7 @@
*
* Authors: Ben Skeggs
*/
#include "priv.h"
#include "user.h"
#include <core/gpuobj.h>
#include <subdev/fb.h>
......@@ -36,7 +36,7 @@ struct nv04_dmaobj {
u32 flags2;
};
static int
int
nv04_dmaobj_bind(struct nvkm_dmaobj *obj, struct nvkm_gpuobj *parent,
struct nvkm_gpuobj **pgpuobj)
{
......@@ -76,7 +76,7 @@ nv04_dmaobj_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
struct nvkm_oclass *oclass, void *data, u32 size,
struct nvkm_object **pobject)
{
struct nvkm_dmaeng *dmaeng = (void *)engine;
struct nvkm_dma *dmaeng = (void *)engine;
struct nv04_mmu *mmu = nv04_mmu(engine);
struct nv04_dmaobj *dmaobj;
int ret;
......@@ -132,23 +132,10 @@ nv04_dmaobj_ofuncs = {
.fini = _nvkm_dmaobj_fini,
};
static struct nvkm_oclass
struct nvkm_oclass
nv04_dmaeng_sclass[] = {
{ NV_DMA_FROM_MEMORY, &nv04_dmaobj_ofuncs },
{ NV_DMA_TO_MEMORY, &nv04_dmaobj_ofuncs },
{ NV_DMA_IN_MEMORY, &nv04_dmaobj_ofuncs },
{}
};
struct nvkm_oclass *
nv04_dmaeng_oclass = &(struct nvkm_dmaeng_impl) {
.base.handle = NV_ENGINE(DMAOBJ, 0x04),
.base.ofuncs = &(struct nvkm_ofuncs) {
.ctor = _nvkm_dmaeng_ctor,
.dtor = _nvkm_dmaeng_dtor,
.init = _nvkm_dmaeng_init,
.fini = _nvkm_dmaeng_fini,
},
.sclass = nv04_dmaeng_sclass,
.bind = nv04_dmaobj_bind,
}.base;
......@@ -21,7 +21,7 @@
*
* Authors: Ben Skeggs
*/
#include "priv.h"
#include "user.h"
#include <core/client.h>
#include <core/gpuobj.h>
......@@ -36,7 +36,7 @@ struct nv50_dmaobj {
u32 flags5;
};
static int
int
nv50_dmaobj_bind(struct nvkm_dmaobj *obj, struct nvkm_gpuobj *parent,
struct nvkm_gpuobj **pgpuobj)
{
......@@ -65,7 +65,7 @@ nv50_dmaobj_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
struct nvkm_oclass *oclass, void *data, u32 size,
struct nvkm_object **pobject)
{
struct nvkm_dmaeng *dmaeng = (void *)engine;
struct nvkm_dma *dmaeng = (void *)engine;
union {
struct nv50_dma_v0 v0;
} *args;
......@@ -152,23 +152,10 @@ nv50_dmaobj_ofuncs = {
.fini = _nvkm_dmaobj_fini,
};
static struct nvkm_oclass
struct nvkm_oclass
nv50_dmaeng_sclass[] = {
{ NV_DMA_FROM_MEMORY, &nv50_dmaobj_ofuncs },
{ NV_DMA_TO_MEMORY, &nv50_dmaobj_ofuncs },
{ NV_DMA_IN_MEMORY, &nv50_dmaobj_ofuncs },
{}
};
struct nvkm_oclass *
nv50_dmaeng_oclass = &(struct nvkm_dmaeng_impl) {
.base.handle = NV_ENGINE(DMAOBJ, 0x50),
.base.ofuncs = &(struct nvkm_ofuncs) {
.ctor = _nvkm_dmaeng_ctor,
.dtor = _nvkm_dmaeng_dtor,
.init = _nvkm_dmaeng_init,
.fini = _nvkm_dmaeng_fini,
},
.sclass = nv50_dmaeng_sclass,
.bind = nv50_dmaobj_bind,
}.base;
nvkm-y += nvkm/engine/dmaobj/base.o
nvkm-y += nvkm/engine/dmaobj/nv04.o
nvkm-y += nvkm/engine/dmaobj/nv50.o
nvkm-y += nvkm/engine/dmaobj/gf100.o
nvkm-y += nvkm/engine/dmaobj/gf110.o
......@@ -26,7 +26,7 @@
#include <core/client.h>
#include <core/handle.h>
#include <core/notify.h>
#include <engine/dmaobj.h>
#include <engine/dma.h>
#include <nvif/class.h>
#include <nvif/event.h>
......@@ -104,7 +104,7 @@ nvkm_fifo_channel_create_(struct nvkm_object *parent,
struct nvkm_fifo *fifo = (void *)engine;
struct nvkm_fifo_base *base = (void *)parent;
struct nvkm_fifo_chan *chan;
struct nvkm_dmaeng *dmaeng;
struct nvkm_dma *dma;
struct nvkm_subdev *subdev = &fifo->engine.subdev;
struct nvkm_device *device = subdev->device;
unsigned long flags;
......@@ -124,7 +124,7 @@ nvkm_fifo_channel_create_(struct nvkm_object *parent,
return -ENOENT;
dmaobj = (void *)handle->object;
dmaeng = (void *)dmaobj->base.engine;
dma = (void *)dmaobj->base.engine;
switch (dmaobj->base.oclass->handle) {
case NV_DMA_FROM_MEMORY:
case NV_DMA_IN_MEMORY:
......@@ -133,7 +133,7 @@ nvkm_fifo_channel_create_(struct nvkm_object *parent,
return -EINVAL;
}
ret = dmaeng->bind(dmaobj, &base->gpuobj, &chan->pushgpu);
ret = dma->bind(dmaobj, &base->gpuobj, &chan->pushgpu);
if (ret)
return ret;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment