Linux 5.7.6
[linux/fpc-iii.git] / arch / x86 / include / asm / intel_telemetry.h
blob2f77e31a1283c733a09e95db3f3fa3057281ae65
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3 * Intel SOC Telemetry Driver Header File
4 * Copyright (C) 2015, Intel Corporation.
5 * All Rights Reserved.
6 */
7 #ifndef INTEL_TELEMETRY_H
8 #define INTEL_TELEMETRY_H
10 #define TELEM_MAX_EVENTS_SRAM 28
11 #define TELEM_MAX_OS_ALLOCATED_EVENTS 20
13 enum telemetry_unit {
14 TELEM_PSS = 0,
15 TELEM_IOSS,
16 TELEM_UNIT_NONE
19 struct telemetry_evtlog {
20 u32 telem_evtid;
21 u64 telem_evtlog;
24 struct telemetry_evtconfig {
25 /* Array of Event-IDs to Enable */
26 u32 *evtmap;
28 /* Number of Events (<29) in evtmap */
29 u8 num_evts;
31 /* Sampling period */
32 u8 period;
35 struct telemetry_evtmap {
36 const char *name;
37 u32 evt_id;
40 struct telemetry_unit_config {
41 struct telemetry_evtmap *telem_evts;
42 void __iomem *regmap;
43 u8 ssram_evts_used;
44 u8 curr_period;
45 u8 max_period;
46 u8 min_period;
49 struct telemetry_plt_config {
50 struct telemetry_unit_config pss_config;
51 struct telemetry_unit_config ioss_config;
52 struct mutex telem_trace_lock;
53 struct mutex telem_lock;
54 bool telem_in_use;
57 struct telemetry_core_ops {
58 int (*get_sampling_period)(u8 *pss_min_period, u8 *pss_max_period,
59 u8 *ioss_min_period, u8 *ioss_max_period);
61 int (*get_eventconfig)(struct telemetry_evtconfig *pss_evtconfig,
62 struct telemetry_evtconfig *ioss_evtconfig,
63 int pss_len, int ioss_len);
65 int (*update_events)(struct telemetry_evtconfig pss_evtconfig,
66 struct telemetry_evtconfig ioss_evtconfig);
68 int (*set_sampling_period)(u8 pss_period, u8 ioss_period);
70 int (*get_trace_verbosity)(enum telemetry_unit telem_unit,
71 u32 *verbosity);
73 int (*set_trace_verbosity)(enum telemetry_unit telem_unit,
74 u32 verbosity);
76 int (*raw_read_eventlog)(enum telemetry_unit telem_unit,
77 struct telemetry_evtlog *evtlog,
78 int len, int log_all_evts);
80 int (*read_eventlog)(enum telemetry_unit telem_unit,
81 struct telemetry_evtlog *evtlog,
82 int len, int log_all_evts);
84 int (*add_events)(u8 num_pss_evts, u8 num_ioss_evts,
85 u32 *pss_evtmap, u32 *ioss_evtmap);
87 int (*reset_events)(void);
90 int telemetry_set_pltdata(const struct telemetry_core_ops *ops,
91 struct telemetry_plt_config *pltconfig);
93 int telemetry_clear_pltdata(void);
95 int telemetry_pltconfig_valid(void);
97 int telemetry_get_evtname(enum telemetry_unit telem_unit,
98 const char **name, int len);
100 int telemetry_update_events(struct telemetry_evtconfig pss_evtconfig,
101 struct telemetry_evtconfig ioss_evtconfig);
103 int telemetry_add_events(u8 num_pss_evts, u8 num_ioss_evts,
104 u32 *pss_evtmap, u32 *ioss_evtmap);
106 int telemetry_reset_events(void);
108 int telemetry_get_eventconfig(struct telemetry_evtconfig *pss_config,
109 struct telemetry_evtconfig *ioss_config,
110 int pss_len, int ioss_len);
112 int telemetry_read_events(enum telemetry_unit telem_unit,
113 struct telemetry_evtlog *evtlog, int len);
115 int telemetry_raw_read_events(enum telemetry_unit telem_unit,
116 struct telemetry_evtlog *evtlog, int len);
118 int telemetry_read_eventlog(enum telemetry_unit telem_unit,
119 struct telemetry_evtlog *evtlog, int len);
121 int telemetry_raw_read_eventlog(enum telemetry_unit telem_unit,
122 struct telemetry_evtlog *evtlog, int len);
124 int telemetry_get_sampling_period(u8 *pss_min_period, u8 *pss_max_period,
125 u8 *ioss_min_period, u8 *ioss_max_period);
127 int telemetry_set_sampling_period(u8 pss_period, u8 ioss_period);
129 int telemetry_set_trace_verbosity(enum telemetry_unit telem_unit,
130 u32 verbosity);
132 int telemetry_get_trace_verbosity(enum telemetry_unit telem_unit,
133 u32 *verbosity);
135 #endif /* INTEL_TELEMETRY_H */