summaryrefslogtreecommitdiff
path: root/drivers/misc/tegra-profiler/quadd.h
blob: bb47f7114904876d7ba0e83d81faa9947bd10894 (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
/*
 * drivers/misc/tegra-profiler/quadd.h
 *
 * Copyright (c) 2015, NVIDIA CORPORATION.  All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms and conditions of the GNU General Public License,
 * version 2, as published by the Free Software Foundation.
 *
 * This program is distributed in the hope 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 __QUADD_H
#define __QUADD_H

#include <linux/tegra_profiler.h>

/* #define QUADD_USE_EMULATE_COUNTERS	1 */

struct event_data;
struct quadd_comm_data_interface;
struct quadd_hrt_ctx;
struct quadd_module_state;
struct quadd_arch_info;

struct quadd_event_source_interface {
	int (*enable)(void);
	void (*disable)(void);
	void (*start)(void);
	void (*stop)(void);
	int (*read)(struct event_data *events, int max_events);
	int (*set_events)(int *events, int size);
	int (*get_supported_events)(int *events, int max_events);
	int (*get_current_events)(int *events, int max_events);
	struct quadd_arch_info * (*get_arch)(void);
};

struct source_info {
	int supported_events[QUADD_MAX_COUNTERS];
	int nr_supported_events;

	int active;
};

struct quadd_ctx {
	struct quadd_parameters param;
	struct quadd_comm_cap cap;

	struct quadd_event_source_interface *pmu;
	struct source_info pmu_info;

	struct quadd_event_source_interface *pl310;
	struct source_info pl310_info;

	struct quadd_comm_data_interface *comm;
	struct quadd_hrt_ctx *hrt;

	atomic_t started;
	atomic_t tegra_profiler_lock;

	int collect_kernel_ips;
};

void quadd_get_state(struct quadd_module_state *state);

int tegra_profiler_try_lock(void);
void tegra_profiler_unlock(void);

#endif	/* __QUADD_H */