Merge tag 'pm-4.13-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
[linux/fpc-iii.git] / arch / x86 / include / asm / intel_telemetry.h
blob85029b58d0cd34c2b6dff04ce5e0e1a20e1bc81b
1 /*
2 * Intel SOC Telemetry Driver Header File
3 * Copyright (C) 2015, Intel Corporation.
4 * All Rights Reserved.
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.
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.
16 #ifndef INTEL_TELEMETRY_H
17 #define INTEL_TELEMETRY_H
19 #define TELEM_MAX_EVENTS_SRAM 28
20 #define TELEM_MAX_OS_ALLOCATED_EVENTS 20
22 enum telemetry_unit {
23 TELEM_PSS = 0,
24 TELEM_IOSS,
25 TELEM_UNIT_NONE
28 struct telemetry_evtlog {
29 u32 telem_evtid;
30 u64 telem_evtlog;
33 struct telemetry_evtconfig {
34 /* Array of Event-IDs to Enable */
35 u32 *evtmap;
37 /* Number of Events (<29) in evtmap */
38 u8 num_evts;
40 /* Sampling period */
41 u8 period;
44 struct telemetry_evtmap {
45 const char *name;
46 u32 evt_id;
49 struct 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;
61 struct 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;
69 struct 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);
73 int (*get_eventconfig)(struct telemetry_evtconfig *pss_evtconfig,
74 struct telemetry_evtconfig *ioss_evtconfig,
75 int pss_len, int ioss_len);
77 int (*update_events)(struct telemetry_evtconfig pss_evtconfig,
78 struct telemetry_evtconfig ioss_evtconfig);
80 int (*set_sampling_period)(u8 pss_period, u8 ioss_period);
82 int (*get_trace_verbosity)(enum telemetry_unit telem_unit,
83 u32 *verbosity);
85 int (*set_trace_verbosity)(enum telemetry_unit telem_unit,
86 u32 verbosity);
88 int (*raw_read_eventlog)(enum telemetry_unit telem_unit,
89 struct telemetry_evtlog *evtlog,
90 int len, int log_all_evts);
92 int (*read_eventlog)(enum telemetry_unit telem_unit,
93 struct telemetry_evtlog *evtlog,
94 int len, int log_all_evts);
96 int (*add_events)(u8 num_pss_evts, u8 num_ioss_evts,
97 u32 *pss_evtmap, u32 *ioss_evtmap);
99 int (*reset_events)(void);
102 int telemetry_set_pltdata(const struct telemetry_core_ops *ops,
103 struct telemetry_plt_config *pltconfig);
105 int telemetry_clear_pltdata(void);
107 int telemetry_pltconfig_valid(void);
109 int telemetry_get_evtname(enum telemetry_unit telem_unit,
110 const char **name, int len);
112 int telemetry_update_events(struct telemetry_evtconfig pss_evtconfig,
113 struct telemetry_evtconfig ioss_evtconfig);
115 int telemetry_add_events(u8 num_pss_evts, u8 num_ioss_evts,
116 u32 *pss_evtmap, u32 *ioss_evtmap);
118 int telemetry_reset_events(void);
120 int telemetry_get_eventconfig(struct telemetry_evtconfig *pss_config,
121 struct telemetry_evtconfig *ioss_config,
122 int pss_len, int ioss_len);
124 int telemetry_read_events(enum telemetry_unit telem_unit,
125 struct telemetry_evtlog *evtlog, int len);
127 int telemetry_raw_read_events(enum telemetry_unit telem_unit,
128 struct telemetry_evtlog *evtlog, int len);
130 int telemetry_read_eventlog(enum telemetry_unit telem_unit,
131 struct telemetry_evtlog *evtlog, int len);
133 int telemetry_raw_read_eventlog(enum telemetry_unit telem_unit,
134 struct telemetry_evtlog *evtlog, int len);
136 int telemetry_get_sampling_period(u8 *pss_min_period, u8 *pss_max_period,
137 u8 *ioss_min_period, u8 *ioss_max_period);
139 int telemetry_set_sampling_period(u8 pss_period, u8 ioss_period);
141 int telemetry_set_trace_verbosity(enum telemetry_unit telem_unit,
142 u32 verbosity);
144 int telemetry_get_trace_verbosity(enum telemetry_unit telem_unit,
145 u32 *verbosity);
147 #endif /* INTEL_TELEMETRY_H */