Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions
sysfs.c File Reference
#include <linux/device.h>
#include <linux/cpu.h>
#include <linux/smp.h>
#include <linux/percpu.h>
#include <linux/init.h>
#include <linux/sched.h>
#include <linux/export.h>
#include <linux/nodemask.h>
#include <linux/cpumask.h>
#include <linux/notifier.h>
#include <asm/current.h>
#include <asm/processor.h>
#include <asm/cputable.h>
#include <asm/hvcall.h>
#include <asm/prom.h>
#include <asm/machdep.h>
#include <asm/smp.h>
#include <asm/pmc.h>
#include "cacheinfo.h"

Go to the source code of this file.

Macros

#define SYSFS_PMCSETUP(NAME, ADDRESS)
 

Functions

void ppc_enable_pmcs (void)
 
 EXPORT_SYMBOL (ppc_enable_pmcs)
 
int cpu_add_dev_attr (struct device_attribute *attr)
 
 EXPORT_SYMBOL_GPL (cpu_add_dev_attr)
 
int cpu_add_dev_attr_group (struct attribute_group *attrs)
 
 EXPORT_SYMBOL_GPL (cpu_add_dev_attr_group)
 
void cpu_remove_dev_attr (struct device_attribute *attr)
 
 EXPORT_SYMBOL_GPL (cpu_remove_dev_attr)
 
void cpu_remove_dev_attr_group (struct attribute_group *attrs)
 
 EXPORT_SYMBOL_GPL (cpu_remove_dev_attr_group)
 
 subsys_initcall (topology_init)
 

Macro Definition Documentation

#define SYSFS_PMCSETUP (   NAME,
  ADDRESS 
)
Value:
static void read_##NAME(void *val) \
{ \
*(unsigned long *)val = mfspr(ADDRESS); \
} \
static void write_##NAME(void *val) \
{ \
ppc_enable_pmcs(); \
mtspr(ADDRESS, *(unsigned long *)val); \
} \
static ssize_t show_##NAME(struct device *dev, \
char *buf) \
{ \
struct cpu *cpu = container_of(dev, struct cpu, dev); \
unsigned long val; \
smp_call_function_single(cpu->dev.id, read_##NAME, &val, 1); \
return sprintf(buf, "%lx\n", val); \
} \
static ssize_t __used \
store_##NAME(struct device *dev, struct device_attribute *attr, \
const char *buf, size_t count) \
{ \
struct cpu *cpu = container_of(dev, struct cpu, dev); \
unsigned long val; \
int ret = sscanf(buf, "%lx", &val); \
if (ret != 1) \
return -EINVAL; \
smp_call_function_single(cpu->dev.id, write_##NAME, &val, 1); \
return count; \
}

Definition at line 110 of file sysfs.c.

Function Documentation

int cpu_add_dev_attr ( struct device_attribute attr)

Definition at line 531 of file sysfs.c.

int cpu_add_dev_attr_group ( struct attribute_group attrs)

Definition at line 546 of file sysfs.c.

void cpu_remove_dev_attr ( struct device_attribute attr)

Definition at line 566 of file sysfs.c.

void cpu_remove_dev_attr_group ( struct attribute_group attrs)

Definition at line 580 of file sysfs.c.

EXPORT_SYMBOL ( ppc_enable_pmcs  )
EXPORT_SYMBOL_GPL ( cpu_add_dev_attr  )
EXPORT_SYMBOL_GPL ( cpu_add_dev_attr_group  )
EXPORT_SYMBOL_GPL ( cpu_remove_dev_attr  )
EXPORT_SYMBOL_GPL ( cpu_remove_dev_attr_group  )
void ppc_enable_pmcs ( void  )

Definition at line 95 of file sysfs.c.

subsys_initcall ( topology_init  )