struct nvkm_top_device {
enum nvkm_subdev_type type;
int inst;
- enum nvkm_devidx index;
u32 addr;
int fault;
int engine;
u32 nvkm_top_reset(struct nvkm_device *, enum nvkm_subdev_type, int);
u32 nvkm_top_intr_mask(struct nvkm_device *, enum nvkm_subdev_type, int);
int nvkm_top_fault_id(struct nvkm_device *, enum nvkm_subdev_type, int);
-enum nvkm_devidx nvkm_top_fault(struct nvkm_device *, int fault);
+struct nvkm_subdev *nvkm_top_fault(struct nvkm_device *, int fault);
int gk104_top_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_top **);
#endif
struct nvkm_engine *engine = NULL;
struct nvkm_fifo_chan *chan;
unsigned long flags;
- char ct[8] = "HUB/", en[16] = "";
+ const char *en = "";
+ char ct[8] = "HUB/";
er = nvkm_enum_find(fifo->func->fault.reason, info->reason);
ee = nvkm_enum_find(fifo->func->fault.engine, info->engine);
}
if (ee == NULL) {
- enum nvkm_devidx engidx = nvkm_top_fault(device, info->engine);
- if (engidx < NVKM_SUBDEV_NR) {
- const char *src = nvkm_subdev_type[engidx];
- char *dst = en;
- do {
- *dst++ = toupper(*src++);
- } while(*src);
- engine = nvkm_device_engine(device, engidx, 0);
+ struct nvkm_subdev *subdev = nvkm_top_fault(device, info->engine);
+ if (subdev) {
+ if (subdev->func == &nvkm_engine)
+ engine = container_of(subdev, typeof(*engine), subdev);
+ en = engine->subdev.name;
}
} else {
- snprintf(en, sizeof(en), "%s", ee->name);
+ en = ee->name;
}
spin_lock_irqsave(&fifo->base.lock, flags);
struct nvkm_engine *engine = NULL;
struct nvkm_fifo_chan *chan;
unsigned long flags;
- char ct[8] = "HUB/", en[16] = "";
+ const char *en = "";
+ char ct[8] = "HUB/";
int engn;
er = nvkm_enum_find(fifo->func->fault.reason, info->reason);
}
if (ee == NULL) {
- enum nvkm_devidx engidx = nvkm_top_fault(device, info->engine);
-
- if (engidx < NVKM_SUBDEV_NR) {
- const char *src = nvkm_subdev_type[engidx];
- char *dst = en;
-
- do {
- *dst++ = toupper(*src++);
- } while (*src);
- engine = nvkm_device_engine(device, engidx, 0);
+ struct nvkm_subdev *subdev = nvkm_top_fault(device, info->engine);
+ if (subdev) {
+ if (subdev->func == &nvkm_engine)
+ engine = container_of(subdev, typeof(*engine), subdev);
+ en = engine->subdev.name;
}
} else {
- snprintf(en, sizeof(en), "%s", ee->name);
+ en = ee->name;
}
spin_lock_irqsave(&fifo->base.lock, flags);
if (info) {
info->type = NVKM_SUBDEV_NR;
info->inst = -1;
- info->index = NVKM_SUBDEV_NR;
info->addr = 0;
info->fault = -1;
info->engine = -1;
return -ENOENT;
}
-enum nvkm_devidx
+struct nvkm_subdev *
nvkm_top_fault(struct nvkm_device *device, int fault)
{
struct nvkm_top *top = device->top;
list_for_each_entry(info, &top->device, head) {
if (info->fault == fault)
- return info->index;
+ return nvkm_device_subdev(device, info->type, info->inst);
}
- return NVKM_SUBDEV_NR;
+ return NULL;
}
static int
continue;
/* Translate engine type to NVKM engine identifier. */
-#define I_(T,I) do { info->type = (T); info->inst = (I); info->index = (T) + (I); } while(0)
+#define I_(T,I) do { info->type = (T); info->inst = (I); } while(0)
#define O_(T,I) do { WARN_ON(inst); I_(T, I); } while (0)
switch (type) {
case 0x00000000: O_(NVKM_ENGINE_GR , 0); break;