drm/nouveau/dmaobj: namespace + nvidia gpu names (no binary change)
authorBen Skeggs <bskeggs@redhat.com>
Wed, 14 Jan 2015 05:27:54 +0000 (15:27 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Thu, 22 Jan 2015 02:18:02 +0000 (12:18 +1000)
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>
13 files changed:
drivers/gpu/drm/nouveau/include/nvkm/engine/dmaobj.h
drivers/gpu/drm/nouveau/nvkm/engine/device/gm100.c
drivers/gpu/drm/nouveau/nvkm/engine/device/nvc0.c
drivers/gpu/drm/nouveau/nvkm/engine/device/nve0.c
drivers/gpu/drm/nouveau/nvkm/engine/dmaobj/Kbuild
drivers/gpu/drm/nouveau/nvkm/engine/dmaobj/base.c
drivers/gpu/drm/nouveau/nvkm/engine/dmaobj/gf100.c [new file with mode: 0644]
drivers/gpu/drm/nouveau/nvkm/engine/dmaobj/gf110.c [new file with mode: 0644]
drivers/gpu/drm/nouveau/nvkm/engine/dmaobj/nv04.c
drivers/gpu/drm/nouveau/nvkm/engine/dmaobj/nv50.c
drivers/gpu/drm/nouveau/nvkm/engine/dmaobj/nvc0.c [deleted file]
drivers/gpu/drm/nouveau/nvkm/engine/dmaobj/nvd0.c [deleted file]
drivers/gpu/drm/nouveau/nvkm/engine/dmaobj/priv.h

index 1b283a7b78e6994973c7c1f8327388bd0e106832..c4fce8afcf831f6196a8cf16fea0fc0f63a6763c 100644 (file)
@@ -1,31 +1,26 @@
-#ifndef __NOUVEAU_DMAOBJ_H__
-#define __NOUVEAU_DMAOBJ_H__
-
-#include <core/object.h>
+#ifndef __NVKM_DMAOBJ_H__
+#define __NVKM_DMAOBJ_H__
 #include <core/engine.h>
+struct nvkm_gpuobj;
 
-struct nouveau_gpuobj;
-
-struct nouveau_dmaobj {
-       struct nouveau_object base;
+struct nvkm_dmaobj {
+       struct nvkm_object base;
        u32 target;
        u32 access;
        u64 start;
        u64 limit;
 };
 
-struct nouveau_dmaeng {
-       struct nouveau_engine base;
+struct nvkm_dmaeng {
+       struct nvkm_engine base;
 
-       /* creates a "physical" dma object from a struct nouveau_dmaobj */
-       int (*bind)(struct nouveau_dmaobj *dmaobj,
-                   struct nouveau_object *parent,
-                   struct nouveau_gpuobj **);
+       /* creates a "physical" dma object from a struct nvkm_dmaobj */
+       int (*bind)(struct nvkm_dmaobj *dmaobj, struct nvkm_object *parent,
+                   struct nvkm_gpuobj **);
 };
 
-extern struct nouveau_oclass *nv04_dmaeng_oclass;
-extern struct nouveau_oclass *nv50_dmaeng_oclass;
-extern struct nouveau_oclass *nvc0_dmaeng_oclass;
-extern struct nouveau_oclass *nvd0_dmaeng_oclass;
-
+extern struct nvkm_oclass *nv04_dmaeng_oclass;
+extern struct nvkm_oclass *nv50_dmaeng_oclass;
+extern struct nvkm_oclass *gf100_dmaeng_oclass;
+extern struct nvkm_oclass *gf110_dmaeng_oclass;
 #endif
index dfc9e544e3e61990672ec35c6f85e7a7b2920df3..1d851d61f98288a0fc5a0ce5b33aab24db4d99a0 100644 (file)
@@ -83,7 +83,7 @@ gm100_identify(struct nouveau_device *device)
 #if 0
                device->oclass[NVDEV_SUBDEV_VOLT   ] = &nv40_volt_oclass;
 #endif
-               device->oclass[NVDEV_ENGINE_DMAOBJ ] =  nvd0_dmaeng_oclass;
+               device->oclass[NVDEV_ENGINE_DMAOBJ ] =  gf110_dmaeng_oclass;
                device->oclass[NVDEV_ENGINE_FIFO   ] =  nv108_fifo_oclass;
                device->oclass[NVDEV_ENGINE_SW     ] =  nvc0_sw_oclass;
                device->oclass[NVDEV_ENGINE_GR     ] =  gm107_gr_oclass;
@@ -126,7 +126,7 @@ gm100_identify(struct nouveau_device *device)
 #if 0
                device->oclass[NVDEV_SUBDEV_VOLT   ] = &nv40_volt_oclass;
 #endif
-               device->oclass[NVDEV_ENGINE_DMAOBJ ] =  nvd0_dmaeng_oclass;
+               device->oclass[NVDEV_ENGINE_DMAOBJ ] =  gf110_dmaeng_oclass;
 #if 0
                device->oclass[NVDEV_ENGINE_FIFO   ] =  nv108_fifo_oclass;
                device->oclass[NVDEV_ENGINE_SW     ] =  nvc0_sw_oclass;
index 9ef067398052240f3dd57902c5af5d71444651a2..9a4e062656aca50d70225a0abae1fa9ac2387e96 100644 (file)
@@ -80,7 +80,7 @@ nvc0_identify(struct nouveau_device *device)
                device->oclass[NVDEV_SUBDEV_BAR    ] = &gf100_bar_oclass;
                device->oclass[NVDEV_SUBDEV_PMU    ] =  gf100_pmu_oclass;
                device->oclass[NVDEV_SUBDEV_VOLT   ] = &nv40_volt_oclass;
-               device->oclass[NVDEV_ENGINE_DMAOBJ ] =  nvc0_dmaeng_oclass;
+               device->oclass[NVDEV_ENGINE_DMAOBJ ] =  gf100_dmaeng_oclass;
                device->oclass[NVDEV_ENGINE_FIFO   ] =  nvc0_fifo_oclass;
                device->oclass[NVDEV_ENGINE_SW     ] =  nvc0_sw_oclass;
                device->oclass[NVDEV_ENGINE_GR     ] =  nvc0_gr_oclass;
@@ -113,7 +113,7 @@ nvc0_identify(struct nouveau_device *device)
                device->oclass[NVDEV_SUBDEV_BAR    ] = &gf100_bar_oclass;
                device->oclass[NVDEV_SUBDEV_PMU    ] =  gf100_pmu_oclass;
                device->oclass[NVDEV_SUBDEV_VOLT   ] = &nv40_volt_oclass;
-               device->oclass[NVDEV_ENGINE_DMAOBJ ] =  nvc0_dmaeng_oclass;
+               device->oclass[NVDEV_ENGINE_DMAOBJ ] =  gf100_dmaeng_oclass;
                device->oclass[NVDEV_ENGINE_FIFO   ] =  nvc0_fifo_oclass;
                device->oclass[NVDEV_ENGINE_SW     ] =  nvc0_sw_oclass;
                device->oclass[NVDEV_ENGINE_GR     ] =  nvc4_gr_oclass;
@@ -146,7 +146,7 @@ nvc0_identify(struct nouveau_device *device)
                device->oclass[NVDEV_SUBDEV_BAR    ] = &gf100_bar_oclass;
                device->oclass[NVDEV_SUBDEV_PMU    ] =  gf100_pmu_oclass;
                device->oclass[NVDEV_SUBDEV_VOLT   ] = &nv40_volt_oclass;
-               device->oclass[NVDEV_ENGINE_DMAOBJ ] =  nvc0_dmaeng_oclass;
+               device->oclass[NVDEV_ENGINE_DMAOBJ ] =  gf100_dmaeng_oclass;
                device->oclass[NVDEV_ENGINE_FIFO   ] =  nvc0_fifo_oclass;
                device->oclass[NVDEV_ENGINE_SW     ] =  nvc0_sw_oclass;
                device->oclass[NVDEV_ENGINE_GR     ] =  nvc4_gr_oclass;
@@ -178,7 +178,7 @@ nvc0_identify(struct nouveau_device *device)
                device->oclass[NVDEV_SUBDEV_BAR    ] = &gf100_bar_oclass;
                device->oclass[NVDEV_SUBDEV_PMU    ] =  gf100_pmu_oclass;
                device->oclass[NVDEV_SUBDEV_VOLT   ] = &nv40_volt_oclass;
-               device->oclass[NVDEV_ENGINE_DMAOBJ ] =  nvc0_dmaeng_oclass;
+               device->oclass[NVDEV_ENGINE_DMAOBJ ] =  gf100_dmaeng_oclass;
                device->oclass[NVDEV_ENGINE_FIFO   ] =  nvc0_fifo_oclass;
                device->oclass[NVDEV_ENGINE_SW     ] =  nvc0_sw_oclass;
                device->oclass[NVDEV_ENGINE_GR     ] =  nvc4_gr_oclass;
@@ -211,7 +211,7 @@ nvc0_identify(struct nouveau_device *device)
                device->oclass[NVDEV_SUBDEV_BAR    ] = &gf100_bar_oclass;
                device->oclass[NVDEV_SUBDEV_PMU    ] =  gf100_pmu_oclass;
                device->oclass[NVDEV_SUBDEV_VOLT   ] = &nv40_volt_oclass;
-               device->oclass[NVDEV_ENGINE_DMAOBJ ] =  nvc0_dmaeng_oclass;
+               device->oclass[NVDEV_ENGINE_DMAOBJ ] =  gf100_dmaeng_oclass;
                device->oclass[NVDEV_ENGINE_FIFO   ] =  nvc0_fifo_oclass;
                device->oclass[NVDEV_ENGINE_SW     ] =  nvc0_sw_oclass;
                device->oclass[NVDEV_ENGINE_GR     ] =  nvc4_gr_oclass;
@@ -243,7 +243,7 @@ nvc0_identify(struct nouveau_device *device)
                device->oclass[NVDEV_SUBDEV_BAR    ] = &gf100_bar_oclass;
                device->oclass[NVDEV_SUBDEV_PMU    ] =  gf100_pmu_oclass;
                device->oclass[NVDEV_SUBDEV_VOLT   ] = &nv40_volt_oclass;
-               device->oclass[NVDEV_ENGINE_DMAOBJ ] =  nvc0_dmaeng_oclass;
+               device->oclass[NVDEV_ENGINE_DMAOBJ ] =  gf100_dmaeng_oclass;
                device->oclass[NVDEV_ENGINE_FIFO   ] =  nvc0_fifo_oclass;
                device->oclass[NVDEV_ENGINE_SW     ] =  nvc0_sw_oclass;
                device->oclass[NVDEV_ENGINE_GR     ] =  nvc1_gr_oclass;
@@ -275,7 +275,7 @@ nvc0_identify(struct nouveau_device *device)
                device->oclass[NVDEV_SUBDEV_BAR    ] = &gf100_bar_oclass;
                device->oclass[NVDEV_SUBDEV_PMU    ] =  gf100_pmu_oclass;
                device->oclass[NVDEV_SUBDEV_VOLT   ] = &nv40_volt_oclass;
-               device->oclass[NVDEV_ENGINE_DMAOBJ ] =  nvc0_dmaeng_oclass;
+               device->oclass[NVDEV_ENGINE_DMAOBJ ] =  gf100_dmaeng_oclass;
                device->oclass[NVDEV_ENGINE_FIFO   ] =  nvc0_fifo_oclass;
                device->oclass[NVDEV_ENGINE_SW     ] =  nvc0_sw_oclass;
                device->oclass[NVDEV_ENGINE_GR     ] =  nvc8_gr_oclass;
@@ -308,7 +308,7 @@ nvc0_identify(struct nouveau_device *device)
                device->oclass[NVDEV_SUBDEV_BAR    ] = &gf100_bar_oclass;
                device->oclass[NVDEV_SUBDEV_PMU    ] =  gf110_pmu_oclass;
                device->oclass[NVDEV_SUBDEV_VOLT   ] = &nv40_volt_oclass;
-               device->oclass[NVDEV_ENGINE_DMAOBJ ] =  nvd0_dmaeng_oclass;
+               device->oclass[NVDEV_ENGINE_DMAOBJ ] =  gf110_dmaeng_oclass;
                device->oclass[NVDEV_ENGINE_FIFO   ] =  nvc0_fifo_oclass;
                device->oclass[NVDEV_ENGINE_SW     ] =  nvc0_sw_oclass;
                device->oclass[NVDEV_ENGINE_GR     ] =  nvd9_gr_oclass;
@@ -338,7 +338,7 @@ nvc0_identify(struct nouveau_device *device)
                device->oclass[NVDEV_SUBDEV_INSTMEM] =  nv50_instmem_oclass;
                device->oclass[NVDEV_SUBDEV_MMU    ] = &gf100_mmu_oclass;
                device->oclass[NVDEV_SUBDEV_BAR    ] = &gf100_bar_oclass;
-               device->oclass[NVDEV_ENGINE_DMAOBJ ] =  nvd0_dmaeng_oclass;
+               device->oclass[NVDEV_ENGINE_DMAOBJ ] =  gf110_dmaeng_oclass;
                device->oclass[NVDEV_ENGINE_FIFO   ] =  nvc0_fifo_oclass;
                device->oclass[NVDEV_ENGINE_SW     ] =  nvc0_sw_oclass;
                device->oclass[NVDEV_ENGINE_GR     ] =  nvd7_gr_oclass;
index 1072ada31416b24443b38d636f9b2eeff3322c5b..91aea039bfb1b90a9157a4e99f67028a4258ab03 100644 (file)
@@ -80,7 +80,7 @@ nve0_identify(struct nouveau_device *device)
                device->oclass[NVDEV_SUBDEV_BAR    ] = &gf100_bar_oclass;
                device->oclass[NVDEV_SUBDEV_PMU    ] =  gk104_pmu_oclass;
                device->oclass[NVDEV_SUBDEV_VOLT   ] = &nv40_volt_oclass;
-               device->oclass[NVDEV_ENGINE_DMAOBJ ] =  nvd0_dmaeng_oclass;
+               device->oclass[NVDEV_ENGINE_DMAOBJ ] =  gf110_dmaeng_oclass;
                device->oclass[NVDEV_ENGINE_FIFO   ] =  nve0_fifo_oclass;
                device->oclass[NVDEV_ENGINE_SW     ] =  nvc0_sw_oclass;
                device->oclass[NVDEV_ENGINE_GR     ] =  nve4_gr_oclass;
@@ -114,7 +114,7 @@ nve0_identify(struct nouveau_device *device)
                device->oclass[NVDEV_SUBDEV_BAR    ] = &gf100_bar_oclass;
                device->oclass[NVDEV_SUBDEV_PMU    ] =  gf110_pmu_oclass;
                device->oclass[NVDEV_SUBDEV_VOLT   ] = &nv40_volt_oclass;
-               device->oclass[NVDEV_ENGINE_DMAOBJ ] =  nvd0_dmaeng_oclass;
+               device->oclass[NVDEV_ENGINE_DMAOBJ ] =  gf110_dmaeng_oclass;
                device->oclass[NVDEV_ENGINE_FIFO   ] =  nve0_fifo_oclass;
                device->oclass[NVDEV_ENGINE_SW     ] =  nvc0_sw_oclass;
                device->oclass[NVDEV_ENGINE_GR     ] =  nve4_gr_oclass;
@@ -148,7 +148,7 @@ nve0_identify(struct nouveau_device *device)
                device->oclass[NVDEV_SUBDEV_BAR    ] = &gf100_bar_oclass;
                device->oclass[NVDEV_SUBDEV_PMU    ] =  gk104_pmu_oclass;
                device->oclass[NVDEV_SUBDEV_VOLT   ] = &nv40_volt_oclass;
-               device->oclass[NVDEV_ENGINE_DMAOBJ ] =  nvd0_dmaeng_oclass;
+               device->oclass[NVDEV_ENGINE_DMAOBJ ] =  gf110_dmaeng_oclass;
                device->oclass[NVDEV_ENGINE_FIFO   ] =  nve0_fifo_oclass;
                device->oclass[NVDEV_ENGINE_SW     ] =  nvc0_sw_oclass;
                device->oclass[NVDEV_ENGINE_GR     ] =  nve4_gr_oclass;
@@ -174,7 +174,7 @@ nve0_identify(struct nouveau_device *device)
                device->oclass[NVDEV_SUBDEV_INSTMEM] = nv50_instmem_oclass;
                device->oclass[NVDEV_SUBDEV_MMU    ] = &gf100_mmu_oclass;
                device->oclass[NVDEV_SUBDEV_BAR    ] = &gk20a_bar_oclass;
-               device->oclass[NVDEV_ENGINE_DMAOBJ ] =  nvd0_dmaeng_oclass;
+               device->oclass[NVDEV_ENGINE_DMAOBJ ] =  gf110_dmaeng_oclass;
                device->oclass[NVDEV_ENGINE_FIFO   ] =  gk20a_fifo_oclass;
                device->oclass[NVDEV_ENGINE_SW     ] =  nvc0_sw_oclass;
                device->oclass[NVDEV_ENGINE_GR     ] =  gk20a_gr_oclass;
@@ -204,7 +204,7 @@ nve0_identify(struct nouveau_device *device)
                device->oclass[NVDEV_SUBDEV_BAR    ] = &gf100_bar_oclass;
                device->oclass[NVDEV_SUBDEV_PMU    ] =  gf110_pmu_oclass;
                device->oclass[NVDEV_SUBDEV_VOLT   ] = &nv40_volt_oclass;
-               device->oclass[NVDEV_ENGINE_DMAOBJ ] =  nvd0_dmaeng_oclass;
+               device->oclass[NVDEV_ENGINE_DMAOBJ ] =  gf110_dmaeng_oclass;
                device->oclass[NVDEV_ENGINE_FIFO   ] =  nve0_fifo_oclass;
                device->oclass[NVDEV_ENGINE_SW     ] =  nvc0_sw_oclass;
                device->oclass[NVDEV_ENGINE_GR     ] =  nvf0_gr_oclass;
@@ -238,7 +238,7 @@ nve0_identify(struct nouveau_device *device)
                device->oclass[NVDEV_SUBDEV_BAR    ] = &gf100_bar_oclass;
                device->oclass[NVDEV_SUBDEV_PMU    ] =  gf110_pmu_oclass;
                device->oclass[NVDEV_SUBDEV_VOLT   ] = &nv40_volt_oclass;
-               device->oclass[NVDEV_ENGINE_DMAOBJ ] =  nvd0_dmaeng_oclass;
+               device->oclass[NVDEV_ENGINE_DMAOBJ ] =  gf110_dmaeng_oclass;
                device->oclass[NVDEV_ENGINE_FIFO   ] =  nve0_fifo_oclass;
                device->oclass[NVDEV_ENGINE_SW     ] =  nvc0_sw_oclass;
                device->oclass[NVDEV_ENGINE_GR     ] =  gk110b_gr_oclass;
@@ -272,7 +272,7 @@ nve0_identify(struct nouveau_device *device)
                device->oclass[NVDEV_SUBDEV_BAR    ] = &gf100_bar_oclass;
                device->oclass[NVDEV_SUBDEV_PMU    ] =  gk208_pmu_oclass;
                device->oclass[NVDEV_SUBDEV_VOLT   ] = &nv40_volt_oclass;
-               device->oclass[NVDEV_ENGINE_DMAOBJ ] =  nvd0_dmaeng_oclass;
+               device->oclass[NVDEV_ENGINE_DMAOBJ ] =  gf110_dmaeng_oclass;
                device->oclass[NVDEV_ENGINE_FIFO   ] =  nv108_fifo_oclass;
                device->oclass[NVDEV_ENGINE_SW     ] =  nvc0_sw_oclass;
                device->oclass[NVDEV_ENGINE_GR     ] =  nv108_gr_oclass;
@@ -305,7 +305,7 @@ nve0_identify(struct nouveau_device *device)
                device->oclass[NVDEV_SUBDEV_BAR    ] = &gf100_bar_oclass;
                device->oclass[NVDEV_SUBDEV_PMU    ] =  gk208_pmu_oclass;
                device->oclass[NVDEV_SUBDEV_VOLT   ] = &nv40_volt_oclass;
-               device->oclass[NVDEV_ENGINE_DMAOBJ ] =  nvd0_dmaeng_oclass;
+               device->oclass[NVDEV_ENGINE_DMAOBJ ] =  gf110_dmaeng_oclass;
                device->oclass[NVDEV_ENGINE_FIFO   ] =  nv108_fifo_oclass;
                device->oclass[NVDEV_ENGINE_SW     ] =  nvc0_sw_oclass;
                device->oclass[NVDEV_ENGINE_GR     ] =  nv108_gr_oclass;
index 4f9286a038eff4dddd9e65b9354461ea62959ba0..7529632dbedb6ee4d22fca0653aa5e28e6eee39b 100644 (file)
@@ -1,5 +1,5 @@
 nvkm-y += nvkm/engine/dmaobj/base.o
 nvkm-y += nvkm/engine/dmaobj/nv04.o
 nvkm-y += nvkm/engine/dmaobj/nv50.o
-nvkm-y += nvkm/engine/dmaobj/nvc0.o
-nvkm-y += nvkm/engine/dmaobj/nvd0.o
+nvkm-y += nvkm/engine/dmaobj/gf100.o
+nvkm-y += nvkm/engine/dmaobj/gf110.o
index 741f4a7cc0b1bfcc40673c7ab81847345d3a11f7..a2b60d86baba9f2f6019ad5975fa55f763a1eb86 100644 (file)
  *
  * Authors: Ben Skeggs
  */
+#include "priv.h"
 
-#include <core/object.h>
 #include <core/client.h>
 #include <core/device.h>
-#include <nvif/unpack.h>
-#include <nvif/class.h>
-
 #include <subdev/fb.h>
 #include <subdev/instmem.h>
 
-#include "priv.h"
+#include <nvif/class.h>
+#include <nvif/unpack.h>
 
 static int
-nvkm_dmaobj_bind(struct nouveau_dmaobj *dmaobj, struct nouveau_object *parent,
-                struct nouveau_gpuobj **pgpuobj)
+nvkm_dmaobj_bind(struct nvkm_dmaobj *dmaobj, struct nvkm_object *parent,
+                struct nvkm_gpuobj **pgpuobj)
 {
        const struct nvkm_dmaeng_impl *impl = (void *)
                nv_oclass(nv_object(dmaobj)->engine);
@@ -48,7 +46,7 @@ nvkm_dmaobj_bind(struct nouveau_dmaobj *dmaobj, struct nouveau_object *parent,
                }
                ret = impl->bind(dmaobj, parent, pgpuobj);
                if (ret == 0)
-                       nouveau_object_ref(NULL, &parent);
+                       nvkm_object_ref(NULL, &parent);
                return ret;
        }
 
@@ -56,24 +54,24 @@ nvkm_dmaobj_bind(struct nouveau_dmaobj *dmaobj, struct nouveau_object *parent,
 }
 
 int
-nvkm_dmaobj_create_(struct nouveau_object *parent,
-                   struct nouveau_object *engine,
-                   struct nouveau_oclass *oclass, void **pdata, u32 *psize,
+nvkm_dmaobj_create_(struct nvkm_object *parent,
+                   struct nvkm_object *engine,
+                   struct nvkm_oclass *oclass, void **pdata, u32 *psize,
                    int length, void **pobject)
 {
        union {
                struct nv_dma_v0 v0;
        } *args = *pdata;
-       struct nouveau_instmem *instmem = nouveau_instmem(parent);
-       struct nouveau_client *client = nouveau_client(parent);
-       struct nouveau_device *device = nv_device(parent);
-       struct nouveau_fb *pfb = nouveau_fb(parent);
-       struct nouveau_dmaobj *dmaobj;
+       struct nvkm_instmem *instmem = nvkm_instmem(parent);
+       struct nvkm_client *client = nvkm_client(parent);
+       struct nvkm_device *device = nv_device(parent);
+       struct nvkm_fb *pfb = nvkm_fb(parent);
+       struct nvkm_dmaobj *dmaobj;
        void *data = *pdata;
        u32 size = *psize;
        int ret;
 
-       ret = nouveau_object_create_(parent, engine, oclass, 0, length, pobject);
+       ret = nvkm_object_create_(parent, engine, oclass, 0, length, pobject);
        dmaobj = *pobject;
        if (ret)
                return ret;
@@ -146,16 +144,16 @@ nvkm_dmaobj_create_(struct nouveau_object *parent,
 }
 
 int
-_nvkm_dmaeng_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
-                 struct nouveau_oclass *oclass, void *data, u32 size,
-                 struct nouveau_object **pobject)
+_nvkm_dmaeng_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
+                 struct nvkm_oclass *oclass, void *data, u32 size,
+                 struct nvkm_object **pobject)
 {
        const struct nvkm_dmaeng_impl *impl = (void *)oclass;
-       struct nouveau_dmaeng *dmaeng;
+       struct nvkm_dmaeng *dmaeng;
        int ret;
 
-       ret = nouveau_engine_create(parent, engine, oclass, true, "DMAOBJ",
-                                   "dmaobj", &dmaeng);
+       ret = nvkm_engine_create(parent, engine, oclass, true, "DMAOBJ",
+                                "dmaobj", &dmaeng);
        *pobject = nv_object(dmaeng);
        if (ret)
                return ret;
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/dmaobj/gf100.c b/drivers/gpu/drm/nouveau/nvkm/engine/dmaobj/gf100.c
new file mode 100644 (file)
index 0000000..f880e51
--- /dev/null
@@ -0,0 +1,176 @@
+/*
+ * Copyright 2012 Red Hat Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Authors: Ben Skeggs
+ */
+#include "priv.h"
+
+#include <core/client.h>
+#include <core/gpuobj.h>
+#include <subdev/fb.h>
+
+#include <nvif/class.h>
+#include <nvif/unpack.h>
+
+struct gf100_dmaobj_priv {
+       struct nvkm_dmaobj base;
+       u32 flags0;
+       u32 flags5;
+};
+
+static int
+gf100_dmaobj_bind(struct nvkm_dmaobj *dmaobj, struct nvkm_object *parent,
+                 struct nvkm_gpuobj **pgpuobj)
+{
+       struct gf100_dmaobj_priv *priv = (void *)dmaobj;
+       int ret;
+
+       if (!nv_iclass(parent, NV_ENGCTX_CLASS)) {
+               switch (nv_mclass(parent->parent)) {
+               case GT214_DISP_CORE_CHANNEL_DMA:
+               case GT214_DISP_BASE_CHANNEL_DMA:
+               case GT214_DISP_OVERLAY_CHANNEL_DMA:
+                       break;
+               default:
+                       return -EINVAL;
+               }
+       } else
+               return 0;
+
+       ret = nvkm_gpuobj_new(parent, parent, 24, 32, 0, pgpuobj);
+       if (ret == 0) {
+               nv_wo32(*pgpuobj, 0x00, priv->flags0 | nv_mclass(dmaobj));
+               nv_wo32(*pgpuobj, 0x04, lower_32_bits(priv->base.limit));
+               nv_wo32(*pgpuobj, 0x08, lower_32_bits(priv->base.start));
+               nv_wo32(*pgpuobj, 0x0c, upper_32_bits(priv->base.limit) << 24 |
+                                       upper_32_bits(priv->base.start));
+               nv_wo32(*pgpuobj, 0x10, 0x00000000);
+               nv_wo32(*pgpuobj, 0x14, priv->flags5);
+       }
+
+       return ret;
+}
+
+static int
+gf100_dmaobj_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
+                 struct nvkm_oclass *oclass, void *data, u32 size,
+                 struct nvkm_object **pobject)
+{
+       struct nvkm_dmaeng *dmaeng = (void *)engine;
+       union {
+               struct gf100_dma_v0 v0;
+       } *args;
+       struct gf100_dmaobj_priv *priv;
+       u32 kind, user, unkn;
+       int ret;
+
+       ret = nvkm_dmaobj_create(parent, engine, oclass, &data, &size, &priv);
+       *pobject = nv_object(priv);
+       if (ret)
+               return ret;
+       args = data;
+
+       nv_ioctl(parent, "create gf100 dma size %d\n", size);
+       if (nvif_unpack(args->v0, 0, 0, false)) {
+               nv_ioctl(parent, "create gf100 dma vers %d priv %d kind %02x\n",
+                        args->v0.version, args->v0.priv, args->v0.kind);
+               kind = args->v0.kind;
+               user = args->v0.priv;
+               unkn = 0;
+       } else
+       if (size == 0) {
+               if (priv->base.target != NV_MEM_TARGET_VM) {
+                       kind = GF100_DMA_V0_KIND_PITCH;
+                       user = GF100_DMA_V0_PRIV_US;
+                       unkn = 2;
+               } else {
+                       kind = GF100_DMA_V0_KIND_VM;
+                       user = GF100_DMA_V0_PRIV_VM;
+                       unkn = 0;
+               }
+       } else
+               return ret;
+
+       if (user > 2)
+               return -EINVAL;
+       priv->flags0 |= (kind << 22) | (user << 20);
+       priv->flags5 |= (unkn << 16);
+
+       switch (priv->base.target) {
+       case NV_MEM_TARGET_VM:
+               priv->flags0 |= 0x00000000;
+               break;
+       case NV_MEM_TARGET_VRAM:
+               priv->flags0 |= 0x00010000;
+               break;
+       case NV_MEM_TARGET_PCI:
+               priv->flags0 |= 0x00020000;
+               break;
+       case NV_MEM_TARGET_PCI_NOSNOOP:
+               priv->flags0 |= 0x00030000;
+               break;
+       default:
+               return -EINVAL;
+       }
+
+       switch (priv->base.access) {
+       case NV_MEM_ACCESS_VM:
+               break;
+       case NV_MEM_ACCESS_RO:
+               priv->flags0 |= 0x00040000;
+               break;
+       case NV_MEM_ACCESS_WO:
+       case NV_MEM_ACCESS_RW:
+               priv->flags0 |= 0x00080000;
+               break;
+       }
+
+       return dmaeng->bind(&priv->base, nv_object(priv), (void *)pobject);
+}
+
+static struct nvkm_ofuncs
+gf100_dmaobj_ofuncs = {
+       .ctor =  gf100_dmaobj_ctor,
+       .dtor = _nvkm_dmaobj_dtor,
+       .init = _nvkm_dmaobj_init,
+       .fini = _nvkm_dmaobj_fini,
+};
+
+static struct nvkm_oclass
+gf100_dmaeng_sclass[] = {
+       { NV_DMA_FROM_MEMORY, &gf100_dmaobj_ofuncs },
+       { NV_DMA_TO_MEMORY, &gf100_dmaobj_ofuncs },
+       { NV_DMA_IN_MEMORY, &gf100_dmaobj_ofuncs },
+       {}
+};
+
+struct nvkm_oclass *
+gf100_dmaeng_oclass = &(struct nvkm_dmaeng_impl) {
+       .base.handle = NV_ENGINE(DMAOBJ, 0xc0),
+       .base.ofuncs = &(struct nvkm_ofuncs) {
+               .ctor = _nvkm_dmaeng_ctor,
+               .dtor = _nvkm_dmaeng_dtor,
+               .init = _nvkm_dmaeng_init,
+               .fini = _nvkm_dmaeng_fini,
+       },
+       .sclass = gf100_dmaeng_sclass,
+       .bind = gf100_dmaobj_bind,
+}.base;
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/dmaobj/gf110.c b/drivers/gpu/drm/nouveau/nvkm/engine/dmaobj/gf110.c
new file mode 100644 (file)
index 0000000..bf8f0f2
--- /dev/null
@@ -0,0 +1,165 @@
+/*
+ * Copyright 2012 Red Hat Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Authors: Ben Skeggs
+ */
+#include "priv.h"
+
+#include <core/client.h>
+#include <core/gpuobj.h>
+#include <subdev/fb.h>
+
+#include <nvif/class.h>
+#include <nvif/unpack.h>
+
+struct gf110_dmaobj_priv {
+       struct nvkm_dmaobj base;
+       u32 flags0;
+};
+
+static int
+gf110_dmaobj_bind(struct nvkm_dmaobj *dmaobj, struct nvkm_object *parent,
+                 struct nvkm_gpuobj **pgpuobj)
+{
+       struct gf110_dmaobj_priv *priv = (void *)dmaobj;
+       int ret;
+
+       if (!nv_iclass(parent, NV_ENGCTX_CLASS)) {
+               switch (nv_mclass(parent->parent)) {
+               case GF110_DISP_CORE_CHANNEL_DMA:
+               case GK104_DISP_CORE_CHANNEL_DMA:
+               case GK110_DISP_CORE_CHANNEL_DMA:
+               case GM107_DISP_CORE_CHANNEL_DMA:
+               case GM204_DISP_CORE_CHANNEL_DMA:
+               case GF110_DISP_BASE_CHANNEL_DMA:
+               case GK104_DISP_BASE_CHANNEL_DMA:
+               case GK110_DISP_BASE_CHANNEL_DMA:
+               case GF110_DISP_OVERLAY_CONTROL_DMA:
+               case GK104_DISP_OVERLAY_CONTROL_DMA:
+                       break;
+               default:
+                       return -EINVAL;
+               }
+       } else
+               return 0;
+
+       ret = nvkm_gpuobj_new(parent, parent, 24, 32, 0, pgpuobj);
+       if (ret == 0) {
+               nv_wo32(*pgpuobj, 0x00, priv->flags0);
+               nv_wo32(*pgpuobj, 0x04, priv->base.start >> 8);
+               nv_wo32(*pgpuobj, 0x08, priv->base.limit >> 8);
+               nv_wo32(*pgpuobj, 0x0c, 0x00000000);
+               nv_wo32(*pgpuobj, 0x10, 0x00000000);
+               nv_wo32(*pgpuobj, 0x14, 0x00000000);
+       }
+
+       return ret;
+}
+
+static int
+gf110_dmaobj_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
+                 struct nvkm_oclass *oclass, void *data, u32 size,
+                 struct nvkm_object **pobject)
+{
+       struct nvkm_dmaeng *dmaeng = (void *)engine;
+       union {
+               struct gf110_dma_v0 v0;
+       } *args;
+       struct gf110_dmaobj_priv *priv;
+       u32 kind, page;
+       int ret;
+
+       ret = nvkm_dmaobj_create(parent, engine, oclass, &data, &size, &priv);
+       *pobject = nv_object(priv);
+       if (ret)
+               return ret;
+       args = data;
+
+       nv_ioctl(parent, "create gf110 dma size %d\n", size);
+       if (nvif_unpack(args->v0, 0, 0, false)) {
+               nv_ioctl(parent, "create gf100 dma vers %d page %d kind %02x\n",
+                        args->v0.version, args->v0.page, args->v0.kind);
+               kind = args->v0.kind;
+               page = args->v0.page;
+       } else
+       if (size == 0) {
+               if (priv->base.target != NV_MEM_TARGET_VM) {
+                       kind = GF110_DMA_V0_KIND_PITCH;
+                       page = GF110_DMA_V0_PAGE_SP;
+               } else {
+                       kind = GF110_DMA_V0_KIND_VM;
+                       page = GF110_DMA_V0_PAGE_LP;
+               }
+       } else
+               return ret;
+
+       if (page > 1)
+               return -EINVAL;
+       priv->flags0 = (kind << 20) | (page << 6);
+
+       switch (priv->base.target) {
+       case NV_MEM_TARGET_VRAM:
+               priv->flags0 |= 0x00000009;
+               break;
+       case NV_MEM_TARGET_VM:
+       case NV_MEM_TARGET_PCI:
+       case NV_MEM_TARGET_PCI_NOSNOOP:
+               /* XXX: don't currently know how to construct a real one
+                *      of these.  we only use them to represent pushbufs
+                *      on these chipsets, and the classes that use them
+                *      deal with the target themselves.
+                */
+               break;
+       default:
+               return -EINVAL;
+       }
+
+       return dmaeng->bind(&priv->base, nv_object(priv), (void *)pobject);
+}
+
+static struct nvkm_ofuncs
+gf110_dmaobj_ofuncs = {
+       .ctor =  gf110_dmaobj_ctor,
+       .dtor = _nvkm_dmaobj_dtor,
+       .init = _nvkm_dmaobj_init,
+       .fini = _nvkm_dmaobj_fini,
+};
+
+static struct nvkm_oclass
+gf110_dmaeng_sclass[] = {
+       { NV_DMA_FROM_MEMORY, &gf110_dmaobj_ofuncs },
+       { NV_DMA_TO_MEMORY, &gf110_dmaobj_ofuncs },
+       { NV_DMA_IN_MEMORY, &gf110_dmaobj_ofuncs },
+       {}
+};
+
+struct nvkm_oclass *
+gf110_dmaeng_oclass = &(struct nvkm_dmaeng_impl) {
+       .base.handle = NV_ENGINE(DMAOBJ, 0xd0),
+       .base.ofuncs = &(struct nvkm_ofuncs) {
+               .ctor = _nvkm_dmaeng_ctor,
+               .dtor = _nvkm_dmaeng_dtor,
+               .init = _nvkm_dmaeng_init,
+               .fini = _nvkm_dmaeng_fini,
+       },
+       .sclass = gf110_dmaeng_sclass,
+       .bind = gf110_dmaobj_bind,
+}.base;
index 8089310f11572624209f9a41cc97fb4eac060a0f..b4379c2a2fb5785e265c42e576c54e8fdd297285 100644 (file)
  *
  * Authors: Ben Skeggs
  */
+#include "priv.h"
 
 #include <core/gpuobj.h>
-#include <nvif/class.h>
-
 #include <subdev/fb.h>
 #include <subdev/mmu/nv04.h>
 
-#include "priv.h"
+#include <nvif/class.h>
 
 struct nv04_dmaobj_priv {
-       struct nouveau_dmaobj base;
+       struct nvkm_dmaobj base;
        bool clone;
        u32 flags0;
        u32 flags2;
 };
 
 static int
-nv04_dmaobj_bind(struct nouveau_dmaobj *dmaobj,
-                struct nouveau_object *parent,
-                struct nouveau_gpuobj **pgpuobj)
+nv04_dmaobj_bind(struct nvkm_dmaobj *dmaobj, struct nvkm_object *parent,
+                struct nvkm_gpuobj **pgpuobj)
 {
        struct nv04_dmaobj_priv *priv = (void *)dmaobj;
-       struct nouveau_gpuobj *gpuobj;
+       struct nvkm_gpuobj *gpuobj;
        u64 offset = priv->base.start & 0xfffff000;
        u64 adjust = priv->base.start & 0x00000fff;
        u32 length = priv->base.limit - priv->base.start;
@@ -63,14 +61,14 @@ nv04_dmaobj_bind(struct nouveau_dmaobj *dmaobj,
 
        if (priv->clone) {
                struct nv04_mmu_priv *mmu = nv04_mmu(dmaobj);
-               struct nouveau_gpuobj *pgt = mmu->vm->pgt[0].obj[0];
+               struct nvkm_gpuobj *pgt = mmu->vm->pgt[0].obj[0];
                if (!dmaobj->start)
-                       return nouveau_gpuobj_dup(parent, pgt, pgpuobj);
+                       return nvkm_gpuobj_dup(parent, pgt, pgpuobj);
                offset  = nv_ro32(pgt, 8 + (offset >> 10));
                offset &= 0xfffff000;
        }
 
-       ret = nouveau_gpuobj_new(parent, parent, 16, 16, 0, &gpuobj);
+       ret = nvkm_gpuobj_new(parent, parent, 16, 16, 0, &gpuobj);
        *pgpuobj = gpuobj;
        if (ret == 0) {
                nv_wo32(*pgpuobj, 0x00, priv->flags0 | (adjust << 20));
@@ -83,11 +81,11 @@ nv04_dmaobj_bind(struct nouveau_dmaobj *dmaobj,
 }
 
 static int
-nv04_dmaobj_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
-                struct nouveau_oclass *oclass, void *data, u32 size,
-                struct nouveau_object **pobject)
+nv04_dmaobj_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
+                struct nvkm_oclass *oclass, void *data, u32 size,
+                struct nvkm_object **pobject)
 {
-       struct nouveau_dmaeng *dmaeng = (void *)engine;
+       struct nvkm_dmaeng *dmaeng = (void *)engine;
        struct nv04_mmu_priv *mmu = nv04_mmu(engine);
        struct nv04_dmaobj_priv *priv;
        int ret;
@@ -135,7 +133,7 @@ nv04_dmaobj_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
        return dmaeng->bind(&priv->base, nv_object(priv), (void *)pobject);
 }
 
-static struct nouveau_ofuncs
+static struct nvkm_ofuncs
 nv04_dmaobj_ofuncs = {
        .ctor =  nv04_dmaobj_ctor,
        .dtor = _nvkm_dmaobj_dtor,
@@ -143,7 +141,7 @@ nv04_dmaobj_ofuncs = {
        .fini = _nvkm_dmaobj_fini,
 };
 
-static struct nouveau_oclass
+static struct nvkm_oclass
 nv04_dmaeng_sclass[] = {
        { NV_DMA_FROM_MEMORY, &nv04_dmaobj_ofuncs },
        { NV_DMA_TO_MEMORY, &nv04_dmaobj_ofuncs },
@@ -151,10 +149,10 @@ nv04_dmaeng_sclass[] = {
        {}
 };
 
-struct nouveau_oclass *
+struct nvkm_oclass *
 nv04_dmaeng_oclass = &(struct nvkm_dmaeng_impl) {
        .base.handle = NV_ENGINE(DMAOBJ, 0x04),
-       .base.ofuncs = &(struct nouveau_ofuncs) {
+       .base.ofuncs = &(struct nvkm_ofuncs) {
                .ctor = _nvkm_dmaeng_ctor,
                .dtor = _nvkm_dmaeng_dtor,
                .init = _nvkm_dmaeng_init,
index a740ddba2ee26626d3f013cf5dcd78c7ee66e92d..4d3c828fe0e67a7e646f03a7b998b32ea3a308fb 100644 (file)
  *
  * Authors: Ben Skeggs
  */
+#include "priv.h"
 
 #include <core/client.h>
 #include <core/gpuobj.h>
-#include <nvif/unpack.h>
-#include <nvif/class.h>
-
 #include <subdev/fb.h>
 
-#include "priv.h"
+#include <nvif/class.h>
+#include <nvif/unpack.h>
 
 struct nv50_dmaobj_priv {
-       struct nouveau_dmaobj base;
+       struct nvkm_dmaobj base;
        u32 flags0;
        u32 flags5;
 };
 
 static int
-nv50_dmaobj_bind(struct nouveau_dmaobj *dmaobj,
-                struct nouveau_object *parent,
-                struct nouveau_gpuobj **pgpuobj)
+nv50_dmaobj_bind(struct nvkm_dmaobj *dmaobj, struct nvkm_object *parent,
+                struct nvkm_gpuobj **pgpuobj)
 {
        struct nv50_dmaobj_priv *priv = (void *)dmaobj;
        int ret;
@@ -69,7 +67,7 @@ nv50_dmaobj_bind(struct nouveau_dmaobj *dmaobj,
                }
        }
 
-       ret = nouveau_gpuobj_new(parent, parent, 24, 32, 0, pgpuobj);
+       ret = nvkm_gpuobj_new(parent, parent, 24, 32, 0, pgpuobj);
        if (ret == 0) {
                nv_wo32(*pgpuobj, 0x00, priv->flags0 | nv_mclass(dmaobj));
                nv_wo32(*pgpuobj, 0x04, lower_32_bits(priv->base.limit));
@@ -84,11 +82,11 @@ nv50_dmaobj_bind(struct nouveau_dmaobj *dmaobj,
 }
 
 static int
-nv50_dmaobj_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
-                struct nouveau_oclass *oclass, void *data, u32 size,
-                struct nouveau_object **pobject)
+nv50_dmaobj_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
+                struct nvkm_oclass *oclass, void *data, u32 size,
+                struct nvkm_object **pobject)
 {
-       struct nouveau_dmaeng *dmaeng = (void *)engine;
+       struct nvkm_dmaeng *dmaeng = (void *)engine;
        union {
                struct nv50_dma_v0 v0;
        } *args;
@@ -167,7 +165,7 @@ nv50_dmaobj_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
        return dmaeng->bind(&priv->base, nv_object(priv), (void *)pobject);
 }
 
-static struct nouveau_ofuncs
+static struct nvkm_ofuncs
 nv50_dmaobj_ofuncs = {
        .ctor =  nv50_dmaobj_ctor,
        .dtor = _nvkm_dmaobj_dtor,
@@ -175,7 +173,7 @@ nv50_dmaobj_ofuncs = {
        .fini = _nvkm_dmaobj_fini,
 };
 
-static struct nouveau_oclass
+static struct nvkm_oclass
 nv50_dmaeng_sclass[] = {
        { NV_DMA_FROM_MEMORY, &nv50_dmaobj_ofuncs },
        { NV_DMA_TO_MEMORY, &nv50_dmaobj_ofuncs },
@@ -183,10 +181,10 @@ nv50_dmaeng_sclass[] = {
        {}
 };
 
-struct nouveau_oclass *
+struct nvkm_oclass *
 nv50_dmaeng_oclass = &(struct nvkm_dmaeng_impl) {
        .base.handle = NV_ENGINE(DMAOBJ, 0x50),
-       .base.ofuncs = &(struct nouveau_ofuncs) {
+       .base.ofuncs = &(struct nvkm_ofuncs) {
                .ctor = _nvkm_dmaeng_ctor,
                .dtor = _nvkm_dmaeng_dtor,
                .init = _nvkm_dmaeng_init,
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/dmaobj/nvc0.c b/drivers/gpu/drm/nouveau/nvkm/engine/dmaobj/nvc0.c
deleted file mode 100644 (file)
index 88ec33b..0000000
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- * Copyright 2012 Red Hat Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors: Ben Skeggs
- */
-
-#include <core/client.h>
-#include <core/device.h>
-#include <core/gpuobj.h>
-#include <nvif/unpack.h>
-#include <nvif/class.h>
-
-#include <subdev/fb.h>
-
-#include "priv.h"
-
-struct nvc0_dmaobj_priv {
-       struct nouveau_dmaobj base;
-       u32 flags0;
-       u32 flags5;
-};
-
-static int
-nvc0_dmaobj_bind(struct nouveau_dmaobj *dmaobj,
-                struct nouveau_object *parent,
-                struct nouveau_gpuobj **pgpuobj)
-{
-       struct nvc0_dmaobj_priv *priv = (void *)dmaobj;
-       int ret;
-
-       if (!nv_iclass(parent, NV_ENGCTX_CLASS)) {
-               switch (nv_mclass(parent->parent)) {
-               case GT214_DISP_CORE_CHANNEL_DMA:
-               case GT214_DISP_BASE_CHANNEL_DMA:
-               case GT214_DISP_OVERLAY_CHANNEL_DMA:
-                       break;
-               default:
-                       return -EINVAL;
-               }
-       } else
-               return 0;
-
-       ret = nouveau_gpuobj_new(parent, parent, 24, 32, 0, pgpuobj);
-       if (ret == 0) {
-               nv_wo32(*pgpuobj, 0x00, priv->flags0 | nv_mclass(dmaobj));
-               nv_wo32(*pgpuobj, 0x04, lower_32_bits(priv->base.limit));
-               nv_wo32(*pgpuobj, 0x08, lower_32_bits(priv->base.start));
-               nv_wo32(*pgpuobj, 0x0c, upper_32_bits(priv->base.limit) << 24 |
-                                       upper_32_bits(priv->base.start));
-               nv_wo32(*pgpuobj, 0x10, 0x00000000);
-               nv_wo32(*pgpuobj, 0x14, priv->flags5);
-       }
-
-       return ret;
-}
-
-static int
-nvc0_dmaobj_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
-                struct nouveau_oclass *oclass, void *data, u32 size,
-                struct nouveau_object **pobject)
-{
-       struct nouveau_dmaeng *dmaeng = (void *)engine;
-       union {
-               struct gf100_dma_v0 v0;
-       } *args;
-       struct nvc0_dmaobj_priv *priv;
-       u32 kind, user, unkn;
-       int ret;
-
-       ret = nvkm_dmaobj_create(parent, engine, oclass, &data, &size, &priv);
-       *pobject = nv_object(priv);
-       if (ret)
-               return ret;
-       args = data;
-
-       nv_ioctl(parent, "create gf100 dma size %d\n", size);
-       if (nvif_unpack(args->v0, 0, 0, false)) {
-               nv_ioctl(parent, "create gf100 dma vers %d priv %d kind %02x\n",
-                        args->v0.version, args->v0.priv, args->v0.kind);
-               kind = args->v0.kind;
-               user = args->v0.priv;
-               unkn = 0;
-       } else
-       if (size == 0) {
-               if (priv->base.target != NV_MEM_TARGET_VM) {
-                       kind = GF100_DMA_V0_KIND_PITCH;
-                       user = GF100_DMA_V0_PRIV_US;
-                       unkn = 2;
-               } else {
-                       kind = GF100_DMA_V0_KIND_VM;
-                       user = GF100_DMA_V0_PRIV_VM;
-                       unkn = 0;
-               }
-       } else
-               return ret;
-
-       if (user > 2)
-               return -EINVAL;
-       priv->flags0 |= (kind << 22) | (user << 20);
-       priv->flags5 |= (unkn << 16);
-
-       switch (priv->base.target) {
-       case NV_MEM_TARGET_VM:
-               priv->flags0 |= 0x00000000;
-               break;
-       case NV_MEM_TARGET_VRAM:
-               priv->flags0 |= 0x00010000;
-               break;
-       case NV_MEM_TARGET_PCI:
-               priv->flags0 |= 0x00020000;
-               break;
-       case NV_MEM_TARGET_PCI_NOSNOOP:
-               priv->flags0 |= 0x00030000;
-               break;
-       default:
-               return -EINVAL;
-       }
-
-       switch (priv->base.access) {
-       case NV_MEM_ACCESS_VM:
-               break;
-       case NV_MEM_ACCESS_RO:
-               priv->flags0 |= 0x00040000;
-               break;
-       case NV_MEM_ACCESS_WO:
-       case NV_MEM_ACCESS_RW:
-               priv->flags0 |= 0x00080000;
-               break;
-       }
-
-       return dmaeng->bind(&priv->base, nv_object(priv), (void *)pobject);
-}
-
-static struct nouveau_ofuncs
-nvc0_dmaobj_ofuncs = {
-       .ctor =  nvc0_dmaobj_ctor,
-       .dtor = _nvkm_dmaobj_dtor,
-       .init = _nvkm_dmaobj_init,
-       .fini = _nvkm_dmaobj_fini,
-};
-
-static struct nouveau_oclass
-nvc0_dmaeng_sclass[] = {
-       { NV_DMA_FROM_MEMORY, &nvc0_dmaobj_ofuncs },
-       { NV_DMA_TO_MEMORY, &nvc0_dmaobj_ofuncs },
-       { NV_DMA_IN_MEMORY, &nvc0_dmaobj_ofuncs },
-       {}
-};
-
-struct nouveau_oclass *
-nvc0_dmaeng_oclass = &(struct nvkm_dmaeng_impl) {
-       .base.handle = NV_ENGINE(DMAOBJ, 0xc0),
-       .base.ofuncs = &(struct nouveau_ofuncs) {
-               .ctor = _nvkm_dmaeng_ctor,
-               .dtor = _nvkm_dmaeng_dtor,
-               .init = _nvkm_dmaeng_init,
-               .fini = _nvkm_dmaeng_fini,
-       },
-       .sclass = nvc0_dmaeng_sclass,
-       .bind = nvc0_dmaobj_bind,
-}.base;
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/dmaobj/nvd0.c b/drivers/gpu/drm/nouveau/nvkm/engine/dmaobj/nvd0.c
deleted file mode 100644 (file)
index 19f5f65..0000000
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * Copyright 2012 Red Hat Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors: Ben Skeggs
- */
-
-#include <core/client.h>
-#include <core/device.h>
-#include <core/gpuobj.h>
-#include <nvif/unpack.h>
-#include <nvif/class.h>
-
-#include <subdev/fb.h>
-
-#include "priv.h"
-
-struct nvd0_dmaobj_priv {
-       struct nouveau_dmaobj base;
-       u32 flags0;
-};
-
-static int
-nvd0_dmaobj_bind(struct nouveau_dmaobj *dmaobj,
-                struct nouveau_object *parent,
-                struct nouveau_gpuobj **pgpuobj)
-{
-       struct nvd0_dmaobj_priv *priv = (void *)dmaobj;
-       int ret;
-
-       if (!nv_iclass(parent, NV_ENGCTX_CLASS)) {
-               switch (nv_mclass(parent->parent)) {
-               case GF110_DISP_CORE_CHANNEL_DMA:
-               case GK104_DISP_CORE_CHANNEL_DMA:
-               case GK110_DISP_CORE_CHANNEL_DMA:
-               case GM107_DISP_CORE_CHANNEL_DMA:
-               case GM204_DISP_CORE_CHANNEL_DMA:
-               case GF110_DISP_BASE_CHANNEL_DMA:
-               case GK104_DISP_BASE_CHANNEL_DMA:
-               case GK110_DISP_BASE_CHANNEL_DMA:
-               case GF110_DISP_OVERLAY_CONTROL_DMA:
-               case GK104_DISP_OVERLAY_CONTROL_DMA:
-                       break;
-               default:
-                       return -EINVAL;
-               }
-       } else
-               return 0;
-
-       ret = nouveau_gpuobj_new(parent, parent, 24, 32, 0, pgpuobj);
-       if (ret == 0) {
-               nv_wo32(*pgpuobj, 0x00, priv->flags0);
-               nv_wo32(*pgpuobj, 0x04, priv->base.start >> 8);
-               nv_wo32(*pgpuobj, 0x08, priv->base.limit >> 8);
-               nv_wo32(*pgpuobj, 0x0c, 0x00000000);
-               nv_wo32(*pgpuobj, 0x10, 0x00000000);
-               nv_wo32(*pgpuobj, 0x14, 0x00000000);
-       }
-
-       return ret;
-}
-
-static int
-nvd0_dmaobj_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
-                struct nouveau_oclass *oclass, void *data, u32 size,
-                struct nouveau_object **pobject)
-{
-       struct nouveau_dmaeng *dmaeng = (void *)engine;
-       union {
-               struct gf110_dma_v0 v0;
-       } *args;
-       struct nvd0_dmaobj_priv *priv;
-       u32 kind, page;
-       int ret;
-
-       ret = nvkm_dmaobj_create(parent, engine, oclass, &data, &size, &priv);
-       *pobject = nv_object(priv);
-       if (ret)
-               return ret;
-       args = data;
-
-       nv_ioctl(parent, "create gf110 dma size %d\n", size);
-       if (nvif_unpack(args->v0, 0, 0, false)) {
-               nv_ioctl(parent, "create gf100 dma vers %d page %d kind %02x\n",
-                        args->v0.version, args->v0.page, args->v0.kind);
-               kind = args->v0.kind;
-               page = args->v0.page;
-       } else
-       if (size == 0) {
-               if (priv->base.target != NV_MEM_TARGET_VM) {
-                       kind = GF110_DMA_V0_KIND_PITCH;
-                       page = GF110_DMA_V0_PAGE_SP;
-               } else {
-                       kind = GF110_DMA_V0_KIND_VM;
-                       page = GF110_DMA_V0_PAGE_LP;
-               }
-       } else
-               return ret;
-
-       if (page > 1)
-               return -EINVAL;
-       priv->flags0 = (kind << 20) | (page << 6);
-
-       switch (priv->base.target) {
-       case NV_MEM_TARGET_VRAM:
-               priv->flags0 |= 0x00000009;
-               break;
-       case NV_MEM_TARGET_VM:
-       case NV_MEM_TARGET_PCI:
-       case NV_MEM_TARGET_PCI_NOSNOOP:
-               /* XXX: don't currently know how to construct a real one
-                *      of these.  we only use them to represent pushbufs
-                *      on these chipsets, and the classes that use them
-                *      deal with the target themselves.
-                */
-               break;
-       default:
-               return -EINVAL;
-       }
-
-       return dmaeng->bind(&priv->base, nv_object(priv), (void *)pobject);
-}
-
-static struct nouveau_ofuncs
-nvd0_dmaobj_ofuncs = {
-       .ctor =  nvd0_dmaobj_ctor,
-       .dtor = _nvkm_dmaobj_dtor,
-       .init = _nvkm_dmaobj_init,
-       .fini = _nvkm_dmaobj_fini,
-};
-
-static struct nouveau_oclass
-nvd0_dmaeng_sclass[] = {
-       { NV_DMA_FROM_MEMORY, &nvd0_dmaobj_ofuncs },
-       { NV_DMA_TO_MEMORY, &nvd0_dmaobj_ofuncs },
-       { NV_DMA_IN_MEMORY, &nvd0_dmaobj_ofuncs },
-       {}
-};
-
-struct nouveau_oclass *
-nvd0_dmaeng_oclass = &(struct nvkm_dmaeng_impl) {
-       .base.handle = NV_ENGINE(DMAOBJ, 0xd0),
-       .base.ofuncs = &(struct nouveau_ofuncs) {
-               .ctor = _nvkm_dmaeng_ctor,
-               .dtor = _nvkm_dmaeng_dtor,
-               .init = _nvkm_dmaeng_init,
-               .fini = _nvkm_dmaeng_fini,
-       },
-       .sclass = nvd0_dmaeng_sclass,
-       .bind = nvd0_dmaobj_bind,
-}.base;
index 36f74386693748fb474f5f59f281dcef5ab15b0e..44ae8a0ca65c6c79574ab9fcee8393d66da5f238 100644 (file)
@@ -1,30 +1,28 @@
 #ifndef __NVKM_DMAOBJ_PRIV_H__
 #define __NVKM_DMAOBJ_PRIV_H__
-
 #include <engine/dmaobj.h>
 
 #define nvkm_dmaobj_create(p,e,c,pa,sa,d)                                      \
        nvkm_dmaobj_create_((p), (e), (c), (pa), (sa), sizeof(**d), (void **)d)
 
-int nvkm_dmaobj_create_(struct nouveau_object *, struct nouveau_object *,
-                       struct nouveau_oclass *, void **, u32 *,
+int nvkm_dmaobj_create_(struct nvkm_object *, struct nvkm_object *,
+                       struct nvkm_oclass *, void **, u32 *,
                        int, void **);
-#define _nvkm_dmaobj_dtor nouveau_object_destroy
-#define _nvkm_dmaobj_init nouveau_object_init
-#define _nvkm_dmaobj_fini nouveau_object_fini
+#define _nvkm_dmaobj_dtor nvkm_object_destroy
+#define _nvkm_dmaobj_init nvkm_object_init
+#define _nvkm_dmaobj_fini nvkm_object_fini
 
-int _nvkm_dmaeng_ctor(struct nouveau_object *, struct nouveau_object *,
-                     struct nouveau_oclass *, void *, u32,
-                     struct nouveau_object **);
-#define _nvkm_dmaeng_dtor _nouveau_engine_dtor
-#define _nvkm_dmaeng_init _nouveau_engine_init
-#define _nvkm_dmaeng_fini _nouveau_engine_fini
+int _nvkm_dmaeng_ctor(struct nvkm_object *, struct nvkm_object *,
+                     struct nvkm_oclass *, void *, u32,
+                     struct nvkm_object **);
+#define _nvkm_dmaeng_dtor _nvkm_engine_dtor
+#define _nvkm_dmaeng_init _nvkm_engine_init
+#define _nvkm_dmaeng_fini _nvkm_engine_fini
 
 struct nvkm_dmaeng_impl {
-       struct nouveau_oclass base;
-       struct nouveau_oclass *sclass;
-       int (*bind)(struct nouveau_dmaobj *, struct nouveau_object *,
-                   struct nouveau_gpuobj **);
+       struct nvkm_oclass base;
+       struct nvkm_oclass *sclass;
+       int (*bind)(struct nvkm_dmaobj *, struct nvkm_object *,
+                   struct nvkm_gpuobj **);
 };
-
 #endif