diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2009-09-24 15:29:13 -0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2009-10-30 02:20:53 -0400 |
commit | 188917e183cf9ad0374b571006d0fc6d48a7f447 (patch) | |
tree | b4d39a26e2b551c44e3bf18099c984ff8e2d903a /arch/powerpc/kernel/proc_ppc64.c | |
parent | 64eb38a6e9732f45d518b9e522d613195c930e8f (diff) |
powerpc: Move /proc/ppc64 to /proc/powerpc and add symlink
Some of the stuff in /proc/ppc64 such as the RTAS bits are actually
useful to some 32-bit platforms. Rename the file, and create a
symlink on 64-bit for backward compatibility
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/kernel/proc_ppc64.c')
-rw-r--r-- | arch/powerpc/kernel/proc_ppc64.c | 122 |
1 files changed, 0 insertions, 122 deletions
diff --git a/arch/powerpc/kernel/proc_ppc64.c b/arch/powerpc/kernel/proc_ppc64.c deleted file mode 100644 index c647ddef40dc..000000000000 --- a/arch/powerpc/kernel/proc_ppc64.c +++ /dev/null | |||
@@ -1,122 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2001 Mike Corrigan & Dave Engebretsen IBM Corporation | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program; if not, write to the Free Software | ||
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
17 | */ | ||
18 | |||
19 | #include <linux/init.h> | ||
20 | #include <linux/mm.h> | ||
21 | #include <linux/proc_fs.h> | ||
22 | #include <linux/slab.h> | ||
23 | #include <linux/kernel.h> | ||
24 | |||
25 | #include <asm/machdep.h> | ||
26 | #include <asm/vdso_datapage.h> | ||
27 | #include <asm/rtas.h> | ||
28 | #include <asm/uaccess.h> | ||
29 | #include <asm/prom.h> | ||
30 | |||
31 | static loff_t page_map_seek( struct file *file, loff_t off, int whence); | ||
32 | static ssize_t page_map_read( struct file *file, char __user *buf, size_t nbytes, | ||
33 | loff_t *ppos); | ||
34 | static int page_map_mmap( struct file *file, struct vm_area_struct *vma ); | ||
35 | |||
36 | static const struct file_operations page_map_fops = { | ||
37 | .llseek = page_map_seek, | ||
38 | .read = page_map_read, | ||
39 | .mmap = page_map_mmap | ||
40 | }; | ||
41 | |||
42 | /* | ||
43 | * Create the ppc64 and ppc64/rtas directories early. This allows us to | ||
44 | * assume that they have been previously created in drivers. | ||
45 | */ | ||
46 | static int __init proc_ppc64_create(void) | ||
47 | { | ||
48 | struct proc_dir_entry *root; | ||
49 | |||
50 | root = proc_mkdir("ppc64", NULL); | ||
51 | if (!root) | ||
52 | return 1; | ||
53 | |||
54 | if (!of_find_node_by_path("/rtas")) | ||
55 | return 0; | ||
56 | |||
57 | if (!proc_mkdir("rtas", root)) | ||
58 | return 1; | ||
59 | |||
60 | if (!proc_symlink("rtas", NULL, "ppc64/rtas")) | ||
61 | return 1; | ||
62 | |||
63 | return 0; | ||
64 | } | ||
65 | core_initcall(proc_ppc64_create); | ||
66 | |||
67 | static int __init proc_ppc64_init(void) | ||
68 | { | ||
69 | struct proc_dir_entry *pde; | ||
70 | |||
71 | pde = proc_create_data("ppc64/systemcfg", S_IFREG|S_IRUGO, NULL, | ||
72 | &page_map_fops, vdso_data); | ||
73 | if (!pde) | ||
74 | return 1; | ||
75 | pde->size = PAGE_SIZE; | ||
76 | |||
77 | return 0; | ||
78 | } | ||
79 | __initcall(proc_ppc64_init); | ||
80 | |||
81 | static loff_t page_map_seek( struct file *file, loff_t off, int whence) | ||
82 | { | ||
83 | loff_t new; | ||
84 | struct proc_dir_entry *dp = PDE(file->f_path.dentry->d_inode); | ||
85 | |||
86 | switch(whence) { | ||
87 | case 0: | ||
88 | new = off; | ||
89 | break; | ||
90 | case 1: | ||
91 | new = file->f_pos + off; | ||
92 | break; | ||
93 | case 2: | ||
94 | new = dp->size + off; | ||
95 | break; | ||
96 | default: | ||
97 | return -EINVAL; | ||
98 | } | ||
99 | if ( new < 0 || new > dp->size ) | ||
100 | return -EINVAL; | ||
101 | return (file->f_pos = new); | ||
102 | } | ||
103 | |||
104 | static ssize_t page_map_read( struct file *file, char __user *buf, size_t nbytes, | ||
105 | loff_t *ppos) | ||
106 | { | ||
107 | struct proc_dir_entry *dp = PDE(file->f_path.dentry->d_inode); | ||
108 | return simple_read_from_buffer(buf, nbytes, ppos, dp->data, dp->size); | ||
109 | } | ||
110 | |||
111 | static int page_map_mmap( struct file *file, struct vm_area_struct *vma ) | ||
112 | { | ||
113 | struct proc_dir_entry *dp = PDE(file->f_path.dentry->d_inode); | ||
114 | |||
115 | if ((vma->vm_end - vma->vm_start) > dp->size) | ||
116 | return -EINVAL; | ||
117 | |||
118 | remap_pfn_range(vma, vma->vm_start, __pa(dp->data) >> PAGE_SHIFT, | ||
119 | dp->size, vma->vm_page_prot); | ||
120 | return 0; | ||
121 | } | ||
122 | |||