Laura Abbott | ad340ff | 2012-01-04 14:23:48 -0800 | [diff] [blame] | 1 | /* |
| 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 Abbott | cdedff1 | 2012-02-14 11:13:46 -0800 | [diff] [blame] | 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 | */ |
Laura Abbott | ad340ff | 2012-01-04 14:23:48 -0800 | [diff] [blame] | 20 | enum logk_event_type { |
| 21 | LOGK_NONE = 0, |
Laura Abbott | cdedff1 | 2012-02-14 11:13:46 -0800 | [diff] [blame] | 22 | LOGK_READL = 1, |
| 23 | LOGK_WRITEL = 2, |
| 24 | LOGK_LOGBUF = 3, |
| 25 | LOGK_HOTPLUG = 4, |
| 26 | LOGK_CTXID = 5, |
| 27 | LOGK_OTHER = 31, |
Laura Abbott | ad340ff | 2012-01-04 14:23:48 -0800 | [diff] [blame] | 28 | }; |
| 29 | |
Laura Abbott | f8c03b9 | 2012-02-16 14:57:58 -0800 | [diff] [blame] | 30 | struct msm_rtb_platform_data { |
| 31 | unsigned int size; |
| 32 | }; |
| 33 | |
Laura Abbott | ad340ff | 2012-01-04 14:23:48 -0800 | [diff] [blame] | 34 | #if defined(CONFIG_MSM_RTB) |
| 35 | /* |
| 36 | * returns 1 if data was logged, 0 otherwise |
| 37 | */ |
| 38 | int 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 | */ |
| 44 | int uncached_logk(enum logk_event_type log_type, void *data); |
| 45 | |
Laura Abbott | 0f9c776 | 2012-01-06 18:44:47 -0800 | [diff] [blame] | 46 | #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 Abbott | ad340ff | 2012-01-04 14:23:48 -0800 | [diff] [blame] | 62 | #else |
| 63 | |
| 64 | static inline int uncached_logk_pc(enum logk_event_type log_type, |
| 65 | void *caller, |
| 66 | void *data) { return 0; } |
| 67 | |
| 68 | static inline int uncached_logk(enum logk_event_type log_type, |
| 69 | void *data) { return 0; } |
Laura Abbott | 0f9c776 | 2012-01-06 18:44:47 -0800 | [diff] [blame] | 70 | |
| 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 Abbott | ad340ff | 2012-01-04 14:23:48 -0800 | [diff] [blame] | 78 | #endif |
| 79 | #endif |