public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] OLPC: pci: fix up PCI stuff so that PCI_GOANY supports OLPC
@ 2008-06-05 19:29 Andres Salomon
  2008-06-05 19:42 ` Andrew Morton
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Andres Salomon @ 2008-06-05 19:29 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, mingo, H. Peter Anvin, tglx, rmh

Previously, one would have to specifically choose CONFIG_OLPC and
CONFIG_PCI_GOOLPC in order to enable PCI_OLPC.  That doesn't really
work for distro kernels, so this patch allows one to choose
CONFIG_OLPC and CONFIG_PCI_GOANY in order to build in OLPC support in
a generic kernel (as requested by Robert Millan).

This also moves GOOLPC before GOANY in the menuconfig list.

Finally, make pci_access_init return early if we detect OLPC hardware.
There's no need to continue probing stuff, and pci_pcbios_init
specifically trashes our settings (we didn't run into that before
because PCI_GOANY wasn't supported).

It would be great if we could sneak this in for 2.6.26..  *cough*  :)

Signed-off-by: Andres Salomon <dilinger@debian.org>
---
 arch/x86/Kconfig    |   11 +++++------
 arch/x86/pci/init.c |    3 ++-
 arch/x86/pci/olpc.c |    5 +++--
 arch/x86/pci/pci.h  |    2 +-
 4 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index dcbec34..52e18e6 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -1508,13 +1508,13 @@ config PCI_GOMMCONFIG
 config PCI_GODIRECT
 	bool "Direct"
 
-config PCI_GOANY
-	bool "Any"
-
 config PCI_GOOLPC
 	bool "OLPC"
 	depends on OLPC
 
+config PCI_GOANY
+	bool "Any"
+
 endchoice
 
 config PCI_BIOS
@@ -1531,9 +1531,8 @@ config PCI_MMCONFIG
 	depends on X86_32 && PCI && ACPI && (PCI_GOMMCONFIG || PCI_GOANY)
 
 config PCI_OLPC
-	bool
-	depends on PCI && PCI_GOOLPC
-	default y
+	def_bool y
+	depends on PCI && OLPC && (PCI_GOOLPC || PCI_GOANY)
 
 config PCI_DOMAINS
 	def_bool y
diff --git a/arch/x86/pci/init.c b/arch/x86/pci/init.c
index e70b9c5..b821f44 100644
--- a/arch/x86/pci/init.c
+++ b/arch/x86/pci/init.c
@@ -15,7 +15,8 @@ static __init int pci_access_init(void)
 	pci_mmcfg_early_init();
 
 #ifdef CONFIG_PCI_OLPC
-	pci_olpc_init();
+	if (!pci_olpc_init())
+		return 0;	/* skip additional checks if it's an XO */
 #endif
 #ifdef CONFIG_PCI_BIOS
 	pci_pcbios_init();
diff --git a/arch/x86/pci/olpc.c b/arch/x86/pci/olpc.c
index 5e76365..e11e9e8 100644
--- a/arch/x86/pci/olpc.c
+++ b/arch/x86/pci/olpc.c
@@ -302,12 +302,13 @@ static struct pci_raw_ops pci_olpc_conf = {
 	.write = pci_olpc_write,
 };
 
-void __init pci_olpc_init(void)
+int __init pci_olpc_init(void)
 {
 	if (!machine_is_olpc() || olpc_has_vsa())
-		return;
+		return -ENODEV;
 
 	printk(KERN_INFO "PCI: Using configuration type OLPC\n");
 	raw_pci_ops = &pci_olpc_conf;
 	is_lx = is_geode_lx();
+	return 0;
 }
diff --git a/arch/x86/pci/pci.h b/arch/x86/pci/pci.h
index f3972b1..720c4c5 100644
--- a/arch/x86/pci/pci.h
+++ b/arch/x86/pci/pci.h
@@ -101,7 +101,7 @@ extern struct pci_raw_ops pci_direct_conf1;
 extern int pci_direct_probe(void);
 extern void pci_direct_init(int type);
 extern void pci_pcbios_init(void);
-extern void pci_olpc_init(void);
+extern int pci_olpc_init(void);
 
 /* pci-mmconfig.c */
 
-- 
1.5.5.1


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

* Re: [PATCH] OLPC: pci: fix up PCI stuff so that PCI_GOANY supports OLPC
  2008-06-05 19:29 [PATCH] OLPC: pci: fix up PCI stuff so that PCI_GOANY supports OLPC Andres Salomon
@ 2008-06-05 19:42 ` Andrew Morton
  2008-06-05 20:34   ` Jesse Barnes
  2008-06-05 20:49   ` Thomas Gleixner
  2008-06-05 20:07 ` Randy.Dunlap
  2008-06-06 11:05 ` Pavel Machek
  2 siblings, 2 replies; 9+ messages in thread
