pvr_fw_trace.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /* SPDX-License-Identifier: GPL-2.0-only OR MIT */
  2. /* Copyright (c) 2023 Imagination Technologies Ltd. */
  3. #ifndef PVR_FW_TRACE_H
  4. #define PVR_FW_TRACE_H
  5. #include <drm/drm_file.h>
  6. #include <linux/types.h>
  7. #include "pvr_rogue_fwif.h"
  8. /* Forward declaration from pvr_device.h. */
  9. struct pvr_device;
  10. /* Forward declaration from pvr_gem.h. */
  11. struct pvr_fw_object;
  12. /* Forward declarations from pvr_rogue_fwif.h */
  13. struct rogue_fwif_tracebuf;
  14. struct rogue_fwif_tracebuf_space;
  15. /**
  16. * struct pvr_fw_trace_buffer - Structure representing a trace buffer
  17. */
  18. struct pvr_fw_trace_buffer {
  19. /** @buf_obj: FW buffer object representing trace buffer. */
  20. struct pvr_fw_object *buf_obj;
  21. /** @buf: Pointer to CPU mapping of trace buffer. */
  22. u32 *buf;
  23. /**
  24. * @tracebuf_space: Pointer to FW tracebuf_space structure for this
  25. * trace buffer.
  26. */
  27. struct rogue_fwif_tracebuf_space *tracebuf_space;
  28. };
  29. /**
  30. * struct pvr_fw_trace - Device firmware trace data
  31. */
  32. struct pvr_fw_trace {
  33. /**
  34. * @tracebuf_ctrl_obj: Object representing FW trace buffer control
  35. * structure.
  36. */
  37. struct pvr_fw_object *tracebuf_ctrl_obj;
  38. /**
  39. * @tracebuf_ctrl: Pointer to CPU mapping of FW trace buffer control
  40. * structure.
  41. */
  42. struct rogue_fwif_tracebuf *tracebuf_ctrl;
  43. /**
  44. * @buffers: Array representing the actual trace buffers owned by this
  45. * device.
  46. */
  47. struct pvr_fw_trace_buffer buffers[ROGUE_FW_THREAD_MAX];
  48. /** @group_mask: Mask of enabled trace groups. */
  49. u32 group_mask;
  50. };
  51. int pvr_fw_trace_init(struct pvr_device *pvr_dev);
  52. void pvr_fw_trace_fini(struct pvr_device *pvr_dev);
  53. #if defined(CONFIG_DEBUG_FS)
  54. /* Forward declaration from <linux/dcache.h>. */
  55. struct dentry;
  56. void pvr_fw_trace_mask_update(struct pvr_device *pvr_dev, u32 old_mask,
  57. u32 new_mask);
  58. void pvr_fw_trace_debugfs_init(struct pvr_device *pvr_dev, struct dentry *dir);
  59. #endif /* defined(CONFIG_DEBUG_FS) */
  60. #endif /* PVR_FW_TRACE_H */