arm-ccn.c (700a9cf0527ca2d7d3e4980fef2deb4883432ab6) arm-ccn.c (9ec9f9cf8660d549c77e719d2ce11647a03063b9)
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 *
4 * Copyright (C) 2014 ARM Limited
5 */
6
7#include <linux/ctype.h>
8#include <linux/hrtimer.h>

--- 312 unchanged lines hidden (view full) ---

321
322
323static ssize_t arm_ccn_pmu_event_show(struct device *dev,
324 struct device_attribute *attr, char *buf)
325{
326 struct arm_ccn *ccn = pmu_to_arm_ccn(dev_get_drvdata(dev));
327 struct arm_ccn_pmu_event *event = container_of(attr,
328 struct arm_ccn_pmu_event, attr);
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 *
4 * Copyright (C) 2014 ARM Limited
5 */
6
7#include <linux/ctype.h>
8#include <linux/hrtimer.h>

--- 312 unchanged lines hidden (view full) ---

321
322
323static ssize_t arm_ccn_pmu_event_show(struct device *dev,
324 struct device_attribute *attr, char *buf)
325{
326 struct arm_ccn *ccn = pmu_to_arm_ccn(dev_get_drvdata(dev));
327 struct arm_ccn_pmu_event *event = container_of(attr,
328 struct arm_ccn_pmu_event, attr);
329 ssize_t res;
329 int res;
330
330
331 res = scnprintf(buf, PAGE_SIZE, "type=0x%x", event->type);
331 res = sysfs_emit(buf, "type=0x%x", event->type);
332 if (event->event)
332 if (event->event)
333 res += scnprintf(buf + res, PAGE_SIZE - res, ",event=0x%x",
334 event->event);
333 res += sysfs_emit_at(buf, res, ",event=0x%x", event->event);
335 if (event->def)
334 if (event->def)
336 res += scnprintf(buf + res, PAGE_SIZE - res, ",%s",
337 event->def);
335 res += sysfs_emit_at(buf, res, ",%s", event->def);
338 if (event->mask)
336 if (event->mask)
339 res += scnprintf(buf + res, PAGE_SIZE - res, ",mask=0x%x",
340 event->mask);
337 res += sysfs_emit_at(buf, res, ",mask=0x%x", event->mask);
341
342 /* Arguments required by an event */
343 switch (event->type) {
344 case CCN_TYPE_CYCLES:
345 break;
346 case CCN_TYPE_XP:
338
339 /* Arguments required by an event */
340 switch (event->type) {
341 case CCN_TYPE_CYCLES:
342 break;
343 case CCN_TYPE_XP:
347 res += scnprintf(buf + res, PAGE_SIZE - res,
348 ",xp=?,vc=?");
344 res += sysfs_emit_at(buf, res, ",xp=?,vc=?");
349 if (event->event == CCN_EVENT_WATCHPOINT)
345 if (event->event == CCN_EVENT_WATCHPOINT)
350 res += scnprintf(buf + res, PAGE_SIZE - res,
346 res += sysfs_emit_at(buf, res,
351 ",port=?,dir=?,cmp_l=?,cmp_h=?,mask=?");
352 else
347 ",port=?,dir=?,cmp_l=?,cmp_h=?,mask=?");
348 else
353 res += scnprintf(buf + res, PAGE_SIZE - res,
354 ",bus=?");
349 res += sysfs_emit_at(buf, res, ",bus=?");
355
356 break;
357 case CCN_TYPE_MN:
350
351 break;
352 case CCN_TYPE_MN:
358 res += scnprintf(buf + res, PAGE_SIZE - res, ",node=%d", ccn->mn_id);
353 res += sysfs_emit_at(buf, res, ",node=%d", ccn->mn_id);
359 break;
360 default:
354 break;
355 default:
361 res += scnprintf(buf + res, PAGE_SIZE - res, ",node=?");
356 res += sysfs_emit_at(buf, res, ",node=?");
362 break;
363 }
364
357 break;
358 }
359
365 res += scnprintf(buf + res, PAGE_SIZE - res, "\n");
360 res += sysfs_emit_at(buf, res, "\n");
366
367 return res;
368}
369
370static umode_t arm_ccn_pmu_events_is_visible(struct kobject *kobj,
371 struct attribute *attr, int index)
372{
373 struct device *dev = kobj_to_dev(kobj);

--- 1210 unchanged lines hidden ---
361
362 return res;
363}
364
365static umode_t arm_ccn_pmu_events_is_visible(struct kobject *kobj,
366 struct attribute *attr, int index)
367{
368 struct device *dev = kobj_to_dev(kobj);

--- 1210 unchanged lines hidden ---