debug.h 1.1 KB

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