summaryrefslogtreecommitdiff
path: root/drivers/misc/tegra-profiler/tegra.h
blob: 1a253cf2aebe1eca056c63beb03af7f891a87322 (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
/*
 * drivers/misc/tegra-profiler/tegra.h
 *
 * Copyright (c) 2014, 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_TEGRA_H
#define __QUADD_TEGRA_H

#include <linux/smp.h>
#include <asm/ptrace.h>

#ifdef CONFIG_TEGRA_CLUSTER_CONTROL
#include <linux/io.h>
#include <../../mach-tegra/pm.h>
#endif

static inline int
is_thumb_mode(struct pt_regs *regs)
{
#ifdef CONFIG_ARM64
	return compat_thumb_mode(regs);
#else
	return thumb_mode(regs);
#endif
}

static inline unsigned int
quadd_get_processor_id(struct pt_regs *regs, unsigned int *flags)
{
	if (flags) {
		*flags = 0;

#ifdef CONFIG_TEGRA_CLUSTER_CONTROL
		if (is_lp_cluster())
			*flags |= QUADD_CPUMODE_TEGRA_POWER_CLUSTER_LP;
#endif

		if (regs && is_thumb_mode(regs))
			*flags |= QUADD_CPUMODE_THUMB;
	}

	return smp_processor_id();
}

static inline int quadd_is_cpu_with_lp_cluster(void)
{
#ifdef CONFIG_TEGRA_CLUSTER_CONTROL
	return 1;
#else
	return 0;
#endif
}

#endif  /* __QUADD_TEGRA_H */