2010-02-02 22:23:15 +03:00
|
|
|
/*
|
|
|
|
* linux/arch/arm/include/asm/pmu.h
|
|
|
|
*
|
|
|
|
* Copyright (C) 2009 picoChip Designs Ltd, Jamie Iles
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __ARM_PMU_H__
|
|
|
|
#define __ARM_PMU_H__
|
|
|
|
|
2010-04-29 20:11:45 +04:00
|
|
|
enum arm_pmu_type {
|
|
|
|
ARM_PMU_DEVICE_CPU = 0,
|
|
|
|
ARM_NUM_PMU_DEVICES,
|
|
|
|
};
|
|
|
|
|
2010-02-02 22:23:15 +03:00
|
|
|
#ifdef CONFIG_CPU_HAS_PMU
|
|
|
|
|
|
|
|
/**
|
|
|
|
* reserve_pmu() - reserve the hardware performance counters
|
|
|
|
*
|
|
|
|
* Reserve the hardware performance counters in the system for exclusive use.
|
2010-04-29 20:13:24 +04:00
|
|
|
* The platform_device for the system is returned on success, ERR_PTR()
|
2010-02-02 22:23:15 +03:00
|
|
|
* encoded error on failure.
|
|
|
|
*/
|
2010-04-29 20:13:24 +04:00
|
|
|
extern struct platform_device *
|
|
|
|
reserve_pmu(enum arm_pmu_type device);
|
2010-02-02 22:23:15 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* release_pmu() - Relinquish control of the performance counters
|
|
|
|
*
|
|
|
|
* Release the performance counters and allow someone else to use them.
|
|
|
|
* Callers must have disabled the counters and released IRQs before calling
|
2010-04-29 20:13:24 +04:00
|
|
|
* this. The platform_device returned from reserve_pmu() must be passed as
|
2010-02-02 22:23:15 +03:00
|
|
|
* a cookie.
|
|
|
|
*/
|
|
|
|
extern int
|
2010-04-29 20:13:24 +04:00
|
|
|
release_pmu(struct platform_device *pdev);
|
2010-02-02 22:23:15 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* init_pmu() - Initialise the PMU.
|
|
|
|
*
|
|
|
|
* Initialise the system ready for PMU enabling. This should typically set the
|
|
|
|
* IRQ affinity and nothing else. The users (oprofile/perf events etc) will do
|
|
|
|
* the actual hardware initialisation.
|
|
|
|
*/
|
|
|
|
extern int
|
2010-04-29 20:13:24 +04:00
|
|
|
init_pmu(enum arm_pmu_type device);
|
2010-02-02 22:23:15 +03:00
|
|
|
|
|
|
|
#else /* CONFIG_CPU_HAS_PMU */
|
|
|
|
|
2010-04-29 20:13:24 +04:00
|
|
|
#include <linux/err.h>
|
|
|
|
|
|
|
|
static inline struct platform_device *
|
|
|
|
reserve_pmu(enum arm_pmu_type device)
|
2010-02-02 22:23:15 +03:00
|
|
|
{
|
|
|
|
return ERR_PTR(-ENODEV);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int
|
2010-04-29 20:13:24 +04:00
|
|
|
release_pmu(struct platform_device *pdev)
|
2010-02-02 22:23:15 +03:00
|
|
|
{
|
|
|
|
return -ENODEV;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int
|
2010-04-29 20:13:24 +04:00
|
|
|
init_pmu(enum arm_pmu_type device)
|
2010-02-02 22:23:15 +03:00
|
|
|
{
|
|
|
|
return -ENODEV;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* CONFIG_CPU_HAS_PMU */
|
|
|
|
|
|
|
|
#endif /* __ARM_PMU_H__ */
|