linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/4] maple: match "pcie" name for CPC945
@ 2006-12-07  0:50 Nathan Lynch
  2006-12-07  0:50 ` [PATCH 2/4] maple: select PPC_RTAS Nathan Lynch
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Nathan Lynch @ 2006-12-07  0:50 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: paulus

Some firmwares have "pcie" for the "name" property of the CPC945 PCI
Express host bridge.  Check for "pcie" in addition to "pci" so we
don't miss it.

Signed-off-by: Nathan Lynch <ntl@pobox.com>
---
 arch/powerpc/platforms/maple/pci.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/platforms/maple/pci.c b/arch/powerpc/platforms/maple/pci.c
index 3a32ded..3f6a69f 100644
--- a/arch/powerpc/platforms/maple/pci.c
+++ b/arch/powerpc/platforms/maple/pci.c
@@ -562,7 +562,7 @@ void __init maple_pci_init(void)
 	for (np = NULL; (np = of_get_next_child(root, np)) != NULL;) {
 		if (np->name == NULL)
 			continue;
-		if (strcmp(np->name, "pci") == 0) {
+		if (!strcmp(np->name, "pci") || !strcmp(np->name, "pcie")) {
 			if (add_bridge(np) == 0)
 				of_node_get(np);
 		}
-- 
1.4.4.1

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

* [PATCH 2/4] maple: select PPC_RTAS
  2006-12-07  0:50 [PATCH 1/4] maple: match "pcie" name for CPC945 Nathan Lynch
@ 2006-12-07  0:50 ` Nathan Lynch
  2006-12-07  0:50   ` [PATCH 3/4] add rtas_service_present() helper Nathan Lynch
  2006-12-07  3:20 ` [PATCH 1/4] maple: match "pcie" name for CPC945 Olof Johansson
  2006-12-07  8:30 ` Segher Boessenkool
  2 siblings, 1 reply; 12+ messages in thread
From: Nathan Lynch @ 2006-12-07  0:50 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: paulus

Some systems supported by the maple platform have RTAS; make PPC_MAPLE
select PPC_RTAS.

Signed-off-by: Nathan Lynch <ntl@pobox.com>
---
 arch/powerpc/Kconfig |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 291c95a..f524b3b 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -470,6 +470,7 @@ config PPC_MAPLE
 	select PPC_UDBG_16550
 	select PPC_970_NAP
 	select PPC_NATIVE
+	select PPC_RTAS
 	default n
 	help
           This option enables support for the Maple 970FX Evaluation Board.
-- 
1.4.4.1

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

* [PATCH 3/4] add rtas_service_present() helper
  2006-12-07  0:50 ` [PATCH 2/4] maple: select PPC_RTAS Nathan Lynch
@ 2006-12-07  0:50   ` Nathan Lynch
  2006-12-07  0:50     ` [PATCH 4/4] maple: use RTAS for reboot and halt Nathan Lynch
  2006-12-07  2:51     ` [PATCH 3/4] add rtas_service_present() helper Michael Ellerman
  0 siblings, 2 replies; 12+ messages in thread
From: Nathan Lynch @ 2006-12-07  0:50 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: paulus

To test for the existence of an RTAS function, we typically do:

   foo_token = rtas_token("foo");
   if (foo_token == RTAS_UNKNOWN_SERVICE)
      return;

Add a rtas_service_present method, which provides a more conventional
boolean interface for testing the existence of an RTAS method.

Signed-off-by: Nathan Lynch <ntl@pobox.com>
---
 arch/powerpc/kernel/rtas.c |    6 ++++++
 include/asm-powerpc/rtas.h |    1 +
 2 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c
index 387ed0d..7970bed 100644
--- a/arch/powerpc/kernel/rtas.c
+++ b/arch/powerpc/kernel/rtas.c
@@ -303,6 +303,12 @@ int rtas_token(const char *service)
 }
 EXPORT_SYMBOL(rtas_token);
 
+int rtas_service_present(const char *service)
+{
+	return rtas_token(service) != RTAS_UNKNOWN_SERVICE;
+}
+EXPORT_SYMBOL(rtas_service_present);
+
 #ifdef CONFIG_RTAS_ERROR_LOGGING
 /*
  * Return the firmware-specified size of the error log buffer
diff --git a/include/asm-powerpc/rtas.h b/include/asm-powerpc/rtas.h
index 5a0c136..f08f356 100644
--- a/include/asm-powerpc/rtas.h
+++ b/include/asm-powerpc/rtas.h
@@ -159,6 +159,7 @@ extern struct rtas_t rtas;
 
 extern void enter_rtas(unsigned long);
 extern int rtas_token(const char *service);
+extern int rtas_service_present(const char *service);
 extern int rtas_call(int token, int, int, int *, ...);
 extern void rtas_restart(char *cmd);
 extern void rtas_power_off(void);
-- 
1.4.4.1

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

* [PATCH 4/4] maple: use RTAS for reboot and halt
  2006-12-07  0:50   ` [PATCH 3/4] add rtas_service_present() helper Nathan Lynch
