drm/nouveau/flcn: specify debug/production register offset from subdev
authorBen Skeggs <bskeggs@redhat.com>
Tue, 14 Jan 2020 20:34:21 +0000 (06:34 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Wed, 15 Jan 2020 00:50:28 +0000 (10:50 +1000)
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/include/nvkm/engine/falcon.h
drivers/gpu/drm/nouveau/nvkm/engine/nvdec/gm107.c
drivers/gpu/drm/nouveau/nvkm/engine/sec2/gp102.c
drivers/gpu/drm/nouveau/nvkm/engine/sec2/tu102.c
drivers/gpu/drm/nouveau/nvkm/falcon/base.c
drivers/gpu/drm/nouveau/nvkm/subdev/pmu/gt215.c

index e9e3fde9d6a16e12ac7a8a77457c55f8593102eb..fbb57e114c72e2a1ae57e7f2ab3ba4bc6f76e410 100644 (file)
@@ -78,6 +78,7 @@ struct nvkm_falcon_func {
        void (*init)(struct nvkm_falcon *);
        void (*intr)(struct nvkm_falcon *, struct nvkm_fifo_chan *);
 
+       u32 debug;
        u32 fbif;
 
        void (*load_imem)(struct nvkm_falcon *, void *, u32, u32, u16, u8, bool);
index 1478079d95803ebbe0b08880c84fa9ab494e4b25..0ab27ab4d8ee6d94e3541bc9cfec475d1a5c792c 100644 (file)
@@ -23,6 +23,7 @@
 
 static const struct nvkm_falcon_func
 gm107_nvdec_flcn = {
+       .debug = 0xd00,
        .fbif = 0x600,
        .load_imem = nvkm_falcon_v1_load_imem,
        .load_dmem = nvkm_falcon_v1_load_dmem,
index 9ef5623457613bf1ded5a88169940a22d2bed509..bb95a2d72b893fce2d21b528fa1b913176af1753 100644 (file)
@@ -88,6 +88,7 @@ gp102_sec2_flcn_bind_context(struct nvkm_falcon *falcon,
 
 static const struct nvkm_falcon_func
 gp102_sec2_flcn = {
+       .debug = 0x408,
        .fbif = 0x600,
        .load_imem = nvkm_falcon_v1_load_imem,
        .load_dmem = nvkm_falcon_v1_load_dmem,
index f4dd2a4814b05c11e06178e5985073d980ffab36..c35752765ced832eb642944fa40da3742281ef59 100644 (file)
@@ -23,6 +23,7 @@
 
 static const struct nvkm_falcon_func
 tu102_sec2_flcn = {
+       .debug = 0x408,
        .fbif = 0x600,
        .load_imem = nvkm_falcon_v1_load_imem,
        .load_dmem = nvkm_falcon_v1_load_dmem,
index 9e9e6808afb7400c018f5504633bb25d2a976c94..c6a3448180d6fdb9102026bbbd17bffad1ca1775 100644 (file)
@@ -138,8 +138,8 @@ nvkm_falcon_clear_interrupt(struct nvkm_falcon *falcon, u32 mask)
 static int
 nvkm_falcon_oneinit(struct nvkm_falcon *falcon)
 {
+       const struct nvkm_falcon_func *func = falcon->func;
        const struct nvkm_subdev *subdev = falcon->owner;
-       u32 debug_reg;
        u32 reg;
 
        if (!falcon->addr) {
@@ -158,31 +158,8 @@ nvkm_falcon_oneinit(struct nvkm_falcon *falcon)
        falcon->code.limit = (reg & 0x1ff) << 8;
        falcon->data.limit = (reg & 0x3fe00) >> 1;
 
-       switch (subdev->index) {
-       case NVKM_ENGINE_GR:
-               debug_reg = 0x0;
-               break;
-       case NVKM_SUBDEV_PMU:
-               debug_reg = 0xc08;
-               break;
-       case NVKM_ENGINE_NVDEC0:
-               debug_reg = 0xd00;
-               break;
-       case NVKM_ENGINE_SEC2:
-               debug_reg = 0x408;
-               break;
-       case NVKM_SUBDEV_GSP:
-               debug_reg = 0x0; /*XXX*/
-               break;
-       default:
-               nvkm_warn(subdev, "unsupported falcon %s!\n",
-                         nvkm_subdev_name[subdev->index]);
-               debug_reg = 0;
-               break;
-       }
-
-       if (debug_reg) {
-               u32 val = nvkm_falcon_rd32(falcon, debug_reg);
+       if (func->debug) {
+               u32 val = nvkm_falcon_rd32(falcon, func->debug);
                falcon->debug = (val >> 20) & 0x1;
        }
 
index c38a80bc7e538284d3d4a8374b4fed78165eac9e..0e23325f94a7205a54b6cb307245955c0d8a57e6 100644 (file)
@@ -243,6 +243,7 @@ gt215_pmu_init(struct nvkm_pmu *pmu)
 
 const struct nvkm_falcon_func
 gt215_pmu_flcn = {
+       .debug = 0xc08,
        .fbif = 0xe00,
        .load_imem = nvkm_falcon_v1_load_imem,
        .load_dmem = nvkm_falcon_v1_load_dmem,