2 * Intel SOC Telemetry Driver Header File
3 * Copyright (C) 2015, Intel Corporation.
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
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
28 struct telemetry_evtlog {
33 struct telemetry_evtconfig {
34 /* Array of Event-IDs to Enable */
37 /* Number of Events (<29) in evtmap */
44 struct telemetry_evtmap {
49 struct telemetry_unit_config {
50 struct telemetry_evtmap *telem_evts;
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;
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,
85 int (*set_trace_verbosity)(enum telemetry_unit telem_unit,
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,
144 int telemetry_get_trace_verbosity(enum telemetry_unit telem_unit,
147 #endif /* INTEL_TELEMETRY_H */