diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2015-01-14 14:11:21 +1000 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2015-01-22 12:17:49 +1000 |
commit | 5025407b9862349d17b1dff25737aaef6520a439 (patch) | |
tree | 6d11493365d06c00d79daf5818b42dfa2d421c1e /drivers/gpu/drm/nouveau/nvkm/core | |
parent | 989aa5b76ad2af7653353cf01bdebec2ba9436aa (diff) | |
download | linux-5025407b9862349d17b1dff25737aaef6520a439.tar.bz2 |
drm/nouveau/core: namespace + nvidia gpu names (no binary change)
The namespace of NVKM is being changed to nvkm_ instead of nouveau_,
which will be used for the DRM part of the driver. This is being
done in order to make it very clear as to what part of the driver a
given symbol belongs to, and as a minor step towards splitting the
DRM driver out to be able to stand on its own (for virt).
Because there's already a large amount of churn here anyway, this is
as good a time as any to also switch to NVIDIA's device and chipset
naming to ease collaboration with them.
A comparison of objdump disassemblies proves no code changes.
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau/nvkm/core')
-rw-r--r-- | drivers/gpu/drm/nouveau/nvkm/core/client.c | 93 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nvkm/core/engctx.c | 122 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nvkm/core/engine.c | 30 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nvkm/core/enum.c | 14 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nvkm/core/event.c | 3 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nvkm/core/gpuobj.c | 190 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nvkm/core/handle.c | 97 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nvkm/core/ioctl.c | 162 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nvkm/core/mm.c | 71 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nvkm/core/namedb.c | 108 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nvkm/core/notify.c | 9 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nvkm/core/object.c | 106 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nvkm/core/option.c | 9 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nvkm/core/parent.c | 54 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nvkm/core/printk.c | 12 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nvkm/core/ramht.c | 45 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nvkm/core/subdev.c | 55 |
17 files changed, 559 insertions, 621 deletions
diff --git a/drivers/gpu/drm/nouveau/nvkm/core/client.c b/drivers/gpu/drm/nouveau/nvkm/core/client.c index acff10387846..878a82f8f295 100644 --- a/drivers/gpu/drm/nouveau/nvkm/core/client.c +++ b/drivers/gpu/drm/nouveau/nvkm/core/client.c @@ -21,21 +21,18 @@ * * Authors: Ben Skeggs */ - -#include <core/object.h> #include <core/client.h> +#include <core/device.h> #include <core/handle.h> +#include <core/notify.h> #include <core/option.h> -#include <nvif/unpack.h> -#include <nvif/class.h> -#include <nvif/unpack.h> +#include <nvif/class.h> #include <nvif/event.h> - -#include <engine/device.h> +#include <nvif/unpack.h> struct nvkm_client_notify { - struct nouveau_client *client; + struct nvkm_client *client; struct nvkm_notify n; u8 version; u8 size; @@ -48,12 +45,12 @@ static int nvkm_client_notify(struct nvkm_notify *n) { struct nvkm_client_notify *notify = container_of(n, typeof(*notify), n); - struct nouveau_client *client = notify->client; + struct nvkm_client *client = notify->client; return client->ntfy(¬ify->rep, notify->size, n->data, n->size); } int -nvkm_client_notify_put(struct nouveau_client *client, int index) +nvkm_client_notify_put(struct nvkm_client *client, int index) { if (index < ARRAY_SIZE(client->notify)) { if (client->notify[index]) { @@ -65,7 +62,7 @@ nvkm_client_notify_put(struct nouveau_client *client, int index) } int -nvkm_client_notify_get(struct nouveau_client *client, int index) +nvkm_client_notify_get(struct nvkm_client *client, int index) { if (index < ARRAY_SIZE(client->notify)) { if (client->notify[index]) { @@ -77,7 +74,7 @@ nvkm_client_notify_get(struct nouveau_client *client, int index) } int -nvkm_client_notify_del(struct nouveau_client *client, int index) +nvkm_client_notify_del(struct nvkm_client *client, int index) { if (index < ARRAY_SIZE(client->notify)) { if (client->notify[index]) { @@ -91,10 +88,10 @@ nvkm_client_notify_del(struct nouveau_client *client, int index) } int -nvkm_client_notify_new(struct nouveau_object *object, +nvkm_client_notify_new(struct nvkm_object *object, struct nvkm_event *event, void *data, u32 size) { - struct nouveau_client *client = nouveau_client(object); + struct nvkm_client *client = nvkm_client(object); struct nvkm_client_notify *notify; union { struct nvif_notify_req_v0 v0; @@ -142,7 +139,7 @@ nvkm_client_notify_new(struct nouveau_object *object, } static int -nouveau_client_devlist(struct nouveau_object *object, void *data, u32 size) +nvkm_client_mthd_devlist(struct nvkm_object *object, void *data, u32 size) { union { struct nv_client_devlist_v0 v0; @@ -154,8 +151,7 @@ nouveau_client_devlist(struct nouveau_object *object, void *data, u32 size) nv_ioctl(object, "client devlist vers %d count %d\n", args->v0.version, args->v0.count); if (size == sizeof(args->v0.device[0]) * args->v0.count) { - ret = nouveau_device_list(args->v0.device, - args->v0.count); + ret = nvkm_device_list(args->v0.device, args->v0.count); if (ret >= 0) { args->v0.count = ret; ret = 0; @@ -169,12 +165,11 @@ nouveau_client_devlist(struct nouveau_object *object, void *data, u32 size) } static int -nouveau_client_mthd(struct nouveau_object *object, u32 mthd, - void *data, u32 size) +nvkm_client_mthd(struct nvkm_object *object, u32 mthd, void *data, u32 size) { switch (mthd) { case NV_CLIENT_DEVLIST: - return nouveau_client_devlist(object, data, size); + return nvkm_client_mthd_devlist(object, data, size); default: break; } @@ -182,71 +177,71 @@ nouveau_client_mthd(struct nouveau_object *object, u32 mthd, } static void -nouveau_client_dtor(struct nouveau_object *object) +nvkm_client_dtor(struct nvkm_object *object) { - struct nouveau_client *client = (void *)object; + struct nvkm_client *client = (void *)object; int i; for (i = 0; i < ARRAY_SIZE(client->notify); i++) nvkm_client_notify_del(client, i); - nouveau_object_ref(NULL, &client->device); - nouveau_handle_destroy(client->root); - nouveau_namedb_destroy(&client->namedb); + nvkm_object_ref(NULL, &client->device); + nvkm_handle_destroy(client->root); + nvkm_namedb_destroy(&client->namedb); } -static struct nouveau_oclass -nouveau_client_oclass = { - .ofuncs = &(struct nouveau_ofuncs) { - .dtor = nouveau_client_dtor, - .mthd = nouveau_client_mthd, +static struct nvkm_oclass +nvkm_client_oclass = { + .ofuncs = &(struct nvkm_ofuncs) { + .dtor = nvkm_client_dtor, + .mthd = nvkm_client_mthd, }, }; int -nouveau_client_create_(const char *name, u64 devname, const char *cfg, - const char *dbg, int length, void **pobject) +nvkm_client_create_(const char *name, u64 devname, const char *cfg, + const char *dbg, int length, void **pobject) { - struct nouveau_object *device; - struct nouveau_client *client; + struct nvkm_object *device; + struct nvkm_client *client; int ret; - device = (void *)nouveau_device_find(devname); + device = (void *)nvkm_device_find(devname); if (!device) return -ENODEV; - ret = nouveau_namedb_create_(NULL, NULL, &nouveau_client_oclass, - NV_CLIENT_CLASS, NULL, - (1ULL << NVDEV_ENGINE_DEVICE), - length, pobject); + ret = nvkm_namedb_create_(NULL, NULL, &nvkm_client_oclass, + NV_CLIENT_CLASS, NULL, + (1ULL << NVDEV_ENGINE_DEVICE), + length, pobject); client = *pobject; if (ret) return ret; - ret = nouveau_handle_create(nv_object(client), ~0, ~0, - nv_object(client), &client->root); + ret = nvkm_handle_create(nv_object(client), ~0, ~0, nv_object(client), + &client->root); if (ret) return ret; /* prevent init/fini being called, os in in charge of this */ atomic_set(&nv_object(client)->usecount, 2); - nouveau_object_ref(device, &client->device); + nvkm_object_ref(device, &client->device); snprintf(client->name, sizeof(client->name), "%s", name); - client->debug = nouveau_dbgopt(dbg, "CLIENT"); + client->debug = nvkm_dbgopt(dbg, "CLIENT"); return 0; } int -nouveau_client_init(struct nouveau_client *client) +nvkm_client_init(struct nvkm_client *client) { int ret; nv_debug(client, "init running\n"); - ret = nouveau_handle_init(client->root); + ret = nvkm_handle_init(client->root); nv_debug(client, "init completed with %d\n", ret); return ret; } int -nouveau_client_fini(struct nouveau_client *client, bool suspend) +nvkm_client_fini(struct nvkm_client *client, bool suspend) { const char *name[2] = { "fini", "suspend" }; int ret, i; @@ -255,16 +250,16 @@ nouveau_client_fini(struct nouveau_client *client, bool suspend) for (i = 0; i < ARRAY_SIZE(client->notify); i++) nvkm_client_notify_put(client, i); nv_debug(client, "%s object\n", name[suspend]); - ret = nouveau_handle_fini(client->root, suspend); + ret = nvkm_handle_fini(client->root, suspend); nv_debug(client, "%s completed with %d\n", name[suspend], ret); return ret; } const char * -nouveau_client_name(void *obj) +nvkm_client_name(void *obj) { const char *client_name = "unknown"; - struct nouveau_client *client = nouveau_client(obj); + struct nvkm_client *client = nvkm_client(obj); if (client) client_name = client->name; return client_name; diff --git a/drivers/gpu/drm/nouveau/nvkm/core/engctx.c b/drivers/gpu/drm/nouveau/nvkm/core/engctx.c index 892baa461575..a9df07a90f9b 100644 --- a/drivers/gpu/drm/nouveau/nvkm/core/engctx.c +++ b/drivers/gpu/drm/nouveau/nvkm/core/engctx.c @@ -21,21 +21,15 @@ * * Authors: Ben Skeggs */ - -#include <core/object.h> -#include <core/namedb.h> -#include <core/handle.h> -#include <core/client.h> #include <core/engctx.h> - -#include <subdev/mmu.h> +#include <core/client.h> static inline int -nouveau_engctx_exists(struct nouveau_object *parent, - struct nouveau_engine *engine, void **pobject) +nvkm_engctx_exists(struct nvkm_object *parent, + struct nvkm_engine *engine, void **pobject) { - struct nouveau_engctx *engctx; - struct nouveau_object *parctx; + 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); @@ -50,16 +44,13 @@ nouveau_engctx_exists(struct nouveau_object *parent, } int -nouveau_engctx_create_(struct nouveau_object *parent, - struct nouveau_object *engobj, - struct nouveau_oclass *oclass, - struct nouveau_object *pargpu, - u32 size, u32 align, u32 flags, - int length, void **pobject) +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 nouveau_client *client = nouveau_client(parent); - struct nouveau_engine *engine = nv_engine(engobj); - struct nouveau_object *engctx; + struct nvkm_client *client = nvkm_client(parent); + struct nvkm_engine *engine = nv_engine(engobj); + struct nvkm_object *engctx; unsigned long save; int ret; @@ -67,7 +58,7 @@ nouveau_engctx_create_(struct nouveau_object *parent, * and reference it instead of creating a new one */ spin_lock_irqsave(&engine->lock, save); - ret = nouveau_engctx_exists(parent, engine, pobject); + ret = nvkm_engctx_exists(parent, engine, pobject); spin_unlock_irqrestore(&engine->lock, save); if (ret) return ret; @@ -76,13 +67,12 @@ nouveau_engctx_create_(struct nouveau_object *parent, * objects backed by instance memory */ if (size) { - ret = nouveau_gpuobj_create_(parent, engobj, oclass, - NV_ENGCTX_CLASS, - pargpu, size, align, flags, - length, pobject); + ret = nvkm_gpuobj_create_(parent, engobj, oclass, + NV_ENGCTX_CLASS, pargpu, size, + align, flags, length, pobject); } else { - ret = nouveau_object_create_(parent, engobj, oclass, - NV_ENGCTX_CLASS, length, pobject); + ret = nvkm_object_create_(parent, engobj, oclass, + NV_ENGCTX_CLASS, length, pobject); } engctx = *pobject; @@ -94,10 +84,10 @@ nouveau_engctx_create_(struct nouveau_object *parent, * it's not possible to allocate the object with it held. */ spin_lock_irqsave(&engine->lock, save); - ret = nouveau_engctx_exists(parent, engine, pobject); + ret = nvkm_engctx_exists(parent, engine, pobject); if (ret) { spin_unlock_irqrestore(&engine->lock, save); - nouveau_object_ref(NULL, &engctx); + nvkm_object_ref(NULL, &engctx); return ret; } @@ -110,13 +100,13 @@ nouveau_engctx_create_(struct nouveau_object *parent, } void -nouveau_engctx_destroy(struct nouveau_engctx *engctx) +nvkm_engctx_destroy(struct nvkm_engctx *engctx) { - struct nouveau_engine *engine = engctx->gpuobj.object.engine; - struct nouveau_client *client = nouveau_client(engctx); + struct nvkm_engine *engine = engctx->gpuobj.object.engine; + struct nvkm_client *client = nvkm_client(engctx); unsigned long save; - nouveau_gpuobj_unmap(&engctx->vma); + nvkm_gpuobj_unmap(&engctx->vma); spin_lock_irqsave(&engine->lock, save); list_del(&engctx->head); spin_unlock_irqrestore(&engine->lock, save); @@ -125,21 +115,21 @@ nouveau_engctx_destroy(struct nouveau_engctx *engctx) atomic_dec(&client->vm->engref[nv_engidx(engine)]); if (engctx->gpuobj.size) - nouveau_gpuobj_destroy(&engctx->gpuobj); + nvkm_gpuobj_destroy(&engctx->gpuobj); else - nouveau_object_destroy(&engctx->gpuobj.object); + nvkm_object_destroy(&engctx->gpuobj.object); } int -nouveau_engctx_init(struct nouveau_engctx *engctx) +nvkm_engctx_init(struct nvkm_engctx *engctx) { - struct nouveau_object *object = nv_object(engctx); - struct nouveau_subdev *subdev = nv_subdev(object->engine); - struct nouveau_object *parent; - struct nouveau_subdev *pardev; + struct nvkm_object *object = nv_object(engctx); + struct nvkm_subdev *subdev = nv_subdev(object->engine); + struct nvkm_object *parent; + struct nvkm_subdev *pardev; int ret; - ret = nouveau_gpuobj_init(&engctx->gpuobj); + ret = nvkm_gpuobj_init(&engctx->gpuobj); if (ret) return ret; @@ -162,12 +152,12 @@ nouveau_engctx_init(struct nouveau_engctx *engctx) } int -nouveau_engctx_fini(struct nouveau_engctx *engctx, bool suspend) +nvkm_engctx_fini(struct nvkm_engctx *engctx, bool suspend) { - struct nouveau_object *object = nv_object(engctx); - struct nouveau_subdev *subdev = nv_subdev(object->engine); - struct nouveau_object *parent; - struct nouveau_subdev *pardev; + struct nvkm_object *object = nv_object(engctx); + struct nvkm_subdev *subdev = nv_subdev(object->engine); + struct nvkm_object *parent; + struct nvkm_subdev *pardev; int ret = 0; parent = nv_pclass(object->parent, NV_PARENT_CLASS); @@ -185,47 +175,45 @@ nouveau_engctx_fini(struct nouveau_engctx *engctx, bool suspend) } nv_debug(parent, "detached %s context\n", subdev->name); - return nouveau_gpuobj_fini(&engctx->gpuobj, suspend); + return nvkm_gpuobj_fini(&engctx->gpuobj, suspend); } int -_nouveau_engctx_ctor(struct nouveau_object *parent, - struct nouveau_object *engine, - struct nouveau_oclass *oclass, void *data, u32 size, - struct nouveau_object **pobject) +_nvkm_engctx_ctor(struct nvkm_object *parent, struct nvkm_object *engine, + struct nvkm_oclass *oclass, void *data, u32 size, + struct nvkm_object **pobject) { - struct nouveau_engctx *engctx; + struct nvkm_engctx *engctx; int ret; - ret = nouveau_engctx_create(parent, engine, oclass, NULL, 256, 256, - NVOBJ_FLAG_ZERO_ALLOC, &engctx); + ret = nvkm_engctx_create(parent, engine, oclass, NULL, 256, 256, + NVOBJ_FLAG_ZERO_ALLOC, &engctx); *pobject = nv_object(engctx); return ret; } void -_nouveau_engctx_dtor(struct nouveau_object *object) +_nvkm_engctx_dtor(struct nvkm_object *object) { - nouveau_engctx_destroy(nv_engctx(object)); + nvkm_engctx_destroy(nv_engctx(object)); } int -_nouveau_engctx_init(struct nouveau_object *object) +_nvkm_engctx_init(struct nvkm_object *object) { - return nouveau_engctx_init(nv_engctx(object)); + return nvkm_engctx_init(nv_engctx(object)); } - int -_nouveau_engctx_fini(struct nouveau_object *object, bool suspend) +_nvkm_engctx_fini(struct nvkm_object *object, bool suspend) { - return nouveau_engctx_fini(nv_engctx(object), suspend); + return nvkm_engctx_fini(nv_engctx(object), suspend); } -struct nouveau_object * -nouveau_engctx_get(struct nouveau_engine *engine, u64 addr) +struct nvkm_object * +nvkm_engctx_get(struct nvkm_engine *engine, u64 addr) { - struct nouveau_engctx *engctx; + struct nvkm_engctx *engctx; unsigned long flags; spin_lock_irqsave(&engine->lock, flags); @@ -240,11 +228,11 @@ nouveau_engctx_get(struct nouveau_engine *engine, u64 addr) } void -nouveau_engctx_put(struct nouveau_object *object) +nvkm_engctx_put(struct nvkm_object *object) { if (object) { - struct nouveau_engine *engine = nv_engine(object->engine); - struct nouveau_engctx *engctx = nv_engctx(object); + struct nvkm_engine *engine = nv_engine(object->engine); + struct nvkm_engctx *engctx = nv_engctx(object); spin_unlock_irqrestore(&engine->lock, engctx->save); } } diff --git a/drivers/gpu/drm/nouveau/nvkm/core/engine.c b/drivers/gpu/drm/nouveau/nvkm/core/engine.c index c9414b1532ff..60820173c6aa 100644 --- a/drivers/gpu/drm/nouveau/nvkm/core/engine.c +++ b/drivers/gpu/drm/nouveau/nvkm/core/engine.c @@ -21,42 +21,40 @@ * * Authors: Ben Skeggs */ - -#include <core/device.h> #include <core/engine.h> +#include <core/device.h> #include <core/option.h> -struct nouveau_engine * -nouveau_engine(void *obj, int idx) +struct nvkm_engine * +nvkm_engine(void *obj, int idx) { - obj = nouveau_subdev(obj, idx); + obj = nvkm_subdev(obj, idx); if (obj && nv_iclass(obj, NV_ENGINE_CLASS)) return nv_engine(obj); return NULL; } int -nouveau_engine_create_(struct nouveau_object *parent, - struct nouveau_object *engobj, - struct nouveau_oclass *oclass, bool enable, - const char *iname, const char *fname, - int length, void **pobject) +nvkm_engine_create_(struct nvkm_object *parent, struct nvkm_object *engobj, + struct nvkm_oclass *oclass, bool enable, + const char *iname, const char *fname, + int length, void **pobject) { - struct nouveau_engine *engine; + struct nvkm_engine *engine; int ret; - ret = nouveau_subdev_create_(parent, engobj, oclass, NV_ENGINE_CLASS, - iname, fname, length, pobject); + ret = nvkm_subdev_create_(parent, engobj, oclass, NV_ENGINE_CLASS, + iname, fname, length, pobject); engine = *pobject; if (ret) return ret; if (parent) { - struct nouveau_device *device = nv_device(parent); + struct nvkm_device *device = nv_device(parent); int engidx = nv_engidx(engine); if (device->disable_mask & (1ULL << engidx)) { - if (!nouveau_boolopt(device->cfgopt, iname, false)) { + if (!nvkm_boolopt(device->cfgopt, iname, false)) { nv_debug(engine, "engine disabled by hw/fw\n"); return -ENODEV; } @@ -64,7 +62,7 @@ nouveau_engine_create_(struct nouveau_object *parent, nv_warn(engine, "ignoring hw/fw engine disable\n"); } - if (!nouveau_boolopt(device->cfgopt, iname, enable)) { + if (!nvkm_boolopt(device->cfgopt, iname, enable)) { if (!enable) nv_warn(engine, "disabled, %s=1 to enable\n", iname); return -ENODEV; diff --git a/drivers/gpu/drm/nouveau/nvkm/core/enum.c b/drivers/gpu/drm/nouveau/nvkm/core/enum.c index dd434790ccc4..4f92bfc13d6b 100644 --- a/drivers/gpu/drm/nouveau/nvkm/core/enum.c +++ b/drivers/gpu/drm/nouveau/nvkm/core/enum.c @@ -24,12 +24,10 @@ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ - -#include <core/os.h> #include <core/enum.h> -const struct nouveau_enum * -nouveau_enum_find(const struct nouveau_enum *en, u32 value) +const struct nvkm_enum * +nvkm_enum_find(const struct nvkm_enum *en, u32 value) { while (en->name) { if (en->value == value) @@ -40,10 +38,10 @@ nouveau_enum_find(const struct nouveau_enum *en, u32 value) return NULL; } -const struct nouveau_enum * -nouveau_enum_print(const struct nouveau_enum *en, u32 value) +const struct nvkm_enum * +nvkm_enum_print(const struct nvkm_enum *en, u32 value) { - en = nouveau_enum_find(en, value); + en = nvkm_enum_find(en, value); if (en) pr_cont("%s", en->name); else @@ -52,7 +50,7 @@ nouveau_enum_print(const struct nouveau_enum *en, u32 value) } void -nouveau_bitfield_print(const struct nouveau_bitfield *bf, u32 value) +nvkm_bitfield_print(const struct nvkm_bitfield *bf, u32 value) { while (bf->name) { if (value & bf->mask) { diff --git a/drivers/gpu/drm/nouveau/nvkm/core/event.c b/drivers/gpu/drm/nouveau/nvkm/core/event.c index 760947e380c9..4e8d3fa042df 100644 --- a/drivers/gpu/drm/nouveau/nvkm/core/event.c +++ b/drivers/gpu/drm/nouveau/nvkm/core/event.c @@ -19,9 +19,8 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ - -#include <core/object.h> #include <core/event.h> +#include <core/notify.h> void nvkm_event_put(struct nvkm_event *event, u32 types, int index) diff --git a/drivers/gpu/drm/nouveau/nvkm/core/gpuobj.c b/drivers/gpu/drm/nouveau/nvkm/core/gpuobj.c index 68a4232d35cc..0c5cb55fc617 100644 --- a/drivers/gpu/drm/nouveau/nvkm/core/gpuobj.c +++ b/drivers/gpu/drm/nouveau/nvkm/core/gpuobj.c @@ -21,8 +21,6 @@ * * Authors: Ben Skeggs */ - -#include <core/object.h> #include <core/gpuobj.h> #include <subdev/instmem.h> @@ -30,7 +28,7 @@ #include <subdev/mmu.h> void -nouveau_gpuobj_destroy(struct nouveau_gpuobj *gpuobj) +nvkm_gpuobj_destroy(struct nvkm_gpuobj *gpuobj) { int i; @@ -39,29 +37,25 @@ nouveau_gpuobj_destroy(struct nouveau_gpuobj *gpuobj) nv_wo32(gpuobj, i, 0x00000000); } - if (gpuobj->node) { - nouveau_mm_free(&nv_gpuobj(gpuobj->parent)->heap, - &gpuobj->node); - } + if (gpuobj->node) + nvkm_mm_free(&nv_gpuobj(gpuobj->parent)->heap, &gpuobj->node); if (gpuobj->heap.block_size) - nouveau_mm_fini(&gpuobj->heap); + nvkm_mm_fini(&gpuobj->heap); - nouveau_object_destroy(&gpuobj->object); + nvkm_object_destroy(&gpuobj->object); } int -nouveau_gpuobj_create_(struct nouveau_object *parent, - struct nouveau_object *engine, - struct nouveau_oclass *oclass, u32 pclass, - struct nouveau_object *pargpu, - u32 size, u32 align, u32 flags, - int length, void **pobject) +nvkm_gpuobj_create_(struct nvkm_object *parent, struct nvkm_object *engine, + struct nvkm_oclass *oclass, u32 pclass, + struct nvkm_object *pargpu, u32 size, u32 align, u32 flags, + int length, void **pobject) { - struct nouveau_instmem *imem = nouveau_instmem(parent); - struct nouveau_bar *bar = nouveau_bar(parent); - struct nouveau_gpuobj *gpuobj; - struct nouveau_mm *heap = NULL; + struct nvkm_instmem *imem = nvkm_instmem(parent); + struct nvkm_bar *bar = nvkm_bar(parent); + struct nvkm_gpuobj *gpuobj; + struct nvkm_mm *heap = NULL; int ret, i; u64 addr; @@ -92,19 +86,19 @@ nouveau_gpuobj_create_(struct nouveau_object *parent, size = nv_memobj(pargpu)->size; if (bar && bar->alloc) { - struct nouveau_instobj *iobj = (void *)parent; - struct nouveau_mem **mem = (void *)(iobj + 1); - struct nouveau_mem *node = *mem; + struct nvkm_instobj *iobj = (void *)parent; + struct nvkm_mem **mem = (void *)(iobj + 1); + struct nvkm_mem *node = *mem; if (!bar->alloc(bar, parent, node, &pargpu)) { - nouveau_object_ref(NULL, &parent); + nvkm_object_ref(NULL, &parent); parent = pargpu; } } } - ret = nouveau_object_create_(parent, engine, oclass, pclass | - NV_GPUOBJ_CLASS, length, pobject); - nouveau_object_ref(NULL, &parent); + ret = nvkm_object_create_(parent, engine, oclass, pclass | + NV_GPUOBJ_CLASS, length, pobject); + nvkm_object_ref(NULL, &parent); gpuobj = *pobject; if (ret) return ret; @@ -115,8 +109,8 @@ nouveau_gpuobj_create_(struct nouveau_object *parent, gpuobj->size = size; if (heap) { - ret = nouveau_mm_head(heap, 0, 1, size, size, - max(align, (u32)1), &gpuobj->node); + ret = nvkm_mm_head(heap, 0, 1, size, size, max(align, (u32)1), + &gpuobj->node); if (ret) return ret; @@ -124,7 +118,7 @@ nouveau_gpuobj_create_(struct nouveau_object *parent, } if (gpuobj->flags & NVOBJ_FLAG_HEAP) { - ret = nouveau_mm_init(&gpuobj->heap, 0, gpuobj->size, 1); + ret = nvkm_mm_init(&gpuobj->heap, 0, gpuobj->size, 1); if (ret) return ret; } @@ -137,26 +131,25 @@ nouveau_gpuobj_create_(struct nouveau_object *parent, return ret; } -struct nouveau_gpuobj_class { - struct nouveau_object *pargpu; +struct nvkm_gpuobj_class { + struct nvkm_object *pargpu; u64 size; u32 align; u32 flags; }; static int -_nouveau_gpuobj_ctor(struct nouveau_object *parent, - struct nouveau_object *engine, - struct nouveau_oclass *oclass, void *data, u32 size, - struct nouveau_object **pobject) +_nvkm_gpuobj_ctor(struct nvkm_object *parent, struct nvkm_object *engine, + struct nvkm_oclass *oclass, void *data, u32 size, + struct nvkm_object **pobject) { - struct nouveau_gpuobj_class *args = data; - struct nouveau_gpuobj *object; + struct nvkm_gpuobj_class *args = data; + struct nvkm_gpuobj *object; int ret; - ret = nouveau_gpuobj_create(parent, engine, oclass, 0, args->pargpu, - args->size, args->align, args->flags, - &object); + ret = nvkm_gpuobj_create(parent, engine, oclass, 0, args->pargpu, + args->size, args->align, args->flags, + &object); *pobject = nv_object(object); if (ret) return ret; @@ -165,63 +158,63 @@ _nouveau_gpuobj_ctor(struct nouveau_object *parent, } void -_nouveau_gpuobj_dtor(struct nouveau_object *object) +_nvkm_gpuobj_dtor(struct nvkm_object *object) { - nouveau_gpuobj_destroy(nv_gpuobj(object)); + nvkm_gpuobj_destroy(nv_gpuobj(object)); } int -_nouveau_gpuobj_init(struct nouveau_object *object) +_nvkm_gpuobj_init(struct nvkm_object *object) { - return nouveau_gpuobj_init(nv_gpuobj(object)); + return nvkm_gpuobj_init(nv_gpuobj(object)); } int -_nouveau_gpuobj_fini(struct nouveau_object *object, bool suspend) +_nvkm_gpuobj_fini(struct nvkm_object *object, bool suspend) { - return nouveau_gpuobj_fini(nv_gpuobj(object), suspend); + return nvkm_gpuobj_fini(nv_gpuobj(object), suspend); } u32 -_nouveau_gpuobj_rd32(struct nouveau_object *object, u64 addr) +_nvkm_gpuobj_rd32(struct nvkm_object *object, u64 addr) { - struct nouveau_gpuobj *gpuobj = nv_gpuobj(object); - struct nouveau_ofuncs *pfuncs = nv_ofuncs(gpuobj->parent); + struct nvkm_gpuobj *gpuobj = nv_gpuobj(object); + struct nvkm_ofuncs *pfuncs = nv_ofuncs(gpuobj->parent); if (gpuobj->node) addr += gpuobj->node->offset; return pfuncs->rd32(gpuobj->parent, addr); } void -_nouveau_gpuobj_wr32(struct nouveau_object *object, u64 addr, u32 data) +_nvkm_gpuobj_wr32(struct nvkm_object *object, u64 addr, u32 data) { - struct nouveau_gpuobj *gpuobj = nv_gpuobj(object); - struct nouveau_ofuncs *pfuncs = nv_ofuncs(gpuobj->parent); + struct nvkm_gpuobj *gpuobj = nv_gpuobj(object); + struct nvkm_ofuncs *pfuncs = nv_ofuncs(gpuobj->parent); if (gpuobj->node) addr += gpuobj->node->offset; pfuncs->wr32(gpuobj->parent, addr, data); } -static struct nouveau_oclass -_nouveau_gpuobj_oclass = { +static struct nvkm_oclass +_nvkm_gpuobj_oclass = { .handle = 0x00000000, - .ofuncs = &(struct nouveau_ofuncs) { - .ctor = _nouveau_gpuobj_ctor, - .dtor = _nouveau_gpuobj_dtor, - .init = _nouveau_gpuobj_init, - .fini = _nouveau_gpuobj_fini, - .rd32 = _nouveau_gpuobj_rd32, - .wr32 = _nouveau_gpuobj_wr32, + .ofuncs = &(struct nvkm_ofuncs) { + .ctor = _nvkm_gpuobj_ctor, + .dtor = _nvkm_gpuobj_dtor, + .init = _nvkm_gpuobj_init, + .fini = _nvkm_gpuobj_fini, + .rd32 = _nvkm_gpuobj_rd32, + .wr32 = _nvkm_gpuobj_wr32, }, }; int -nouveau_gpuobj_new(struct nouveau_object *parent, struct nouveau_object *pargpu, - u32 size, u32 align, u32 flags, - struct nouveau_gpuobj **pgpuobj) +nvkm_gpuobj_new(struct nvkm_object *parent, struct nvkm_object *pargpu, + u32 size, u32 align, u32 flags, + struct nvkm_gpuobj **pgpuobj) { - struct nouveau_object *engine = parent; - struct nouveau_gpuobj_class args = { + struct nvkm_object *engine = parent; + struct nvkm_gpuobj_class args = { .pargpu = pargpu, .size = size, .align = align, @@ -232,22 +225,21 @@ nouveau_gpuobj_new(struct nouveau_object *parent, struct nouveau_object *pargpu, engine = &engine->engine->subdev.object; BUG_ON(engine == NULL); - return nouveau_object_ctor(parent, engine, &_nouveau_gpuobj_oclass, - &args, sizeof(args), - (struct nouveau_object **)pgpuobj); + return nvkm_object_ctor(parent, engine, &_nvkm_gpuobj_oclass, + &args, sizeof(args), + (struct nvkm_object **)pgpuobj); } int -nouveau_gpuobj_map(struct nouveau_gpuobj *gpuobj, u32 access, - struct nouveau_vma *vma) +nvkm_gpuobj_map(struct nvkm_gpuobj *gpuobj, u32 access, struct nvkm_vma *vma) { - struct nouveau_bar *bar = nouveau_bar(gpuobj); + struct nvkm_bar *bar = nvkm_bar(gpuobj); int ret = -EINVAL; if (bar && bar->umap) { - struct nouveau_instobj *iobj = (void *) + struct nvkm_instobj *iobj = (void *) nv_pclass(nv_object(gpuobj), NV_MEMOBJ_CLASS); - struct nouveau_mem **mem = (void *)(iobj + 1); + struct nvkm_mem **mem = (void *)(iobj + 1); ret = bar->umap(bar, *mem, access, vma); } @@ -255,28 +247,28 @@ nouveau_gpuobj_map(struct nouveau_gpuobj *gpuobj, u32 access, } int -nouveau_gpuobj_map_vm(struct nouveau_gpuobj *gpuobj, struct nouveau_vm *vm, - u32 access, struct nouveau_vma *vma) +nvkm_gpuobj_map_vm(struct nvkm_gpuobj *gpuobj, struct nvkm_vm *vm, + u32 access, struct nvkm_vma *vma) { - struct nouveau_instobj *iobj = (void *) + struct nvkm_instobj *iobj = (void *) nv_pclass(nv_object(gpuobj), NV_MEMOBJ_CLASS); - struct nouveau_mem **mem = (void *)(iobj + 1); + struct nvkm_mem **mem = (void *)(iobj + 1); int ret; - ret = nouveau_vm_get(vm, gpuobj->size, 12, access, vma); + ret = nvkm_vm_get(vm, gpuobj->size, 12, access, vma); if (ret) return ret; - nouveau_vm_map(vma, *mem); + nvkm_vm_map(vma, *mem); return 0; } void -nouveau_gpuobj_unmap(struct nouveau_vma *vma) +nvkm_gpuobj_unmap(struct nvkm_vma *vma) { if (vma->node) { - nouveau_vm_unmap(vma); - nouveau_vm_put(vma); + nvkm_vm_unmap(vma); + nvkm_vm_put(vma); } } @@ -286,37 +278,37 @@ nouveau_gpuobj_unmap(struct nouveau_vma *vma) */ static void -nouveau_gpudup_dtor(struct nouveau_object *object) +nvkm_gpudup_dtor(struct nvkm_object *object) { - struct nouveau_gpuobj *gpuobj = (void *)object; - nouveau_object_ref(NULL, &gpuobj->parent); - nouveau_object_destroy(&gpuobj->object); + struct nvkm_gpuobj *gpuobj = (void *)object; + nvkm_object_ref(NULL, &gpuobj->parent); + nvkm_object_destroy(&gpuobj->object); } -static struct nouveau_oclass -nouveau_gpudup_oclass = { +static struct nvkm_oclass +nvkm_gpudup_oclass = { .handle = NV_GPUOBJ_CLASS, - .ofuncs = &(struct nouveau_ofuncs) { - .dtor = nouveau_gpudup_dtor, - .init = nouveau_object_init, - .fini = nouveau_object_fini, + .ofuncs = &(struct nvkm_ofuncs) { + .dtor = nvkm_gpudup_dtor, + .init = nvkm_object_init, + .fini = nvkm_object_fini, }, }; int -nouveau_gpuobj_dup(struct nouveau_object *parent, struct nouveau_gpuobj *base, - struct nouveau_gpuobj **pgpuobj) +nvkm_gpuobj_dup(struct nvkm_object *parent, struct nvkm_gpuobj *base, + struct nvkm_gpuobj **pgpuobj) { - struct nouveau_gpuobj *gpuobj; + struct nvkm_gpuobj *gpuobj; int ret; - ret = nouveau_object_create(parent, &parent->engine->subdev.object, - &nouveau_gpudup_oclass, 0, &gpuobj); + ret = nvkm_object_create(parent, &parent->engine->subdev.object, + &nvkm_gpudup_oclass, 0, &gpuobj); *pgpuobj = gpuobj; if (ret) return ret; - nouveau_object_ref(nv_object(base), &gpuobj->parent); + nvkm_object_ref(nv_object(base), &gpuobj->parent); gpuobj->addr = base->addr; gpuobj->size = base->size; return 0; diff --git a/drivers/gpu/drm/nouveau/nvkm/core/handle.c b/drivers/gpu/drm/nouveau/nvkm/core/handle.c index 13f816cb08bd..dc7ff10ebe7b 100644 --- a/drivers/gpu/drm/nouveau/nvkm/core/handle.c +++ b/drivers/gpu/drm/nouveau/nvkm/core/handle.c @@ -21,31 +21,29 @@ * * Authors: Ben Skeggs */ - -#include <core/object.h> #include <core/handle.h> #include <core/client.h> #define hprintk(h,l,f,a...) do { \ - struct nouveau_client *c = nouveau_client((h)->object); \ - struct nouveau_handle *p = (h)->parent; u32 n = p ? p->name : ~0; \ + struct nvkm_client *c = nvkm_client((h)->object); \ + struct nvkm_handle *p = (h)->parent; u32 n = p ? p->name : ~0; \ nv_printk((c), l, "0x%08x:0x%08x "f, n, (h)->name, ##a); \ } while(0) int -nouveau_handle_init(struct nouveau_handle *handle) +nvkm_handle_init(struct nvkm_handle *handle) { - struct nouveau_handle *item; + struct nvkm_handle *item; int ret; hprintk(handle, TRACE, "init running\n"); - ret = nouveau_object_inc(handle->object); + ret = nvkm_object_inc(handle->object); if (ret) return ret; hprintk(handle, TRACE, "init children\n"); list_for_each_entry(item, &handle->tree, head) { - ret = nouveau_handle_init(item); + ret = nvkm_handle_init(item); if (ret) goto fail; } @@ -55,30 +53,30 @@ nouveau_handle_init(struct nouveau_handle *handle) fail: hprintk(handle, ERROR, "init failed with %d\n", ret); list_for_each_entry_continue_reverse(item, &handle->tree, head) { - nouveau_handle_fini(item, false); + nvkm_handle_fini(item, false); } - nouveau_object_dec(handle->object, false); + nvkm_object_dec(handle->object, false); return ret; } int -nouveau_handle_fini(struct nouveau_handle *handle, bool suspend) +nvkm_handle_fini(struct nvkm_handle *handle, bool suspend) { static char *name[2] = { "fini", "suspend" }; - struct nouveau_handle *item; + struct nvkm_handle *item; int ret; hprintk(handle, TRACE, "%s children\n", name[suspend]); list_for_each_entry(item, &handle->tree, head) { - ret = nouveau_handle_fini(item, suspend); + ret = nvkm_handle_fini(item, suspend); if (ret && suspend) goto fail; } hprintk(handle, TRACE, "%s running\n", name[suspend]); if (handle->object) { - ret = nouveau_object_dec(handle->object, suspend); + ret = nvkm_object_dec(handle->object, suspend); if (ret && suspend) goto fail; } @@ -88,7 +86,7 @@ nouveau_handle_fini(struct nouveau_handle *handle, bool suspend) fail: hprintk(handle, ERROR, "%s failed with %d\n", name[suspend], ret); list_for_each_entry_continue_reverse(item, &handle->tree, head) { - int rret = nouveau_handle_init(item); + int rret = nvkm_handle_init(item); if (rret) hprintk(handle, FATAL, "failed to restart, %d\n", rret); } @@ -97,12 +95,11 @@ fail: } int -nouveau_handle_create(struct nouveau_object *parent, u32 _parent, u32 _handle, - struct nouveau_object *object, - struct nouveau_handle **phandle) +nvkm_handle_create(struct nvkm_object *parent, u32 _parent, u32 _handle, + struct nvkm_object *object, struct nvkm_handle **phandle) { - struct nouveau_object *namedb; - struct nouveau_handle *handle; + struct nvkm_object *namedb; + struct nvkm_handle *handle; int ret; namedb = parent; @@ -118,7 +115,7 @@ nouveau_handle_create(struct nouveau_object *parent, u32 _parent, u32 _handle, handle->name = _handle; handle->priv = ~0; - ret = nouveau_namedb_insert(nv_namedb(namedb), _handle, object, handle); + ret = nvkm_namedb_insert(nv_namedb(namedb), _handle, object, handle); if (ret) { kfree(handle); return ret; @@ -127,7 +124,7 @@ nouveau_handle_create(struct nouveau_object *parent, u32 _parent, u32 _handle, if (nv_parent(parent)->object_attach) { ret = nv_parent(parent)->object_attach(parent, object, _handle); if (ret < 0) { - nouveau_handle_destroy(handle); + nvkm_handle_destroy(handle); return ret; } @@ -138,10 +135,10 @@ nouveau_handle_create(struct nouveau_object *parent, u32 _parent, u32 _handle, while (!nv_iclass(namedb, NV_CLIENT_CLASS)) namedb = namedb->parent; - handle->parent = nouveau_namedb_get(nv_namedb(namedb), _parent); + handle->parent = nvkm_namedb_get(nv_namedb(namedb), _parent); if (handle->parent) { list_add(&handle->head, &handle->parent->tree); - nouveau_namedb_put(handle->parent); + nvkm_namedb_put(handle->parent); } } @@ -151,74 +148,74 @@ nouveau_handle_create(struct nouveau_object *parent, u32 _parent, u32 _handle, } void -nouveau_handle_destroy(struct nouveau_handle *handle) +nvkm_handle_destroy(struct nvkm_handle *handle) { - struct nouveau_handle *item, *temp; + struct nvkm_handle *item, *temp; hprintk(handle, TRACE, "destroy running\n"); list_for_each_entry_safe(item, temp, &handle->tree, head) { - nouveau_handle_destroy(item); + nvkm_handle_destroy(item); } list_del(&handle->head); if (handle->priv != ~0) { - struct nouveau_object *parent = handle->parent->object; + struct nvkm_object *parent = handle->parent->object; nv_parent(parent)->object_detach(parent, handle->priv); } hprintk(handle, TRACE, "destroy completed\n"); - nouveau_namedb_remove(handle); + nvkm_namedb_remove(handle); kfree(handle); } -struct nouveau_object * -nouveau_handle_ref(struct nouveau_object *parent, u32 name) +struct nvkm_object * +nvkm_handle_ref(struct nvkm_object *parent, u32 name) { - struct nouveau_object *object = NULL; - struct nouveau_handle *handle; + struct nvkm_object *object = NULL; + struct nvkm_handle *handle; while (!nv_iclass(parent, NV_NAMEDB_CLASS)) parent = parent->parent; - handle = nouveau_namedb_get(nv_namedb(parent), name); + handle = nvkm_namedb_get(nv_namedb(parent), name); if (handle) { - nouveau_object_ref(handle->object, &object); - nouveau_namedb_put(handle); + nvkm_object_ref(handle->object, &object); + nvkm_namedb_put(handle); } return object; } -struct nouveau_handle * -nouveau_handle_get_class(struct nouveau_object *engctx, u16 oclass) +struct nvkm_handle * +nvkm_handle_get_class(struct nvkm_object *engctx, u16 oclass) { - struct nouveau_namedb *namedb; + struct nvkm_namedb *namedb; if (engctx && (namedb = (void *)nv_pclass(engctx, NV_NAMEDB_CLASS))) - return nouveau_namedb_get_class(namedb, oclass); + return nvkm_namedb_get_class(namedb, oclass); return NULL; } -struct nouveau_handle * -nouveau_handle_get_vinst(struct nouveau_object *engctx, u64 vinst) +struct nvkm_handle * +nvkm_handle_get_vinst(struct nvkm_object *engctx, u64 vinst) { - struct nouveau_namedb *namedb; + struct nvkm_namedb *namedb; if (engctx && (namedb = (void *)nv_pclass(engctx, NV_NAMEDB_CLASS))) - return nouveau_namedb_get_vinst(namedb, vinst); + return nvkm_namedb_get_vinst(namedb, vinst); return NULL; } -struct nouveau_handle * -nouveau_handle_get_cinst(struct nouveau_object *engctx, u32 cinst) +struct nvkm_handle * +nvkm_handle_get_cinst(struct nvkm_object *engctx, u32 cinst) { - struct nouveau_namedb *namedb; + struct nvkm_namedb *namedb; if (engctx && (namedb = (void *)nv_pclass(engctx, NV_NAMEDB_CLASS))) - return nouveau_namedb_get_cinst(namedb, cinst); + return nvkm_namedb_get_cinst(namedb, cinst); return NULL; } void -nouveau_handle_put(struct nouveau_handle *handle) +nvkm_handle_put(struct nvkm_handle *handle) { if (handle) - nouveau_namedb_put(handle); + nvkm_namedb_put(handle); } diff --git a/drivers/gpu/drm/nouveau/nvkm/core/ioctl.c b/drivers/gpu/drm/nouveau/nvkm/core/ioctl.c index bdfabb4a8dc9..4459ff5f4cb8 100644 --- a/drivers/gpu/drm/nouveau/nvkm/core/ioctl.c +++ b/drivers/gpu/drm/nouveau/nvkm/core/ioctl.c @@ -21,23 +21,19 @@ * * Authors: Ben Skeggs <bskeggs@redhat.com> */ - -#include <core/object.h> -#include <core/parent.h> +#include <core/ioctl.h> +#include <core/client.h> +#include <core/engine.h> #include <core/handle.h> #include <core/namedb.h> -#include <core/client.h> -#include <core/device.h> -#include <core/ioctl.h> -#include <core/event.h> #include <nvif/unpack.h> #include <nvif/ioctl.h> static int -nvkm_ioctl_nop(struct nouveau_handle *handle, void *data, u32 size) +nvkm_ioctl_nop(struct nvkm_handle *handle, void *data, u32 size) { - struct nouveau_object *object = handle->object; + struct nvkm_object *object = handle->object; union { struct nvif_ioctl_nop none; } *args = data; @@ -52,9 +48,9 @@ nvkm_ioctl_nop(struct nouveau_handle *handle, void *data, u32 size) } static int -nvkm_ioctl_sclass(struct nouveau_handle *handle, void *data, u32 size) +nvkm_ioctl_sclass(struct nvkm_handle *handle, void *data, u32 size) { - struct nouveau_object *object = handle->object; + struct nvkm_object *object = handle->object; union { struct nvif_ioctl_sclass_v0 v0; } *args = data; @@ -70,8 +66,8 @@ nvkm_ioctl_sclass(struct nouveau_handle *handle, void *data, u32 size) nv_ioctl(object, "sclass vers %d count %d\n", args->v0.version, args->v0.count); if (size == args->v0.count * sizeof(args->v0.oclass[0])) { - ret = nouveau_parent_lclass(object, args->v0.oclass, - args->v0.count); + ret = nvkm_parent_lclass(object, args->v0.oclass, + args->v0.count); if (ret >= 0) { args->v0.count = ret; ret = 0; @@ -85,17 +81,17 @@ nvkm_ioctl_sclass(struct nouveau_handle *handle, void *data, u32 size) } static int -nvkm_ioctl_new(struct nouveau_handle *handle, void *data, u32 size) +nvkm_ioctl_new(struct nvkm_handle *handle, void *data, u32 size) { union { struct nvif_ioctl_new_v0 v0; } *args = data; - struct nouveau_client *client = nouveau_client(handle->object); - struct nouveau_object *engctx = NULL; - struct nouveau_object *object = NULL; - struct nouveau_parent *parent; - struct nouveau_object *engine; - struct nouveau_oclass *oclass; + struct nvkm_client *client = nvkm_client(handle->object); + struct nvkm_object *engctx = NULL; + struct nvkm_object *object = NULL; + struct nvkm_parent *parent; + struct nvkm_object *engine; + struct nvkm_oclass *oclass; u32 _handle, _oclass; int ret; @@ -108,8 +104,8 @@ nvkm_ioctl_new(struct nouveau_handle *handle, void *data, u32 size) nv_ioctl(client, "new vers %d handle %08x class %08x " "route %02x token %llx\n", - args->v0.version, _handle, _oclass, - args->v0.route, args->v0.token); + args->v0.version, _handle, _oclass, + args->v0.route, args->v0.token); if (!nv_iclass(handle->object, NV_PARENT_CLASS)) { nv_debug(handle->object, "cannot have children (ctor)\n"); @@ -120,7 +116,7 @@ nvkm_ioctl_new(struct nouveau_handle *handle, void *data, u32 size) parent = nv_parent(handle->object); /* check that parent supports the requested subclass */ - ret = nouveau_parent_sclass(&parent->object, _oclass, &engine, &oclass); + ret = nvkm_parent_sclass(&parent->object, _oclass, &engine, &oclass); if (ret) { nv_debug(parent, "illegal class 0x%04x\n", _oclass); goto fail_class; @@ -131,7 +127,7 @@ nvkm_ioctl_new(struct nouveau_handle *handle, void *data, u32 size) * state calculated at init (ie. default context construction) */ if (engine) { - ret = nouveau_object_inc(engine); + ret = nvkm_object_inc(engine); if (ret) goto fail_class; } @@ -140,53 +136,53 @@ nvkm_ioctl_new(struct nouveau_handle *handle, void *data, u32 size) * between the parent and its children (eg. PGRAPH context) */ if (engine && nv_engine(engine)->cclass) { - ret = nouveau_object_ctor(&parent->object, engine, - nv_engine(engine)->cclass, - data, size, &engctx); + ret = nvkm_object_ctor(&parent->object, engine, + nv_engine(engine)->cclass, + data, size, &engctx); if (ret) goto fail_engctx; } else { - nouveau_object_ref(&parent->object, &engctx); + nvkm_object_ref(&parent->object, &engctx); } /* finally, create new object and bind it to its handle */ - ret = nouveau_object_ctor(engctx, engine, oclass, data, size, &object); + ret = nvkm_object_ctor(engctx, engine, oclass, data, size, &object); client->data = object; if (ret) goto fail_ctor; - ret = nouveau_object_inc(object); + ret = nvkm_object_inc(object); if (ret) goto fail_init; - ret = nouveau_handle_create(&parent->object, handle->name, - _handle, object, &handle); + ret = nvkm_handle_create(&parent->object, handle->name, + _handle, object, &handle); if (ret) goto fail_handle; - ret = nouveau_handle_init(handle); + ret = nvkm_handle_init(handle); handle->route = args->v0.route; handle->token = args->v0.token; if (ret) - nouveau_handle_destroy(handle); + nvkm_handle_destroy(handle); fail_handle: - nouveau_object_dec(object, false); + nvkm_object_dec(object, false); fail_init: - nouveau_object_ref(NULL, &object); + nvkm_object_ref(NULL, &object); fail_ctor: - nouveau_object_ref(NULL, &engctx); + nvkm_object_ref(NULL, &engctx); fail_engctx: if (engine) - nouveau_object_dec(engine, false); + nvkm_object_dec(engine, false); fail_class: return ret; } static int -nvkm_ioctl_del(struct nouveau_handle *handle, void *data, u32 size) +nvkm_ioctl_del(struct nvkm_handle *handle, void *data, u32 size) { - struct nouveau_object *object = handle->object; + struct nvkm_object *object = handle->object; union { struct nvif_ioctl_del none; } *args = data; @@ -195,18 +191,18 @@ nvkm_ioctl_del(struct nouveau_handle *handle, void *data, u32 size) nv_ioctl(object, "delete size %d\n", size); if (nvif_unvers(args->none)) { nv_ioctl(object, "delete\n"); - nouveau_handle_fini(handle, false); - nouveau_handle_destroy(handle); + nvkm_handle_fini(handle, false); + nvkm_handle_destroy(handle); } return ret; } static int -nvkm_ioctl_mthd(struct nouveau_handle *handle, void *data, u32 size) +nvkm_ioctl_mthd(struct nvkm_handle *handle, void *data, u32 size) { - struct nouveau_object *object = handle->object; - struct nouveau_ofuncs *ofuncs = object->oclass->ofuncs; + struct nvkm_object *object = handle->object; + struct nvkm_ofuncs *ofuncs = object->oclass->ofuncs; union { struct nvif_ioctl_mthd_v0 v0; } *args = data; @@ -225,10 +221,10 @@ nvkm_ioctl_mthd(struct nouveau_handle *handle, void *data, u32 size) static int -nvkm_ioctl_rd(struct nouveau_handle *handle, void *data, u32 size) +nvkm_ioctl_rd(struct nvkm_handle *handle, void *data, u32 size) { - struct nouveau_object *object = handle->object; - struct nouveau_ofuncs *ofuncs = object->oclass->ofuncs; + struct nvkm_object *object = handle->object; + struct nvkm_ofuncs *ofuncs = object->oclass->ofuncs; union { struct nvif_ioctl_rd_v0 v0; } *args = data; @@ -237,7 +233,7 @@ nvkm_ioctl_rd(struct nouveau_handle *handle, void *data, u32 size) nv_ioctl(object, "rd size %d\n", size); if (nvif_unpack(args->v0, 0, 0, false)) { nv_ioctl(object, "rd vers %d size %d addr %016llx\n", - args->v0.version, args->v0.size, args->v0.addr); + args->v0.version, args->v0.size, args->v0.addr); switch (args->v0.size) { case 1: if (ret = -ENODEV, ofuncs->rd08) { @@ -267,10 +263,10 @@ nvkm_ioctl_rd(struct nouveau_handle *handle, void *data, u32 size) } static int -nvkm_ioctl_wr(struct nouveau_handle *handle, void *data, u32 size) +nvkm_ioctl_wr(struct nvkm_handle *handle, void *data, u32 size) { - struct nouveau_object *object = handle->object; - struct nouveau_ofuncs *ofuncs = object->oclass->ofuncs; + struct nvkm_object *object = handle->object; + struct nvkm_ofuncs *ofuncs = object->oclass->ofuncs; union { struct nvif_ioctl_wr_v0 v0; } *args = data; @@ -310,10 +306,10 @@ nvkm_ioctl_wr(struct nouveau_handle *handle, void *data, u32 size) } static int -nvkm_ioctl_map(struct nouveau_handle *handle, void *data, u32 size) +nvkm_ioctl_map(struct nvkm_handle *handle, void *data, u32 size) { - struct nouveau_object *object = handle->object; - struct nouveau_ofuncs *ofuncs = object->oclass->ofuncs; + struct nvkm_object *object = handle->object; + struct nvkm_ofuncs *ofuncs = object->oclass->ofuncs; union { struct nvif_ioctl_map_v0 v0; } *args = data; @@ -332,9 +328,9 @@ nvkm_ioctl_map(struct nouveau_handle *handle, void *data, u32 size) } static int -nvkm_ioctl_unmap(struct nouveau_handle *handle, void *data, u32 size) +nvkm_ioctl_unmap(struct nvkm_handle *handle, void *data, u32 size) { - struct nouveau_object *object = handle->object; + struct nvkm_object *object = handle->object; union { struct nvif_ioctl_unmap none; } *args = data; @@ -349,10 +345,10 @@ nvkm_ioctl_unmap(struct nouveau_handle *handle, void *data, u32 size) } static int -nvkm_ioctl_ntfy_new(struct nouveau_handle *handle, void *data, u32 size) +nvkm_ioctl_ntfy_new(struct nvkm_handle *handle, void *data, u32 size) { - struct nouveau_object *object = handle->object; - struct nouveau_ofuncs *ofuncs = object->oclass->ofuncs; + struct nvkm_object *object = handle->object; + struct nvkm_ofuncs *ofuncs = object->oclass->ofuncs; union { struct nvif_ioctl_ntfy_new_v0 v0; } *args = data; @@ -378,10 +374,10 @@ nvkm_ioctl_ntfy_new(struct nouveau_handle *handle, void *data, u32 size) } static int -nvkm_ioctl_ntfy_del(struct nouveau_handle *handle, void *data, u32 size) +nvkm_ioctl_ntfy_del(struct nvkm_handle *handle, void *data, u32 size) { - struct nouveau_client *client = nouveau_client(handle->object); - struct nouveau_object *object = handle->object; + struct nvkm_client *client = nvkm_client(handle->object); + struct nvkm_object *object = handle->object; union { struct nvif_ioctl_ntfy_del_v0 v0; } *args = data; @@ -398,10 +394,10 @@ nvkm_ioctl_ntfy_del(struct nouveau_handle *handle, void *data, u32 size) } static int -nvkm_ioctl_ntfy_get(struct nouveau_handle *handle, void *data, u32 size) +nvkm_ioctl_ntfy_get(struct nvkm_handle *handle, void *data, u32 size) { - struct nouveau_client *client = nouveau_client(handle->object); - struct nouveau_object *object = handle->object; + struct nvkm_client *client = nvkm_client(handle->object); + struct nvkm_object *object = handle->object; union { struct nvif_ioctl_ntfy_get_v0 v0; } *args = data; @@ -418,10 +414,10 @@ nvkm_ioctl_ntfy_get(struct nouveau_handle *handle, void *data, u32 size) } static int -nvkm_ioctl_ntfy_put(struct nouveau_handle *handle, void *data, u32 size) +nvkm_ioctl_ntfy_put(struct nvkm_handle *handle, void *data, u32 size) { - struct nouveau_client *client = nouveau_client(handle->object); - struct nouveau_object *object = handle->object; + struct nvkm_client *client = nvkm_client(handle->object); + struct nvkm_object *object = handle->object; union { struct nvif_ioctl_ntfy_put_v0 v0; } *args = data; @@ -439,7 +435,7 @@ nvkm_ioctl_ntfy_put(struct nouveau_handle *handle, void *data, u32 size) static struct { int version; - int (*func)(struct nouveau_handle *, void *, u32); + int (*func)(struct nvkm_handle *, void *, u32); } nvkm_ioctl_v0[] = { { 0x00, nvkm_ioctl_nop }, @@ -458,13 +454,12 @@ nvkm_ioctl_v0[] = { }; static int -nvkm_ioctl_path(struct nouveau_handle *parent, u32 type, u32 nr, - u32 *path, void *data, u32 size, - u8 owner, u8 *route, u64 *token) +nvkm_ioctl_path(struct nvkm_handle *parent, u32 type, u32 nr, u32 *path, + void *data, u32 size, u8 owner, u8 *route, u64 *token) { - struct nouveau_handle *handle = parent; - struct nouveau_namedb *namedb; - struct nouveau_object *object; + struct nvkm_handle *handle = parent; + struct nvkm_namedb *namedb; + struct nvkm_object *object; int ret; while ((object = parent->object), nr--) { @@ -475,16 +470,15 @@ nvkm_ioctl_path(struct nouveau_handle *parent, u32 type, u32 nr, } if (!(namedb = (void *)nv_pclass(object, NV_NAMEDB_CLASS)) || - !(handle = nouveau_namedb_get(namedb, path[nr]))) { + !(handle = nvkm_namedb_get(namedb, path[nr]))) { nv_debug(object, "handle 0x%08x not found\n", path[nr]); return -ENOENT; } - nouveau_namedb_put(handle); + nvkm_namedb_put(handle); parent = handle; } - if (owner != NVIF_IOCTL_V0_OWNER_ANY && - owner != handle->route) { + if (owner != NVIF_IOCTL_V0_OWNER_ANY && owner != handle->route) { nv_ioctl(object, "object route != owner\n"); return -EACCES; } @@ -492,16 +486,15 @@ nvkm_ioctl_path(struct nouveau_handle *parent, u32 type, u32 nr, *token = handle->token; if (ret = -EINVAL, type < ARRAY_SIZE(nvkm_ioctl_v0)) { - if (nvkm_ioctl_v0[type].version == 0) { + if (nvkm_ioctl_v0[type].version == 0) ret = nvkm_ioctl_v0[type].func(handle, data, size); - } } return ret; } int -nvkm_ioctl(struct nouveau_client *client, bool supervisor, +nvkm_ioctl(struct nvkm_client *client, bool supervisor, void *data, u32 size, void **hack) { union { @@ -519,7 +512,7 @@ nvkm_ioctl(struct nouveau_client *client, bool supervisor, ret = nvkm_ioctl_path(client->root, args->v0.type, args->v0.path_nr, args->v0.path, data, size, args->v0.owner, - &args->v0.route, &args->v0.token); + &args->v0.route, &args->v0.token); } nv_ioctl(client, "return %d\n", ret); @@ -527,6 +520,7 @@ nvkm_ioctl(struct nouveau_client *client, bool supervisor, *hack = client->data; client->data = NULL; } + client->super = false; return ret; } diff --git a/drivers/gpu/drm/nouveau/nvkm/core/mm.c b/drivers/gpu/drm/nouveau/nvkm/core/mm.c index b4f5db66d5b5..7f458dfd5608 100644 --- a/drivers/gpu/drm/nouveau/nvkm/core/mm.c +++ b/drivers/gpu/drm/nouveau/nvkm/core/mm.c @@ -21,39 +21,37 @@ * * Authors: Ben Skeggs */ +#include <core/mm.h> -#include "core/os.h" -#include "core/mm.h" - -#define node(root, dir) ((root)->nl_entry.dir == &mm->nodes) ? NULL : \ - list_entry((root)->nl_entry.dir, struct nouveau_mm_node, nl_entry) +#define node(root, dir) ((root)->nl_entry.dir == &mm->nodes) ? NULL : \ + list_entry((root)->nl_entry.dir, struct nvkm_mm_node, nl_entry) static void -nouveau_mm_dump(struct nouveau_mm *mm, const char *header) +nvkm_mm_dump(struct nvkm_mm *mm, const char *header) { - struct nouveau_mm_node *node; + struct nvkm_mm_node *node; - printk(KERN_ERR "nouveau: %s\n", header); - printk(KERN_ERR "nouveau: node list:\n"); + printk(KERN_ERR "nvkm: %s\n", header); + printk(KERN_ERR "nvkm: node list:\n"); list_for_each_entry(node, &mm->nodes, nl_entry) { - printk(KERN_ERR "nouveau: \t%08x %08x %d\n", + printk(KERN_ERR "nvkm: \t%08x %08x %d\n", node->offset, node->length, node->type); } - printk(KERN_ERR "nouveau: free list:\n"); + printk(KERN_ERR "nvkm: free list:\n"); list_for_each_entry(node, &mm->free, fl_entry) { - printk(KERN_ERR "nouveau: \t%08x %08x %d\n", + printk(KERN_ERR "nvkm: \t%08x %08x %d\n", node->offset, node->length, node->type); } } void -nouveau_mm_free(struct nouveau_mm *mm, struct nouveau_mm_node **pthis) +nvkm_mm_free(struct nvkm_mm *mm, struct nvkm_mm_node **pthis) { - struct nouveau_mm_node *this = *pthis; + struct nvkm_mm_node *this = *pthis; if (this) { - struct nouveau_mm_node *prev = node(this, prev); - struct nouveau_mm_node *next = node(this, next); + struct nvkm_mm_node *prev = node(this, prev); + struct nvkm_mm_node *next = node(this, next); if (prev && prev->type == NVKM_MM_TYPE_NONE) { prev->length += this->length; @@ -84,10 +82,10 @@ nouveau_mm_free(struct nouveau_mm *mm, struct nouveau_mm_node **pthis) *pthis = NULL; } -static struct nouveau_mm_node * -region_head(struct nouveau_mm *mm, struct nouveau_mm_node *a, u32 size) +static struct nvkm_mm_node * +region_head(struct nvkm_mm *mm, struct nvkm_mm_node *a, u32 size) { - struct nouveau_mm_node *b; + struct nvkm_mm_node *b; if (a->length == size) return a; @@ -105,14 +103,15 @@ region_head(struct nouveau_mm *mm, struct nouveau_mm_node *a, u32 size) list_add_tail(&b->nl_entry, &a->nl_entry); if (b->type == NVKM_MM_TYPE_NONE) list_add_tail(&b->fl_entry, &a->fl_entry); + return b; } int -nouveau_mm_head(struct nouveau_mm *mm, u8 heap, u8 type, u32 size_max, - u32 size_min, u32 align, struct nouveau_mm_node **pnode) +nvkm_mm_head(struct nvkm_mm *mm, u8 heap, u8 type, u32 size_max, u32 size_min, + u32 align, struct nvkm_mm_node **pnode) { - struct nouveau_mm_node *prev, *this, *next; + struct nvkm_mm_node *prev, *this, *next; u32 mask = align - 1; u32 splitoff; u32 s, e; @@ -157,10 +156,10 @@ nouveau_mm_head(struct nouveau_mm *mm, u8 heap, u8 type, u32 size_max, return -ENOSPC; } -static struct nouveau_mm_node * -region_tail(struct nouveau_mm *mm, struct nouveau_mm_node *a, u32 size) +static struct nvkm_mm_node * +region_tail(struct nvkm_mm *mm, struct nvkm_mm_node *a, u32 size) { - struct nouveau_mm_node *b; + struct nvkm_mm_node *b; if (a->length == size) return a; @@ -178,14 +177,15 @@ region_tail(struct nouveau_mm *mm, struct nouveau_mm_node *a, u32 size) list_add(&b->nl_entry, &a->nl_entry); if (b->type == NVKM_MM_TYPE_NONE) list_add(&b->fl_entry, &a->fl_entry); + return b; } int -nouveau_mm_tail(struct nouveau_mm *mm, u8 heap, u8 type, u32 size_max, - u32 size_min, u32 align, struct nouveau_mm_node **pnode) +nvkm_mm_tail(struct nvkm_mm *mm, u8 heap, u8 type, u32 size_max, u32 size_min, + u32 align, struct nvkm_mm_node **pnode) { - struct nouveau_mm_node *prev, *this, *next; + struct nvkm_mm_node *prev, *this, *next; u32 mask = align - 1; BUG_ON(type == NVKM_MM_TYPE_NONE || type == NVKM_MM_TYPE_HOLE); @@ -235,12 +235,12 @@ nouveau_mm_tail(struct nouveau_mm *mm, u8 heap, u8 type, u32 size_max, } int -nouveau_mm_init(struct nouveau_mm *mm, u32 offset, u32 length, u32 block) +nvkm_mm_init(struct nvkm_mm *mm, u32 offset, u32 length, u32 block) { - struct nouveau_mm_node *node, *prev; + struct nvkm_mm_node *node, *prev; u32 next; - if (nouveau_mm_initialised(mm)) { + if (nvkm_mm_initialised(mm)) { prev = list_last_entry(&mm->nodes, typeof(*node), nl_entry); next = prev->offset + prev->length; if (next != offset) { @@ -277,18 +277,18 @@ nouveau_mm_init(struct nouveau_mm *mm, u32 offset, u32 length, u32 block) } int -nouveau_mm_fini(struct nouveau_mm *mm) +nvkm_mm_fini(struct nvkm_mm *mm) { - struct nouveau_mm_node *node, *temp; + struct nvkm_mm_node *node, *temp; int nodes = 0; - if (!nouveau_mm_initialised(mm)) + if (!nvkm_mm_initialised(mm)) return 0; list_for_each_entry(node, &mm->nodes, nl_entry) { if (node->type != NVKM_MM_TYPE_HOLE) { if (++nodes > mm->heap_nodes) { - nouveau_mm_dump(mm, "mm not clean!"); + nvkm_mm_dump(mm, "mm not clean!"); return -EBUSY; } } @@ -298,6 +298,7 @@ nouveau_mm_fini(struct nouveau_mm *mm) list_del(&node->nl_entry); kfree(node); } + mm->heap_nodes = 0; return 0; } diff --git a/drivers/gpu/drm/nouveau/nvkm/core/namedb.c b/drivers/gpu/drm/nouveau/nvkm/core/namedb.c index 0594a599f6fb..6400767c5dba 100644 --- a/drivers/gpu/drm/nouveau/nvkm/core/namedb.c +++ b/drivers/gpu/drm/nouveau/nvkm/core/namedb.c @@ -21,16 +21,14 @@ * * Authors: Ben Skeggs */ - -#include <core/object.h> #include <core/namedb.h> -#include <core/handle.h> #include <core/gpuobj.h> +#include <core/handle.h> -static struct nouveau_handle * -nouveau_namedb_lookup(struct nouveau_namedb *namedb, u32 name) +static struct nvkm_handle * +nvkm_namedb_lookup(struct nvkm_namedb *namedb, u32 name) { - struct nouveau_handle *handle; + struct nvkm_handle *handle; list_for_each_entry(handle, &namedb->list, node) { if (handle->name == name) @@ -40,10 +38,10 @@ nouveau_namedb_lookup(struct nouveau_namedb *namedb, u32 name) return NULL; } -static struct nouveau_handle * -nouveau_namedb_lookup_class(struct nouveau_namedb *namedb, u16 oclass) +static struct nvkm_handle * +nvkm_namedb_lookup_class(struct nvkm_namedb *namedb, u16 oclass) { - struct nouveau_handle *handle; + struct nvkm_handle *handle; list_for_each_entry(handle, &namedb->list, node) { if (nv_mclass(handle->object) == oclass) @@ -53,10 +51,10 @@ nouveau_namedb_lookup_class(struct nouveau_namedb *namedb, u16 oclass) return NULL; } -static struct nouveau_handle * -nouveau_namedb_lookup_vinst(struct nouveau_namedb *namedb, u64 vinst) +static struct nvkm_handle * +nvkm_namedb_lookup_vinst(struct nvkm_namedb *namedb, u64 vinst) { - struct nouveau_handle *handle; + struct nvkm_handle *handle; list_for_each_entry(handle, &namedb->list, node) { if (nv_iclass(handle->object, NV_GPUOBJ_CLASS)) { @@ -68,10 +66,10 @@ nouveau_namedb_lookup_vinst(struct nouveau_namedb *namedb, u64 vinst) return NULL; } -static struct nouveau_handle * -nouveau_namedb_lookup_cinst(struct nouveau_namedb *namedb, u32 cinst) +static struct nvkm_handle * +nvkm_namedb_lookup_cinst(struct nvkm_namedb *namedb, u32 cinst) { - struct nouveau_handle *handle; + struct nvkm_handle *handle; list_for_each_entry(handle, &namedb->list, node) { if (nv_iclass(handle->object, NV_GPUOBJ_CLASS)) { @@ -85,14 +83,14 @@ nouveau_namedb_lookup_cinst(struct nouveau_namedb *namedb, u32 cinst) } int -nouveau_namedb_insert(struct nouveau_namedb *namedb, u32 name, - struct nouveau_object *object, - struct nouveau_handle *handle) +nvkm_namedb_insert(struct nvkm_namedb *namedb, u32 name, + struct nvkm_object *object, + struct nvkm_handle *handle) { int ret = -EEXIST; write_lock_irq(&namedb->lock); - if (!nouveau_namedb_lookup(namedb, name)) { - nouveau_object_ref(object, &handle->object); + if (!nvkm_namedb_lookup(namedb, name)) { + nvkm_object_ref(object, &handle->object); handle->namedb = namedb; list_add(&handle->node, &namedb->list); ret = 0; @@ -102,80 +100,79 @@ nouveau_namedb_insert(struct nouveau_namedb *namedb, u32 name, } void -nouveau_namedb_remove(struct nouveau_handle *handle) +nvkm_namedb_remove(struct nvkm_handle *handle) { - struct nouveau_namedb *namedb = handle->namedb; - struct nouveau_object *object = handle->object; + struct nvkm_namedb *namedb = handle->namedb; + struct nvkm_object *object = handle->object; write_lock_irq(&namedb->lock); list_del(&handle->node); write_unlock_irq(&namedb->lock); - nouveau_object_ref(NULL, &object); + nvkm_object_ref(NULL, &object); } -struct nouveau_handle * -nouveau_namedb_get(struct nouveau_namedb *namedb, u32 name) +struct nvkm_handle * +nvkm_namedb_get(struct nvkm_namedb *namedb, u32 name) { - struct nouveau_handle *handle; + struct nvkm_handle *handle; read_lock(&namedb->lock); - handle = nouveau_namedb_lookup(namedb, name); + handle = nvkm_namedb_lookup(namedb, name); if (handle == NULL) read_unlock(&namedb->lock); return handle; } -struct nouveau_handle * -nouveau_namedb_get_class(struct nouveau_namedb *namedb, u16 oclass) +struct nvkm_handle * +nvkm_namedb_get_class(struct nvkm_namedb *namedb, u16 oclass) { - struct nouveau_handle *handle; + struct nvkm_handle *handle; read_lock(&namedb->lock); - handle = nouveau_namedb_lookup_class(namedb, oclass); + handle = nvkm_namedb_lookup_class(namedb, oclass); if (handle == NULL) read_unlock(&namedb->lock); return handle; } -struct nouveau_handle * -nouveau_namedb_get_vinst(struct nouveau_namedb *namedb, u64 vinst) +struct nvkm_handle * +nvkm_namedb_get_vinst(struct nvkm_namedb *namedb, u64 vinst) { - struct nouveau_handle *handle; + struct nvkm_handle *handle; read_lock(&namedb->lock); - handle = nouveau_namedb_lookup_vinst(namedb, vinst); + handle = nvkm_namedb_lookup_vinst(namedb, vinst); if (handle == NULL) read_unlock(&namedb->lock); return handle; } -struct nouveau_handle * -nouveau_namedb_get_cinst(struct nouveau_namedb *namedb, u32 cinst) +struct nvkm_handle * +nvkm_namedb_get_cinst(struct nvkm_namedb *namedb, u32 cinst) { - struct nouveau_handle *handle; + struct nvkm_handle *handle; read_lock(&namedb->lock); - handle = nouveau_namedb_lookup_cinst(namedb, cinst); + handle = nvkm_namedb_lookup_cinst(namedb, cinst); if (handle == NULL) read_unlock(&namedb->lock); return handle; } void -nouveau_namedb_put(struct nouveau_handle *handle) +nvkm_namedb_put(struct nvkm_handle *handle) { if (handle) read_unlock(&handle->namedb->lock); } int -nouveau_namedb_create_(struct nouveau_object *parent, - struct nouveau_object *engine, - struct nouveau_oclass *oclass, u32 pclass, - struct nouveau_oclass *sclass, u64 engcls, - int length, void **pobject) +nvkm_namedb_create_(struct nvkm_object *parent, struct nvkm_object *engine, + struct nvkm_oclass *oclass, u32 pclass, + struct nvkm_oclass *sclass, u64 engcls, + int length, void **pobject) { - struct nouveau_namedb *namedb; + struct nvkm_namedb *namedb; int ret; - ret = nouveau_parent_create_(parent, engine, oclass, pclass | - NV_NAMEDB_CLASS, sclass, engcls, - length, pobject); + ret = nvkm_parent_create_(parent, engine, oclass, pclass | + NV_NAMEDB_CLASS, sclass, engcls, + length, pobject); namedb = *pobject; if (ret) return ret; @@ -186,15 +183,14 @@ nouveau_namedb_create_(struct nouveau_object *parent, } int -_nouveau_namedb_ctor(struct nouveau_object *parent, - struct nouveau_object *engine, - struct nouveau_oclass *oclass, void *data, u32 size, - struct nouveau_object **pobject) +_nvkm_namedb_ctor(struct nvkm_object *parent, struct nvkm_object *engine, + struct nvkm_oclass *oclass, void *data, u32 size, + struct nvkm_object **pobject) { - struct nouveau_namedb *object; + struct nvkm_namedb *object; int ret; - ret = nouveau_namedb_create(parent, engine, oclass, 0, NULL, 0, &object); + ret = nvkm_namedb_create(parent, engine, oclass, 0, NULL, 0, &object); *pobject = nv_object(object); if (ret) return ret; diff --git a/drivers/gpu/drm/nouveau/nvkm/core/notify.c b/drivers/gpu/drm/nouveau/nvkm/core/notify.c index 839a32577680..023610d01458 100644 --- a/drivers/gpu/drm/nouveau/nvkm/core/notify.c +++ b/drivers/gpu/drm/nouveau/nvkm/core/notify.c @@ -21,13 +21,8 @@ * * Authors: Ben Skeggs <bskeggs@redhat.com> */ - -#include <core/client.h> -#include <core/event.h> #include <core/notify.h> - -#include <nvif/unpack.h> -#include <nvif/event.h> +#include <core/event.h> static inline void nvkm_notify_put_locked(struct nvkm_notify *notify) @@ -134,7 +129,7 @@ nvkm_notify_fini(struct nvkm_notify *notify) } int -nvkm_notify_init(struct nouveau_object *object, struct nvkm_event *event, +nvkm_notify_init(struct nvkm_object *object, struct nvkm_event *event, int (*func)(struct nvkm_notify *), bool work, void *data, u32 size, u32 reply, struct nvkm_notify *notify) diff --git a/drivers/gpu/drm/nouveau/nvkm/core/object.c b/drivers/gpu/drm/nouveau/nvkm/core/object.c index b160860edf54..979f3627d395 100644 --- a/drivers/gpu/drm/nouveau/nvkm/core/object.c +++ b/drivers/gpu/drm/nouveau/nvkm/core/object.c @@ -21,36 +21,34 @@ * * Authors: Ben Skeggs */ - #include <core/object.h> #include <core/engine.h> -#ifdef NOUVEAU_OBJECT_MAGIC +#ifdef NVKM_OBJECT_MAGIC static struct list_head _objlist = LIST_HEAD_INIT(_objlist); static DEFINE_SPINLOCK(_objlist_lock); #endif int -nouveau_object_create_(struct nouveau_object *parent, - struct nouveau_object *engine, - struct nouveau_oclass *oclass, u32 pclass, - int size, void **pobject) +nvkm_object_create_(struct nvkm_object *parent, struct nvkm_object *engine, + struct nvkm_oclass *oclass, u32 pclass, + int size, void **pobject) { - struct nouveau_object *object; + struct nvkm_object *object; object = *pobject = kzalloc(size, GFP_KERNEL); if (!object) return -ENOMEM; - nouveau_object_ref(parent, &object->parent); - nouveau_object_ref(engine, (struct nouveau_object **)&object->engine); + nvkm_object_ref(parent, &object->parent); + nvkm_object_ref(engine, (struct nvkm_object **)&object->engine); object->oclass = oclass; object->oclass->handle |= pclass; atomic_set(&object->refcount, 1); atomic_set(&object->usecount, 0); -#ifdef NOUVEAU_OBJECT_MAGIC - object->_magic = NOUVEAU_OBJECT_MAGIC; +#ifdef NVKM_OBJECT_MAGIC + object->_magic = NVKM_OBJECT_MAGIC; spin_lock(&_objlist_lock); list_add(&object->list, &_objlist); spin_unlock(&_objlist_lock); @@ -59,57 +57,55 @@ nouveau_object_create_(struct nouveau_object *parent, } int -_nouveau_object_ctor(struct nouveau_object *parent, - struct nouveau_object *engine, - struct nouveau_oclass *oclass, void *data, u32 size, - struct nouveau_object **pobject) +_nvkm_object_ctor(struct nvkm_object *parent, struct nvkm_object *engine, + struct nvkm_oclass *oclass, void *data, u32 size, + struct nvkm_object **pobject) { if (size != 0) return -ENOSYS; - return nouveau_object_create(parent, engine, oclass, 0, pobject); + return nvkm_object_create(parent, engine, oclass, 0, pobject); } void -nouveau_object_destroy(struct nouveau_object *object) +nvkm_object_destroy(struct nvkm_object *object) { -#ifdef NOUVEAU_OBJECT_MAGIC +#ifdef NVKM_OBJECT_MAGIC spin_lock(&_objlist_lock); list_del(&object->list); spin_unlock(&_objlist_lock); #endif - nouveau_object_ref(NULL, (struct nouveau_object **)&object->engine); - nouveau_object_ref(NULL, &object->parent); + nvkm_object_ref(NULL, (struct nvkm_object **)&object->engine); + nvkm_object_ref(NULL, &object->parent); kfree(object); } int -nouveau_object_init(struct nouveau_object *object) +nvkm_object_init(struct nvkm_object *object) { return 0; } int -nouveau_object_fini(struct nouveau_object *object, bool suspend) +nvkm_object_fini(struct nvkm_object *object, bool suspend) { return 0; } -struct nouveau_ofuncs -nouveau_object_ofuncs = { - .ctor = _nouveau_object_ctor, - .dtor = nouveau_object_destroy, - .init = nouveau_object_init, - .fini = nouveau_object_fini, +struct nvkm_ofuncs +nvkm_object_ofuncs = { + .ctor = _nvkm_object_ctor, + .dtor = nvkm_object_destroy, + .init = nvkm_object_init, + .fini = nvkm_object_fini, }; int -nouveau_object_ctor(struct nouveau_object *parent, - struct nouveau_object *engine, - struct nouveau_oclass *oclass, void *data, u32 size, - struct nouveau_object **pobject) +nvkm_object_ctor(struct nvkm_object *parent, struct nvkm_object *engine, + struct nvkm_oclass *oclass, void *data, u32 size, + struct nvkm_object **pobject) { - struct nouveau_ofuncs *ofuncs = oclass->ofuncs; - struct nouveau_object *object = NULL; + struct nvkm_ofuncs *ofuncs = oclass->ofuncs; + struct nvkm_object *object = NULL; int ret; ret = ofuncs->ctor(parent, engine, oclass, data, size, &object); @@ -137,14 +133,14 @@ nouveau_object_ctor(struct nouveau_object *parent, } static void -nouveau_object_dtor(struct nouveau_object *object) +nvkm_object_dtor(struct nvkm_object *object) { nv_trace(object, "destroying\n"); nv_ofuncs(object)->dtor(object); } void -nouveau_object_ref(struct nouveau_object *obj, struct nouveau_object **ref) +nvkm_object_ref(struct nvkm_object *obj, struct nvkm_object **ref) { if (obj) { atomic_inc(&obj->refcount); @@ -155,14 +151,14 @@ nouveau_object_ref(struct nouveau_object *obj, struct nouveau_object **ref) int dead = atomic_dec_and_test(&(*ref)->refcount); nv_trace(*ref, "dec() == %d\n", atomic_read(&(*ref)->refcount)); if (dead) - nouveau_object_dtor(*ref); + nvkm_object_dtor(*ref); } *ref = obj; } int -nouveau_object_inc(struct nouveau_object *object) +nvkm_object_inc(struct nvkm_object *object) { int ref = atomic_add_return(1, &object->usecount); int ret; @@ -173,7 +169,7 @@ nouveau_object_inc(struct nouveau_object *object) nv_trace(object, "initialising...\n"); if (object->parent) { - ret = nouveau_object_inc(object->parent); + ret = nvkm_object_inc(object->parent); if (ret) { nv_error(object, "parent failed, %d\n", ret); goto fail_parent; @@ -182,7 +178,7 @@ nouveau_object_inc(struct nouveau_object *object) if (object->engine) { mutex_lock(&nv_subdev(object->engine)->mutex); - ret = nouveau_object_inc(&object->engine->subdev.object); + ret = nvkm_object_inc(&object->engine->subdev.object); mutex_unlock(&nv_subdev(object->engine)->mutex); if (ret) { nv_error(object, "engine failed, %d\n", ret); @@ -203,19 +199,19 @@ nouveau_object_inc(struct nouveau_object *object) fail_self: if (object->engine) { mutex_lock(&nv_subdev(object->engine)->mutex); - nouveau_object_dec(&object->engine->subdev.object, false); + nvkm_object_dec(&object->engine->subdev.object, false); mutex_unlock(&nv_subdev(object->engine)->mutex); } fail_engine: if (object->parent) - nouveau_object_dec(object->parent, false); + nvkm_object_dec(object->parent, false); fail_parent: atomic_dec(&object->usecount); return ret; } static int -nouveau_object_decf(struct nouveau_object *object) +nvkm_object_decf(struct nvkm_object *object) { int ret; @@ -228,19 +224,19 @@ nouveau_object_decf(struct nouveau_object *object) if (object->engine) { mutex_lock(&nv_subdev(object->engine)->mutex); - nouveau_object_dec(&object->engine->subdev.object, false); + nvkm_object_dec(&object->engine->subdev.object, false); mutex_unlock(&nv_subdev(object->engine)->mutex); } if (object->parent) - nouveau_object_dec(object->parent, false); + nvkm_object_dec(object->parent, false); nv_trace(object, "stopped\n"); return 0; } static int -nouveau_object_decs(struct nouveau_object *object) +nvkm_object_decs(struct nvkm_object *object) { int ret, rret; @@ -255,7 +251,7 @@ nouveau_object_decs(struct nouveau_object *object) if (object->engine) { mutex_lock(&nv_subdev(object->engine)->mutex); - ret = nouveau_object_dec(&object->engine->subdev.object, true); + ret = nvkm_object_dec(&object->engine->subdev.object, true); mutex_unlock(&nv_subdev(object->engine)->mutex); if (ret) { nv_warn(object, "engine failed suspend, %d\n", ret); @@ -264,7 +260,7 @@ nouveau_object_decs(struct nouveau_object *object) } if (object->parent) { - ret = nouveau_object_dec(object->parent, true); + ret = nvkm_object_dec(object->parent, true); if (ret) { nv_warn(object, "parent failed suspend, %d\n", ret); goto fail_parent; @@ -277,7 +273,7 @@ nouveau_object_decs(struct nouveau_object *object) fail_parent: if (object->engine) { mutex_lock(&nv_subdev(object->engine)->mutex); - rret = nouveau_object_inc(&object->engine->subdev.object); + rret = nvkm_object_inc(&object->engine->subdev.object); mutex_unlock(&nv_subdev(object->engine)->mutex); if (rret) nv_fatal(object, "engine failed to reinit, %d\n", rret); @@ -292,7 +288,7 @@ fail_engine: } int -nouveau_object_dec(struct nouveau_object *object, bool suspend) +nvkm_object_dec(struct nvkm_object *object, bool suspend) { int ref = atomic_add_return(-1, &object->usecount); int ret; @@ -301,9 +297,9 @@ nouveau_object_dec(struct nouveau_object *object, bool suspend) if (ref == 0) { if (suspend) - ret = nouveau_object_decs(object); + ret = nvkm_object_decs(object); else - ret = nouveau_object_decf(object); + ret = nvkm_object_decf(object); if (ret) { atomic_inc(&object->usecount); @@ -315,10 +311,10 @@ nouveau_object_dec(struct nouveau_object *object, bool suspend) } void -nouveau_object_debug(void) +nvkm_object_debug(void) { -#ifdef NOUVEAU_OBJECT_MAGIC - struct nouveau_object *object; +#ifdef NVKM_OBJECT_MAGIC + struct nvkm_object *object; if (!list_empty(&_objlist)) { nv_fatal(NULL, "*******************************************\n"); nv_fatal(NULL, "* AIIIII! object(s) still exist!!!\n"); diff --git a/drivers/gpu/drm/nouveau/nvkm/core/option.c b/drivers/gpu/drm/nouveau/nvkm/core/option.c index 9f6fcc5f66c2..19d153f8c8fd 100644 --- a/drivers/gpu/drm/nouveau/nvkm/core/option.c +++ b/drivers/gpu/drm/nouveau/nvkm/core/option.c @@ -21,12 +21,11 @@ * * Authors: Ben Skeggs */ - #include <core/option.h> #include <core/debug.h> const char * -nouveau_stropt(const char *optstr, const char *opt, int *arglen) +nvkm_stropt(const char *optstr, const char *opt, int *arglen) { while (optstr && *optstr != '\0') { int len = strcspn(optstr, ",="); @@ -52,11 +51,11 @@ nouveau_stropt(const char *optstr, const char *opt, int *arglen) } bool -nouveau_boolopt(const char *optstr, const char *opt, bool value) +nvkm_boolopt(const char *optstr, const char *opt, bool value) { int arglen; - optstr = nouveau_stropt(optstr, opt, &arglen); + optstr = nvkm_stropt(optstr, opt, &arglen); if (optstr) { if (!strncasecmpz(optstr, "0", arglen) || !strncasecmpz(optstr, "no", arglen) || @@ -75,7 +74,7 @@ nouveau_boolopt(const char *optstr, const char *opt, bool value) } int -nouveau_dbgopt(const char *optstr, const char *sub) +nvkm_dbgopt(const char *optstr, const char *sub) { int mode = 1, level = CONFIG_NOUVEAU_DEBUG_DEFAULT; diff --git a/drivers/gpu/drm/nouveau/nvkm/core/parent.c b/drivers/gpu/drm/nouveau/nvkm/core/parent.c index 1f28fa12e98f..dd56cd1eeb38 100644 --- a/drivers/gpu/drm/nouveau/nvkm/core/parent.c +++ b/drivers/gpu/drm/nouveau/nvkm/core/parent.c @@ -21,19 +21,18 @@ * * Authors: Ben Skeggs */ - -#include <core/object.h> #include <core/parent.h> #include <core/client.h> +#include <core/engine.h> int -nouveau_parent_sclass(struct nouveau_object *parent, u16 handle, - struct nouveau_object **pengine, - struct nouveau_oclass **poclass) +nvkm_parent_sclass(struct nvkm_object *parent, u16 handle, + struct nvkm_object **pengine, + struct nvkm_oclass **poclass) { - struct nouveau_sclass *sclass; - struct nouveau_engine *engine; - struct nouveau_oclass *oclass; + struct nvkm_sclass *sclass; + struct nvkm_engine *engine; + struct nvkm_oclass *oclass; u64 mask; sclass = nv_parent(parent)->sclass; @@ -54,7 +53,7 @@ nouveau_parent_sclass(struct nouveau_object *parent, u16 handle, if (nv_iclass(parent, NV_CLIENT_CLASS)) engine = nv_engine(nv_client(parent)->device); else - engine = nouveau_engine(parent, i); + engine = nvkm_engine(parent, i); if (engine) { oclass = engine->sclass; @@ -75,11 +74,11 @@ nouveau_parent_sclass(struct nouveau_object *parent, u16 handle, } int -nouveau_parent_lclass(struct nouveau_object *parent, u32 *lclass, int size) +nvkm_parent_lclass(struct nvkm_object *parent, u32 *lclass, int size) { - struct nouveau_sclass *sclass; - struct nouveau_engine *engine; - struct nouveau_oclass *oclass; + struct nvkm_sclass *sclass; + struct nvkm_engine *engine; + struct nvkm_oclass *oclass; int nr = -1, i; u64 mask; @@ -92,7 +91,7 @@ nouveau_parent_lclass(struct nouveau_object *parent, u32 *lclass, int size) mask = nv_parent(parent)->engine; while (i = __ffs64(mask), mask) { - engine = nouveau_engine(parent, i); + engine = nvkm_engine(parent, i); if (engine && (oclass = engine->sclass)) { while (oclass->ofuncs) { if (++nr < size) @@ -108,18 +107,17 @@ nouveau_parent_lclass(struct nouveau_object *parent, u32 *lclass, int size) } int -nouveau_parent_create_(struct nouveau_object *parent, - struct nouveau_object *engine, - struct nouveau_oclass *oclass, u32 pclass, - struct nouveau_oclass *sclass, u64 engcls, - int size, void **pobject) +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 nouveau_parent *object; - struct nouveau_sclass *nclass; + struct nvkm_parent *object; + struct nvkm_sclass *nclass; int ret; - ret = nouveau_object_create_(parent, engine, oclass, pclass | - NV_PARENT_CLASS, size, pobject); + ret = nvkm_object_create_(parent, engine, oclass, pclass | + NV_PARENT_CLASS, size, pobject); object = *pobject; if (ret) return ret; @@ -141,21 +139,21 @@ nouveau_parent_create_(struct nouveau_object *parent, } void -nouveau_parent_destroy(struct nouveau_parent *parent) +nvkm_parent_destroy(struct nvkm_parent *parent) { - struct nouveau_sclass *sclass; + struct nvkm_sclass *sclass; while ((sclass = parent->sclass)) { parent->sclass = sclass->sclass; kfree(sclass); } - nouveau_object_destroy(&parent->object); + nvkm_object_destroy(&parent->object); } void -_nouveau_parent_dtor(struct nouveau_object *object) +_nvkm_parent_dtor(struct nvkm_object *object) { - nouveau_parent_destroy(nv_parent(object)); + nvkm_parent_destroy(nv_parent(object)); } diff --git a/drivers/gpu/drm/nouveau/nvkm/core/printk.c b/drivers/gpu/drm/nouveau/nvkm/core/printk.c index ed424f99f383..4a220eb91660 100644 --- a/drivers/gpu/drm/nouveau/nvkm/core/printk.c +++ b/drivers/gpu/drm/nouveau/nvkm/core/printk.c @@ -21,16 +21,14 @@ * * Authors: Ben Skeggs */ - -#include <core/object.h> -#include <core/client.h> -#include <core/subdev.h> #include <core/printk.h> +#include <core/client.h> +#include <core/device.h> int nv_info_debug_level = NV_DBG_INFO_NORMAL; void -nv_printk_(struct nouveau_object *object, int level, const char *fmt, ...) +nv_printk_(struct nvkm_object *object, int level, const char *fmt, ...) { static const char name[] = { '!', 'E', 'W', ' ', 'D', 'T', 'P', 'S' }; const char *pfx; @@ -60,8 +58,8 @@ nv_printk_(struct nouveau_object *object, int level, const char *fmt, ...) } if (object && !nv_iclass(object, NV_CLIENT_CLASS)) { - struct nouveau_object *device; - struct nouveau_object *subdev; + struct nvkm_object *device; + struct nvkm_object *subdev; char obuf[64], *ofmt = ""; if (object->engine == NULL) { diff --git a/drivers/gpu/drm/nouveau/nvkm/core/ramht.c b/drivers/gpu/drm/nouveau/nvkm/core/ramht.c index 25cd6f29072b..0a382d0975b0 100644 --- a/drivers/gpu/drm/nouveau/nvkm/core/ramht.c +++ b/drivers/gpu/drm/nouveau/nvkm/core/ramht.c @@ -19,14 +19,12 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ - -#include <core/object.h> #include <core/ramht.h> #include <subdev/bar.h> static u32 -nouveau_ramht_hash(struct nouveau_ramht *ramht, int chid, u32 handle) +nvkm_ramht_hash(struct nvkm_ramht *ramht, int chid, u32 handle) { u32 hash = 0; @@ -41,13 +39,12 @@ nouveau_ramht_hash(struct nouveau_ramht *ramht, int chid, u32 handle) } int -nouveau_ramht_insert(struct nouveau_ramht *ramht, int chid, - u32 handle, u32 context) +nvkm_ramht_insert(struct nvkm_ramht *ramht, int chid, u32 handle, u32 context) { - struct nouveau_bar *bar = nouveau_bar(ramht); + struct nvkm_bar *bar = nvkm_bar(ramht); u32 co, ho; - co = ho = nouveau_ramht_hash(ramht, chid, handle); + co = ho = nvkm_ramht_hash(ramht, chid, handle); do { if (!nv_ro32(ramht, co + 4)) { nv_wo32(ramht, co + 0, handle); @@ -66,39 +63,39 @@ nouveau_ramht_insert(struct nouveau_ramht *ramht, int chid, } void -nouveau_ramht_remove(struct nouveau_ramht *ramht, int cookie) +nvkm_ramht_remove(struct nvkm_ramht *ramht, int cookie) { - struct nouveau_bar *bar = nouveau_bar(ramht); + struct nvkm_bar *bar = nvkm_bar(ramht); nv_wo32(ramht, cookie + 0, 0x00000000); nv_wo32(ramht, cookie + 4, 0x00000000); if (bar) bar->flush(bar); } -static struct nouveau_oclass -nouveau_ramht_oclass = { +static struct nvkm_oclass +nvkm_ramht_oclass = { .handle = 0x0000abcd, - .ofuncs = &(struct nouveau_ofuncs) { + .ofuncs = &(struct nvkm_ofuncs) { .ctor = NULL, - .dtor = _nouveau_gpuobj_dtor, - .init = _nouveau_gpuobj_init, - .fini = _nouveau_gpuobj_fini, - .rd32 = _nouveau_gpuobj_rd32, - .wr32 = _nouveau_gpuobj_wr32, + .dtor = _nvkm_gpuobj_dtor, + .init = _nvkm_gpuobj_init, + .fini = _nvkm_gpuobj_fini, + .rd32 = _nvkm_gpuobj_rd32, + .wr32 = _nvkm_gpuobj_wr32, }, }; int -nouveau_ramht_new(struct nouveau_object *parent, struct nouveau_object *pargpu, - u32 size, u32 align, struct nouveau_ramht **pramht) +nvkm_ramht_new(struct nvkm_object *parent, struct nvkm_object *pargpu, + u32 size, u32 align, struct nvkm_ramht **pramht) { - struct nouveau_ramht *ramht; + struct nvkm_ramht *ramht; int ret; - ret = nouveau_gpuobj_create(parent, parent->engine ? - &parent->engine->subdev.object : parent, /* <nv50 ramht */ - &nouveau_ramht_oclass, 0, pargpu, size, - align, NVOBJ_FLAG_ZERO_ALLOC, &ramht); + ret = nvkm_gpuobj_create(parent, parent->engine ? + &parent->engine->subdev.object : parent, /* <nv50 ramht */ + &nvkm_ramht_oclass, 0, pargpu, size, + align, NVOBJ_FLAG_ZERO_ALLOC, &ramht); *pramht = ramht; if (ret) return ret; diff --git a/drivers/gpu/drm/nouveau/nvkm/core/subdev.c b/drivers/gpu/drm/nouveau/nvkm/core/subdev.c index cb1c49c2e9d6..c5fb3a793174 100644 --- a/drivers/gpu/drm/nouveau/nvkm/core/subdev.c +++ b/drivers/gpu/drm/nouveau/nvkm/core/subdev.c @@ -21,16 +21,14 @@ * * Authors: Ben Skeggs */ - -#include <core/object.h> #include <core/subdev.h> #include <core/device.h> #include <core/option.h> -struct nouveau_subdev * -nouveau_subdev(void *obj, int idx) +struct nvkm_subdev * +nvkm_subdev(void *obj, int idx) { - struct nouveau_object *object = nv_object(obj); + struct nvkm_object *object = nv_object(obj); while (object && !nv_iclass(object, NV_SUBDEV_CLASS)) object = object->parent; if (object == NULL || nv_subidx(nv_subdev(object)) != idx) @@ -39,7 +37,7 @@ nouveau_subdev(void *obj, int idx) } void -nouveau_subdev_reset(struct nouveau_object *subdev) +nvkm_subdev_reset(struct nvkm_object *subdev) { nv_trace(subdev, "resetting...\n"); nv_ofuncs(subdev)->fini(subdev, false); @@ -47,65 +45,64 @@ nouveau_subdev_reset(struct nouveau_object *subdev) } int -nouveau_subdev_init(struct nouveau_subdev *subdev) +nvkm_subdev_init(struct nvkm_subdev *subdev) { - int ret = nouveau_object_init(&subdev->object); + int ret = nvkm_object_init(&subdev->object); if (ret) return ret; - nouveau_subdev_reset(&subdev->object); + nvkm_subdev_reset(&subdev->object); return 0; } int -_nouveau_subdev_init(struct nouveau_object *object) +_nvkm_subdev_init(struct nvkm_object *object) { - return nouveau_subdev_init(nv_subdev(object)); + return nvkm_subdev_init(nv_subdev(object)); } int -nouveau_subdev_fini(struct nouveau_subdev *subdev, bool suspend) +nvkm_subdev_fini(struct nvkm_subdev *subdev, bool suspend) { if (subdev->unit) { nv_mask(subdev, 0x000200, subdev->unit, 0x00000000); nv_mask(subdev, 0x000200, subdev->unit, subdev->unit); } - return nouveau_object_fini(&subdev->object, suspend); + return nvkm_object_fini(&subdev->object, suspend); } int -_nouveau_subdev_fini(struct nouveau_object *object, bool suspend) +_nvkm_subdev_fini(struct nvkm_object *object, bool suspend) { - return nouveau_subdev_fini(nv_subdev(object), suspend); + return nvkm_subdev_fini(nv_subdev(object), suspend); } void -nouveau_subdev_destroy(struct nouveau_subdev *subdev) +nvkm_subdev_destroy(struct nvkm_subdev *subdev) { int subidx = nv_hclass(subdev) & 0xff; nv_device(subdev)->subdev[subidx] = NULL; - nouveau_object_destroy(&subdev->object); + nvkm_object_destroy(&subdev->object); } void -_nouveau_subdev_dtor(struct nouveau_object *object) +_nvkm_subdev_dtor(struct nvkm_object *object) { - nouveau_subdev_destroy(nv_subdev(object)); + nvkm_subdev_destroy(nv_subdev(object)); } int -nouveau_subdev_create_(struct nouveau_object *parent, - struct nouveau_object *engine, - struct nouveau_oclass *oclass, u32 pclass, - const char *subname, const char *sysname, - int size, void **pobject) +nvkm_subdev_create_(struct nvkm_object *parent, struct nvkm_object *engine, + struct nvkm_oclass *oclass, u32 pclass, + const char *subname, const char *sysname, + int size, void **pobject) { - struct nouveau_subdev *subdev; + struct nvkm_subdev *subdev; int ret; - ret = nouveau_object_create_(parent, engine, oclass, pclass | - NV_SUBDEV_CLASS, size, pobject); + ret = nvkm_object_create_(parent, engine, oclass, pclass | + NV_SUBDEV_CLASS, size, pobject); subdev = *pobject; if (ret) return ret; @@ -114,8 +111,8 @@ nouveau_subdev_create_(struct nouveau_object *parent, subdev->name = subname; if (parent) { - struct nouveau_device *device = nv_device(parent); - subdev->debug = nouveau_dbgopt(device->dbgopt, subname); + struct nvkm_device *device = nv_device(parent); + subdev->debug = nvkm_dbgopt(device->dbgopt, subname); subdev->mmio = nv_subdev(device)->mmio; } |