From: Andrew Morton @ 2008-06-05 19:42 UTC (permalink / raw)
  To: Andres Salomon; +Cc: linux-kernel, mingo, hpa, tglx, rmh, Jesse Barnes

On Thu, 5 Jun 2008 15:29:14 -0400
Andres Salomon <dilinger@queued.net> wrote:

> Previously, one would have to specifically choose CONFIG_OLPC and
> CONFIG_PCI_GOOLPC in order to enable PCI_OLPC.  That doesn't really
> work for distro kernels, so this patch allows one to choose
> CONFIG_OLPC and CONFIG_PCI_GOANY in order to build in OLPC support in
> a generic kernel (as requested by Robert Millan).
> 
> This also moves GOOLPC before GOANY in the menuconfig list.
> 
> Finally, make pci_access_init return early if we detect OLPC hardware.
> There's no need to continue probing stuff, and pci_pcbios_init
> specifically trashes our settings (we didn't run into that before
> because PCI_GOANY wasn't supported).
> 
> It would be great if we could sneak this in for 2.6.26..  *cough*  :)
> 

It looks harmless enough.

> ---
>  arch/x86/Kconfig    |   11 +++++------
>  arch/x86/pci/init.c |    3 ++-
>  arch/x86/pci/olpc.c |    5 +++--
>  arch/x86/pci/pci.h  |    2 +-

But I never know whether arch/x86/pci is a Jesse thing or an Ingo
thing.  Usual answer: it's an everyone thing and we all make a big mess ;)



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

* Re: [PATCH] OLPC: pci: fix up PCI stuff so that PCI_GOANY supports OLPC
  2008-06-05 19:29 [PATCH] OLPC: pci: fix up PCI stuff so that PCI_GOANY supports OLPC Andres Salomon
  2008-06-05 19:42 ` Andrew Morton
@ 2008-06-05 20:07 ` Randy.Dunlap
  2008-06-05 20:27   ` Andres Salomon
  2008-06-06 11:05 ` Pavel Machek
  2 siblings, 1 reply; 9+ messages in thread
From: Randy.Dunlap @ 2008-06-05 20:07 UTC (permalink / raw)
  To: Andres Salomon
  Cc: Andrew Morton, linux-kernel, mingo, H. Peter Anvin, tglx, rmh

On Thu, 5 Jun 2008, Andres Salomon wrote:

> Previously, one would have to specifically choose CONFIG_OLPC and
> CONFIG_PCI_GOOLPC in order to enable PCI_OLPC.  That doesn't really
> work for distro kernels, so this patch allows one to choose
> CONFIG_OLPC and CONFIG_PCI_GOANY in order to build in OLPC support in
> a generic kernel (as requested by Robert Millan).
> 
> This also moves GOOLPC before GOANY in the menuconfig list.

Please say why... (for above)

