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

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
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -28,6 +28,8 @@ nvkm_top_device_new(struct nvkm_top *top)
{
	struct nvkm_top_device *info = kmalloc(sizeof(*info), GFP_KERNEL);
	if (info) {
		info->type = NVKM_SUBDEV_NR;
		info->inst = -1;
		info->index = NVKM_SUBDEV_NR;
		info->addr = 0;
		info->fault = -1;
+18 −20
Original line number Diff line number Diff line
@@ -70,26 +70,24 @@ gk104_top_oneinit(struct nvkm_top *top)
			continue;

		/* Translate engine type to NVKM engine identifier. */
#define A_(A) if (inst == 0) info->index = NVKM_ENGINE_##A
#define B_(A) if (inst + NVKM_ENGINE_##A##0 < NVKM_ENGINE_##A##_LAST + 1)      \
		info->index = NVKM_ENGINE_##A##0 + inst
#define C_(A) if (inst == 0) info->index = NVKM_SUBDEV_##A
#define I_(T,I) do { info->type = (T); info->inst = (I); info->index = (T) + (I); } while(0)
#define O_(T,I) do { WARN_ON(inst); I_(T, I); } while (0)
		switch (type) {
		case 0x00000000: A_(GR    ); break;
		case 0x00000001: A_(CE0   ); break;
		case 0x00000002: A_(CE1   ); break;
		case 0x00000003: A_(CE2   ); break;
		case 0x00000008: A_(MSPDEC); break;
		case 0x00000009: A_(MSPPP ); break;
		case 0x0000000a: A_(MSVLD ); break;
		case 0x0000000b: A_(MSENC ); break;
		case 0x0000000c: A_(VIC   ); break;
		case 0x0000000d: A_(SEC2  ); break;
		case 0x0000000e: B_(NVENC ); break;
		case 0x0000000f: A_(NVENC1); break;
		case 0x00000010: B_(NVDEC ); break;
		case 0x00000013: B_(CE    ); break;
		case 0x00000014: C_(GSP   ); break;
		case 0x00000000: O_(NVKM_ENGINE_GR    ,    0); break;
		case 0x00000001: O_(NVKM_ENGINE_CE    ,    0); break;
		case 0x00000002: O_(NVKM_ENGINE_CE    ,    1); break;
		case 0x00000003: O_(NVKM_ENGINE_CE    ,    2); break;
		case 0x00000008: O_(NVKM_ENGINE_MSPDEC,    0); break;
		case 0x00000009: O_(NVKM_ENGINE_MSPPP ,    0); break;
		case 0x0000000a: O_(NVKM_ENGINE_MSVLD ,    0); break;
		case 0x0000000b: O_(NVKM_ENGINE_MSENC ,    0); break;
		case 0x0000000c: O_(NVKM_ENGINE_VIC   ,    0); break;
		case 0x0000000d: O_(NVKM_ENGINE_SEC2  ,    0); break;
		case 0x0000000e: I_(NVKM_ENGINE_NVENC , inst); break;
		case 0x0000000f: O_(NVKM_ENGINE_NVENC ,    1); break;
		case 0x00000010: I_(NVKM_ENGINE_NVDEC , inst); break;
		case 0x00000013: I_(NVKM_ENGINE_CE    , inst); break;
		case 0x00000014: O_(NVKM_SUBDEV_GSP   ,    0); break;
		default:
			break;
		}
@@ -97,7 +95,7 @@ gk104_top_oneinit(struct nvkm_top *top)
		nvkm_debug(subdev, "%02x.%d (%8s): addr %06x fault %2d "
				   "engine %2d runlist %2d intr %2d "
				   "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->intr, info->reset);
		info = NULL;
+2 −0
Original line number Diff line number Diff line
@@ -12,6 +12,8 @@ int nvkm_top_new_(const struct nvkm_top_func *, struct nvkm_device *,
		  int, struct nvkm_top **);

struct nvkm_top_device {
	enum nvkm_subdev_type type;
	int inst;
	enum nvkm_devidx index;
	u32 addr;
	int fault;