linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] enable RTAS /proc for PowerPC/CHRP platform
@ 2006-10-17 11:29 Nicolas DET
  2006-10-17 13:22 ` Christoph Hellwig
  0 siblings, 1 reply; 32+ messages in thread
From: Nicolas DET @ 2006-10-17 11:29 UTC (permalink / raw)
  To: linuxppc-dev, akpm, Sven Luther, tilmann

[-- Attachment #1: Type: text/plain, Size: 375 bytes --]

This patch enables RTAS /proc support for PowerPC 32bits / CHRP platform.

A new entry is created (/proc/ppc/rtas/) which contains the RTAS nodes. 
Theses nodes and the code are the exact same than with the ppc64 
architecture.

This patch has been succefully applied on the kernel 2.6.18.1 and tested 
on bPlan's OpenFirmware.

Signed-off-by: Nicolas DET <nd@bplan-gmbh.de>

[-- Attachment #2: rtas-proc_ppc32.patch --]
[-- Type: text/plain, Size: 2707 bytes --]

--- a/arch/powerpc/kernel/rtas-proc.c	2006-10-14 05:34:03.000000000 +0200
+++ b/arch/powerpc/kernel/rtas-proc.c	2006-10-16 10:46:16.000000000 +0200
@@ -253,43 +253,70 @@ static void get_location_code(struct seq
 static void check_location_string(struct seq_file *m, char *c);
 static void check_location(struct seq_file *m, char *c);
 
+#ifdef CONFIG_PPC64
+#define PROCRTAS_ROOT "ppc64"
+#else
+#define PROCRTAS_ROOT "ppc"
+static int __init proc_ppc32_create(void)
+{
+        struct proc_dir_entry *root;
+
+        root = proc_mkdir(PROCRTAS_ROOT , NULL);
+        if (!root)
+                return -1;
+
+        if (!proc_mkdir("rtas", root))
+                return -1;
+
+        if (!proc_symlink("rtas", NULL, PROCRTAS_ROOT "/rtas"))
+                return -1;
+
+        return 0;
+}
+#endif
+
 static int __init proc_rtas_init(void)
 {
 	struct proc_dir_entry *entry;
 
-	if (!machine_is(pseries))
+	if ( ! ( machine_is(pseries) || machine_is(chrp) ) )
 		return -ENODEV;
 
 	rtas_node = of_find_node_by_name(NULL, "rtas");
 	if (rtas_node == NULL)
 		return -ENODEV;
 
-	entry = create_proc_entry("ppc64/rtas/progress", S_IRUGO|S_IWUSR, NULL);
+#ifndef CONFIG_PPC64
+	if (proc_ppc32_create() != 0)
+		return -ENODEV;
+#endif
+
+	entry = create_proc_entry(PROCRTAS_ROOT "/rtas/progress", S_IRUGO|S_IWUSR, NULL);
 	if (entry)
 		entry->proc_fops = &ppc_rtas_progress_operations;
 
-	entry = create_proc_entry("ppc64/rtas/clock", S_IRUGO|S_IWUSR, NULL);
+	entry = create_proc_entry(PROCRTAS_ROOT "/rtas/clock", S_IRUGO|S_IWUSR, NULL);
 	if (entry)
 		entry->proc_fops = &ppc_rtas_clock_operations;
 
-	entry = create_proc_entry("ppc64/rtas/poweron", S_IWUSR|S_IRUGO, NULL);
+	entry = create_proc_entry(PROCRTAS_ROOT "/rtas/poweron", S_IWUSR|S_IRUGO, NULL);
 	if (entry)
 		entry->proc_fops = &ppc_rtas_poweron_operations;
 
-	entry = create_proc_entry("ppc64/rtas/sensors", S_IRUGO, NULL);
+	entry = create_proc_entry(PROCRTAS_ROOT "/rtas/sensors", S_IRUGO, NULL);
 	if (entry)
 		entry->proc_fops = &ppc_rtas_sensors_operations;
 
-	entry = create_proc_entry("ppc64/rtas/frequency", S_IWUSR|S_IRUGO,
+	entry = create_proc_entry(PROCRTAS_ROOT "/rtas/frequency", S_IWUSR|S_IRUGO,
 				  NULL);
 	if (entry)
 		entry->proc_fops = &ppc_rtas_tone_freq_operations;
 
-	entry = create_proc_entry("ppc64/rtas/volume", S_IWUSR|S_IRUGO, NULL);
+	entry = create_proc_entry(PROCRTAS_ROOT "/rtas/volume", S_IWUSR|S_IRUGO, NULL);
 	if (entry)
 		entry->proc_fops = &ppc_rtas_tone_volume_operations;
 
-	entry = create_proc_entry("ppc64/rtas/rmo_buffer", S_IRUSR, NULL);
+	entry = create_proc_entry(PROCRTAS_ROOT "/rtas/rmo_buffer", S_IRUSR, NULL);
 	if (entry)
 		entry->proc_fops = &ppc_rtas_rmo_buf_ops;
 

[-- Attachment #3: nd.vcf --]
[-- Type: text/x-vcard, Size: 249 bytes --]

begin:vcard
fn:Nicolas DET ( bplan GmbH )
n:DET;Nicolas
org:bplan GmbH
adr:;;;;;;Germany
email;internet:nd@bplan-gmbh.de
title:Software Entwicklung
tel;work:+49 6171 9187 - 31
x-mozilla-html:FALSE
url:http://www.bplan-gmbh.de
version:2.1
end:vcard


^ permalink raw reply	[flat|nested] 32+ messages in thread

end of thread, other threads:[~2006-10-20 13:59 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-17 11:29 [PATCH] enable RTAS /proc for PowerPC/CHRP platform Nicolas DET
2006-10-17 13:22 ` Christoph Hellwig
2006-10-17 22:22   ` Arnd Bergmann
2006-10-18 22:39     ` Benjamin Herrenschmidt
2006-10-20  8:13     ` Nicolas DET
2006-10-18  5:51   ` Nicolas DET
2006-10-18  6:05     ` Sven Luther
2006-10-18  6:15     ` Michael Ellerman
2006-10-18  6:34       ` Nicolas DET
2006-10-18  7:38       ` Olaf Hering
2006-10-18 22:38         ` Benjamin Herrenschmidt
2006-10-19  7:03           ` Olaf Hering
2006-10-19 23:35             ` Benjamin Herrenschmidt
2006-10-20  5:44               ` Olaf Hering
2006-10-20  5:56                 ` Benjamin Herrenschmidt
2006-10-20  6:24                   ` Sven Luther
2006-10-20  6:44                     ` Olaf Hering
2006-10-20  6:58                       ` Sven Luther
2006-10-20  7:12                         ` Benjamin Herrenschmidt
2006-10-20  7:36                           ` Sven Luther
2006-10-20  8:16                             ` Benjamin Herrenschmidt
2006-10-20  7:20                         ` Olaf Hering
2006-10-20  7:37                           ` Sven Luther
2006-10-20  7:49                             ` Olaf Hering
2006-10-20  8:12                             ` Segher Boessenkool
2006-10-20  8:52                               ` Sven Luther
2006-10-20 10:00                                 ` Olaf Hering
2006-10-20 13:59                                   ` Segher Boessenkool
2006-10-20  7:11                       ` Benjamin Herrenschmidt
2006-10-20  7:14                         ` Olaf Hering
2006-10-20  7:36                           ` Benjamin Herrenschmidt
2006-10-20 10:01                       ` Paul Mackerras

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).