1 /*************************************************************************/ /*!
3 @Title Host Trace Buffer interface string format specifiers
4 @Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
5 @Description Header for the Host Trace Buffer logging messages. The following
6 list are the messages the host driver prints. Changing anything
7 but the first column or spelling mistakes in the strings will
8 break compatibility with log files created with older/newer
10 @License Dual MIT/GPLv2
12 The contents of this file are subject to the MIT license as set out below.
14 Permission is hereby granted, free of charge, to any person obtaining a copy
15 of this software and associated documentation files (the "Software"), to deal
16 in the Software without restriction, including without limitation the rights
17 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
18 copies of the Software, and to permit persons to whom the Software is
19 furnished to do so, subject to the following conditions:
21 The above copyright notice and this permission notice shall be included in
22 all copies or substantial portions of the Software.
24 Alternatively, the contents of this file may be used under the terms of
25 the GNU General Public License Version 2 ("GPL") in which case the provisions
26 of GPL are applicable instead of those above.
28 If you wish to allow use of your version of this file only under the terms of
29 GPL, and not to allow others to use your version of this file under the terms
30 of the MIT license, indicate your decision by deleting the provisions above
31 and replace them with the notice and other provisions required by GPL as set
32 out in the file called "GPL-COPYING" included in this distribution. If you do
33 not delete the provisions above, a recipient may use your version of this file
34 under the terms of either the MIT license or GPL.
36 This License is also included in this distribution in the file called
39 EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
40 PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
41 BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
42 PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
43 COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
44 IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
45 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
46 */ /**************************************************************************/
47 #ifndef __HTBUFFER_SF_H__
48 #define __HTBUFFER_SF_H__
50 #if defined (__cplusplus)
55 /*****************************************************************************
56 * *DO*NOT* rearrange or delete lines in SFIDLIST or SFGROUPLIST or you
57 * WILL BREAK host tracing message compatibility with previous
58 * driver versions. Only add new ones, if so required.
59 ****************************************************************************/
62 /* String used in pvrdebug -h output */
63 #define HTB_LOG_GROUPS_STRING_LIST "ctrl,mmu,sync,main,brg"
65 /* Used in print statements to display log group state, one %s per group defined */
66 #define HTB_LOG_ENABLED_GROUPS_LIST_PFSPEC "%s%s%s%s%s"
68 /* Available log groups - Master template
70 * Group usage is as follows:
71 * CTRL - Internal Host Trace information and synchronisation data
72 * MMU - MMU page mapping information
73 * SYNC - Synchronisation debug
74 * MAIN - Data master kicks, etc. tying in with the MAIN group in FWTrace
75 * DBG - Temporary debugging group, logs not to be left in the driver
78 #define HTB_LOG_SFGROUPLIST \
79 X( HTB_GROUP_NONE, NONE ) \
80 /* gid, group flag / apphint name */ \
81 X( HTB_GROUP_CTRL, CTRL ) \
82 X( HTB_GROUP_MMU, MMU ) \
83 X( HTB_GROUP_SYNC, SYNC ) \
84 X( HTB_GROUP_MAIN, MAIN ) \
85 X( HTB_GROUP_BRG, BRG ) \
86 /* Debug group HTB_GROUP_DBG must always be last */ \
87 X( HTB_GROUP_DBG, DBG )
90 /* Table of String Format specifiers, the group they belong and the number of
91 * arguments each expects. Xmacro styled macros are used to generate what is
92 * needed without requiring hand editing.
94 * id : unique id within a group
95 * gid : group id as defined above
96 * sym name : symbolic name of enumerations used to identify message strings
97 * string : Actual string
98 * #args : number of arguments the string format requires
100 #define HTB_LOG_SFIDLIST \
101 /*id, gid, sym name, string, # arguments */ \
102 X( 0, HTB_GROUP_NONE, HTB_SF_FIRST, "You should not use this string", 0) \
104 X( 1, HTB_GROUP_CTRL, HTB_SF_CTRL_LOGMODE, "HTB log mode set to %d (1- all PID, 2 - restricted PID)\n", 1) \
105 X( 2, HTB_GROUP_CTRL, HTB_SF_CTRL_ENABLE_PID, "HTB enable logging for PID %d\n", 1) \
106 X( 3, HTB_GROUP_CTRL, HTB_SF_CTRL_ENABLE_GROUP, "HTB enable logging groups 0x%08x\n", 1) \
107 X( 4, HTB_GROUP_CTRL, HTB_SF_CTRL_LOG_LEVEL, "HTB log level set to %d\n", 1) \
108 X( 5, HTB_GROUP_CTRL, HTB_SF_CTRL_OPMODE, "HTB operating mode set to %d (1 - droplatest, 2 - drop oldest, 3 - block)\n", 1) \
109 X( 6, HTB_GROUP_CTRL, HTB_SF_CTRL_FWSYNC_SCALE, "HTBFWSync OSTS=%08x%08x CRTS=%08x%08x CalcClkSpd=%d\n", 5) \
110 X( 7, HTB_GROUP_CTRL, HTB_SF_CTRL_FWSYNC_SCALE_RPT, "FW Sync scale info OSTS=%08x%08x CRTS=%08x%08x CalcClkSpd=%d\n", 5) \
111 X( 8, HTB_GROUP_CTRL, HTB_SF_CTRL_FWSYNC_MARK, "FW Sync Partition marker: %d\n", 1) \
112 X( 9, HTB_GROUP_CTRL, HTB_SF_CTRL_FWSYNC_MARK_RPT, "FW Sync Partition repeat: %d\n", 1) \
114 X( 1, HTB_GROUP_MMU, HTB_SF_MMU_PAGE_OP_TABLE, "MMU page op table entry page_id=%08x%08x index=%d level=%d val=%08x%08x map=%d\n", 7) \
115 X( 2, HTB_GROUP_MMU, HTB_SF_MMU_PAGE_OP_ALLOC, "MMU allocating DevVAddr from %08x%08x to %08x%08x\n", 4) \
116 X( 3, HTB_GROUP_MMU, HTB_SF_MMU_PAGE_OP_FREE, "MMU freeing DevVAddr from %08x%08x to %08x%08x\n", 4) \
117 X( 4, HTB_GROUP_MMU, HTB_SF_MMU_PAGE_OP_MAP, "MMU mapping DevVAddr %08x%08x to DevPAddr %08x%08x\n", 4) \
118 X( 5, HTB_GROUP_MMU, HTB_SF_MMU_PAGE_OP_PMRMAP, "MMU mapping PMR DevVAddr %08x%08x to DevPAddr %08x%08x\n", 4) \
119 X( 6, HTB_GROUP_MMU, HTB_SF_MMU_PAGE_OP_UNMAP, "MMU unmapping DevVAddr %08x%08x\n", 2) \
121 X( 1, HTB_GROUP_SYNC, HTB_SF_SYNC_SERVER_ALLOC, "Server sync allocation [%08X]\n", 1) \
122 X( 2, HTB_GROUP_SYNC, HTB_SF_SYNC_SERVER_UNREF, "Server sync unreferenced [%08X]\n", 1) \
123 X( 3, HTB_GROUP_SYNC, HTB_SF_SYNC_PRIM_OP_CREATE, "Sync OP create 0x%08x, block count=%d, server syncs=%d, client syncs=%d\n", 4) \
124 X( 4, HTB_GROUP_SYNC, HTB_SF_SYNC_PRIM_OP_TAKE, "Sync OP take 0x%08x server syncs=%d, client syncs=%d\n", 3) \
125 X( 5, HTB_GROUP_SYNC, HTB_SF_SYNC_PRIM_OP_COMPLETE, "Sync OP complete 0x%08x\n", 1) \
126 X( 6, HTB_GROUP_SYNC, HTB_SF_SYNC_PRIM_OP_DESTROY, "Sync OP destroy 0x%08x\n", 1) \
128 X( 1, HTB_GROUP_MAIN, HTB_SF_MAIN_KICK_TA, "Kick TA: FWCtx %08X @ %d\n", 2) \
129 X( 2, HTB_GROUP_MAIN, HTB_SF_MAIN_KICK_3D, "Kick 3D: FWCtx %08X @ %d\n", 2) \
130 X( 3, HTB_GROUP_MAIN, HTB_SF_MAIN_KICK_CDM, "Kick CDM: FWCtx %08X @ %d\n", 2) \
131 X( 4, HTB_GROUP_MAIN, HTB_SF_MAIN_KICK_RTU, "Kick RTU: FWCtx %08X @ %d\n", 2) \
132 X( 5, HTB_GROUP_MAIN, HTB_SF_MAIN_KICK_SHG, "Kick SHG: FWCtx %08X @ %d\n", 2) \
133 X( 6, HTB_GROUP_MAIN, HTB_SF_MAIN_KICK_2D, "Kick 2D: FWCtx %08X @ %d\n", 2) \
134 X( 7, HTB_GROUP_MAIN, HTB_SF_MAIN_KICK_UNCOUNTED, "Kick (uncounted) for all DMs\n", 0) \
135 X( 8, HTB_GROUP_MAIN, HTB_SF_MAIN_FWCCB_CMD, "FW CCB Cmd: %d\n", 1) \
137 X( 1, HTB_GROUP_BRG, HTB_SF_BRG_BRIDGE_CALL, "Bridge call: start: %010u: bid %03d fid %d\n", 3) \
138 X( 2, HTB_GROUP_BRG, HTB_SF_BRG_BRIDGE_CALL_ERR, "Bridge call: start: %010u: bid %03d fid %d error %d\n", 4) \
140 X( 1, HTB_GROUP_DBG, HTB_SF_DBG_INTPAIR, "0x%8.8x 0x%8.8x\n", 2) \
142 X( 65535, HTB_GROUP_NONE, HTB_SF_LAST, "You should not use this string\n", 15)
146 /* gid - Group numbers */
147 typedef enum _HTB_LOG_SFGROUPS {
154 /* group flags are stored in an array of elements */
155 /* each of which have a certain number of bits */
156 #define HTB_FLAG_EL_T IMG_UINT32
157 #define HTB_FLAG_NUM_BITS_IN_EL ( sizeof(HTB_FLAG_EL_T) * 8 )
159 #define HTB_LOG_GROUP_FLAG_GROUP(gid) ( (gid-1) / HTB_FLAG_NUM_BITS_IN_EL )
160 #define HTB_LOG_GROUP_FLAG(gid) (gid? (0x1 << ((gid-1)%HTB_FLAG_NUM_BITS_IN_EL)): 0)
161 #define HTB_LOG_GROUP_FLAG_NAME(gid) HTB_LOG_TYPE_ ## gid
163 /* group enable flags */
164 typedef enum _HTB_LOG_TYPE {
165 #define X(a, b) HTB_LOG_GROUP_FLAG_NAME(b) = HTB_LOG_GROUP_FLAG(a),
172 /* The symbolic names found in the table above are assigned an ui32 value of
173 * the following format:
174 * 31 30 28 27 20 19 16 15 12 11 0 bits
175 * - --- ---- ---- ---- ---- ---- ---- ----
177 * 12-15: group id number
178 * 16-19: number of parameters
180 * 28-30: active: identify SF packet, otherwise regular int32
181 * 31: reserved for signed/unsigned compatibility
183 * The following macro assigns those values to the enum generated SF ids list.
185 #define HTB_LOG_IDMARKER (0x70000000)
186 #define HTB_LOG_CREATESFID(a,b,e) ((a) | (b<<12) | (e<<16)) | HTB_LOG_IDMARKER
188 #define HTB_LOG_IDMASK (0xFFF00000)
189 #define HTB_LOG_VALIDID(I) ( ((I) & HTB_LOG_IDMASK) == HTB_LOG_IDMARKER )
191 typedef enum HTB_LOG_SFids {
192 #define X(a, b, c, d, e) c = HTB_LOG_CREATESFID(a,b,e),
197 /* Return the group id that the given (enum generated) id belongs to */
198 #define HTB_SF_GID(x) (((x)>>12) & 0xf)
199 /* future improvement to support log levels */
200 #define HTB_SF_LVL(x) (0)
201 /* Returns how many arguments the SF(string format) for the given (enum generated) id requires */
202 #define HTB_SF_PARAMNUM(x) (((x)>>16) & 0xf)
204 /* format of messages is: SF:PID:TIME:[PARn]*
206 #define HTB_LOG_HEADER_SIZE 3
207 #define HTB_LOG_MAX_PARAMS 15
209 #if defined (__cplusplus)
213 #endif /* __HTBUFFER_SF_H__ */
214 /*****************************************************************************
215 End of file (htbuffer_sf.h)
216 *****************************************************************************/