|
12 | 12 |
|
13 | 13 | #include "coresight-trace-id.h"
|
14 | 14 |
|
15 |
| -/* Default trace ID map. Used on systems that don't require per sink mappings */ |
| 15 | +/* Default trace ID map. Used in sysfs mode and for system sources */ |
16 | 16 | static struct coresight_trace_id_map id_map_default;
|
17 | 17 |
|
18 | 18 | /* maintain a record of the mapping of IDs and pending releases per cpu */
|
@@ -47,7 +47,7 @@ static void coresight_trace_id_dump_table(struct coresight_trace_id_map *id_map,
|
47 | 47 | #endif
|
48 | 48 |
|
49 | 49 | /* unlocked read of current trace ID value for given CPU */
|
50 |
| -static int _coresight_trace_id_read_cpu_id(int cpu) |
| 50 | +static int _coresight_trace_id_read_cpu_id(int cpu, struct coresight_trace_id_map *id_map) |
51 | 51 | {
|
52 | 52 | return atomic_read(&per_cpu(cpu_id, cpu));
|
53 | 53 | }
|
@@ -152,15 +152,15 @@ static void coresight_trace_id_release_all_pending(void)
|
152 | 152 | DUMP_ID_MAP(id_map);
|
153 | 153 | }
|
154 | 154 |
|
155 |
| -static int coresight_trace_id_map_get_cpu_id(int cpu, struct coresight_trace_id_map *id_map) |
| 155 | +static int _coresight_trace_id_get_cpu_id(int cpu, struct coresight_trace_id_map *id_map) |
156 | 156 | {
|
157 | 157 | unsigned long flags;
|
158 | 158 | int id;
|
159 | 159 |
|
160 | 160 | spin_lock_irqsave(&id_map_lock, flags);
|
161 | 161 |
|
162 | 162 | /* check for existing allocation for this CPU */
|
163 |
| - id = _coresight_trace_id_read_cpu_id(cpu); |
| 163 | + id = _coresight_trace_id_read_cpu_id(cpu, id_map); |
164 | 164 | if (id)
|
165 | 165 | goto get_cpu_id_clr_pend;
|
166 | 166 |
|
@@ -196,13 +196,13 @@ static int coresight_trace_id_map_get_cpu_id(int cpu, struct coresight_trace_id_
|
196 | 196 | return id;
|
197 | 197 | }
|
198 | 198 |
|
199 |
| -static void coresight_trace_id_map_put_cpu_id(int cpu, struct coresight_trace_id_map *id_map) |
| 199 | +static void _coresight_trace_id_put_cpu_id(int cpu, struct coresight_trace_id_map *id_map) |
200 | 200 | {
|
201 | 201 | unsigned long flags;
|
202 | 202 | int id;
|
203 | 203 |
|
204 | 204 | /* check for existing allocation for this CPU */
|
205 |
| - id = _coresight_trace_id_read_cpu_id(cpu); |
| 205 | + id = _coresight_trace_id_read_cpu_id(cpu, id_map); |
206 | 206 | if (!id)
|
207 | 207 | return;
|
208 | 208 |
|
@@ -254,22 +254,40 @@ static void coresight_trace_id_map_put_system_id(struct coresight_trace_id_map *
|
254 | 254 |
|
255 | 255 | int coresight_trace_id_get_cpu_id(int cpu)
|
256 | 256 | {
|
257 |
| - return coresight_trace_id_map_get_cpu_id(cpu, &id_map_default); |
| 257 | + return _coresight_trace_id_get_cpu_id(cpu, &id_map_default); |
258 | 258 | }
|
259 | 259 | EXPORT_SYMBOL_GPL(coresight_trace_id_get_cpu_id);
|
260 | 260 |
|
| 261 | +int coresight_trace_id_get_cpu_id_map(int cpu, struct coresight_trace_id_map *id_map) |
| 262 | +{ |
| 263 | + return _coresight_trace_id_get_cpu_id(cpu, id_map); |
| 264 | +} |
| 265 | +EXPORT_SYMBOL_GPL(coresight_trace_id_get_cpu_id_map); |
| 266 | + |
261 | 267 | void coresight_trace_id_put_cpu_id(int cpu)
|
262 | 268 | {
|
263 |
| - coresight_trace_id_map_put_cpu_id(cpu, &id_map_default); |
| 269 | + _coresight_trace_id_put_cpu_id(cpu, &id_map_default); |
264 | 270 | }
|
265 | 271 | EXPORT_SYMBOL_GPL(coresight_trace_id_put_cpu_id);
|
266 | 272 |
|
| 273 | +void coresight_trace_id_put_cpu_id_map(int cpu, struct coresight_trace_id_map *id_map) |
| 274 | +{ |
| 275 | + _coresight_trace_id_put_cpu_id(cpu, id_map); |
| 276 | +} |
| 277 | +EXPORT_SYMBOL_GPL(coresight_trace_id_put_cpu_id_map); |
| 278 | + |
267 | 279 | int coresight_trace_id_read_cpu_id(int cpu)
|
268 | 280 | {
|
269 |
| - return _coresight_trace_id_read_cpu_id(cpu); |
| 281 | + return _coresight_trace_id_read_cpu_id(cpu, &id_map_default); |
270 | 282 | }
|
271 | 283 | EXPORT_SYMBOL_GPL(coresight_trace_id_read_cpu_id);
|
272 | 284 |
|
| 285 | +int coresight_trace_id_read_cpu_id_map(int cpu, struct coresight_trace_id_map *id_map) |
| 286 | +{ |
| 287 | + return _coresight_trace_id_read_cpu_id(cpu, id_map); |
| 288 | +} |
| 289 | +EXPORT_SYMBOL_GPL(coresight_trace_id_read_cpu_id_map); |
| 290 | + |
273 | 291 | int coresight_trace_id_get_system_id(void)
|
274 | 292 | {
|
275 | 293 | return coresight_trace_id_map_get_system_id(&id_map_default);
|
|
0 commit comments