summaryrefslogtreecommitdiff
path: root/include/soc/qcom/profiler.h
blob: ffcf6ec9118775dc5cb95cf9a2e7cf4f3e6f3262 (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
/*
 * Copyright (c) 2017 The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
 * only version 2 as published by the Free Software Foundation.
 *
 * 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.
 */

#ifndef __PROFILER_H_
#define __PROFILER_H_


struct profiler_bw_cntrs_req {
	uint32_t total;
	uint32_t cpu;
	uint32_t gpu;
	uint32_t cmd;
};

struct compat_profiler_bw_cntrs_req {
	compat_uint_t total;
	compat_uint_t cpu;
	compat_uint_t gpu;
	compat_uint_t cmd;
};

/* Error types */
enum tz_bw_svc_err {
	E_BW_SUCCESS = 0,       /* Operation successful    */
	E_BW_FAILURE = 1,       /* Operation failed due to unknown err   */
	E_BW_NULL_PARAM = 2,    /* Null Parameter          */
	E_BW_INVALID_ARG = 3,   /* Arg is not recognized   */
	E_BW_BAD_ADDRESS = 4,   /* Ptr arg is bad address  */
	E_BW_INVALID_ARG_LEN = 5,       /* Arg length is wrong   */
	E_BW_NOT_SUPPORTED = 6, /* Operation not supported */
	E_BW_NOT_PERMITTED = 7, /* Operation not permitted on platform   */
	E_BW_TIME_LOCKED = 8,   /* Operation not permitted right now     */
	E_BW_RESERVED = 0x7FFFFFFF
};

#define TZ_BW_SVC_VERSION (1)
#define PROFILER_IOC_MAGIC    0x98

#define PROFILER_IOCTL_GET_BW_INFO \
	_IOWR(PROFILER_IOC_MAGIC, 1, struct profiler_bw_cntrs_req)

#define COMPAT_PROFILER_IOCTL_GET_BW_INFO \
	_IOWR(PROFILER_IOC_MAGIC, 1, struct compat_profiler_bw_cntrs_req)

/* Command types */
enum tz_bw_svc_cmd {
	TZ_BW_SVC_START_ID = 0x00000001,
	TZ_BW_SVC_GET_ID = 0x00000002,
	TZ_BW_SVC_STOP_ID = 0x00000003,
	TZ_BW_SVC_LAST_ID = 0x7FFFFFFF
};
/* Start Request */
struct tz_bw_svc_start_req {
	enum tz_bw_svc_cmd cmd_id;
	uint32_t version;
} __packed;

/* Get Request */
struct tz_bw_svc_get_req {
	enum tz_bw_svc_cmd cmd_id;
	uint64_t buf_ptr;
	uint32_t buf_size;
} __packed;

/*  Stop Request */
struct tz_bw_svc_stop_req {
	enum tz_bw_svc_cmd cmd_id;
} __packed;

struct tz_bw_svc_resp {
	enum tz_bw_svc_cmd cmd_id;
	enum tz_bw_svc_err status;
} __packed;

__packed union tz_bw_svc_req {
	struct tz_bw_svc_start_req *start_req;
	struct tz_bw_svc_get_req *get_req;
	struct tz_bw_svc_stop_req *stop_req;
};

struct tz_bw_svc_buf {
	union tz_bw_svc_req bwreq;
	struct tz_bw_svc_resp bwresp;
	uint32_t req_size;
} __packed;


#define TZ_SVC_INFO                      6    /* Misc. information services */
#define TZ_SVC_BW_PROF_ID                0x07

#endif /* __PROFILER_H_ */