> Finally, make pci_access_init return early if we detect OLPC hardware.
> There's no need to continue probing stuff, and pci_pcbios_init
> specifically trashes our settings (we didn't run into that before
> because PCI_GOANY wasn't supported).
> 
> It would be great if we could sneak this in for 2.6.26..  *cough*  :)
> 
> Signed-off-by: Andres Salomon <dilinger@debian.org>
> ---
>  arch/x86/Kconfig    |   11 +++++------
>  arch/x86/pci/init.c |    3 ++-
>  arch/x86/pci/olpc.c |    5 +++--
>  arch/x86/pci/pci.h  |    2 +-
>  4 files changed, 11 insertions(+), 10 deletions(-)
> 
> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> index dcbec34..52e18e6 100644
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -1508,13 +1508,13 @@ config PCI_GOMMCONFIG
>  config PCI_GODIRECT
>  	bool "Direct"
>  
> -config PCI_GOANY
> -	bool "Any"
> -
>  config PCI_GOOLPC
>  	bool "OLPC"
>  	depends on OLPC
>  
> +config PCI_GOANY
> +	bool "Any"
> +
>  endchoice
>  
>  config PCI_BIOS
> @@ -1531,9 +1531,8 @@ config PCI_MMCONFIG
>  	depends on X86_32 && PCI && ACPI && (PCI_GOMMCONFIG || PCI_GOANY)
>  
>  config PCI_OLPC
> -	bool
> -	depends on PCI && PCI_GOOLPC
> -	default y
> +	def_bool y
> +	depends on PCI && OLPC && (PCI_GOOLPC || PCI_GOANY)
>  
>  config PCI_DOMAINS
>  	def_bool y
> diff --git a/arch/x86/pci/init.c b/arch/x86/pci/init.c
> index e70b9c5..b821f44 100644
> --- a/arch/x86/pci/init.c
> +++ b/arch/x86/pci/init.c
> @@ -15,7 +15,8 @@ static __init int pci_access_init(void)
>  	pci_mmcfg_early_init();
>  
>  #ifdef CONFIG_PCI_OLPC
> -	pci_olpc_init();
> +	if (!pci_olpc_init())
> +		return 0;	/* skip additional checks if it's an XO */
>  #endif
>  #ifdef CONFIG_PCI_BIOS
>  	pci_pcbios_init();
> diff --git a/arch/x86/pci/olpc.c b/arch/x86/pci/olpc.c
> index 5e76365..e11e9e8 100644
> --- a/arch/x86/pci/olpc.c
> +++ b/arch/x86/pci/olpc.c
> @@ -302,12 +302,13 @@ static struct pci_raw_ops pci_olpc_conf = {
>  	.write = pci_olpc_write,
>  };
>  
> -void __init pci_olpc_init(void)
> +int __init pci_olpc_init(void)
>  {
>  	if (!machine_is_olpc() || olpc_has_vsa())
> -		return;
> +		return -ENODEV;
>  
>  	printk(KERN_INFO "PCI: Using configuration type OLPC\n");
>  	raw_pci_ops = &pci_olpc_conf;
>  	is_lx = is_geode_lx();
> +	return 0;
>  }
> diff --git a/arch/x86/pci/pci.h b/arch/x86/pci/pci.h
> index f3972b1..720c4c5 100644
> --- a/arch/x86/pci/pci.h
> +++ b/arch/x86/pci/pci.h
> @@ -101,7 +101,7 @@ extern struct pci_raw_ops pci_direct_conf1;
>  extern int pci_direct_probe(void);
>  extern void pci_direct_init(int type);
>  extern void pci_pcbios_init(void);
> -extern void pci_olpc_init(void);
> +extern int pci_olpc_init(void);
>  
>  /* pci-mmconfig.c */
>  
> 

-- 
~Randy

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

* Re: [PATCH] OLPC: pci: fix up PCI stuff so that PCI_GOANY supports OLPC
  2008-06-05 20:07 ` Randy.Dunlap
@ 2008-06-05 20:27   ` Andres Salomon
  0 siblings, 0 replies; 9+ messages in thread
From: Andres Salomon @ 2008-06-05 20:27 UTC (permalink / raw)
  To: Randy.Dunlap
  Cc: Andrew Morton, linux-kernel, mingo, H. Peter Anvin, tglx, rmh

On Thu, 5 Jun 2008 13:07:35 -0700 (PDT)
"Randy.Dunlap" <rdunlap@xenotime.net> wrote:

> On Thu, 5 Jun 2008, Andres Salomon wrote:
> 
> > Previously, one would have to specifically choose CONFIG_OLPC and
> > CONFIG_PCI_GOOLPC in order to enable PCI_OLPC.  That doesn't really
> > work for distro kernels, so this patch allows one to choose
> > CONFIG_OLPC and CONFIG_PCI_GOANY in order to build in OLPC support
> > in a generic kernel (as requested by Robert Millan).
> > 
> > This also moves GOOLPC before GOANY in the menuconfig list.
> 
> Please say why... (for above)
> 

The options above GOANY are included in GOANY.
Previously, GOANY did not support GOOLPC, so GOOLPC was listed after it.
Now that GOANY supports GOOLPC, it can be listed above w/ the others.

Plus, _I_ think it looks nicer.  :)  That hunk can easily be removed from
the patch if others disagree.

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

