blob: 5eea63f47f2e710b28f8cf2c9c9110cc9bc8f3d9 [file] [log] [blame]
Laura Abbottad340ff2012-01-04 14:23:48 -08001/*
2 * Copyright (c) 2012, Code Aurora Forum. 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
Laura Abbottcdedff12012-02-14 11:13:46 -080016/*
17 * These numbers are used from the kernel command line and sysfs
18 * to control filtering. Remove items from here with extreme caution
19 */
Laura Abbottad340ff2012-01-04 14:23:48 -080020enum logk_event_type {
21 LOGK_NONE = 0,
Laura Abbottcdedff12012-02-14 11:13:46 -080022 LOGK_READL = 1,
23 LOGK_WRITEL = 2,
24 LOGK_LOGBUF = 3,
25 LOGK_HOTPLUG = 4,
26 LOGK_CTXID = 5,
27 LOGK_OTHER = 31,
Laura Abbottad340ff2012-01-04 14:23:48 -080028};
29
Laura Abbottf8c03b92012-02-16 14:57:58 -080030struct msm_rtb_platform_data {
31 unsigned int size;
32};
33
Laura Abbottad340ff2012-01-04 14:23:48 -080034#if defined(CONFIG_MSM_RTB)
35/*
36 * returns 1 if data was logged, 0 otherwise
37 */
38int uncached_logk_pc(enum logk_event_type log_type, void *caller,
39 void *data);
40
41/*
42 * returns 1 if data was logged, 0 otherwise
43 */
44int uncached_logk(enum logk_event_type log_type, void *data);
45
Laura Abbott0f9c7762012-01-06 18:44:47 -080046#define ETB_WAYPOINT do { \
47 BRANCH_TO_NEXT_ISTR; \
48 nop(); \
49 BRANCH_TO_NEXT_ISTR; \
50 nop(); \
51 } while (0)
52
53#define BRANCH_TO_NEXT_ISTR asm volatile("b .+4\n" : : : "memory")
54/*
55 * both the mb and the isb are needed to ensure enough waypoints for
56 * etb tracing
57 */
58#define LOG_BARRIER do { \
59 mb(); \
60 isb();\
61 } while (0)
Laura Abbottad340ff2012-01-04 14:23:48 -080062#else
63
64static inline int uncached_logk_pc(enum logk_event_type log_type,
65 void *caller,
66 void *data) { return 0; }
67
68static inline int uncached_logk(enum logk_event_type log_type,
69 void *data) { return 0; }
Laura Abbott0f9c7762012-01-06 18:44:47 -080070
71#define ETB_WAYPOINT
72#define BRANCH_TO_NEXT_ISTR
73/*
74 * Due to a GCC bug, we need to have a nop here in order to prevent an extra
75 * read from being generated after the write.
76 */
77#define LOG_BARRIER nop()
Laura Abbottad340ff2012-01-04 14:23:48 -080078#endif
79#endif