Skip to content

Commit 188917e

Browse files
committed
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>
1 parent 64eb38a commit 188917e

6 files changed

Lines changed: 66 additions & 62 deletions

File tree

‎arch/powerpc/kernel/Makefile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ obj-$(CONFIG_ALTIVEC) += vecemu.o
4242
obj-$(CONFIG_PPC_970_NAP) += idle_power4.o
4343
obj-$(CONFIG_PPC_OF) += of_device.o of_platform.o prom_parse.o
4444
obj-$(CONFIG_PPC_CLOCK) += clock.o
45-
procfs-$(CONFIG_PPC64) := proc_ppc64.o
45+
procfs-y := proc_powerpc.o
4646
obj-$(CONFIG_PROC_FS) += $(procfs-y)
4747
rtaspci-$(CONFIG_PPC64)-$(CONFIG_PCI) := rtas_pci.o
4848
obj-$(CONFIG_PPC_RTAS) += rtas.o rtas-rtc.o $(rtaspci-y-y)

‎arch/powerpc/kernel/lparcfg.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -781,9 +781,9 @@ static int __init lparcfg_init(void)
781781
!firmware_has_feature(FW_FEATURE_ISERIES))
782782
mode |= S_IWUSR;
783783

784-
ent = proc_create("ppc64/lparcfg", mode, NULL, &lparcfg_fops);
784+
ent = proc_create("powerpc/lparcfg", mode, NULL, &lparcfg_fops);
785785
if (!ent) {
786-
printk(KERN_ERR "Failed to create ppc64/lparcfg\n");
786+
printk(KERN_ERR "Failed to create powerpc/lparcfg\n");
787787
return -EIO;
788788
}
789789

Lines changed: 53 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -28,55 +28,7 @@
2828
#include <asm/uaccess.h>
2929
#include <asm/prom.h>
3030

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);
31+
#ifdef CONFIG_PPC64
8032

8133
static loff_t page_map_seek( struct file *file, loff_t off, int whence)
8234
{
@@ -120,3 +72,55 @@ static int page_map_mmap( struct file *file, struct vm_area_struct *vma )
12072
return 0;
12173
}
12274

75+
static const struct file_operations page_map_fops = {
76+
.llseek = page_map_seek,
77+
.read = page_map_read,
78+
.mmap = page_map_mmap
79+
};
80+
81+
82+
static int __init proc_ppc64_init(void)
83+
{
84+
struct proc_dir_entry *pde;
85+
86+
pde = proc_create_data("powerpc/systemcfg", S_IFREG|S_IRUGO, NULL,
87+
&page_map_fops, vdso_data);
88+
if (!pde)
89+
return 1;
90+
pde->size = PAGE_SIZE;
91+
92+
return 0;
93+
}
94+
__initcall(proc_ppc64_init);
95+
96+
#endif /* CONFIG_PPC64 */
97+
98+
/*
99+
* Create the ppc64 and ppc64/rtas directories early. This allows us to
100+
* assume that they have been previously created in drivers.
101+
*/
102+
static int __init proc_ppc64_create(void)
103+
{
104+
struct proc_dir_entry *root;
105+
106+
root = proc_mkdir("powerpc", NULL);
107+
if (!root)
108+
return 1;
109+
110+
#ifdef CONFIG_PPC64
111+
if (!proc_symlink("ppc64", NULL, "powerpc"))
112+
pr_err("Failed to create link /proc/ppc64 -> /proc/powerpc\n");
113+
#endif
114+
115+
if (!of_find_node_by_path("/rtas"))
116+
return 0;
117+
118+
if (!proc_mkdir("rtas", root))
119+
return 1;
120+
121+
if (!proc_symlink("rtas", NULL, "powerpc/rtas"))
122+
return 1;
123+
124+
return 0;
125+
}
126+
core_initcall(proc_ppc64_create);

‎arch/powerpc/kernel/rtas_flash.c‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* as published by the Free Software Foundation; either version
77
* 2 of the License, or (at your option) any later version.
88
*
9-
* /proc/ppc64/rtas/firmware_flash interface
9+
* /proc/powerpc/rtas/firmware_flash interface
1010
*
1111
* This file implements a firmware_flash interface to pump a firmware
1212
* image into the kernel. At reboot time rtas_restart() will see the
@@ -740,7 +740,7 @@ static int __init rtas_flash_init(void)
740740
return 1;
741741
}
742742

