hc
2023-08-30 862c27fc9920c83318c784bfdadf43a65df1ec8f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
/* SPDX-License-Identifier: (GPL-2.0+ OR MIT) */
/*
 * Copyright (c) 2019 Fuzhou Rockchip Electronics Co., Ltd
 *
 * author:
 *    Alpha Lin, alpha.lin@rock-chips.com
 *    Randy Li, randy.li@rock-chips.com
 *    Ding Wei, leo.ding@rock-chips.com
 *
 */
#ifndef __ROCKCHIP_MPP_DEBUG_H__
#define __ROCKCHIP_MPP_DEBUG_H__
 
#include <linux/types.h>
 
/*
 * debug flag usage:
 * +------+-------------------+
 * | 8bit |      24bit        |
 * +------+-------------------+
 *  0~23 bit is for different information type
 * 24~31 bit is for information print format
 */
 
#define DEBUG_POWER                0x00000001
#define DEBUG_CLOCK                0x00000002
#define DEBUG_IRQ_STATUS            0x00000004
#define DEBUG_IOMMU                0x00000008
#define DEBUG_IOCTL                0x00000010
#define DEBUG_FUNCTION                0x00000020
#define DEBUG_REGISTER                0x00000040
#define DEBUG_EXTRA_INFO            0x00000080
#define DEBUG_TIMING                0x00000100
#define DEBUG_TASK_INFO                0x00000200
#define DEBUG_DUMP_ERR_REG            0x00000400
#define DEBUG_LINK_TABLE            0x00000800
 
#define DEBUG_SET_REG                0x00001000
#define DEBUG_GET_REG                0x00002000
#define DEBUG_PPS_FILL                0x00004000
#define DEBUG_IRQ_CHECK                0x00008000
#define DEBUG_CACHE_32B                0x00010000
 
#define DEBUG_RESET                0x00020000
#define DEBUG_SET_REG_L2            0x00040000
#define DEBUG_GET_REG_L2            0x00080000
#define DEBUG_GET_PERF_VAL            0x00100000
#define DEBUG_SRAM_INFO                0x00200000
 
#define DEBUG_SESSION                0x00400000
#define DEBUG_DEVICE                0x00800000
 
#define PRINT_FUNCTION                0x80000000
#define PRINT_LINE                0x40000000
 
extern unsigned int mpp_dev_debug;
 
#define mpp_debug_unlikely(type)                \
       (unlikely(mpp_dev_debug & type))
 
#define mpp_debug_func(type, fmt, args...)            \
   do {                            \
       if (unlikely(mpp_dev_debug & type)) {        \
           pr_info("%s:%d: " fmt,            \
                __func__, __LINE__, ##args);    \
       }                        \
   } while (0)
#define mpp_debug(type, fmt, args...)                \
   do {                            \
       if (unlikely(mpp_dev_debug & type)) {        \
           pr_info(fmt, ##args);            \
       }                        \
   } while (0)
 
#define mpp_debug_enter()                    \
   do {                            \
       if (unlikely(mpp_dev_debug & DEBUG_FUNCTION)) {    \
           pr_info("%s:%d: enter\n",        \
                __func__, __LINE__);        \
       }                        \
   } while (0)
 
#define mpp_debug_leave()                    \
   do {                            \
       if (unlikely(mpp_dev_debug & DEBUG_FUNCTION)) {    \
           pr_info("%s:%d: leave\n",        \
                __func__, __LINE__);        \
       }                        \
   } while (0)
 
#define mpp_err(fmt, args...)                    \
       pr_err("%s:%d: " fmt, __func__, __LINE__, ##args)
 
#define mpp_dbg_link_flow(fmt, args...)                \
   do {                            \
       if (unlikely(mpp_dev_debug & DEBUG_LINK_TABLE)) {        \
           pr_info("%s:%d: " fmt,            \
                __func__, __LINE__, ##args);    \
       }                        \
   } while (0)
 
#define mpp_dbg_session(fmt, args...)                \
   do {                            \
       if (unlikely(mpp_dev_debug & DEBUG_SESSION)) {    \
           pr_info(fmt, ##args);            \
       }                        \
   } while (0)
 
#endif