1 /* $NetBSD: amdgpu_dm_trace.h,v 1.2 2021/12/18 23:45:00 riastradh Exp $ */ 2 3 /* 4 * Copyright 2018 Advanced Micro Devices, Inc. 5 * 6 * Permission is hereby granted, free of charge, to any person obtaining a 7 * copy of this software and associated documentation files (the "Software"), 8 * to deal in the Software without restriction, including without limitation 9 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 10 * and/or sell copies of the Software, and to permit persons to whom the 11 * Software is furnished to do so, subject to the following conditions: 12 * 13 * The above copyright notice and this permission notice shall be included in 14 * all copies or substantial portions of the Software. 15 * 16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 19 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 * OTHER DEALINGS IN THE SOFTWARE. 23 * 24 * Authors: AMD 25 * 26 */ 27 28 #undef TRACE_SYSTEM 29 #define TRACE_SYSTEM amdgpu_dm 30 31 #if !defined(_AMDGPU_DM_TRACE_H) || defined(TRACE_HEADER_MULTI_READ) 32 #define _AMDGPU_DM_TRACE_H_ 33 34 #include <linux/tracepoint.h> 35 36 TRACE_EVENT(amdgpu_dc_rreg, 37 TP_PROTO(unsigned long *read_count, uint32_t reg, uint32_t value), 38 TP_ARGS(read_count, reg, value), 39 TP_STRUCT__entry( 40 __field(uint32_t, reg) 41 __field(uint32_t, value) 42 ), 43 TP_fast_assign( 44 __entry->reg = reg; 45 __entry->value = value; 46 *read_count = *read_count + 1; 47 ), 48 TP_printk("reg=0x%08lx, value=0x%08lx", 49 (unsigned long)__entry->reg, 50 (unsigned long)__entry->value) 51 ); 52 53 TRACE_EVENT(amdgpu_dc_wreg, 54 TP_PROTO(unsigned long *write_count, uint32_t reg, uint32_t value), 55 TP_ARGS(write_count, reg, value), 56 TP_STRUCT__entry( 57 __field(uint32_t, reg) 58 __field(uint32_t, value) 59 ), 60 TP_fast_assign( 61 __entry->reg = reg; 62 __entry->value = value; 63 *write_count = *write_count + 1; 64 ), 65 TP_printk("reg=0x%08lx, value=0x%08lx", 66 (unsigned long)__entry->reg, 67 (unsigned long)__entry->value) 68 ); 69 70 71 TRACE_EVENT(amdgpu_dc_performance, 72 TP_PROTO(unsigned long read_count, unsigned long write_count, 73 unsigned long *last_read, unsigned long *last_write, 74 const char *func, unsigned int line), 75 TP_ARGS(read_count, write_count, last_read, last_write, func, line), 76 TP_STRUCT__entry( 77 __field(uint32_t, reads) 78 __field(uint32_t, writes) 79 __field(uint32_t, read_delta) 80 __field(uint32_t, write_delta) 81 __string(func, func) 82 __field(uint32_t, line) 83 ), 84 TP_fast_assign( 85 __entry->reads = read_count; 86 __entry->writes = write_count; 87 __entry->read_delta = read_count - *last_read; 88 __entry->write_delta = write_count - *last_write; 89 __assign_str(func, func); 90 __entry->line = line; 91 *last_read = read_count; 92 *last_write = write_count; 93 ), 94 TP_printk("%s:%d reads=%08ld (%08ld total), writes=%08ld (%08ld total)", 95 __get_str(func), __entry->line, 96 (unsigned long)__entry->read_delta, 97 (unsigned long)__entry->reads, 98 (unsigned long)__entry->write_delta, 99 (unsigned long)__entry->writes) 100 ); 101 #endif /* _AMDGPU_DM_TRACE_H_ */ 102 103 #undef TRACE_INCLUDE_PATH 104 #define TRACE_INCLUDE_PATH . 105 #define TRACE_INCLUDE_FILE amdgpu_dm_trace 106 #include <trace/define_trace.h> 107