@ 2006-12-07  0:50     ` Nathan Lynch
  2006-12-07  2:51     ` [PATCH 3/4] add rtas_service_present() helper Michael Ellerman
  1 sibling, 0 replies; 12+ messages in thread
From: Nathan Lynch @ 2006-12-07  0:50 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: paulus

On maple, use the RTAS "system-reboot" and "power-off" methods if they
are available.

Signed-off-by: Nathan Lynch <ntl@pobox.com>
---
 arch/powerpc/platforms/maple/setup.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/platforms/maple/setup.c b/arch/powerpc/platforms/maple/setup.c
index 094989d..f12d5c6 100644
--- a/arch/powerpc/platforms/maple/setup.c
+++ b/arch/powerpc/platforms/maple/setup.c
@@ -60,6 +60,7 @@
 #include <asm/of_device.h>
 #include <asm/lmb.h>
 #include <asm/mpic.h>
+#include <asm/rtas.h>
 #include <asm/udbg.h>
 
 #include "maple.h"
@@ -166,6 +167,16 @@ struct smp_ops_t maple_smp_ops = {
 };
 #endif /* CONFIG_SMP */
 
+static void __init maple_use_rtas_reboot_and_halt_if_present(void)
+{
+	if (rtas_service_present("system-reboot") &&
+	    rtas_service_present("power-off")) {
+		ppc_md.restart = rtas_restart;
+		ppc_md.power_off = rtas_power_off;
+		ppc_md.halt = rtas_halt;
+	}
+}
+
 void __init maple_setup_arch(void)
 {
 	/* init to some ~sane value until calibrate_delay() runs */
@@ -181,6 +192,7 @@ void __init maple_setup_arch(void)
 #ifdef CONFIG_DUMMY_CONSOLE
 	conswitchp = &dummy_con;
 #endif
+	maple_use_rtas_reboot_and_halt_if_present();
 
 	printk(KERN_DEBUG "Using native/NAP idle loop\n");
 }
-- 
1.4.4.1

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

* Re: [PATCH 3/4] add rtas_service_present() helper
  2006-12-07  0:50   ` [PATCH 3/4] add rtas_service_present() helper Nathan Lynch
  2006-12-07  0:50     ` [PATCH 4/4] maple: use RTAS for reboot and halt Nathan Lynch
@ 2006-12-07  2:51     ` Michael Ellerman
  2006-12-07  3:25       ` Nathan Lynch
  2006-12-07 21:05       ` Linas Vepstas
  1 sibling, 2 replies; 12+ messages in thread
From: Michael Ellerman @ 2006-12-07  2:51 UTC (permalink / raw)
  To: Nathan Lynch; +Cc: linuxppc-dev, paulus

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

On Wed, 2006-12-06 at 18:50 -0600, Nathan Lynch wrote:
> To test for the existence of an RTAS function, we typically do:
> 
>    foo_token = rtas_token("foo");
>    if (foo_token == RTAS_UNKNOWN_SERVICE)
>       return;
> 
> Add a rtas_service_present method, which provides a more conventional
> boolean interface for testing the existence of an RTAS method.


I like it a lot ..

But should it be called rtas_token_present() ? :D

cheers

-- 
Michael Ellerman
OzLabs, IBM Australia Development Lab

wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)

We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: [PATCH 1/4] maple: match "pcie" name for CPC945
  2006-12-07  0:50 [PATCH 1/4] maple: match "pcie" name for CPC945 Nathan Lynch
  2006-12-07  0:50 ` [PATCH 2/4] maple: select PPC_RTAS Nathan Lynch
