diff options
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/debug_gk20a.c')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/debug_gk20a.c | 64 |
1 files changed, 28 insertions, 36 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/debug_gk20a.c b/drivers/gpu/nvgpu/gk20a/debug_gk20a.c index 67434e7f..369fbe29 100644 --- a/drivers/gpu/nvgpu/gk20a/debug_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/debug_gk20a.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * drivers/video/tegra/host/t20/debug_gk20a.c | 2 | * drivers/video/tegra/host/t20/debug_gk20a.c |
3 | * | 3 | * |
4 | * Copyright (C) 2011-2015 NVIDIA Corporation. All rights reserved. | 4 | * Copyright (C) 2011-2016 NVIDIA Corporation. All rights reserved. |
5 | * | 5 | * |
6 | * This software is licensed under the terms of the GNU General Public | 6 | * This software is licensed under the terms of the GNU General Public |
7 | * License version 2, as published by the Free Software Foundation, and | 7 | * License version 2, as published by the Free Software Foundation, and |
@@ -32,7 +32,7 @@ | |||
32 | #include "hw_pbdma_gk20a.h" | 32 | #include "hw_pbdma_gk20a.h" |
33 | 33 | ||
34 | unsigned int gk20a_debug_trace_cmdbuf; | 34 | unsigned int gk20a_debug_trace_cmdbuf; |
35 | static struct platform_device *gk20a_device; | 35 | static struct device *gk20a_device; |
36 | 36 | ||
37 | struct ch_state { | 37 | struct ch_state { |
38 | int pid; | 38 | int pid; |
@@ -120,7 +120,7 @@ static void gk20a_debug_show_channel(struct gk20a *g, | |||
120 | syncpointb = gk20a_mem_rd32(inst_ptr, ram_fc_syncpointb_w()); | 120 | syncpointb = gk20a_mem_rd32(inst_ptr, ram_fc_syncpointb_w()); |
121 | 121 | ||
122 | gk20a_debug_output(o, "%d-%s, pid %d, refs: %d: ", hw_chid, | 122 | gk20a_debug_output(o, "%d-%s, pid %d, refs: %d: ", hw_chid, |
123 | g->dev->name, | 123 | dev_name(g->dev), |
124 | ch_state->pid, | 124 | ch_state->pid, |
125 | ch_state->refs); | 125 | ch_state->refs); |
126 | gk20a_debug_output(o, "%s in use %s %s\n", | 126 | gk20a_debug_output(o, "%s in use %s %s\n", |
@@ -181,7 +181,7 @@ void gk20a_debug_show_dump(struct gk20a *g, struct gk20a_debug_output *o) | |||
181 | u32 status = gk20a_readl(g, fifo_pbdma_status_r(i)); | 181 | u32 status = gk20a_readl(g, fifo_pbdma_status_r(i)); |
182 | u32 chan_status = fifo_pbdma_status_chan_status_v(status); | 182 | u32 chan_status = fifo_pbdma_status_chan_status_v(status); |
183 | 183 | ||
184 | gk20a_debug_output(o, "%s pbdma %d: ", g->dev->name, i); | 184 | gk20a_debug_output(o, "%s pbdma %d: ", dev_name(g->dev), i); |
185 | gk20a_debug_output(o, | 185 | gk20a_debug_output(o, |
186 | "id: %d (%s), next_id: %d (%s) status: %s\n", | 186 | "id: %d (%s), next_id: %d (%s) status: %s\n", |
187 | fifo_pbdma_status_id_v(status), | 187 | fifo_pbdma_status_id_v(status), |
@@ -206,7 +206,7 @@ void gk20a_debug_show_dump(struct gk20a *g, struct gk20a_debug_output *o) | |||
206 | u32 status = gk20a_readl(g, fifo_engine_status_r(i)); | 206 | u32 status = gk20a_readl(g, fifo_engine_status_r(i)); |
207 | u32 ctx_status = fifo_engine_status_ctx_status_v(status); | 207 | u32 ctx_status = fifo_engine_status_ctx_status_v(status); |
208 | 208 | ||
209 | gk20a_debug_output(o, "%s eng %d: ", g->dev->name, i); | 209 | gk20a_debug_output(o, "%s eng %d: ", dev_name(g->dev), i); |
210 | gk20a_debug_output(o, | 210 | gk20a_debug_output(o, |
211 | "id: %d (%s), next_id: %d (%s), ctx: %s ", | 211 | "id: %d (%s), next_id: %d (%s), ctx: %s ", |
212 | fifo_engine_status_id_v(status), | 212 | fifo_engine_status_id_v(status), |
@@ -270,67 +270,67 @@ done: | |||
270 | gk20a_idle(g->dev); | 270 | gk20a_idle(g->dev); |
271 | } | 271 | } |
272 | 272 | ||
273 | static int gk20a_gr_dump_regs(struct platform_device *pdev, | 273 | static int gk20a_gr_dump_regs(struct device *dev, |
274 | struct gk20a_debug_output *o) | 274 | struct gk20a_debug_output *o) |
275 | { | 275 | { |
276 | struct gk20a_platform *platform = gk20a_get_platform(pdev); | 276 | struct gk20a_platform *platform = gk20a_get_platform(dev); |
277 | struct gk20a *g = platform->g; | 277 | struct gk20a *g = platform->g; |
278 | int err; | 278 | int err; |
279 | 279 | ||
280 | err = gk20a_busy(g->dev); | 280 | err = gk20a_busy(dev); |
281 | if (err) { | 281 | if (err) { |
282 | gk20a_err(&pdev->dev, "failed to power on gpu: %d\n", err); | 282 | gk20a_err(dev, "failed to power on gpu: %d\n", err); |
283 | return -EINVAL; | 283 | return -EINVAL; |
284 | } | 284 | } |
285 | 285 | ||
286 | gr_gk20a_elpg_protected_call(g, g->ops.gr.dump_gr_regs(g, o)); | 286 | gr_gk20a_elpg_protected_call(g, g->ops.gr.dump_gr_regs(g, o)); |
287 | 287 | ||
288 | gk20a_idle(g->dev); | 288 | gk20a_idle(dev); |
289 | 289 | ||
290 | return 0; | 290 | return 0; |
291 | } | 291 | } |
292 | 292 | ||
293 | int gk20a_gr_debug_dump(struct platform_device *pdev) | 293 | int gk20a_gr_debug_dump(struct device *dev) |
294 | { | 294 | { |
295 | struct gk20a_debug_output o = { | 295 | struct gk20a_debug_output o = { |
296 | .fn = gk20a_debug_write_printk | 296 | .fn = gk20a_debug_write_printk |
297 | }; | 297 | }; |
298 | 298 | ||
299 | gk20a_gr_dump_regs(pdev, &o); | 299 | gk20a_gr_dump_regs(dev, &o); |
300 | 300 | ||
301 | return 0; | 301 | return 0; |
302 | } | 302 | } |
303 | 303 | ||
304 | static int gk20a_gr_debug_show(struct seq_file *s, void *unused) | 304 | static int gk20a_gr_debug_show(struct seq_file *s, void *unused) |
305 | { | 305 | { |
306 | struct platform_device *pdev = s->private; | 306 | struct device *dev = s->private; |
307 | struct gk20a_debug_output o = { | 307 | struct gk20a_debug_output o = { |
308 | .fn = gk20a_debug_write_to_seqfile, | 308 | .fn = gk20a_debug_write_to_seqfile, |
309 | .ctx = s, | 309 | .ctx = s, |
310 | }; | 310 | }; |
311 | 311 | ||
312 | gk20a_gr_dump_regs(pdev, &o); | 312 | gk20a_gr_dump_regs(dev, &o); |
313 | 313 | ||
314 | return 0; | 314 | return 0; |
315 | } | 315 | } |
316 | 316 | ||
317 | void gk20a_debug_dump(struct platform_device *pdev) | 317 | void gk20a_debug_dump(struct device *dev) |
318 | { | 318 | { |
319 | struct gk20a_platform *platform = gk20a_get_platform(pdev); | 319 | struct gk20a_platform *platform = gk20a_get_platform(dev); |
320 | struct gk20a *g = platform->g; | 320 | struct gk20a *g = platform->g; |
321 | struct gk20a_debug_output o = { | 321 | struct gk20a_debug_output o = { |
322 | .fn = gk20a_debug_write_printk | 322 | .fn = gk20a_debug_write_printk |
323 | }; | 323 | }; |
324 | 324 | ||
325 | if (platform->dump_platform_dependencies) | 325 | if (platform->dump_platform_dependencies) |
326 | platform->dump_platform_dependencies(pdev); | 326 | platform->dump_platform_dependencies(dev); |
327 | 327 | ||
328 | /* HAL only initialized after 1st power-on */ | 328 | /* HAL only initialized after 1st power-on */ |
329 | if (g->ops.debug.show_dump) | 329 | if (g->ops.debug.show_dump) |
330 | g->ops.debug.show_dump(g, &o); | 330 | g->ops.debug.show_dump(g, &o); |
331 | } | 331 | } |
332 | 332 | ||
333 | void gk20a_debug_dump_device(struct platform_device *pdev) | 333 | void gk20a_debug_dump_device(void *data) |
334 | { | 334 | { |
335 | struct gk20a_debug_output o = { | 335 | struct gk20a_debug_output o = { |
336 | .fn = gk20a_debug_write_printk | 336 | .fn = gk20a_debug_write_printk |
@@ -341,15 +341,7 @@ void gk20a_debug_dump_device(struct platform_device *pdev) | |||
341 | if (!tegra_platform_is_silicon()) | 341 | if (!tegra_platform_is_silicon()) |
342 | return; | 342 | return; |
343 | 343 | ||
344 | /* Dump the first device if no info is provided */ | 344 | g = gk20a_from_dev(gk20a_device); |
345 | if (!pdev) { | ||
346 | if (!gk20a_device) | ||
347 | return; | ||
348 | |||
349 | pdev = gk20a_device; | ||
350 | } | ||
351 | |||
352 | g = gk20a_get_platform(pdev)->g; | ||
353 | /* HAL only initialized after 1st power-on */ | 345 | /* HAL only initialized after 1st power-on */ |
354 | if (g->ops.debug.show_dump) | 346 | if (g->ops.debug.show_dump) |
355 | g->ops.debug.show_dump(g, &o); | 347 | g->ops.debug.show_dump(g, &o); |
@@ -358,14 +350,14 @@ EXPORT_SYMBOL(gk20a_debug_dump_device); | |||
358 | 350 | ||
359 | static int gk20a_debug_show(struct seq_file *s, void *unused) | 351 | static int gk20a_debug_show(struct seq_file *s, void *unused) |
360 | { | 352 | { |
361 | struct platform_device *pdev = s->private; | 353 | struct device *dev = s->private; |
362 | struct gk20a_debug_output o = { | 354 | struct gk20a_debug_output o = { |
363 | .fn = gk20a_debug_write_to_seqfile, | 355 | .fn = gk20a_debug_write_to_seqfile, |
364 | .ctx = s, | 356 | .ctx = s, |
365 | }; | 357 | }; |
366 | struct gk20a *g; | 358 | struct gk20a *g; |
367 | 359 | ||
368 | g = gk20a_get_platform(pdev)->g; | 360 | g = gk20a_get_platform(dev)->g; |
369 | /* HAL only initialized after 1st power-on */ | 361 | /* HAL only initialized after 1st power-on */ |
370 | if (g->ops.debug.show_dump) | 362 | if (g->ops.debug.show_dump) |
371 | g->ops.debug.show_dump(g, &o); | 363 | g->ops.debug.show_dump(g, &o); |
@@ -401,24 +393,24 @@ void gk20a_init_debug_ops(struct gpu_ops *gops) | |||
401 | gops->debug.show_dump = gk20a_debug_show_dump; | 393 | gops->debug.show_dump = gk20a_debug_show_dump; |
402 | } | 394 | } |
403 | 395 | ||
404 | void gk20a_debug_init(struct platform_device *pdev) | 396 | void gk20a_debug_init(struct device *dev) |
405 | { | 397 | { |
406 | struct gk20a_platform *platform = platform_get_drvdata(pdev); | 398 | struct gk20a_platform *platform = dev_get_drvdata(dev); |
407 | 399 | ||
408 | /* Store the first device */ | 400 | /* Store the first device */ |
409 | if (!gk20a_device) | 401 | if (!gk20a_device) |
410 | gk20a_device = pdev; | 402 | gk20a_device = dev; |
411 | 403 | ||
412 | platform->debugfs = debugfs_create_dir(pdev->name, NULL); | 404 | platform->debugfs = debugfs_create_dir(dev_name(dev), NULL); |
413 | if (platform->debugfs) { | 405 | if (platform->debugfs) { |
414 | platform->debugfs_alias = | 406 | platform->debugfs_alias = |
415 | debugfs_create_symlink("gpu.0", NULL, pdev->name); | 407 | debugfs_create_symlink("gpu.0", NULL, dev_name(dev)); |
416 | } | 408 | } |
417 | 409 | ||
418 | debugfs_create_file("status", S_IRUGO, platform->debugfs, | 410 | debugfs_create_file("status", S_IRUGO, platform->debugfs, |
419 | pdev, &gk20a_debug_fops); | 411 | dev, &gk20a_debug_fops); |
420 | debugfs_create_file("gr_status", S_IRUGO, platform->debugfs, | 412 | debugfs_create_file("gr_status", S_IRUGO, platform->debugfs, |
421 | pdev, &gk20a_gr_debug_fops); | 413 | dev, &gk20a_gr_debug_fops); |
422 | debugfs_create_u32("trace_cmdbuf", S_IRUGO|S_IWUSR, platform->debugfs, | 414 | debugfs_create_u32("trace_cmdbuf", S_IRUGO|S_IWUSR, platform->debugfs, |
423 | &gk20a_debug_trace_cmdbuf); | 415 | &gk20a_debug_trace_cmdbuf); |
424 | 416 | ||