* Re: [PATCH] OLPC: pci: fix up PCI stuff so that PCI_GOANY supports OLPC
  2008-06-05 19:42 ` Andrew Morton
@ 2008-06-05 20:34   ` Jesse Barnes
  2008-06-05 20:49   ` Thomas Gleixner
  1 sibling, 0 replies; 9+ messages in thread
From: Jesse Barnes @ 2008-06-05 20:34 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Andres Salomon, linux-kernel, mingo, hpa, tglx, rmh

On Thursday, June 05, 2008 12:42 pm Andrew Morton wrote:
> On Thu, 5 Jun 2008 15:29:14 -0400
>
> Andres Salomon <dilinger@queued.net> wrote:
> > Previously, one would have to specifically choose CONFIG_OLPC and
> > CONFIG_PCI_GOOLPC in order to enable PCI_OLPC.  That doesn't really
> > work for distro kernels, so this patch allows one to choose
> > CONFIG_OLPC and CONFIG_PCI_GOANY in order to build in OLPC support in
> > a generic kernel (as requested by Robert Millan).
> >
> > This also moves GOOLPC before GOANY in the menuconfig list.
> >
> > Finally, make pci_access_init return early if we detect OLPC hardware.
> > There's no need to continue probing stuff, and pci_pcbios_init
> > specifically trashes our settings (we didn't run into that before
> > because PCI_GOANY wasn't supported).
> >
> > It would be great if we could sneak this in for 2.6.26..  *cough*  :)
>
> It looks harmless enough.
>
> > ---
> >  arch/x86/Kconfig    |   11 +++++------
> >  arch/x86/pci/init.c |    3 ++-
> >  arch/x86/pci/olpc.c |    5 +++--
> >  arch/x86/pci/pci.h  |    2 +-
>
> But I never know whether arch/x86/pci is a Jesse thing or an Ingo
> thing.  Usual answer: it's an everyone thing and we all make a big mess ;)

Heh, yeah I've been taking quite a few x86 PCI patches (Ingo actually has a 
queue of them for me now), so I can pick this one up and put it in what I 
hope will be my final 2.6.26 pull request.

Jesse

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

* Re: [PATCH] OLPC: pci: fix up PCI stuff so that PCI_GOANY supports OLPC
  2008-06-05 19:42 ` Andrew Morton
  2008-06-05 20:34   ` Jesse Barnes
@ 2008-06-05 20:49   ` Thomas Gleixner
  1 sibling, 0 replies; 9+ messages in thread
From: Thomas Gleixner @ 2008-06-05 20:49 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Andres Salomon, linux-kernel, mingo, hpa, rmh, Jesse Barnes

On Thu, 5 Jun 2008, Andrew Morton wrote:
> On Thu, 5 Jun 2008 15:29:14 -0400
> Andres Salomon <dilinger@queued.net> wrote:
> 
> > Previously, one would have to specifically choose CONFIG_OLPC and
> > CONFIG_PCI_GOOLPC in order to enable PCI_OLPC.  That doesn't really
> > work for distro kernels, so this patch allows one to choose
> > CONFIG_OLPC and CONFIG_PCI_GOANY in order to build in OLPC support in
> > a generic kernel (as requested by Robert Millan).
> > 
> > This also moves GOOLPC before GOANY in the menuconfig list.
> > 
> > Finally, make pci_access_init return early if we detect OLPC hardware.
> > There's no need to continue probing stuff, and pci_pcbios_init
> > specifically trashes our settings (we didn't run into that before
> > because PCI_GOANY wasn't supported).
> > 
> > It would be great if we could sneak this in for 2.6.26..  *cough*  :)
> > 
> 
> It looks harmless enough.
> 
> > ---
> >  arch/x86/Kconfig    |   11 +++++------
> >  arch/x86/pci/init.c |    3 ++-
> >  arch/x86/pci/olpc.c |    5 +++--
> >  arch/x86/pci/pci.h  |    2 +-
> 
> But I never know whether arch/x86/pci is a Jesse thing or an Ingo
> thing.  Usual answer: it's an everyone thing and we all make a big mess ;)

So the Salomonic solution is: 

You pick it up and send it either to Jesse or x86@kernel.org :)

I put it into my urgent bucket just to be on the safe side.

Thanks,
	tglx

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

* Re: [PATCH] OLPC: pci: fix up PCI stuff so that PCI_GOANY supports OLPC
  2008-06-05 19:29 [PATCH] OLPC: pci: fix up PCI stuff so that PCI_GOANY supports OLPC Andres Salomon
  2008-06-05 19:42 ` Andrew Morton
  2008-06-05 20:07 ` Randy.Dunlap
@ 2008-06-06 11:05 ` Pavel Machek
  2008-06-06 12:46   ` Andres Salomon
  2 siblings, 1 reply; 9+ messages in thread
