vserver 1.9.5.x5
[linux-2.6.git] / arch / ppc64 / kernel / proc_ppc64.c
index ed172cd..d3bd869 100644 (file)
 #include <linux/slab.h>
 #include <linux/kernel.h>
 
-#include <asm/naca.h>
-#include <asm/paca.h>
 #include <asm/systemcfg.h>
 #include <asm/rtas.h>
 #include <asm/uaccess.h>
 #include <asm/prom.h>
 
 static loff_t  page_map_seek( struct file *file, loff_t off, int whence);
-static ssize_t page_map_read( struct file *file, char *buf, size_t nbytes, loff_t *ppos);
+static ssize_t page_map_read( struct file *file, char __user *buf, size_t nbytes,
+                             loff_t *ppos);
 static int     page_map_mmap( struct file *file, struct vm_area_struct *vma );
 
 static struct file_operations page_map_fops = {
@@ -56,26 +55,6 @@ static struct file_operations ofdt_fops = {
 };
 #endif
 
-/*
- * NOTE: since paca data is always in flux the values will never be a
- * consistant set.
- */
-static void __init proc_create_paca(struct proc_dir_entry *dir, int num)
-{
-       struct proc_dir_entry *ent;
-       struct paca_struct *lpaca = paca + num;
-       char buf[16];
-
-       sprintf(buf, "%02x", num);
-       ent = create_proc_entry(buf, S_IRUSR, dir);
-       if (ent) {
-               ent->nlink = 1;
-               ent->data = lpaca;
-               ent->size = 4096;
-               ent->proc_fops = &page_map_fops;
-       }
-}
-
 /*
  * Create the ppc64 and ppc64/rtas directories early. This allows us to
  * assume that they have been previously created in drivers.
@@ -103,17 +82,8 @@ core_initcall(proc_ppc64_create);
 
 static int __init proc_ppc64_init(void)
 {
-       unsigned long i;
        struct proc_dir_entry *pde;
 
-       pde = create_proc_entry("ppc64/naca", S_IRUSR, NULL);
-       if (!pde)
-               return 1;
-       pde->nlink = 1;
-       pde->data = naca;
-       pde->size = 4096;
-       pde->proc_fops = &page_map_fops;
-
        pde = create_proc_entry("ppc64/systemcfg", S_IFREG|S_IRUGO, NULL);
        if (!pde)
                return 1;
@@ -122,13 +92,6 @@ static int __init proc_ppc64_init(void)
        pde->size = 4096;
        pde->proc_fops = &page_map_fops;
 
-       /* /proc/ppc64/paca/XX -- raw paca contents.  Only readable to root */
-       pde = proc_mkdir("ppc64/paca", NULL);
-       if (!pde)
-               return 1;
-       for_each_cpu(i)
-               proc_create_paca(pde, i);
-
 #ifdef CONFIG_PPC_PSERIES
        if ((systemcfg->platform & PLATFORM_PSERIES))
                proc_ppc64_create_ofdt();
@@ -161,7 +124,8 @@ static loff_t page_map_seek( struct file *file, loff_t off, int whence)
        return (file->f_pos = new);
 }
 
-static ssize_t page_map_read( struct file *file, char __user *buf, size_t nbytes, loff_t *ppos)
+static ssize_t page_map_read( struct file *file, char __user *buf, size_t nbytes,
+                             loff_t *ppos)
 {
        struct proc_dir_entry *dp = PDE(file->f_dentry->d_inode);
        return simple_read_from_buffer(buf, nbytes, ppos, dp->data, dp->size);
@@ -176,7 +140,8 @@ static int page_map_mmap( struct file *file, struct vm_area_struct *vma )
        if ((vma->vm_end - vma->vm_start) > dp->size)
                return -EINVAL;
 
-       remap_page_range( vma, vma->vm_start, __pa(dp->data), dp->size, vma->vm_page_prot );
+       remap_pfn_range(vma, vma->vm_start, __pa(dp->data) >> PAGE_SHIFT,
+                                               dp->size, vma->vm_page_prot);
        return 0;
 }
 
@@ -207,7 +172,8 @@ static void proc_ppc64_create_ofdt(void)
  * whole nodes along with their properties.  Operations on individual
  * properties are not implemented (yet).
  */
-static ssize_t ofdt_write(struct file *file, const char __user *buf, size_t count, loff_t *off)
+static ssize_t ofdt_write(struct file *file, const char __user *buf, size_t count,
+                         loff_t *off)
 {
        int rv = 0;
        char *kbuf;
@@ -301,7 +267,8 @@ out:
        return rv;
 }
 
-static struct property *new_property(const char *name, const int length, const unsigned char *value, struct property *last)
+static struct property *new_property(const char *name, const int length,
+                                    const unsigned char *value, struct property *last)
 {
        struct property *new = kmalloc(sizeof(*new), GFP_KERNEL);
 
@@ -342,7 +309,8 @@ cleanup:
  * this function does no allocation or copying of the data.  Return value
  * is set to the next name in buf, or NULL on error.
  */
-static char * parse_next_property(char *buf, char *end, char **name, int *length, unsigned char **value)
+static char * parse_next_property(char *buf, char *end, char **name, int *length,
+                                 unsigned char **value)
 {
        char *tmp;
 
@@ -350,13 +318,15 @@ static char * parse_next_property(char *buf, char *end, char **name, int *length
 
        tmp = strchr(buf, ' ');
        if (!tmp) {
-               printk(KERN_ERR "property parse failed in %s at line %d\n", __FUNCTION__, __LINE__);
+               printk(KERN_ERR "property parse failed in %s at line %d\n",
+                      __FUNCTION__, __LINE__);
                return NULL;
        }
        *tmp = '\0';
 
        if (++tmp >= end) {
-               printk(KERN_ERR "property parse failed in %s at line %d\n", __FUNCTION__, __LINE__);
+               printk(KERN_ERR "property parse failed in %s at line %d\n",
+                      __FUNCTION__, __LINE__);
                return NULL;
        }
 
@@ -364,11 +334,13 @@ static char * parse_next_property(char *buf, char *end, char **name, int *length
        *length = -1;
        *length = simple_strtoul(tmp, &tmp, 10);
        if (*length == -1) {
-               printk(KERN_ERR "property parse failed in %s at line %d\n", __FUNCTION__, __LINE__);
+               printk(KERN_ERR "property parse failed in %s at line %d\n", 
+                      __FUNCTION__, __LINE__);
                return NULL;
        }
        if (*tmp != ' ' || ++tmp >= end) {
-               printk(KERN_ERR "property parse failed in %s at line %d\n", __FUNCTION__, __LINE__);
+               printk(KERN_ERR "property parse failed in %s at line %d\n",
+                      __FUNCTION__, __LINE__);
                return NULL;
        }
 
@@ -376,11 +348,13 @@ static char * parse_next_property(char *buf, char *end, char **name, int *length
        *value = tmp;
        tmp += *length;
        if (tmp > end) {
-               printk(KERN_ERR "property parse failed in %s at line %d\n", __FUNCTION__, __LINE__);
+               printk(KERN_ERR "property parse failed in %s at line %d\n",
+                      __FUNCTION__, __LINE__);
                return NULL;
        }
        else if (tmp < end && *tmp != ' ' && *tmp != '\0') {
-               printk(KERN_ERR "property parse failed in %s at line %d\n", __FUNCTION__, __LINE__);
+               printk(KERN_ERR "property parse failed in %s at line %d\n",
+                      __FUNCTION__, __LINE__);
                return NULL;
        }
        tmp++;