X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;ds=sidebyside;f=arch%2Fppc64%2Fkernel%2Fproc_ppc64.c;h=d3bd869faa95d0d43c78f76921d730ea05961ca9;hb=6a77f38946aaee1cd85eeec6cf4229b204c15071;hp=ed172cd78344ddae4d1a59b87ec9f5113ab4e5f5;hpb=87fc8d1bb10cd459024a742c6a10961fefcef18f;p=linux-2.6.git diff --git a/arch/ppc64/kernel/proc_ppc64.c b/arch/ppc64/kernel/proc_ppc64.c index ed172cd78..d3bd869fa 100644 --- a/arch/ppc64/kernel/proc_ppc64.c +++ b/arch/ppc64/kernel/proc_ppc64.c @@ -25,15 +25,14 @@ #include #include -#include -#include #include #include #include #include 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++;