Lines Matching refs:id

12 #include "coresight-trace-id.h"
38 #define DUMP_ID_CPU(cpu, id) pr_debug("%s called; cpu=%d, id=%d\n", __func__, cpu, id)
39 #define DUMP_ID(id) pr_debug("%s called; id=%d\n", __func__, id)
43 #define DUMP_ID(id)
44 #define DUMP_ID_CPU(cpu, id)
77 * if @preferred_id is a valid id then try to use that value if available.
78 * if @preferred_id is not valid and @prefer_odd_id is true, try for odd id.
85 int id = 0;
90 id = preferred_id;
94 id = coresight_trace_id_find_odd_id(id_map);
95 if (id)
103 id = find_next_zero_bit(id_map->used_ids, CORESIGHT_TRACE_ID_RES_TOP, 1);
104 if (id >= CORESIGHT_TRACE_ID_RES_TOP)
109 set_bit(id, id_map->used_ids);
110 return id;
113 static void coresight_trace_id_free(int id, struct coresight_trace_id_map *id_map)
115 if (WARN(!IS_VALID_CS_TRACE_ID(id), "Invalid Trace ID %d\n", id))
117 if (WARN(!test_bit(id, id_map->used_ids), "Freeing unused ID %d\n", id))
119 clear_bit(id, id_map->used_ids);
122 static void coresight_trace_id_set_pend_rel(int id, struct coresight_trace_id_map *id_map)
124 if (WARN(!IS_VALID_CS_TRACE_ID(id), "Invalid Trace ID %d\n", id))
126 set_bit(id, id_map->pend_rel_ids);
132 * This currently operates on the default id map, but may be extended to
133 * operate on all registered id maps if per sink id maps are used.
157 int id;
162 id = _coresight_trace_id_read_cpu_id(cpu);
163 if (id)
176 id = coresight_trace_id_alloc_new_id(id_map,
179 if (!IS_VALID_CS_TRACE_ID(id))
182 /* allocate the new id to the cpu */
183 atomic_set(&per_cpu(cpu_id, cpu), id);
188 clear_bit(id, id_map->pend_rel_ids);
193 DUMP_ID_CPU(cpu, id);
195 return id;
201 int id;
204 id = _coresight_trace_id_read_cpu_id(cpu);
205 if (!id)
212 coresight_trace_id_set_pend_rel(id, id_map);
215 /* otherwise clear id */
216 coresight_trace_id_free(id, id_map);
221 DUMP_ID_CPU(cpu, id);
228 int id;
232 id = coresight_trace_id_alloc_new_id(id_map, 0, true);
235 DUMP_ID(id);
237 return id;
240 static void coresight_trace_id_map_put_system_id(struct coresight_trace_id_map *id_map, int id)
245 coresight_trace_id_free(id, id_map);
248 DUMP_ID(id);
278 void coresight_trace_id_put_system_id(int id)
280 coresight_trace_id_map_put_system_id(&id_map_default, id);