]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - android-sdk/arm-ds5-gator.git/blob - driver/gator.h
gator-driver: Default GATOR_MALI_INTERFACE_STYLE to '2'
[android-sdk/arm-ds5-gator.git] / driver / gator.h
1 /**
2  * Copyright (C) ARM Limited 2010-2012. 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 as
6  * published by the Free Software Foundation.
7  */
9 #ifndef GATOR_H_
10 #define GATOR_H_
12 #include <linux/version.h>
13 #include <linux/fs.h>
14 #include <linux/mm.h>
15 #include <linux/list.h>
17 #define GATOR_PERF_SUPPORT              LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0)
18 #define GATOR_PERF_PMU_SUPPORT  GATOR_PERF_SUPPORT && defined(CONFIG_PERF_EVENTS) && defined(CONFIG_HW_PERF_EVENTS)
19 #define GATOR_NO_PERF_SUPPORT   (!(GATOR_PERF_SUPPORT))
20 #define GATOR_CPU_FREQ_SUPPORT  (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 38)) && defined(CONFIG_CPU_FREQ)
22 // cpu ids
23 #define ARM1136         0xb36
24 #define ARM1156         0xb56
25 #define ARM1176         0xb76
26 #define ARM11MPCORE 0xb02
27 #define CORTEX_A5       0xc05
28 #define CORTEX_A7       0xc07
29 #define CORTEX_A8       0xc08
30 #define CORTEX_A9       0xc09
31 #define CORTEX_A15      0xc0f
32 #define SCORPION        0x00f
33 #define SCORPIONMP      0x02d
34 #define KRAITSIM        0x049
35 #define KRAIT       0x04d
37 /******************************************************************************
38  * Filesystem
39  ******************************************************************************/
40 int gatorfs_create_file_perm(struct super_block *sb, struct dentry *root,
41         char const *name, const struct file_operations *fops, int perm);
43 struct dentry *gatorfs_mkdir(struct super_block *sb,
44         struct dentry *root, char const *name);
46 int gatorfs_create_ulong(struct super_block *sb, struct dentry *root,
47         char const *name, unsigned long *val);
49 int gatorfs_create_ro_ulong(struct super_block *sb, struct dentry *root,
50         char const *name, unsigned long *val);
52 void gator_op_create_files(struct super_block *sb, struct dentry *root);
54 /******************************************************************************
55  * Tracepoints
56  ******************************************************************************/
57 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 32)
58 #       error Kernels prior to 2.6.32 not supported
59 #elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 35)
60 #       define GATOR_DEFINE_PROBE(probe_name, proto) \
61                 static void probe_##probe_name(PARAMS(proto))
62 #       define GATOR_REGISTER_TRACE(probe_name) \
63                 register_trace_##probe_name(probe_##probe_name)
64 #       define GATOR_UNREGISTER_TRACE(probe_name) \
65                 unregister_trace_##probe_name(probe_##probe_name)
66 #else
67 #       define GATOR_DEFINE_PROBE(probe_name, proto) \
68                 static void probe_##probe_name(void *data, PARAMS(proto))
69 #       define GATOR_REGISTER_TRACE(probe_name) \
70                 register_trace_##probe_name(probe_##probe_name, NULL)
71 #       define GATOR_UNREGISTER_TRACE(probe_name) \
72                 unregister_trace_##probe_name(probe_##probe_name, NULL)
73 #endif
75 /******************************************************************************
76  * Events
77  ******************************************************************************/
78 struct gator_interface {
79         int  (*create_files)(struct super_block *sb, struct dentry *root);
80         int  (*start)(void);
81         void (*stop)(void);
82         int  (*online)(int** buffer);
83         int  (*offline)(int** buffer);
84         void  (*online_dispatch)(int cpu);  // called in process context but may not be running on core 'cpu'
85         void  (*offline_dispatch)(int cpu); // called in process context but may not be running on core 'cpu'
86         int  (*read)(int **buffer);
87         int  (*read64)(long long **buffer);
88         struct list_head list;
89 };
91 // gator_events_init is used as a search term in gator_events.sh
92 #define gator_events_init(initfn) \
93         static inline int __gator_events_init_test(void) \
94         { return initfn(); }
96 int gator_events_install(struct gator_interface *interface);
97 int gator_events_get_key(void);
98 extern u32 gator_cpuid(void);
100 #endif // GATOR_H_