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