@ 2006-12-07  3:20 ` Olof Johansson
  2006-12-07  8:41   ` Segher Boessenkool
  2006-12-07  8:30 ` Segher Boessenkool
  2 siblings, 1 reply; 12+ messages in thread
From: Olof Johansson @ 2006-12-07  3:20 UTC (permalink / raw)
  To: Nathan Lynch; +Cc: linuxppc-dev, paulus

On Wed,  6 Dec 2006 18:50:43 -0600 Nathan Lynch <ntl@pobox.com> wrote:

> Some firmwares have "pcie" for the "name" property of the CPC945 PCI
> Express host bridge.  Check for "pcie" in addition to "pci" so we
> don't miss it.

1275 (draft) supplement for PCI Express use 'pciex'. 'Some firmware'
should be changed instead, if possible.

See http://playground.sun.com/1275/bindings/pci/pci-express.txt

That's also what pseries and rtas_pci uses.


-Olof

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

* Re: [PATCH 3/4] add rtas_service_present() helper
  2006-12-07  2:51     ` [PATCH 3/4] add rtas_service_present() helper Michael Ellerman
@ 2006-12-07  3:25       ` Nathan Lynch
  2006-12-07 21:05       ` Linas Vepstas
  1 sibling, 0 replies; 12+ messages in thread
From: Nathan Lynch @ 2006-12-07  3:25 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: linuxppc-dev, paulus

Michael Ellerman wrote:
> On Wed, 2006-12-06 at 18:50 -0600, Nathan Lynch wrote:
> > To test for the existence of an RTAS function, we typically do:
> > 
> >    foo_token = rtas_token("foo");
> >    if (foo_token == RTAS_UNKNOWN_SERVICE)
> >       return;
> > 
> > Add a rtas_service_present method, which provides a more conventional
> > boolean interface for testing the existence of an RTAS method.
> 
> 
> I like it a lot ..
> 
> But should it be called rtas_token_present() ? :D

I considered that, but thought my name was a little more descriptive
-- a token is merely an integer value, but we're really interested in
whether the service named is available.

I don't really care that much either way, though :)

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

* Re: [PATCH 1/4] maple: match "pcie" name for CPC945
  2006-12-07  0:50 [PATCH 1/4] maple: match "pcie" name for CPC945 Nathan Lynch
  2006-12-07  0:50 ` [PATCH 2/4] maple: select PPC_RTAS Nathan Lynch
  2006-12-07  3:20 ` [PATCH 1/4] maple: match "pcie" name for CPC945 Olof Johansson
@ 2006-12-07  8:30 ` Segher Boessenkool
  2006-12-11 22:38   ` Nathan Lynch
  2 siblings, 1 reply; 12+ messages in thread
From: Segher Boessenkool @ 2006-12-07  8:30 UTC (permalink / raw)
  To: Nathan Lynch; +Cc: linuxppc-dev, paulus

> Some firmwares have "pcie" for the "name" property of the CPC945 PCI
> Express host bridge.  Check for "pcie" in addition to "pci" so we
> don't miss it.

You shouldn't use "name" but "device_type" and "compatible".


Segher

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

* Re: [PATCH 1/4] maple: match "pcie" name for CPC945
  2006-12-07  3:20 ` [PATCH 1/4] maple: match "pcie" name for CPC945 Olof Johansson
@ 2006-12-07  8:41   ` Segher Boessenkool
  0 siblings, 0 replies; 12+ messages in thread
From: Segher Boessenkool @ 2006-12-07  8:41 UTC (permalink / raw)
  To: Olof Johansson; +Cc: linuxppc-dev, Nathan Lynch, paulus

>> Some firmwares have "pcie" for the "name" property of the CPC945 PCI
>> Express host bridge.  Check for "pcie" in addition to "pci" so we
>> don't miss it.
>
> 1275 (draft) supplement for PCI Express use 'pciex'. 'Some firmware'
> should be changed instead, if possible.

Nah, the draft should be changed, "pciex" is an absolutely
horrible name :-)  The draft contains a few serious bugs
btw, I hope no one implements this as-is :-)

> See http://playground.sun.com/1275/bindings/pci/pci-express.txt
>
> That's also what pseries and rtas_pci uses.

Apple uses plain "pci".  Using the "device_type" and the
"compatible" property works fine everywhere -- *except*
for implementations following this broken draft spec (the
draft doesn't even define a value for "device_type"; also
it prohibits declaring in the "compatible" property that
a device is backward compatible to some plain old PCI
device).


Segher

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

* Re: [PATCH 3/4] add rtas_service_present() helper
  2006-12-07  2:51     ` [PATCH 3/4] add rtas_service_present() helper Michael Ellerman
  2006-12-07  3:25       ` Nathan Lynch
