Commit 5e0d3dbc authored by Ben Skeggs's avatar Ben Skeggs

drm/nouveau/top: store device type and instance separately

MC/FIFO will need this info as they're switched over.
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
Reviewed-by: default avatarLyude Paul <lyude@redhat.com>
parent 0afc1c4c
...@@ -28,6 +28,8 @@ nvkm_top_device_new(struct nvkm_top *top) ...@@ -28,6 +28,8 @@ nvkm_top_device_new(struct nvkm_top *top)
{ {
struct nvkm_top_device *info = kmalloc(sizeof(*info), GFP_KERNEL); struct nvkm_top_device *info = kmalloc(sizeof(*info), GFP_KERNEL);
if (info) { if (info) {
info->type = NVKM_SUBDEV_NR;
info->inst = -1;
info->index = NVKM_SUBDEV_NR; info->index = NVKM_SUBDEV_NR;
info->addr = 0; info->addr = 0;
info->fault = -1; info->fault = -1;
......
...@@ -70,26 +70,24 @@ gk104_top_oneinit(struct nvkm_top *top) ...@@ -70,26 +70,24 @@ gk104_top_oneinit(struct nvkm_top *top)
continue; continue;
/* Translate engine type to NVKM engine identifier. */ /* Translate engine type to NVKM engine identifier. */
#define A_(A) if (inst == 0) info->index = NVKM_ENGINE_##A #define I_(T,I) do { info->type = (T); info->inst = (I); info->index = (T) + (I); } while(0)
#define B_(A) if (inst + NVKM_ENGINE_##A##0 < NVKM_ENGINE_##A##_LAST + 1) \ #define O_(T,I) do { WARN_ON(inst); I_(T, I); } while (0)
info->index = NVKM_ENGINE_##A##0 + inst
#define C_(A) if (inst == 0) info->index = NVKM_SUBDEV_##A
switch (type) { switch (type) {
case 0x00000000: A_(GR ); break; case 0x00000000: O_(NVKM_ENGINE_GR , 0); break;
case 0x00000001: A_(CE0 ); break; case 0x00000001: O_(NVKM_ENGINE_CE , 0); break;
case 0x00000002: A_(CE1 ); break; case 0x00000002: O_(NVKM_ENGINE_CE , 1); break;
case 0x00000003: A_(CE2 ); break; case 0x00000003: O_(NVKM_ENGINE_CE , 2); break;
case 0x00000008: A_(MSPDEC); break; case 0x00000008: O_(NVKM_ENGINE_MSPDEC, 0); break;
case 0x00000009: A_(MSPPP ); break; case 0x00000009: O_(NVKM_ENGINE_MSPPP , 0); break;
case 0x0000000a: A_(MSVLD ); break; case 0x0000000a: O_(NVKM_ENGINE_MSVLD , 0); break;
case 0x0000000b: A_(MSENC ); break; case 0x0000000b: O_(NVKM_ENGINE_MSENC , 0); break;
case 0x0000000c: A_(VIC ); break; case 0x0000000c: O_(NVKM_ENGINE_VIC , 0); break;
case 0x0000000d: A_(SEC2 ); break; case 0x0000000d: O_(NVKM_ENGINE_SEC2 , 0); break;
case 0x0000000e: B_(NVENC ); break; case 0x0000000e: I_(NVKM_ENGINE_NVENC , inst); break;
case 0x0000000f: A_(NVENC1); break; case 0x0000000f: O_(NVKM_ENGINE_NVENC , 1); break;
case 0x00000010: B_(NVDEC ); break; case 0x00000010: I_(NVKM_ENGINE_NVDEC , inst); break;
case 0x00000013: B_(CE ); break; case 0x00000013: I_(NVKM_ENGINE_CE , inst); break;
case 0x00000014: C_(GSP ); break; case 0x00000014: O_(NVKM_SUBDEV_GSP , 0); break;
default: default:
break; break;
} }
...@@ -97,7 +95,7 @@ gk104_top_oneinit(struct nvkm_top *top) ...@@ -97,7 +95,7 @@ gk104_top_oneinit(struct nvkm_top *top)
nvkm_debug(subdev, "%02x.%d (%8s): addr %06x fault %2d " nvkm_debug(subdev, "%02x.%d (%8s): addr %06x fault %2d "
"engine %2d runlist %2d intr %2d " "engine %2d runlist %2d intr %2d "
"reset %2d\n", type, inst, "reset %2d\n", type, inst,
info->index == NVKM_SUBDEV_NR ? NULL : nvkm_subdev_type[info->index], info->type == NVKM_SUBDEV_NR ? "????????" : nvkm_subdev_type[info->type],
info->addr, info->fault, info->engine, info->runlist, info->addr, info->fault, info->engine, info->runlist,
info->intr, info->reset); info->intr, info->reset);
info = NULL; info = NULL;
......
...@@ -12,6 +12,8 @@ int nvkm_top_new_(const struct nvkm_top_func *, struct nvkm_device *, ...@@ -12,6 +12,8 @@ int nvkm_top_new_(const struct nvkm_top_func *, struct nvkm_device *,
int, struct nvkm_top **); int, struct nvkm_top **);
struct nvkm_top_device { struct nvkm_top_device {
enum nvkm_subdev_type type;
int inst;
enum nvkm_devidx index; enum nvkm_devidx index;
u32 addr; u32 addr;
int fault; int fault;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment