vserver 2.0 rc7
[linux-2.6.git] / arch / ppc / kernel / ppc_htab.c
index 91592c0..ca81002 100644 (file)
 #include <linux/threads.h>
 #include <linux/smp_lock.h>
 #include <linux/seq_file.h>
+#include <linux/init.h>
+#include <linux/bitops.h>
 
 #include <asm/uaccess.h>
-#include <asm/bitops.h>
 #include <asm/mmu.h>
 #include <asm/residual.h>
 #include <asm/io.h>
@@ -34,9 +35,6 @@
 static int ppc_htab_show(struct seq_file *m, void *v);
 static ssize_t ppc_htab_write(struct file * file, const char __user * buffer,
                              size_t count, loff_t *ppos);
-int proc_dol2crvec(ctl_table *table, int write, struct file *filp,
-                 void __user *buffer, size_t *lenp, loff_t *ppos);
-
 extern PTE *Hash, *Hash_end;
 extern unsigned long Hash_size, Hash_mask;
 extern unsigned long _SDR1;
@@ -110,7 +108,7 @@ static int ppc_htab_show(struct seq_file *m, void *v)
        PTE *ptr;
 #endif /* CONFIG_PPC_STD_MMU */
 
-       if (cur_cpu_spec[0]->cpu_features & CPU_FTR_604_PERF_MON) {
+       if (cpu_has_feature(CPU_FTR_604_PERF_MON)) {
                mmcr0 = mfspr(SPRN_MMCR0);
                pmc1 = mfspr(SPRN_PMC1);
                pmc2 = mfspr(SPRN_PMC2);
@@ -211,7 +209,7 @@ static ssize_t ppc_htab_write(struct file * file, const char __user * ubuffer,
 
        if ( !strncmp( buffer, "reset", 5) )
        {
-               if (cur_cpu_spec[0]->cpu_features & CPU_FTR_604_PERF_MON) {
+               if (cpu_has_feature(CPU_FTR_604_PERF_MON)) {
                        /* reset PMC1 and PMC2 */
                        mtspr(SPRN_PMC1, 0);
                        mtspr(SPRN_PMC2, 0);
@@ -223,7 +221,7 @@ static ssize_t ppc_htab_write(struct file * file, const char __user * ubuffer,
        }
 
        /* Everything below here requires the performance monitor feature. */
-       if ( !cur_cpu_spec[0]->cpu_features & CPU_FTR_604_PERF_MON )
+       if (!cpu_has_feature(CPU_FTR_604_PERF_MON))
                return count;
 
        /* turn off performance monitoring */
@@ -341,7 +339,7 @@ int proc_dol2crvec(ctl_table *table, int write, struct file *filp,
                "0.5", "1.0", "(reserved2)", "(reserved3)"
        };
 
-       if (!(cur_cpu_spec[0]->cpu_features & CPU_FTR_L2CR))
+       if (!cpu_has_feature(CPU_FTR_L2CR))
                return -EFAULT;
 
        if ( /*!table->maxlen ||*/ (*ppos && !write)) {
@@ -438,3 +436,32 @@ int proc_dol2crvec(ctl_table *table, int write, struct file *filp,
        *ppos += *lenp;
        return 0;
 }
+
+#ifdef CONFIG_SYSCTL
+/*
+ * Register our sysctl.
+ */
+static ctl_table htab_ctl_table[]={
+       {
+               .ctl_name       = KERN_PPC_L2CR,
+               .procname       = "l2cr",
+               .mode           = 0644,
+               .proc_handler   = &proc_dol2crvec,
+       },
+       { 0, },
+};
+static ctl_table htab_sysctl_root[] = {
+       { 1, "kernel", NULL, 0, 0755, htab_ctl_table, },
+       { 0,},
+};
+
+static int __init
+register_ppc_htab_sysctl(void)
+{
+       register_sysctl_table(htab_sysctl_root, 0);
+
+       return 0;
+}
+
+__initcall(register_ppc_htab_sysctl);
+#endif