Commit | Line | Data |
---|---|---|
378f956e SKC |
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 | ||
22 | enum telemetry_unit { | |
23 | TELEM_PSS = 0, | |
24 | TELEM_IOSS, | |
25 | TELEM_UNIT_NONE | |
26 | }; | |
27 | ||
28 | struct telemetry_evtlog { | |
29 | u32 telem_evtid; | |
30 | u64 telem_evtlog; | |
31 | }; | |
32 | ||
33 | struct 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 | ||
44 | struct telemetry_evtmap { | |
45 | const char *name; | |
46 | u32 evt_id; | |
47 | }; | |
48 | ||
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; | |
58 | ||
59 | }; | |
60 | ||
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; | |
67 | }; | |
68 | ||
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); | |
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 | ||
775d054a | 102 | int telemetry_set_pltdata(const struct telemetry_core_ops *ops, |
378f956e SKC |
103 | struct telemetry_plt_config *pltconfig); |
104 | ||
105 | int telemetry_clear_pltdata(void); | |
106 | ||
107 | int telemetry_pltconfig_valid(void); | |
108 | ||
109 | int telemetry_get_evtname(enum telemetry_unit telem_unit, | |
110 | const char **name, int len); | |
111 | ||
112 | int telemetry_update_events(struct telemetry_evtconfig pss_evtconfig, | |
113 | struct telemetry_evtconfig ioss_evtconfig); | |
114 | ||
115 | int telemetry_add_events(u8 num_pss_evts, u8 num_ioss_evts, | |
116 | u32 *pss_evtmap, u32 *ioss_evtmap); | |
117 | ||
118 | int telemetry_reset_events(void); | |
119 | ||
120 | int telemetry_get_eventconfig(struct telemetry_evtconfig *pss_config, | |
121 | struct telemetry_evtconfig *ioss_config, | |
122 | int pss_len, int ioss_len); | |
123 | ||
124 | int telemetry_read_events(enum telemetry_unit telem_unit, | |
125 | struct telemetry_evtlog *evtlog, int len); | |
126 | ||
127 | int telemetry_raw_read_events(enum telemetry_unit telem_unit, | |
128 | struct telemetry_evtlog *evtlog, int len); | |
129 | ||
130 | int telemetry_read_eventlog(enum telemetry_unit telem_unit, | |
131 | struct telemetry_evtlog *evtlog, int len); | |
132 | ||
133 | int telemetry_raw_read_eventlog(enum telemetry_unit telem_unit, | |
134 | struct telemetry_evtlog *evtlog, int len); | |
135 | ||
136 | int telemetry_get_sampling_period(u8 *pss_min_period, u8 *pss_max_period, | |
137 | u8 *ioss_min_period, u8 *ioss_max_period); | |
138 | ||
139 | int telemetry_set_sampling_period(u8 pss_period, u8 ioss_period); | |
140 | ||
141 | int telemetry_set_trace_verbosity(enum telemetry_unit telem_unit, | |
142 | u32 verbosity); | |
143 | ||
144 | int telemetry_get_trace_verbosity(enum telemetry_unit telem_unit, | |
145 | u32 *verbosity); | |
146 | ||
147 | #endif /* INTEL_TELEMETRY_H */ |