maple: match "pcie" name for CPC945
PATCH 1/4 maple: match "pcie" name for CPC945
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.
--- arch/powerpc/platforms/maple/pci.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/powerpc/platforms/maple/pci.c +1 -1
@@ -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); }
Signature · 1 line
1.4.4.1
PATCH 2/4 maple: select PPC_RTAS
Some systems supported by the maple platform have RTAS; make PPC_MAPLE select PPC_RTAS.
--- arch/powerpc/Kconfig | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
arch/powerpc/Kconfig +1 -0
@@ -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.
Signature · 1 line
1.4.4.1
PATCH 3/4 add rtas_service_present() helper
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.
--- arch/powerpc/kernel/rtas.c | 6 ++++++ include/asm-powerpc/rtas.h | 1 + 2 files changed, 7 insertions(+), 0 deletions(-)
arch/powerpc/kernel/rtas.c +6 -0
@@ -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
include/asm-powerpc/rtas.h +1 -0
@@ -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 );
Signature · 1 line
1.4.4.1
PATCH 4/4 maple: use RTAS for reboot and halt
On maple, use the RTAS "system-reboot" and "power-off" methods if they are available.
--- arch/powerpc/platforms/maple/setup.c | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-)
arch/powerpc/platforms/maple/setup.c +12 -0
@@ -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" ); }
Signature · 1 line
1.4.4.1
Re: [PATCH 3/4] add rtas_service_present() helper
In reply to Nathan LynchQuoted 8 lines · Nathan Lynch
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_presentmethod, 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
Signature · 8 lines
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
Re: [PATCH 3/4] add rtas_service_present() helper
Quoted 7 lines · Michael Ellerman
Quoted 6 lines · Nathan Lynch
To test for the existence of an RTAS function, we typically do:
foo_token = rtas_token("foo"); if (foo_token == RTAS_UNKNOWN_SERVICE) return;
Quoted 7 lines
Quoted 2 lines
Add a
rtas_service_presentmethod, 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 :)
Re: [PATCH 3/4] add rtas_service_present() helper
In reply to Michael EllermanQuoted 7 lines · Michael Ellerman
Quoted 6 lines · Nathan Lynch
To test for the existence of an RTAS function, we typically do:
foo_token = rtas_token("foo"); if (foo_token == RTAS_UNKNOWN_SERVICE) return;
Quoted 5 lines
Quoted 2 lines
Add a
rtas_service_presentmethod, 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
Quoted 3 lines · On Wed, 6 Dec 2006 18:50:43 -0600 Nathan Lynch <[email protected]> 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
Quoted 6 lines
Quoted 3 lines
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 :-)
Quoted 3 lines
See http://playground.sun.com/1275/bindings/pci/pci-express.txt
That's also what pseries and
rtas_pciuses.
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
Quoted 3 lines
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
Quoted 5 lines · Segher Boessenkool
Quoted 3 lines
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?)
arch/powerpc/platforms/maple/pci.c +9 -6
@@ -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; }
Quoted 10 lines · Nathan Lynch
Quoted 5 lines · Segher Boessenkool
Quoted 3 lines
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.