blob: 228094294b318855cd083281cf437dfbcb672222 [file] [log] [blame]
Bhargav Gurappadi0084bbd2016-08-04 14:44:23 -07001/*
2 * Copyright (c) 2012-2014, The Linux Foundation. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 and
6 * only version 2 as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 */
13#ifndef __MSM_RTB_H__
14#define __MSM_RTB_H__
15
16/*
17 * These numbers are used from the kernel command line and sysfs
18 * to control filtering. Remove items from here with extreme caution.
19 */
20enum logk_event_type {
21 LOGK_NONE = 0,
22 LOGK_READL = 1,
23 LOGK_WRITEL = 2,
24 LOGK_LOGBUF = 3,
25 LOGK_HOTPLUG = 4,
26 LOGK_CTXID = 5,
27 LOGK_TIMESTAMP = 6,
28 LOGK_L2CPREAD = 7,
29 LOGK_L2CPWRITE = 8,
30 LOGK_IRQ = 9,
31};
32
33#define LOGTYPE_NOPC 0x80
34
35struct msm_rtb_platform_data {
36 unsigned int size;
37};
38
39#if defined(CONFIG_QCOM_RTB)
40/*
41 * returns 1 if data was logged, 0 otherwise
42 */
43int uncached_logk_pc(enum logk_event_type log_type, void *caller,
44 void *data);
45
46/*
47 * returns 1 if data was logged, 0 otherwise
48 */
49int uncached_logk(enum logk_event_type log_type, void *data);
50
51#define ETB_WAYPOINT do { \
52 BRANCH_TO_NEXT_ISTR; \
53 nop(); \
54 BRANCH_TO_NEXT_ISTR; \
55 nop(); \
56 } while (0)
57
58#define BRANCH_TO_NEXT_ISTR asm volatile("b .+4\n" : : : "memory")
59/*
60 * both the mb and the isb are needed to ensure enough waypoints for
61 * etb tracing
62 */
63#define LOG_BARRIER do { \
64 mb(); \
65 isb();\
66 } while (0)
67#else
68
69static inline int uncached_logk_pc(enum logk_event_type log_type,
70 void *caller,
71 void *data) { return 0; }
72
73static inline int uncached_logk(enum logk_event_type log_type,
74 void *data) { return 0; }
75
76#define ETB_WAYPOINT
77#define BRANCH_TO_NEXT_ISTR
78/*
79 * Due to a GCC bug, we need to have a nop here in order to prevent an extra
80 * read from being generated after the write.
81 */
82#define LOG_BARRIER nop()
83#endif
84#endif