diff options
author | Rob Clark <robdclark@gmail.com> | 2014-09-05 15:05:38 -0400 |
---|---|---|
committer | Rob Clark <robdclark@gmail.com> | 2014-09-10 11:19:09 -0400 |
commit | 3bcefb0497f9fcad19be286b14d286784d584c5b (patch) | |
tree | 1d84684517b03ef818ab882f9d850cd0bee14e43 | |
parent | 3526e9fb4f3f178fe9dbab3886c86e294e45816c (diff) |
drm/msm/adreno: push dump/show stuff to base class
Add ptr to list of interesting registers to 'struct adreno_gpu' and use
that to move most of the debugfs show and register dump bits down into
adreno_gpu. This will avoid duplication as support for additional
adreno generations is added.
Signed-off-by: Rob Clark <robdclark@gmail.com>
-rw-r--r-- | drivers/gpu/drm/msm/adreno/a3xx_gpu.c | 40 | ||||
-rw-r--r-- | drivers/gpu/drm/msm/adreno/adreno_gpu.c | 31 | ||||
-rw-r--r-- | drivers/gpu/drm/msm/adreno/adreno_gpu.h | 3 |
3 files changed, 39 insertions, 35 deletions
diff --git a/drivers/gpu/drm/msm/adreno/a3xx_gpu.c b/drivers/gpu/drm/msm/adreno/a3xx_gpu.c index b7116cb9b41c..218c5b060398 100644 --- a/drivers/gpu/drm/msm/adreno/a3xx_gpu.c +++ b/drivers/gpu/drm/msm/adreno/a3xx_gpu.c | |||
@@ -385,58 +385,26 @@ static const unsigned int a3xx_registers[] = { | |||
385 | 0x2750, 0x2756, 0x2760, 0x2760, 0x300c, 0x300e, 0x301c, 0x301d, | 385 | 0x2750, 0x2756, 0x2760, 0x2760, 0x300c, 0x300e, 0x301c, 0x301d, |
386 | 0x302a, 0x302a, 0x302c, 0x302d, 0x3030, 0x3031, 0x3034, 0x3036, | 386 | 0x302a, 0x302a, 0x302c, 0x302d, 0x3030, 0x3031, 0x3034, 0x3036, |
387 | 0x303c, 0x303c, 0x305e, 0x305f, | 387 | 0x303c, 0x303c, 0x305e, 0x305f, |
388 | ~0 /* sentinel */ | ||
388 | }; | 389 | }; |
389 | 390 | ||
390 | #ifdef CONFIG_DEBUG_FS | 391 | #ifdef CONFIG_DEBUG_FS |
391 | static void a3xx_show(struct msm_gpu *gpu, struct seq_file *m) | 392 | static void a3xx_show(struct msm_gpu *gpu, struct seq_file *m) |
392 | { | 393 | { |
393 | int i; | ||
394 | |||
395 | adreno_show(gpu, m); | ||
396 | |||
397 | gpu->funcs->pm_resume(gpu); | 394 | gpu->funcs->pm_resume(gpu); |
398 | |||
399 | seq_printf(m, "status: %08x\n", | 395 | seq_printf(m, "status: %08x\n", |
400 | gpu_read(gpu, REG_A3XX_RBBM_STATUS)); | 396 | gpu_read(gpu, REG_A3XX_RBBM_STATUS)); |
401 | |||
402 | /* dump these out in a form that can be parsed by demsm: */ | ||
403 | seq_printf(m, "IO:region %s 00000000 00020000\n", gpu->name); | ||
404 | for (i = 0; i < ARRAY_SIZE(a3xx_registers); i += 2) { | ||
405 | uint32_t start = a3xx_registers[i]; | ||
406 | uint32_t end = a3xx_registers[i+1]; | ||
407 | uint32_t addr; | ||
408 | |||
409 | for (addr = start; addr <= end; addr++) { | ||
410 | uint32_t val = gpu_read(gpu, addr); | ||
411 | seq_printf(m, "IO:R %08x %08x\n", addr<<2, val); | ||
412 | } | ||
413 | } | ||
414 | |||
415 | gpu->funcs->pm_suspend(gpu); | 397 | gpu->funcs->pm_suspend(gpu); |
398 | adreno_show(gpu, m); | ||
416 | } | 399 | } |
417 | #endif | 400 | #endif |
418 | 401 | ||
419 | /* would be nice to not have to duplicate the _show() stuff with printk(): */ | 402 | /* would be nice to not have to duplicate the _show() stuff with printk(): */ |
420 | static void a3xx_dump(struct msm_gpu *gpu) | 403 | static void a3xx_dump(struct msm_gpu *gpu) |
421 | { | 404 | { |
422 | int i; | ||
423 | |||
424 | adreno_dump(gpu); | ||
425 | printk("status: %08x\n", | 405 | printk("status: %08x\n", |
426 | gpu_read(gpu, REG_A3XX_RBBM_STATUS)); | 406 | gpu_read(gpu, REG_A3XX_RBBM_STATUS)); |
427 | 407 | adreno_dump(gpu); | |
428 | /* dump these out in a form that can be parsed by demsm: */ | ||
429 | printk("IO:region %s 00000000 00020000\n", gpu->name); | ||
430 | for (i = 0; i < ARRAY_SIZE(a3xx_registers); i += 2) { | ||
431 | uint32_t start = a3xx_registers[i]; | ||
432 | uint32_t end = a3xx_registers[i+1]; | ||
433 | uint32_t addr; | ||
434 | |||
435 | for (addr = start; addr <= end; addr++) { | ||
436 | uint32_t val = gpu_read(gpu, addr); | ||
437 | printk("IO:R %08x %08x\n", addr<<2, val); | ||
438 | } | ||
439 | } | ||
440 | } | 408 | } |
441 | 409 | ||
442 | static const struct adreno_gpu_funcs funcs = { | 410 | static const struct adreno_gpu_funcs funcs = { |
@@ -494,6 +462,8 @@ struct msm_gpu *a3xx_gpu_init(struct drm_device *dev) | |||
494 | gpu->perfcntrs = perfcntrs; | 462 | gpu->perfcntrs = perfcntrs; |
495 | gpu->num_perfcntrs = ARRAY_SIZE(perfcntrs); | 463 | gpu->num_perfcntrs = ARRAY_SIZE(perfcntrs); |
496 | 464 | ||
465 | adreno_gpu->registers = a3xx_registers; | ||
466 | |||
497 | ret = adreno_gpu_init(dev, pdev, adreno_gpu, &funcs); | 467 | ret = adreno_gpu_init(dev, pdev, adreno_gpu, &funcs); |
498 | if (ret) | 468 | if (ret) |
499 | goto fail; | 469 | goto fail; |
diff --git a/drivers/gpu/drm/msm/adreno/adreno_gpu.c b/drivers/gpu/drm/msm/adreno/adreno_gpu.c index d25f85cdcf90..6afa29167fee 100644 --- a/drivers/gpu/drm/msm/adreno/adreno_gpu.c +++ b/drivers/gpu/drm/msm/adreno/adreno_gpu.c | |||
@@ -212,6 +212,7 @@ void adreno_idle(struct msm_gpu *gpu) | |||
212 | void adreno_show(struct msm_gpu *gpu, struct seq_file *m) | 212 | void adreno_show(struct msm_gpu *gpu, struct seq_file *m) |
213 | { | 213 | { |
214 | struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu); | 214 | struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu); |
215 | int i; | ||
215 | 216 | ||
216 | seq_printf(m, "revision: %d (%d.%d.%d.%d)\n", | 217 | seq_printf(m, "revision: %d (%d.%d.%d.%d)\n", |
217 | adreno_gpu->info->revn, adreno_gpu->rev.core, | 218 | adreno_gpu->info->revn, adreno_gpu->rev.core, |
@@ -223,6 +224,23 @@ void adreno_show(struct msm_gpu *gpu, struct seq_file *m) | |||
223 | seq_printf(m, "rptr: %d\n", adreno_gpu->memptrs->rptr); | 224 | seq_printf(m, "rptr: %d\n", adreno_gpu->memptrs->rptr); |
224 | seq_printf(m, "wptr: %d\n", adreno_gpu->memptrs->wptr); | 225 | seq_printf(m, "wptr: %d\n", adreno_gpu->memptrs->wptr); |
225 | seq_printf(m, "rb wptr: %d\n", get_wptr(gpu->rb)); | 226 | seq_printf(m, "rb wptr: %d\n", get_wptr(gpu->rb)); |
227 | |||
228 | gpu->funcs->pm_resume(gpu); | ||
229 | |||
230 | /* dump these out in a form that can be parsed by demsm: */ | ||
231 | seq_printf(m, "IO:region %s 00000000 00020000\n", gpu->name); | ||
232 | for (i = 0; adreno_gpu->registers[i] != ~0; i += 2) { | ||
233 | uint32_t start = adreno_gpu->registers[i]; | ||
234 | uint32_t end = adreno_gpu->registers[i+1]; | ||
235 | uint32_t addr; | ||
236 | |||
237 | for (addr = start; addr <= end; addr++) { | ||
238 | uint32_t val = gpu_read(gpu, addr); | ||
239 | seq_printf(m, "IO:R %08x %08x\n", addr<<2, val); | ||
240 | } | ||
241 | } | ||
242 | |||
243 | gpu->funcs->pm_suspend(gpu); | ||
226 | } | 244 | } |
227 | #endif | 245 | #endif |
228 | 246 | ||
@@ -230,6 +248,7 @@ void adreno_show(struct msm_gpu *gpu, struct seq_file *m) | |||
230 | void adreno_dump(struct msm_gpu *gpu) | 248 | void adreno_dump(struct msm_gpu *gpu) |
231 | { | 249 | { |
232 | struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu); | 250 | struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu); |
251 | int i; | ||
233 | 252 | ||
234 | printk("revision: %d (%d.%d.%d.%d)\n", | 253 | printk("revision: %d (%d.%d.%d.%d)\n", |
235 | adreno_gpu->info->revn, adreno_gpu->rev.core, | 254 | adreno_gpu->info->revn, adreno_gpu->rev.core, |
@@ -242,6 +261,18 @@ void adreno_dump(struct msm_gpu *gpu) | |||
242 | printk("wptr: %d\n", adreno_gpu->memptrs->wptr); | 261 | printk("wptr: %d\n", adreno_gpu->memptrs->wptr); |
243 | printk("rb wptr: %d\n", get_wptr(gpu->rb)); | 262 | printk("rb wptr: %d\n", get_wptr(gpu->rb)); |
244 | 263 | ||
264 | /* dump these out in a form that can be parsed by demsm: */ | ||
265 | printk("IO:region %s 00000000 00020000\n", gpu->name); | ||
266 | for (i = 0; adreno_gpu->registers[i] != ~0; i += 2) { | ||
267 | uint32_t start = adreno_gpu->registers[i]; | ||
268 | uint32_t end = adreno_gpu->registers[i+1]; | ||
269 | uint32_t addr; | ||
270 | |||
271 | for (addr = start; addr <= end; addr++) { | ||
272 | uint32_t val = gpu_read(gpu, addr); | ||
273 | printk("IO:R %08x %08x\n", addr<<2, val); | ||
274 | } | ||
275 | } | ||
245 | } | 276 | } |
246 | 277 | ||
247 | static uint32_t ring_freewords(struct msm_gpu *gpu) | 278 | static uint32_t ring_freewords(struct msm_gpu *gpu) |
diff --git a/drivers/gpu/drm/msm/adreno/adreno_gpu.h b/drivers/gpu/drm/msm/adreno/adreno_gpu.h index 3664a0d98662..52f051579753 100644 --- a/drivers/gpu/drm/msm/adreno/adreno_gpu.h +++ b/drivers/gpu/drm/msm/adreno/adreno_gpu.h | |||
@@ -64,6 +64,9 @@ struct adreno_gpu { | |||
64 | uint32_t revn; /* numeric revision name */ | 64 | uint32_t revn; /* numeric revision name */ |
65 | const struct adreno_gpu_funcs *funcs; | 65 | const struct adreno_gpu_funcs *funcs; |
66 | 66 | ||
67 | /* interesting register offsets to dump: */ | ||
68 | const unsigned int *registers; | ||
69 | |||
67 | /* firmware: */ | 70 | /* firmware: */ |
68 | const struct firmware *pm4, *pfp; | 71 | const struct firmware *pm4, *pfp; |
69 | 72 | ||