aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorSouvik Kumar Chakravarty <souvik.k.chakravarty@intel.com>2016-01-12 05:30:33 -0500
committerDarren Hart <dvhart@linux.intel.com>2016-01-19 20:35:50 -0500
commit378f956e3f93b7862d89f93411953758491b42cc (patch)
tree627bec1b5e96c1101ba514b8c200786cd097f819 /arch
parent3fae75740faff4c6a66be7131838fda3ae92e280 (diff)
platform/x86: Add Intel Telemetry Core Driver
Intel PM Telemetry is a software mechanism via which various SoC PM and performance related parameters like PM counters, firmware trace verbosity, the status of different devices inside the SoC, etc. can be monitored and analyzed. The different samples that may be monitored can be configured at runtime via exported APIs. This patch adds the telemetry core driver that implements basic exported APIs. Signed-off-by: Souvik Kumar Chakravarty <souvik.k.chakravarty@intel.com> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/include/asm/intel_telemetry.h147
1 files changed, 147 insertions, 0 deletions
diff --git a/arch/x86/include/asm/intel_telemetry.h b/arch/x86/include/asm/intel_telemetry.h
new file mode 100644
index 000000000000..ed65fe701de5
--- /dev/null
+++ b/arch/x86/include/asm/intel_telemetry.h
@@ -0,0 +1,147 @@
1/*
2 * Intel SOC Telemetry Driver Header File
3 * Copyright (C) 2015, Intel Corporation.
4 * All Rights Reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License,
8 * version 2, as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
14 *
15 */
16#ifndef INTEL_TELEMETRY_H
17#define INTEL_TELEMETRY_H
18
19#define TELEM_MAX_EVENTS_SRAM 28
20#define TELEM_MAX_OS_ALLOCATED_EVENTS 20
21
22enum telemetry_unit {
23 TELEM_PSS = 0,
24 TELEM_IOSS,
25 TELEM_UNIT_NONE
26};
27
28struct telemetry_evtlog {
29 u32 telem_evtid;
30 u64 telem_evtlog;
31};
32
33struct telemetry_evtconfig {
34 /* Array of Event-IDs to Enable */
35 u32 *evtmap;
36
37 /* Number of Events (<29) in evtmap */
38 u8 num_evts;
39
40 /* Sampling period */
41 u8 period;
42};
43
44struct telemetry_evtmap {
45 const char *name;
46 u32 evt_id;
47};
48
49struct telemetry_unit_config {
50 struct telemetry_evtmap *telem_evts;
51 void __iomem *regmap;
52 u32 ssram_base_addr;
53 u8 ssram_evts_used;
54 u8 curr_period;
55 u8 max_period;
56 u8 min_period;
57 u32 ssram_size;
58
59};
60
61struct telemetry_plt_config {
62 struct telemetry_unit_config pss_config;
63 struct telemetry_unit_config ioss_config;
64 struct mutex telem_trace_lock;
65 struct mutex telem_lock;
66 bool telem_in_use;
67};
68
69struct telemetry_core_ops {
70 int (*get_sampling_period)(u8 *pss_min_period, u8 *pss_max_period,
71 u8 *ioss_min_period, u8 *ioss_max_period);
72
73 int (*get_eventconfig)(struct telemetry_evtconfig *pss_evtconfig,
74 struct telemetry_evtconfig *ioss_evtconfig,
75 int pss_len, int ioss_len);
76
77 int (*update_events)(struct telemetry_evtconfig pss_evtconfig,
78 struct telemetry_evtconfig ioss_evtconfig);
79
80 int (*set_sampling_period)(u8 pss_period, u8 ioss_period);
81
82 int (*get_trace_verbosity)(enum telemetry_unit telem_unit,
83 u32 *verbosity);
84
85 int (*set_trace_verbosity)(enum telemetry_unit telem_unit,
86 u32 verbosity);
87
88 int (*raw_read_eventlog)(enum telemetry_unit telem_unit,
89 struct telemetry_evtlog *evtlog,
90 int len, int log_all_evts);
91
92 int (*read_eventlog)(enum telemetry_unit telem_unit,
93 struct telemetry_evtlog *evtlog,
94 int len, int log_all_evts);
95
96 int (*add_events)(u8 num_pss_evts, u8 num_ioss_evts,
97 u32 *pss_evtmap, u32 *ioss_evtmap);
98
99 int (*reset_events)(void);
100};
101
102int telemetry_set_pltdata(struct telemetry_core_ops *ops,
103 struct telemetry_plt_config *pltconfig);
104
105int telemetry_clear_pltdata(void);
106
107int telemetry_pltconfig_valid(void);
108
109int telemetry_get_evtname(enum telemetry_unit telem_unit,
110 const char **name, int len);
111
112int telemetry_update_events(struct telemetry_evtconfig pss_evtconfig,
113 struct telemetry_evtconfig ioss_evtconfig);
114
115int telemetry_add_events(u8 num_pss_evts, u8 num_ioss_evts,
116 u32 *pss_evtmap, u32 *ioss_evtmap);
117
118int telemetry_reset_events(void);
119
120int telemetry_get_eventconfig(struct telemetry_evtconfig *pss_config,
121 struct telemetry_evtconfig *ioss_config,
122 int pss_len, int ioss_len);
123
124int telemetry_read_events(enum telemetry_unit telem_unit,
125 struct telemetry_evtlog *evtlog, int len);
126
127int telemetry_raw_read_events(enum telemetry_unit telem_unit,
128 struct telemetry_evtlog *evtlog, int len);
129
130int telemetry_read_eventlog(enum telemetry_unit telem_unit,
131 struct telemetry_evtlog *evtlog, int len);
132
133int telemetry_raw_read_eventlog(enum telemetry_unit telem_unit,
134 struct telemetry_evtlog *evtlog, int len);
135
136int telemetry_get_sampling_period(u8 *pss_min_period, u8 *pss_max_period,
137 u8 *ioss_min_period, u8 *ioss_max_period);
138
139int telemetry_set_sampling_period(u8 pss_period, u8 ioss_period);
140
141int telemetry_set_trace_verbosity(enum telemetry_unit telem_unit,
142 u32 verbosity);
143
144int telemetry_get_trace_verbosity(enum telemetry_unit telem_unit,
145 u32 *verbosity);
146
147#endif /* INTEL_TELEMETRY_H */