743-
firmware_flash_pde = create_flash_pde("ppc64/rtas/"
743+
firmware_flash_pde = create_flash_pde("powerpc/rtas/"
744744
FIRMWARE_FLASH_NAME,
745745
&rtas_flash_operations);
746746
if (firmware_flash_pde == NULL) {
@@ -754,7 +754,7 @@ static int __init rtas_flash_init(void)
754754
if (rc != 0)
755755
goto cleanup;
756756

757-
firmware_update_pde = create_flash_pde("ppc64/rtas/"
757+
firmware_update_pde = create_flash_pde("powerpc/rtas/"
758758
FIRMWARE_UPDATE_NAME,
759759
&rtas_flash_operations);
760760
if (firmware_update_pde == NULL) {
@@ -768,7 +768,7 @@ static int __init rtas_flash_init(void)
768768
if (rc != 0)
769769
goto cleanup;
770770

771-
validate_pde = create_flash_pde("ppc64/rtas/" VALIDATE_FLASH_NAME,
771+
validate_pde = create_flash_pde("powerpc/rtas/" VALIDATE_FLASH_NAME,
772772
&validate_flash_operations);
773773
if (validate_pde == NULL) {
774774
rc = -ENOMEM;
@@ -781,7 +781,7 @@ static int __init rtas_flash_init(void)
781781
if (rc != 0)
782782
goto cleanup;
783783

784-
manage_pde = create_flash_pde("ppc64/rtas/" MANAGE_FLASH_NAME,
784+
manage_pde = create_flash_pde("powerpc/rtas/" MANAGE_FLASH_NAME,
785785
&manage_flash_operations);
786786
if (manage_pde == NULL) {
787787
rc = -ENOMEM;

‎arch/powerpc/platforms/pseries/reconfig.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ static int pSeries_reconfig_remove_node(struct device_node *np)
184184
}
185185

186186
/*
187-
* /proc/ppc64/ofdt - yucky binary interface for adding and removing
187+
* /proc/powerpc/ofdt - yucky binary interface for adding and removing
188188
* OF device nodes. Should be deprecated as soon as we get an
189189
* in-kernel wrapper for the RTAS ibm,configure-connector call.
190190
*/
@@ -543,15 +543,15 @@ static const struct file_operations ofdt_fops = {
543543
.write = ofdt_write
544544
};
545545

546-
/* create /proc/ppc64/ofdt write-only by root */
546+
/* create /proc/powerpc/ofdt write-only by root */
547547
static int proc_ppc64_create_ofdt(void)
548548
{
549549
struct proc_dir_entry *ent;
550550

551551
if (!machine_is(pseries))
552552
return 0;
553553

554-
ent = proc_create("ppc64/ofdt", S_IWUSR, NULL, &ofdt_fops);
554+
ent = proc_create("powerpc/ofdt", S_IWUSR, NULL, &ofdt_fops);
555555
if (ent)
556556
ent->size = 0;
557557

‎arch/powerpc/platforms/pseries/scanlog.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* of this data using this driver. A dump exists if the device-tree
1414
* /chosen/ibm,scan-log-data property exists.
1515
*
16-
* This driver exports /proc/ppc64/scan-log-dump which can be read.
16+
* This driver exports /proc/powerpc/scan-log-dump which can be read.
1717
* The driver supports only sequential reads.
1818
*
1919
* The driver looks at a write to the driver for the single word "reset".
@@ -186,7 +186,7 @@ static int __init scanlog_init(void)
186186
if (!data)
187187
goto err;
188188

189-
ent = proc_create_data("ppc64/rtas/scan-log-dump", S_IRUSR, NULL,
189+
ent = proc_create_data("powerpc/rtas/scan-log-dump", S_IRUSR, NULL,
190190
&scanlog_fops, data);
191191
if (!ent)
192192
goto err;

0 commit comments

Comments
 (0)