diff options
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/debug_gk20a.c')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/debug_gk20a.c | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/debug_gk20a.c b/drivers/gpu/nvgpu/gk20a/debug_gk20a.c index 602d713b..1351304d 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-2014 NVIDIA Corporation. All rights reserved. | 4 | * Copyright (C) 2011-2015 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 |
@@ -34,12 +34,6 @@ | |||
34 | unsigned int gk20a_debug_trace_cmdbuf; | 34 | unsigned int gk20a_debug_trace_cmdbuf; |
35 | static struct platform_device *gk20a_device; | 35 | static struct platform_device *gk20a_device; |
36 | 36 | ||
37 | struct gk20a_debug_output { | ||
38 | void (*fn)(void *ctx, const char *str, size_t len); | ||
39 | void *ctx; | ||
40 | char buf[256]; | ||
41 | }; | ||
42 | |||
43 | static const char * const ccsr_chan_status_str[] = { | 37 | static const char * const ccsr_chan_status_str[] = { |
44 | "idle", | 38 | "idle", |
45 | "pending", | 39 | "pending", |
@@ -160,11 +154,8 @@ static void gk20a_debug_show_channel(struct gk20a *g, | |||
160 | gk20a_debug_output(o, "\n"); | 154 | gk20a_debug_output(o, "\n"); |
161 | } | 155 | } |
162 | 156 | ||
163 | static void gk20a_debug_show_dump(struct platform_device *pdev, | 157 | void gk20a_debug_show_dump(struct gk20a *g, struct gk20a_debug_output *o) |
164 | struct gk20a_debug_output *o) | ||
165 | { | 158 | { |
166 | struct gk20a_platform *platform = gk20a_get_platform(pdev); | ||
167 | struct gk20a *g = platform->g; | ||
168 | struct fifo_gk20a *f = &g->fifo; | 159 | struct fifo_gk20a *f = &g->fifo; |
169 | u32 chid; | 160 | u32 chid; |
170 | int i, err; | 161 | int i, err; |
@@ -235,6 +226,7 @@ static void gk20a_debug_show_dump(struct platform_device *pdev, | |||
235 | void gk20a_debug_dump(struct platform_device *pdev) | 226 | void gk20a_debug_dump(struct platform_device *pdev) |
236 | { | 227 | { |
237 | struct gk20a_platform *platform = gk20a_get_platform(pdev); | 228 | struct gk20a_platform *platform = gk20a_get_platform(pdev); |
229 | struct gk20a *g = platform->g; | ||
238 | struct gk20a_debug_output o = { | 230 | struct gk20a_debug_output o = { |
239 | .fn = gk20a_debug_write_printk | 231 | .fn = gk20a_debug_write_printk |
240 | }; | 232 | }; |
@@ -242,7 +234,9 @@ void gk20a_debug_dump(struct platform_device *pdev) | |||
242 | if (platform->dump_platform_dependencies) | 234 | if (platform->dump_platform_dependencies) |
243 | platform->dump_platform_dependencies(pdev); | 235 | platform->dump_platform_dependencies(pdev); |
244 | 236 | ||
245 | gk20a_debug_show_dump(pdev, &o); | 237 | /* HAL only initialized after 1st power-on */ |
238 | if (g->ops.debug.show_dump) | ||
239 | g->ops.debug.show_dump(g, &o); | ||
246 | } | 240 | } |
247 | 241 | ||
248 | void gk20a_debug_dump_device(struct platform_device *pdev) | 242 | void gk20a_debug_dump_device(struct platform_device *pdev) |
@@ -250,6 +244,7 @@ void gk20a_debug_dump_device(struct platform_device *pdev) | |||
250 | struct gk20a_debug_output o = { | 244 | struct gk20a_debug_output o = { |
251 | .fn = gk20a_debug_write_printk | 245 | .fn = gk20a_debug_write_printk |
252 | }; | 246 | }; |
247 | struct gk20a *g; | ||
253 | 248 | ||
254 | /* Dump the first device if no info is provided */ | 249 | /* Dump the first device if no info is provided */ |
255 | if (!pdev) { | 250 | if (!pdev) { |
@@ -259,7 +254,10 @@ void gk20a_debug_dump_device(struct platform_device *pdev) | |||
259 | pdev = gk20a_device; | 254 | pdev = gk20a_device; |
260 | } | 255 | } |
261 | 256 | ||
262 | gk20a_debug_show_dump(pdev, &o); | 257 | g = gk20a_get_platform(pdev)->g; |
258 | /* HAL only initialized after 1st power-on */ | ||
259 | if (g->ops.debug.show_dump) | ||
260 | g->ops.debug.show_dump(g, &o); | ||
263 | } | 261 | } |
264 | EXPORT_SYMBOL(gk20a_debug_dump_device); | 262 | EXPORT_SYMBOL(gk20a_debug_dump_device); |
265 | 263 | ||
@@ -270,7 +268,12 @@ static int gk20a_debug_show(struct seq_file *s, void *unused) | |||
270 | .fn = gk20a_debug_write_to_seqfile, | 268 | .fn = gk20a_debug_write_to_seqfile, |
271 | .ctx = s, | 269 | .ctx = s, |
272 | }; | 270 | }; |
273 | gk20a_debug_show_dump(pdev, &o); | 271 | struct gk20a *g; |
272 | |||
273 | g = gk20a_get_platform(pdev)->g; | ||
274 | /* HAL only initialized after 1st power-on */ | ||
275 | if (g->ops.debug.show_dump) | ||
276 | g->ops.debug.show_dump(g, &o); | ||
274 | return 0; | 277 | return 0; |
275 | } | 278 | } |
276 | 279 | ||
@@ -286,6 +289,11 @@ static const struct file_operations gk20a_debug_fops = { | |||
286 | .release = single_release, | 289 | .release = single_release, |
287 | }; | 290 | }; |
288 | 291 | ||
292 | void gk20a_init_debug_ops(struct gpu_ops *gops) | ||
293 | { | ||
294 | gops->debug.show_dump = gk20a_debug_show_dump; | ||
295 | } | ||
296 | |||
289 | void gk20a_debug_init(struct platform_device *pdev) | 297 | void gk20a_debug_init(struct platform_device *pdev) |
290 | { | 298 | { |
291 | struct gk20a_platform *platform = platform_get_drvdata(pdev); | 299 | struct gk20a_platform *platform = platform_get_drvdata(pdev); |