From: Pavel Machek @ 2008-06-06 11:05 UTC (permalink / raw)
  To: Andres Salomon
  Cc: Andrew Morton, linux-kernel, mingo, H. Peter Anvin, tglx, rmh

On Thu 2008-06-05 15:29:14, Andres Salomon wrote:
> Previously, one would have to specifically choose CONFIG_OLPC and
> CONFIG_PCI_GOOLPC in order to enable PCI_OLPC.  That doesn't really
> work for distro kernels, so this patch allows one to choose

How do distros work on OLPC, anyway? It lacks normal BIOS, so you
can't really use GRUB, right?
								Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

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

* Re: [PATCH] OLPC: pci: fix up PCI stuff so that PCI_GOANY supports OLPC
  2008-06-06 11:05 ` Pavel Machek
@ 2008-06-06 12:46   ` Andres Salomon
  2008-06-06 13:09     ` Robert Millan
  0 siblings, 1 reply; 9+ messages in thread
From: Andres Salomon @ 2008-06-06 12:46 UTC (permalink / raw)
  To: Pavel Machek
  Cc: Andrew Morton, linux-kernel, mingo, H. Peter Anvin, tglx, rmh

On Fri, 6 Jun 2008 13:05:49 +0200
Pavel Machek <pavel@suse.cz> wrote:

> On Thu 2008-06-05 15:29:14, Andres Salomon wrote:
> > Previously, one would have to specifically choose CONFIG_OLPC and
> > CONFIG_PCI_GOOLPC in order to enable PCI_OLPC.  That doesn't really
> > work for distro kernels, so this patch allows one to choose
> 
> How do distros work on OLPC, anyway? It lacks normal BIOS, so you
> can't really use GRUB, right?
> 								Pavel

I believe Robert was actually working on grub support.  I thought it made
little sense within the context of OFW, but if it is a requirement to make
installers happy, so be it.

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

* Re: [PATCH] OLPC: pci: fix up PCI stuff so that PCI_GOANY supports OLPC
  2008-06-06 12:46   ` Andres Salomon
@ 2008-06-06 13:09     ` Robert Millan
  0 siblings, 0 replies; 9+ messages in thread
From: Robert Millan @ 2008-06-06 13:09 UTC (permalink / raw)
  To: Andres Salomon
  Cc: Pavel Machek, Andrew Morton, linux-kernel, mingo, H. Peter Anvin,
	tglx

On Fri, Jun 06, 2008 at 08:46:33AM -0400, Andres Salomon wrote:
> On Fri, 6 Jun 2008 13:05:49 +0200
> Pavel Machek <pavel@suse.cz> wrote:
> 
> > On Thu 2008-06-05 15:29:14, Andres Salomon wrote:
> > > Previously, one would have to specifically choose CONFIG_OLPC and
> > > CONFIG_PCI_GOOLPC in order to enable PCI_OLPC.  That doesn't really
> > > work for distro kernels, so this patch allows one to choose
> > 
> > How do distros work on OLPC, anyway? It lacks normal BIOS, so you
> > can't really use GRUB, right?
> > 								Pavel
> 
> I believe Robert was actually working on grub support.

The OLPC port of GRUB is mostly complete now.  There's a problem with
finding the boot drive though (I'm working on that atm).  Other details
at http://grub.enbug.org/OLPC

As for the BIOS dependency, GRUB 2 is very portable so it wasn't a problem
(we used the existing keyboard driver from the Coreboot port, and the OFW
client framework we already had for powerpc).

> I thought it made
> little sense within the context of OFW, but if it is a requirement to make
> installers happy, so be it.

Some might find it practical to have the GRUB menu & update-grub to autobuild
it :-)

-- 
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What good is a phone call… if you are unable to speak?
(as seen on /.)

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

end of thread, other threads:[~2008-06-06 13:48 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-05 19:29 [PATCH] OLPC: pci: fix up PCI stuff so that PCI_GOANY supports OLPC Andres Salomon
2008-06-05 19:42 ` Andrew Morton
2008-06-05 20:34   ` Jesse Barnes
2008-06-05 20:49   ` Thomas Gleixner
2008-06-05 20:07 ` Randy.Dunlap
2008-06-05 20:27   ` Andres Salomon
2008-06-06 11:05 ` Pavel Machek
2008-06-06 12:46   ` Andres Salomon
2008-06-06 13:09     ` Robert Millan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox