|
Packit |
577717 |
/* $Id: ppc_setup.c,v 1.1.2.4 2006/10/15 09:22:16 mikpe Exp $
|
|
Packit |
577717 |
* Performance-monitoring counters driver.
|
|
Packit |
577717 |
* PPC32-specific kernel-resident code.
|
|
Packit |
577717 |
*
|
|
Packit |
577717 |
* Copyright (C) 2004-2006 Mikael Pettersson
|
|
Packit |
577717 |
*/
|
|
Packit |
577717 |
#include <linux/version.h>
|
|
Packit |
577717 |
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
|
|
Packit |
577717 |
#include <linux/config.h>
|
|
Packit |
577717 |
#endif
|
|
Packit |
577717 |
#include <linux/module.h>
|
|
Packit |
577717 |
#include <linux/init.h>
|
|
Packit |
577717 |
#include <linux/kernel.h>
|
|
Packit |
577717 |
#include <linux/sched.h>
|
|
Packit |
577717 |
#include <linux/interrupt.h>
|
|
Packit |
577717 |
#include <asm/processor.h>
|
|
Packit |
577717 |
#include <asm/perfctr.h>
|
|
Packit |
577717 |
#include "ppc_compat.h"
|
|
Packit |
577717 |
#include "compat.h"
|
|
Packit |
577717 |
|
|
Packit |
577717 |
#ifdef CONFIG_PERFCTR_INTERRUPT_SUPPORT
|
|
Packit |
577717 |
static void perfctr_default_ihandler(unsigned long pc)
|
|
Packit |
577717 |
{
|
|
Packit |
577717 |
}
|
|
Packit |
577717 |
|
|
Packit |
577717 |
static perfctr_ihandler_t perfctr_ihandler = perfctr_default_ihandler;
|
|
Packit |
577717 |
|
|
Packit |
577717 |
void do_perfctr_interrupt(struct pt_regs *regs)
|
|
Packit |
577717 |
{
|
|
Packit |
577717 |
preempt_disable();
|
|
Packit |
577717 |
(*perfctr_ihandler)(instruction_pointer(regs));
|
|
Packit |
577717 |
preempt_enable_no_resched();
|
|
Packit |
577717 |
}
|
|
Packit |
577717 |
|
|
Packit |
577717 |
int perfctr_reserve_pmc_hardware(void)
|
|
Packit |
577717 |
{
|
|
Packit |
577717 |
return reserve_pmc_hardware(do_perfctr_interrupt);
|
|
Packit |
577717 |
}
|
|
Packit |
577717 |
|
|
Packit |
577717 |
void perfctr_cpu_set_ihandler(perfctr_ihandler_t ihandler)
|
|
Packit |
577717 |
{
|
|
Packit |
577717 |
perfctr_ihandler = ihandler ? ihandler : perfctr_default_ihandler;
|
|
Packit |
577717 |
}
|
|
Packit |
577717 |
|
|
Packit |
577717 |
#ifdef CONFIG_PERFCTR_MODULE
|
|
Packit |
577717 |
EXPORT_SYMBOL(perfctr_reserve_pmc_hardware);
|
|
Packit |
577717 |
EXPORT_SYMBOL(perfctr_cpu_set_ihandler);
|
|
Packit |
577717 |
#endif /* MODULE */
|
|
Packit |
577717 |
#endif /* CONFIG_PERFCTR_INTERRUPT_SUPPORT */
|