提交 ef8bc576 编写于 作者: B Ben Skeggs

drm/nouveau/core: kill some (now) dead code

Signed-off-by: NBen Skeggs <bskeggs@redhat.com>
上级 07b9e6cc
#ifndef __NVKM_ENGCTX_H__
#define __NVKM_ENGCTX_H__
#include <core/gpuobj.h>
#include <core/parent.h>
#include <subdev/mmu.h>
#define NV_ENGCTX_(eng,var) (((var) << 8) | (eng))
#define NV_ENGCTX(name,var) NV_ENGCTX_(NVDEV_ENGINE_##name, (var))
struct nvkm_engctx {
struct nvkm_gpuobj gpuobj;
struct nvkm_vma vma;
struct list_head head;
unsigned long save;
u64 addr;
};
static inline struct nvkm_engctx *
nv_engctx(void *obj)
{
#if CONFIG_NOUVEAU_DEBUG >= NV_DBG_PARANOIA
BUG_ON(!nv_iclass(obj, NV_ENGCTX_CLASS));
#endif
return obj;
}
#define nvkm_engctx_create(p,e,c,g,s,a,f,d) \
nvkm_engctx_create_((p), (e), (c), (g), (s), (a), (f), \
sizeof(**d), (void **)d)
int nvkm_engctx_create_(struct nvkm_object *, struct nvkm_object *,
struct nvkm_oclass *, struct nvkm_object *,
u32 size, u32 align, u32 flags,
int length, void **data);
void nvkm_engctx_destroy(struct nvkm_engctx *);
int nvkm_engctx_init(struct nvkm_engctx *);
int nvkm_engctx_fini(struct nvkm_engctx *, bool suspend);
int _nvkm_engctx_ctor(struct nvkm_object *, struct nvkm_object *,
struct nvkm_oclass *, void *, u32,
struct nvkm_object **);
void _nvkm_engctx_dtor(struct nvkm_object *);
int _nvkm_engctx_init(struct nvkm_object *);
int _nvkm_engctx_fini(struct nvkm_object *, bool suspend);
#define _nvkm_engctx_rd32 _nvkm_gpuobj_rd32
#define _nvkm_engctx_wr32 _nvkm_gpuobj_wr32
#endif
#ifndef __NVKM_PARENT_H__
#define __NVKM_PARENT_H__
#include <core/object.h>
struct nvkm_parent {
struct nvkm_object object;
struct nvkm_oclass *sclass;
u64 engine;
int (*context_attach)(struct nvkm_object *, struct nvkm_object *);
int (*context_detach)(struct nvkm_object *, bool suspend,
struct nvkm_object *);
int (*object_attach)(struct nvkm_object *parent,
struct nvkm_object *object, u32 name);
void (*object_detach)(struct nvkm_object *parent, int cookie);
};
static inline struct nvkm_parent *
nv_parent(void *obj)
{
#if CONFIG_NOUVEAU_DEBUG >= NV_DBG_PARANOIA
BUG_ON(!(nv_iclass(obj, NV_PARENT_CLASS)));
#endif
return obj;
}
#define nvkm_parent_create(p,e,c,v,s,m,d) \
nvkm_parent_create_((p), (e), (c), (v), (s), (m), \
sizeof(**d), (void **)d)
#define nvkm_parent_init(p) \
_nvkm_object_init(&(p)->object)
#define nvkm_parent_fini(p,s) \
_nvkm_object_fini(&(p)->object, (s))
int nvkm_parent_create_(struct nvkm_object *, struct nvkm_object *,
struct nvkm_oclass *, u32 pclass,
struct nvkm_oclass *, u64 engcls,
int size, void **);
void nvkm_parent_destroy(struct nvkm_parent *);
void _nvkm_parent_dtor(struct nvkm_object *);
#define _nvkm_parent_init _nvkm_object_init
#define _nvkm_parent_fini _nvkm_object_fini
int nvkm_parent_sclass(struct nvkm_object *, s32 handle,
struct nvkm_object **pengine,
struct nvkm_oclass **poclass);
int nvkm_parent_lclass(struct nvkm_object *, void *, int);
#endif
nvkm-y := nvkm/core/client.o nvkm-y := nvkm/core/client.o
nvkm-y += nvkm/core/engctx.o
nvkm-y += nvkm/core/engine.o nvkm-y += nvkm/core/engine.o
nvkm-y += nvkm/core/enum.o nvkm-y += nvkm/core/enum.o
nvkm-y += nvkm/core/event.o nvkm-y += nvkm/core/event.o
...@@ -12,6 +11,5 @@ nvkm-y += nvkm/core/notify.o ...@@ -12,6 +11,5 @@ nvkm-y += nvkm/core/notify.o
nvkm-y += nvkm/core/object.o nvkm-y += nvkm/core/object.o
nvkm-y += nvkm/core/oproxy.o nvkm-y += nvkm/core/oproxy.o
nvkm-y += nvkm/core/option.o nvkm-y += nvkm/core/option.o
nvkm-y += nvkm/core/parent.o
nvkm-y += nvkm/core/ramht.o nvkm-y += nvkm/core/ramht.o
nvkm-y += nvkm/core/subdev.o nvkm-y += nvkm/core/subdev.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 <core/engctx.h>
#include <core/engine.h>
#include <core/client.h>
static inline int
nvkm_engctx_exists(struct nvkm_object *parent,
struct nvkm_engine *engine, void **pobject)
{
struct nvkm_engctx *engctx;
struct nvkm_object *parctx;
list_for_each_entry(engctx, &engine->contexts, head) {
parctx = nv_pclass(nv_object(engctx), NV_PARENT_CLASS);
if (parctx == parent) {
atomic_inc(&nv_object(engctx)->refcount);
*pobject = engctx;
return 1;
}
}
return 0;
}
int
nvkm_engctx_create_(struct nvkm_object *parent, struct nvkm_object *engobj,
struct nvkm_oclass *oclass, struct nvkm_object *pargpu,
u32 size, u32 align, u32 flags, int length, void **pobject)
{
struct nvkm_client *client = nvkm_client(parent);
struct nvkm_engine *engine = nv_engine(engobj);
struct nvkm_object *engctx;
unsigned long save;
int ret;
/* check if this engine already has a context for the parent object,
* and reference it instead of creating a new one
*/
spin_lock_irqsave(&engine->lock, save);
ret = nvkm_engctx_exists(parent, engine, pobject);
spin_unlock_irqrestore(&engine->lock, save);
if (ret)
return ret;
/* create the new context, supports creating both raw objects and
* objects backed by instance memory
*/
if (size) {
ret = nvkm_gpuobj_create_(parent, engobj, oclass,
NV_ENGCTX_CLASS, pargpu, size,
align, flags, length, pobject);
} else {
ret = nvkm_object_create_(parent, engobj, oclass,
NV_ENGCTX_CLASS, length, pobject);
}
engctx = *pobject;
if (ret)
return ret;
/* must take the lock again and re-check a context doesn't already
* exist (in case of a race) - the lock had to be dropped before as
* it's not possible to allocate the object with it held.
*/
spin_lock_irqsave(&engine->lock, save);
ret = nvkm_engctx_exists(parent, engine, pobject);
if (ret) {
spin_unlock_irqrestore(&engine->lock, save);
nvkm_object_ref(NULL, &engctx);
return ret;
}
if (client->vm)
atomic_inc(&client->vm->engref[nv_engidx(engine)]);
list_add(&nv_engctx(engctx)->head, &engine->contexts);
nv_engctx(engctx)->addr = ~0ULL;
spin_unlock_irqrestore(&engine->lock, save);
return 0;
}
void
nvkm_engctx_destroy(struct nvkm_engctx *engctx)
{
struct nvkm_engine *engine = engctx->gpuobj.object.engine;
struct nvkm_client *client = nvkm_client(&engctx->gpuobj.object);
unsigned long save;
nvkm_gpuobj_unmap(&engctx->vma);
spin_lock_irqsave(&engine->lock, save);
list_del(&engctx->head);
spin_unlock_irqrestore(&engine->lock, save);
if (client->vm)
atomic_dec(&client->vm->engref[nv_engidx(engine)]);
if (engctx->gpuobj.size)
nvkm_gpuobj_destroy(&engctx->gpuobj);
else
nvkm_object_destroy(&engctx->gpuobj.object);
}
int
nvkm_engctx_init(struct nvkm_engctx *engctx)
{
return nvkm_gpuobj_init(&engctx->gpuobj);
}
int
nvkm_engctx_fini(struct nvkm_engctx *engctx, bool suspend)
{
return nvkm_gpuobj_fini(&engctx->gpuobj, suspend);
}
int
_nvkm_engctx_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
struct nvkm_oclass *oclass, void *data, u32 size,
struct nvkm_object **pobject)
{
struct nvkm_engctx *engctx;
int ret;
ret = nvkm_engctx_create(parent, engine, oclass, NULL, 256, 256,
NVOBJ_FLAG_ZERO_ALLOC, &engctx);
*pobject = nv_object(engctx);
return ret;
}
void
_nvkm_engctx_dtor(struct nvkm_object *object)
{
nvkm_engctx_destroy(nv_engctx(object));
}
int
_nvkm_engctx_init(struct nvkm_object *object)
{
return nvkm_engctx_init(nv_engctx(object));
}
int
_nvkm_engctx_fini(struct nvkm_object *object, bool suspend)
{
return nvkm_engctx_fini(nv_engctx(object), suspend);
}
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
*/ */
#include <core/handle.h> #include <core/handle.h>
#include <core/client.h> #include <core/client.h>
#include <core/parent.h>
#define hprintk(h,l,f,a...) do { \ #define hprintk(h,l,f,a...) do { \
struct nvkm_handle *p = (h)->parent; u32 n = p ? p->name : ~0; \ struct nvkm_handle *p = (h)->parent; u32 n = p ? p->name : ~0; \
...@@ -99,7 +98,6 @@ nvkm_handle_create(struct nvkm_handle *parent, u32 _handle, ...@@ -99,7 +98,6 @@ nvkm_handle_create(struct nvkm_handle *parent, u32 _handle,
struct nvkm_object *object, struct nvkm_handle **phandle) struct nvkm_object *object, struct nvkm_handle **phandle)
{ {
struct nvkm_handle *handle; struct nvkm_handle *handle;
int ret;
handle = kzalloc(sizeof(*handle), GFP_KERNEL); handle = kzalloc(sizeof(*handle), GFP_KERNEL);
if (!handle) if (!handle)
...@@ -113,21 +111,8 @@ nvkm_handle_create(struct nvkm_handle *parent, u32 _handle, ...@@ -113,21 +111,8 @@ nvkm_handle_create(struct nvkm_handle *parent, u32 _handle,
handle->parent = parent; handle->parent = parent;
nvkm_object_ref(object, &handle->object); nvkm_object_ref(object, &handle->object);
if (parent) { if (parent)
if (nv_iclass(parent->object, NV_PARENT_CLASS) &&
nv_parent(parent->object)->object_attach) {
ret = nv_parent(parent->object)->
object_attach(parent->object, object, _handle);
if (ret < 0) {
nvkm_handle_destroy(handle);
return ret;
}
handle->priv = ret;
}
list_add(&handle->head, &handle->parent->tree); list_add(&handle->head, &handle->parent->tree);
}
hprintk(handle, TRACE, "created\n"); hprintk(handle, TRACE, "created\n");
*phandle = handle; *phandle = handle;
...@@ -148,11 +133,6 @@ nvkm_handle_destroy(struct nvkm_handle *handle) ...@@ -148,11 +133,6 @@ nvkm_handle_destroy(struct nvkm_handle *handle)
nvkm_client_remove(client, handle); nvkm_client_remove(client, handle);
list_del(&handle->head); list_del(&handle->head);
if (handle->priv != ~0) {
struct nvkm_object *parent = handle->parent->object;
nv_parent(parent)->object_detach(parent, handle->priv);
}
hprintk(handle, TRACE, "destroy completed\n"); hprintk(handle, TRACE, "destroy completed\n");
nvkm_object_ref(NULL, &handle->object); nvkm_object_ref(NULL, &handle->object);
kfree(handle); kfree(handle);
......
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
#include <core/client.h> #include <core/client.h>
#include <core/engine.h> #include <core/engine.h>
#include <core/handle.h> #include <core/handle.h>
#include <core/parent.h>
#include <nvif/unpack.h> #include <nvif/unpack.h>
#include <nvif/ioctl.h> #include <nvif/ioctl.h>
...@@ -65,17 +64,6 @@ nvkm_ioctl_sclass(struct nvkm_handle *handle, void *data, u32 size) ...@@ -65,17 +64,6 @@ nvkm_ioctl_sclass(struct nvkm_handle *handle, void *data, u32 size)
if (size != args->v0.count * sizeof(args->v0.oclass[0])) if (size != args->v0.count * sizeof(args->v0.oclass[0]))
return -EINVAL; return -EINVAL;
if (object->oclass) {
if (nv_iclass(object, NV_PARENT_CLASS)) {
ret = nvkm_parent_lclass(object,
args->v0.oclass,
args->v0.count);
}
args->v0.count = ret;
return 0;
}
while (object->func->sclass && while (object->func->sclass &&
object->func->sclass(object, i, &oclass) >= 0) { object->func->sclass(object, i, &oclass) >= 0) {
if (i < args->v0.count) { if (i < args->v0.count) {
...@@ -92,111 +80,6 @@ nvkm_ioctl_sclass(struct nvkm_handle *handle, void *data, u32 size) ...@@ -92,111 +80,6 @@ nvkm_ioctl_sclass(struct nvkm_handle *handle, void *data, u32 size)
return ret; return ret;
} }
static int
nvkm_ioctl_new_old(struct nvkm_handle *handle, void *data, u32 size)
{
union {
struct nvif_ioctl_new_v0 v0;
} *args = data;
struct nvkm_client *client = nvkm_client(handle->object);
struct nvkm_object *engctx = NULL;
struct nvkm_object *object = NULL;
struct nvkm_parent *parent;
struct nvkm_engine *engine;
struct nvkm_oclass *oclass;
u32 _handle, _oclass;
int ret;
nvif_ioctl(handle->object, "new size %d\n", size);
if (nvif_unpack(args->v0, 0, 0, true)) {
_handle = args->v0.handle;
_oclass = args->v0.oclass;
} else
return ret;
nvif_ioctl(handle->object, "new vers %d handle %08x class %08x "
"route %02x token %llx object %016llx\n",
args->v0.version, _handle, _oclass,
args->v0.route, args->v0.token, args->v0.object);
if (!nv_iclass(handle->object, NV_PARENT_CLASS)) {
nvif_debug(handle->object, "cannot have children (ctor)\n");
ret = -ENODEV;
goto fail_class;
}
parent = nv_parent(handle->object);
/* check that parent supports the requested subclass */
ret = nvkm_parent_sclass(&parent->object, _oclass,
(struct nvkm_object **)&engine, &oclass);
if (ret) {
nvif_debug(&parent->object, "illegal class 0x%04x\n", _oclass);
goto fail_class;
}
/* make sure engine init has been completed *before* any objects
* it controls are created - the constructors may depend on
* state calculated at init (ie. default context construction)
*/
if (engine) {
engine = nvkm_engine_ref(engine);
if (IS_ERR(engine)) {
ret = PTR_ERR(engine);
engine = NULL;
goto fail_class;
}
}
/* if engine requires it, create a context object to insert
* between the parent and its children (eg. PGRAPH context)
*/
if (engine && engine->cclass) {
ret = nvkm_object_old(&parent->object, &engine->subdev.object,
engine->cclass, data, size, &engctx);
if (ret)
goto fail_engctx;
} else {
nvkm_object_ref(&parent->object, &engctx);
}
/* finally, create new object and bind it to its handle */
ret = nvkm_object_old(engctx, &engine->subdev.object, oclass,
data, size, &object);
if (ret)
goto fail_ctor;
object->handle = _handle;
ret = nvkm_object_inc(object);
if (ret)
goto fail_init;
ret = nvkm_handle_create(handle, _handle, object, &handle);
if (ret)
goto fail_handle;
ret = nvkm_handle_init(handle);
handle->route = args->v0.route;
handle->token = args->v0.token;
if (ret)
nvkm_handle_destroy(handle);
handle->handle = args->v0.object;
nvkm_client_insert(client, handle);
client->data = object;
fail_handle:
nvkm_object_dec(object, false);
fail_init:
nvkm_object_ref(NULL, &object);
fail_ctor:
nvkm_object_ref(NULL, &engctx);
fail_engctx:
nvkm_engine_unref(&engine);
fail_class:
return ret;
}
static int static int
nvkm_ioctl_new(struct nvkm_handle *handle, void *data, u32 size) nvkm_ioctl_new(struct nvkm_handle *handle, void *data, u32 size)
{ {
...@@ -209,9 +92,6 @@ nvkm_ioctl_new(struct nvkm_handle *handle, void *data, u32 size) ...@@ -209,9 +92,6 @@ nvkm_ioctl_new(struct nvkm_handle *handle, void *data, u32 size)
struct nvkm_oclass oclass; struct nvkm_oclass oclass;
int ret, i = 0; int ret, i = 0;
if (parent->oclass)
return nvkm_ioctl_new_old(handle, data, size);
nvif_ioctl(parent, "new size %d\n", size); nvif_ioctl(parent, "new size %d\n", size);
if (nvif_unpack(args->v0, 0, 0, true)) { if (nvif_unpack(args->v0, 0, 0, true)) {
nvif_ioctl(parent, "new vers %d handle %08x class %08x " nvif_ioctl(parent, "new vers %d handle %08x class %08x "
......
/*
* 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 <core/parent.h>
#include <core/client.h>
#include <core/engine.h>
#include <nvif/ioctl.h>
int
nvkm_parent_sclass(struct nvkm_object *parent, s32 handle,
struct nvkm_object **pengine,
struct nvkm_oclass **poclass)
{
struct nvkm_oclass *sclass, *oclass;
struct nvkm_engine *engine;
u64 mask;
int i;
sclass = nv_parent(parent)->sclass;
while ((oclass = sclass++) && oclass->ofuncs) {
if (oclass->handle == handle) {
*pengine = &parent->engine->subdev.object;
*poclass = oclass;
return 0;
}
}
mask = nv_parent(parent)->engine;
while (i = __ffs64(mask), mask) {
engine = nvkm_engine(parent, i);
if (engine) {
oclass = engine->sclass;
while (oclass->ofuncs) {
if (oclass->handle == handle) {
*pengine = nv_object(engine);
*poclass = oclass;
return 0;
}
oclass++;
}
}
mask &= ~(1ULL << i);
}
return -EINVAL;
}
int
nvkm_parent_lclass(struct nvkm_object *parent, void *data, int size)
{
struct nvif_ioctl_sclass_oclass_v0 *lclass = data;
struct nvkm_oclass *sclass, *oclass;
struct nvkm_engine *engine;
int nr = -1, i;
u64 mask;
sclass = nv_parent(parent)->sclass;
while ((oclass = sclass++) && oclass->ofuncs) {
if (++nr < size) {
lclass[nr].oclass = oclass->handle;
lclass[nr].minver = -2;
lclass[nr].maxver = -2;
}
}
mask = nv_parent(parent)->engine;
while (i = __ffs64(mask), mask) {
engine = nvkm_engine(parent, i);
if (engine && (oclass = engine->sclass)) {
while (oclass->ofuncs) {
if (++nr < size) {
lclass[nr].oclass = oclass->handle;
lclass[nr].minver = -2;
lclass[nr].maxver = -2;
}
oclass++;
}
}
mask &= ~(1ULL << i);
}
return nr + 1;
}
int
nvkm_parent_create_(struct nvkm_object *parent, struct nvkm_object *engine,
struct nvkm_oclass *oclass, u32 pclass,
struct nvkm_oclass *sclass, u64 engcls,
int size, void **pobject)
{
struct nvkm_parent *object;
int ret;
ret = nvkm_object_create_(parent, engine, oclass, pclass |
NV_PARENT_CLASS, size, pobject);
object = *pobject;
if (ret)
return ret;
object->sclass = sclass;
object->engine = engcls;
return 0;
}
void
nvkm_parent_destroy(struct nvkm_parent *parent)
{
nvkm_object_destroy(&parent->object);
}
void
_nvkm_parent_dtor(struct nvkm_object *object)
{
nvkm_parent_destroy(nv_parent(object));
}
...@@ -1977,7 +1977,6 @@ nv12b_chipset = { ...@@ -1977,7 +1977,6 @@ nv12b_chipset = {
// .sw = gf100_sw_new, // .sw = gf100_sw_new,
}; };
#include <core/parent.h>
#include <core/client.h> #include <core/client.h>
struct nvkm_device * struct nvkm_device *
......
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
#include "ctrl.h" #include "ctrl.h"
#include <core/client.h> #include <core/client.h>
#include <core/parent.h>
#include <subdev/fb.h> #include <subdev/fb.h>
#include <subdev/instmem.h> #include <subdev/instmem.h>
#include <subdev/timer.h> #include <subdev/timer.h>
...@@ -247,31 +246,6 @@ nvkm_udevice_init(struct nvkm_object *object) ...@@ -247,31 +246,6 @@ nvkm_udevice_init(struct nvkm_object *object)
return ret; return ret;
} }
static int
nvkm_udevice_child_old(const struct nvkm_oclass *oclass,
void *data, u32 size, struct nvkm_object **pobject)
{
struct nvkm_object *parent = oclass->parent;
struct nvkm_engine *engine = oclass->engine;
struct nvkm_oclass *eclass = (void *)oclass->priv;
struct nvkm_object *engctx = NULL;
int ret;
if (engine->cclass) {
ret = nvkm_object_old(parent, &engine->subdev.object,
engine->cclass, NULL, 0, &engctx);
if (ret)
return ret;
} else {
nvkm_object_ref(parent, &engctx);
}
ret = nvkm_object_old(engctx, &engine->subdev.object, eclass,
data, size, pobject);
nvkm_object_ref(NULL, &engctx);
return ret;
}
static int static int
nvkm_udevice_child_new(const struct nvkm_oclass *oclass, nvkm_udevice_child_new(const struct nvkm_oclass *oclass,
void *data, u32 size, struct nvkm_object **pobject) void *data, u32 size, struct nvkm_object **pobject)
...@@ -296,26 +270,6 @@ nvkm_udevice_child_get(struct nvkm_object *object, int index, ...@@ -296,26 +270,6 @@ nvkm_udevice_child_get(struct nvkm_object *object, int index,
int i; int i;
for (; i = __ffs64(mask), mask && !sclass; mask &= ~(1ULL << i)) { for (; i = __ffs64(mask), mask && !sclass; mask &= ~(1ULL << i)) {
if ((engine = nvkm_device_engine(device, i)) &&
!engine->func) {
struct nvkm_oclass *sclass = engine->sclass;
int c = 0;
while (sclass && sclass->ofuncs) {
if (c++ == index) {
oclass->base.oclass = sclass->handle;
oclass->base.minver = -2;
oclass->base.maxver = -2;
oclass->ctor = nvkm_udevice_child_old;
oclass->priv = sclass;
oclass->engine = engine;
return 0;
}
sclass++;
}
index -= c;
continue;
}
if (!(engine = nvkm_device_engine(device, i)) || if (!(engine = nvkm_device_engine(device, i)) ||
!(engine->func->base.sclass)) !(engine->func->base.sclass))
continue; continue;
......
...@@ -128,67 +128,6 @@ nvkm_fifo_chan_child_func = { ...@@ -128,67 +128,6 @@ nvkm_fifo_chan_child_func = {
.fini[0] = nvkm_fifo_chan_child_fini, .fini[0] = nvkm_fifo_chan_child_fini,
}; };
static int
nvkm_fifo_chan_child_old(const struct nvkm_oclass *oclass,
void *data, u32 size, struct nvkm_object **pobject)
{
struct nvkm_fifo_chan *chan = nvkm_fifo_chan(oclass->parent);
struct nvkm_object *parent = &chan->object;
struct nvkm_engine *engine = oclass->engine;
struct nvkm_oclass *eclass = (void *)oclass->priv;
struct nvkm_object *engctx = NULL;
struct nvkm_fifo_chan_object *object;
struct nvkm_fifo_engn *engn = &chan->engn[engine->subdev.index];
int ret;
if (!(object = kzalloc(sizeof(*object), GFP_KERNEL)))
return -ENOMEM;
nvkm_oproxy_ctor(&nvkm_fifo_chan_child_func, oclass, &object->oproxy);
*pobject = &object->oproxy.base;
object->chan = chan;
if (!engn->refcount++) {
if (chan->vm)
atomic_inc(&chan->vm->engref[engine->subdev.index]);
if (engine->cclass && !engn->object) {
ret = nvkm_object_old(parent, &engine->subdev.object,
engine->cclass, NULL, 0,
&engn->object);
if (ret) {
nvkm_engine_unref(&engine);
return ret;
}
} else {
nvkm_object_ref(parent, &engn->object);
}
if (chan->func->engine_ctor) {
ret = chan->func->engine_ctor(chan, engine,
engn->object);
if (ret)
return ret;
}
}
nvkm_object_ref(engn->object, &engctx);
ret = nvkm_object_old(engctx, &engine->subdev.object, eclass,
data, size, &object->oproxy.object);
nvkm_object_ref(NULL, &engctx);
if (ret)
return ret;
object->oproxy.object->handle = oclass->handle;
if (chan->func->object_ctor) {
object->hash =
chan->func->object_ctor(chan, object->oproxy.object);
if (object->hash < 0)
return object->hash;
}
return 0;
}
static int static int
nvkm_fifo_chan_child_new(const struct nvkm_oclass *oclass, void *data, u32 size, nvkm_fifo_chan_child_new(const struct nvkm_oclass *oclass, void *data, u32 size,
struct nvkm_object **pobject) struct nvkm_object **pobject)
...@@ -269,26 +208,6 @@ nvkm_fifo_chan_child_get(struct nvkm_object *object, int index, ...@@ -269,26 +208,6 @@ nvkm_fifo_chan_child_get(struct nvkm_object *object, int index,
int ret, i, c; int ret, i, c;
for (; c = 0, i = __ffs64(mask), mask; mask &= ~(1ULL << i)) { for (; c = 0, i = __ffs64(mask), mask; mask &= ~(1ULL << i)) {
if ((engine = nvkm_device_engine(device, i)) &&
!engine->func) {
struct nvkm_oclass *sclass = engine->sclass;
int c = 0;
while (sclass && sclass->ofuncs) {
if (c++ == index) {
oclass->base.oclass = sclass->handle;
oclass->base.minver = -2;
oclass->base.maxver = -2;
oclass->ctor = nvkm_fifo_chan_child_old;
oclass->priv = sclass;
oclass->engine = engine;
return 0;
}
sclass++;
}
index -= c;
continue;
}
if (!(engine = nvkm_device_engine(device, i))) if (!(engine = nvkm_device_engine(device, i)))
continue; continue;
oclass->engine = engine; oclass->engine = engine;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册