summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/include/nvgpu/debug.h
blob: b1b65af33b6d080b9b5f7dfecb7353f645c8b069 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*
 * GK20A Debug functionality
 *
 * Copyright (C) 2011-2017 NVIDIA CORPORATION.  All rights reserved.
 *
 * This software is licensed under the terms of the GNU General Public
 * License version 2, as published by the Free Software Foundation, and
 * may be copied, distributed, and modified under those terms.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 */

#ifndef __NVGPU_DEBUG_H__
#define __NVGPU_DEBUG_H__

struct gk20a;
struct gpu_ops;

struct gk20a_debug_output {
	void (*fn)(void *ctx, const char *str, size_t len);
	void *ctx;
	char buf[256];
};

#ifdef CONFIG_DEBUG_FS
extern unsigned int gk20a_debug_trace_cmdbuf;

void gk20a_debug_output(struct gk20a_debug_output *o,
					const char *fmt, ...);

void gk20a_debug_dump(struct gk20a *g);
void gk20a_debug_show_dump(struct gk20a *g, struct gk20a_debug_output *o);
int gk20a_gr_debug_dump(struct gk20a *g);
void gk20a_init_debug_ops(struct gpu_ops *gops);

void gk20a_debug_init(struct gk20a *g, const char *debugfs_symlink);
void gk20a_debug_deinit(struct gk20a *g);
#else
static inline void gk20a_debug_output(struct gk20a_debug_output *o,
					const char *fmt, ...) {}

static inline void gk20a_debug_dump(struct gk20a *g) {}
static inline void gk20a_debug_show_dump(struct gk20a *g, struct gk20a_debug_output *o) {}
static inline int gk20a_gr_debug_dump(struct gk20a *g) { return 0;}
static inline void gk20a_debug_init(struct gk20a *g, const char *debugfs_symlink) {}
static inline void gk20a_debug_deinit(struct gk20a *g) {}
#endif

#endif /* __NVGPU_DEBUG_H__ */