^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0-only */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * Tegra host1x Debug
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Copyright (c) 2011-2013 NVIDIA Corporation.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) #ifndef __HOST1X_DEBUG_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #define __HOST1X_DEBUG_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <linux/debugfs.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <linux/seq_file.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) struct host1x;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) struct output {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) void (*fn)(void *ctx, const char *str, size_t len, bool cont);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) void *ctx;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) char buf[256];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) static inline void write_to_seqfile(void *ctx, const char *str, size_t len,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) bool cont)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) seq_write((struct seq_file *)ctx, str, len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) static inline void write_to_printk(void *ctx, const char *str, size_t len,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) bool cont)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) if (cont)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) pr_cont("%s", str);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) pr_info("%s", str);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) void __printf(2, 3) host1x_debug_output(struct output *o, const char *fmt, ...);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) void __printf(2, 3) host1x_debug_cont(struct output *o, const char *fmt, ...);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) extern unsigned int host1x_debug_trace_cmdbuf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) void host1x_debug_init(struct host1x *host1x);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) void host1x_debug_deinit(struct host1x *host1x);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) void host1x_debug_dump(struct host1x *host1x);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) void host1x_debug_dump_syncpts(struct host1x *host1x);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) #endif