summaryrefslogtreecommitdiff
path: root/mali_kbase/mali_kbase_mipe_proto.h
blob: c35ee61ce5aaad203d2450639d93d5b5345d6ad1 (plain)
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
/*
 *
 * (C) COPYRIGHT 2010-2021 ARM Limited. All rights reserved.
 *
 * This program is free software and is provided to you under the terms of the
 * GNU General Public License version 2 as published by the Free Software
 * Foundation, and any use by you of this program is subject to the terms
 * of such GNU license.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, you can access it online at
 * http://www.gnu.org/licenses/gpl-2.0.html.
 *
 */

/* THIS FILE IS AUTOGENERATED BY mali_trace_generator.py.
 * DO NOT EDIT.
 */

/* clang-format off */

#if !defined(_KBASE_MIPE_PROTO_H)
#define _KBASE_MIPE_PROTO_H

#define _BITFIELD_MASK_FIELD(pos, len) \
	(((1u << len) - 1) << pos)

#define _BITFIELD_SET_FIELD(pos, len, value) \
	(_BITFIELD_MASK_FIELD(pos, len) & (((u32) value) << pos))

#define BITFIELD_SET(field_name, value) \
	_BITFIELD_SET_FIELD(field_name ## _POS, field_name ## _LEN, value)

/* The version of swtrace protocol used in timeline stream. */
#define SWTRACE_VERSION    3

/* Packet header - first word.
 * These values must be defined according to MIPE documentation.
 */
#define PACKET_STREAMID_POS  0
#define PACKET_STREAMID_LEN  8
#define PACKET_RSVD1_POS     (PACKET_STREAMID_POS + PACKET_STREAMID_LEN)
#define PACKET_RSVD1_LEN     8
#define PACKET_TYPE_POS      (PACKET_RSVD1_POS + PACKET_RSVD1_LEN)
#define PACKET_TYPE_LEN      3
#define PACKET_CLASS_POS     (PACKET_TYPE_POS + PACKET_TYPE_LEN)
#define PACKET_CLASS_LEN     7
#define PACKET_FAMILY_POS    (PACKET_CLASS_POS + PACKET_CLASS_LEN)
#define PACKET_FAMILY_LEN    6

/* Packet header - second word
 * These values must be defined according to MIPE documentation.
 */
#define PACKET_LENGTH_POS    0
#define PACKET_LENGTH_LEN    24
#define PACKET_SEQBIT_POS    (PACKET_LENGTH_POS + PACKET_LENGTH_LEN)
#define PACKET_SEQBIT_LEN    1
#define PACKET_RSVD2_POS     (PACKET_SEQBIT_POS + PACKET_SEQBIT_LEN)
#define PACKET_RSVD2_LEN     7

/* First word of a MIPE packet */
#define MIPE_PACKET_HEADER_W0(pkt_family, pkt_class, pkt_type, stream_id) \
	(0                                          \
	| BITFIELD_SET(PACKET_FAMILY,   pkt_family) \
	| BITFIELD_SET(PACKET_CLASS,    pkt_class)  \
	| BITFIELD_SET(PACKET_TYPE,     pkt_type)   \
	| BITFIELD_SET(PACKET_STREAMID, stream_id))

/* Second word of a MIPE packet */
#define MIPE_PACKET_HEADER_W1(packet_length, seqbit) \
	(0                                           \
	| BITFIELD_SET(PACKET_LENGTH, packet_length) \
	| BITFIELD_SET(PACKET_SEQBIT, seqbit))

/* The number of bytes reserved for packet header.
 * These value must be defined according to MIPE documentation.
 */
#define PACKET_HEADER_SIZE 8 /* bytes */

/* The number of bytes reserved for packet sequence number.
 * These value must be defined according to MIPE documentation.
 */
#define PACKET_NUMBER_SIZE 4 /* bytes */

/* Timeline packet family ids.
 * Values are significant! Check MIPE documentation.
 */
enum tl_packet_family {
	TL_PACKET_FAMILY_CTRL = 0, /* control packets */
	TL_PACKET_FAMILY_TL = 1,   /* timeline packets */
	TL_PACKET_FAMILY_COUNT
};

/* Packet classes used in timeline streams.
 * Values are significant! Check MIPE documentation.
 */
enum tl_packet_class {
	TL_PACKET_CLASS_OBJ = 0, /* timeline objects packet */
	TL_PACKET_CLASS_AUX = 1, /* auxiliary events packet */
};

/* Packet types used in timeline streams.
 * Values are significant! Check MIPE documentation.
 */
enum tl_packet_type {
	TL_PACKET_TYPE_HEADER = 0,  /* stream's header/directory */
	TL_PACKET_TYPE_BODY = 1,    /* stream's body */
	TL_PACKET_TYPE_SUMMARY = 2, /* stream's summary */
};

/* Stream ID types (timeline family). */
enum tl_stream_id {
	TL_STREAM_ID_USER = 0, /* User-space driver Timeline stream. */
	TL_STREAM_ID_KERNEL = 1, /* Kernel-space driver Timeline stream. */
	TL_STREAM_ID_CSFFW = 2, /* CSF firmware driver Timeline stream. */
};

#endif /* _KBASE_MIPE_PROTO_H */

/* clang-format on */