2 * Copyright (C) ARM Limited 2012-2013. All rights reserved.
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.
10 #if !defined(GATOR_EVENTS_MALI_COMMON_H)
11 #define GATOR_EVENTS_MALI_COMMON_H
15 #include <linux/module.h>
16 #include <linux/time.h>
17 #include <linux/math64.h>
18 #include <linux/slab.h>
21 /* Device codes for each known GPU */
22 #define MALI_400 (0x0b07)
23 #define MALI_T6xx (0x0056)
25 /* Ensure that MALI_SUPPORT has been defined to something. */
27 #error MALI_SUPPORT not defined!
30 /* Values for the supported activity event types */
31 #define ACTIVITY_START (1)
32 #define ACTIVITY_STOP (2)
35 * Runtime state information for a counter.
38 unsigned long key; /* 'key' (a unique id set by gatord and returned by gator.ko) */
39 unsigned long enabled; /* counter enable state */
45 typedef void mali_profiling_set_event_type(unsigned int, unsigned int);
46 typedef void mali_osk_fb_control_set_type(unsigned int, unsigned int);
47 typedef void mali_profiling_control_type(unsigned int, unsigned int);
48 typedef void mali_profiling_get_counters_type(unsigned int *, unsigned int *, unsigned int *, unsigned int *);
51 * Driver entry points for functions called directly by gator.
53 extern void _mali_profiling_set_event(unsigned int, unsigned int);
54 extern void _mali_osk_fb_control_set(unsigned int, unsigned int);
55 extern void _mali_profiling_control(unsigned int, unsigned int);
56 extern void _mali_profiling_get_counters(unsigned int *, unsigned int *, unsigned int *, unsigned int *);
59 * Returns a name which identifies the GPU type (eg Mali-400, Mali-T6xx).
61 * @return The name as a constant string.
63 extern const char *gator_mali_get_mali_name(void);
66 * Creates a filesystem entry under /dev/gator relating to the specified event name and key, and
67 * associate the key/enable values with this entry point.
69 * @param mali_name A name related to the type of GPU, obtained from a call to gator_mali_get_mali_name()
70 * @param event_name The name of the event.
71 * @param sb Linux super block
72 * @param root Directory under which the entry will be created.
73 * @param counter_key Ptr to location which will be associated with the counter key.
74 * @param counter_enabled Ptr to location which will be associated with the counter enable state.
76 * @return 0 if entry point was created, non-zero if not.
78 extern int gator_mali_create_file_system(const char *mali_name, const char *event_name, struct super_block *sb, struct dentry *root, mali_counter *counter);
81 * Initializes the counter array.
83 * @param keys The array of counters
84 * @param n_counters The number of entries in each of the arrays.
86 extern void gator_mali_initialise_counters(mali_counter counters[], unsigned int n_counters);
88 #endif /* GATOR_EVENTS_MALI_COMMON_H */