@ 2006-12-07 21:05       ` Linas Vepstas
  1 sibling, 0 replies; 12+ messages in thread
From: Linas Vepstas @ 2006-12-07 21:05 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: linuxppc-dev, Nathan Lynch, paulus

On Thu, Dec 07, 2006 at 01:51:33PM +1100, Michael Ellerman wrote:
> On Wed, 2006-12-06 at 18:50 -0600, Nathan Lynch wrote:
> > To test for the existence of an RTAS function, we typically do:
> > 
> >    foo_token = rtas_token("foo");
> >    if (foo_token == RTAS_UNKNOWN_SERVICE)
> >       return;
> > 
> > Add a rtas_service_present method, which provides a more conventional
> > boolean interface for testing the existence of an RTAS method.
> 
> 
> I like it a lot ..

Me too ... How about making it inline?

--linas

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

* Re: [PATCH 1/4] maple: match "pcie" name for CPC945
  2006-12-07  8:30 ` Segher Boessenkool
@ 2006-12-11 22:38   ` Nathan Lynch
  2006-12-12 22:26     ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 12+ messages in thread
From: Nathan Lynch @ 2006-12-11 22:38 UTC (permalink / raw)
  To: Segher Boessenkool; +Cc: linuxppc-dev, paulus

Segher Boessenkool wrote:
> >Some firmwares have "pcie" for the "name" property of the CPC945 PCI
> >Express host bridge.  Check for "pcie" in addition to "pci" so we
> >don't miss it.
> 
> You shouldn't use "name" but "device_type" and "compatible".

Like this?

(Hmm, does the u3-agp on maple have "pci" for device_type?)

diff --git a/arch/powerpc/platforms/maple/pci.c b/arch/powerpc/platforms/maple/pci.c
index 3a32ded..011f0f1 100644
--- a/arch/powerpc/platforms/maple/pci.c
+++ b/arch/powerpc/platforms/maple/pci.c
@@ -560,13 +560,16 @@ void __init maple_pci_init(void)
 		return;
 	}
 	for (np = NULL; (np = of_get_next_child(root, np)) != NULL;) {
-		if (np->name == NULL)
+		if (!np->type)
 			continue;
-		if (strcmp(np->name, "pci") == 0) {
-			if (add_bridge(np) == 0)
-				of_node_get(np);
-		}
-		if (strcmp(np->name, "ht") == 0) {
+		if (strcmp(np->type, "pci") && strcmp(np->type, "ht"))
+			continue;
+		if ((device_is_compatible(np, "u4-pcie") ||
+		     device_is_compatible(np, "u3-agp")) &&
+		    add_bridge(np) == 0)
+			of_node_get(np);
+
+		if (device_is_compatible(np, "u3-ht")) {
 			of_node_get(np);
 			ht = np;
 		}

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

* Re: [PATCH 1/4] maple: match "pcie" name for CPC945
  2006-12-11 22:38   ` Nathan Lynch
@ 2006-12-12 22:26     ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 12+ messages in thread
From: Benjamin Herrenschmidt @ 2006-12-12 22:26 UTC (permalink / raw)
  To: Nathan Lynch; +Cc: linuxppc-dev, paulus

On Mon, 2006-12-11 at 16:38 -0600, Nathan Lynch wrote:
> Segher Boessenkool wrote:
> > >Some firmwares have "pcie" for the "name" property of the CPC945 PCI
> > >Express host bridge.  Check for "pcie" in addition to "pci" so we
> > >don't miss it.
> > 
> > You shouldn't use "name" but "device_type" and "compatible".
> 
> Like this?
> 
> (Hmm, does the u3-agp on maple have "pci" for device_type?)

I hope so...

There are plenty bits of code in the kernel that _assume_ that
device_type is PCI for PHB's and P2P bridges, wether they are PCI, PCI-X
or PCIe. prom_parse.c is one, but there is more.

Ben.

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

end of thread, other threads:[~2006-12-12 22:26 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-12-07  0:50 [PATCH 1/4] maple: match "pcie" name for CPC945 Nathan Lynch
2006-12-07  0:50 ` [PATCH 2/4] maple: select PPC_RTAS Nathan Lynch
2006-12-07  0:50   ` [PATCH 3/4] add rtas_service_present() helper Nathan Lynch
2006-12-07  0:50     ` [PATCH 4/4] maple: use RTAS for reboot and halt Nathan Lynch
2006-12-07  2:51     ` [PATCH 3/4] add rtas_service_present() helper Michael Ellerman
2006-12-07  3:25       ` Nathan Lynch
2006-12-07 21:05       ` Linas Vepstas
2006-12-07  3:20 ` [PATCH 1/4] maple: match "pcie" name for CPC945 Olof Johansson
2006-12-07  8:41   ` Segher Boessenkool
2006-12-07  8:30 ` Segher Boessenkool
2006-12-11 22:38   ` Nathan Lynch
2006-12-12 22:26     ` Benjamin Herrenschmidt

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).