LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Re: PPC440EPx on Sequoia: /proc/iomem acts weird
From: Steven A. Falco @ 2007-11-12 19:25 UTC (permalink / raw)
  To: Stefan Roese; +Cc: linuxppc-dev
In-Reply-To: <200711101403.48792.sr@denx.de>

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

First I will say that I don't understand resources well enough to 
suggest a fix.  But I have done a little poking around.  In file 
arch/powerpc/platforms/44x/ppc4xx-nand.c I see one "struct resource", 
which is referenced by two "struct platform_device" items (ndfc_dev and 
nand_dev).

In routine ppc4xx_setup_nand_node() we have two calls to 
platform_device_register():

    platform_device_register(&ndfc_dev);
    platform_device_register(&nand_dev);

If I comment out the second one, then there is no loop in the resource 
tree, and I can cat /proc/iomem just fine.  If both calls are present, 
then cat /proc/iomem loops forever.

So, just a wild guess - should there be two "struct resource"s, one for 
each platform_device, or is there some other way to break the loop in 
the tree?

    Steve


Stefan Roese wrote:
> Hi Steve,
>
> On Friday 09 November 2007, Steven A. Falco wrote:
>   
>> I am using the Denx 2.6.32 kernel, which does have powerpc/sequoia.
>> Xenomai is a real-time kernel built on Adeos/Ipipe.  I'll dig into it
>> further.
>>     
>
> Is this arch/ppc or arch/powerpc? I remember fixing this a while ago in 
> arch/ppc:
>
> commit 67a35ce785b1d11d09bf528c166ea26d489a4bd6
> Author: Stefan Roese <sr@denx.de>
> Date:   Thu Aug 2 14:15:22 2007 +0200
>
>     ppc: Fix problem with recursive NDFC platform_device resource management
>
>     This change fixes a problem with a resursive platform_device resource
>     management of the AMCC 4xx NDFC. Without this fix a "cat /proc/iomem"
>     leads to an infinite loop of printing the "ndfc-nand.0" resource.
>
>     Signed-off-by: Stefan Roese <sr@denx.de>
>
> Best regards,
> Stefan
>
>   

[-- Attachment #2: Type: text/html, Size: 2231 bytes --]

^ permalink raw reply

* Re: [PATCH] powerpc: Add support for PORTA sor and PORTB odr registers
From: Scott Wood @ 2007-11-12 17:42 UTC (permalink / raw)
  To: Jochen Friedrich; +Cc: paulus, linux-kernel, linuxppc-embedded@ozlabs.org
In-Reply-To: <473736FB.7090609@scram.de>

Jochen Friedrich wrote:
> PORTA has an so register and PORTB had an odr register, as well.
> However, the PORTB odr register is only 16bit.

Which 8xx chip has a so register on port A?  I checked the 860, 866, 
885, and 823 manuals and didn't see one.

-Scott

^ permalink raw reply

* small bootloader that passes arguments
From: khollan @ 2007-11-12 19:54 UTC (permalink / raw)
  To: linuxppc-embedded


Hi,

I would like to create a small bootloader that is able to pass kernel
arguments and boot a linux kernel.  Im using a xilinx PPC, and have already
booted a working kernel with a Xilinx provided XMD bootloader over USB.  My
main question is how does a bootloader pass these arguments to the kernel
before booting it?  Most specifically the root=/dev/xsa1 command so I can
tell it to either boot from compact flash or NFS.

I really don't want to try and port U-boot since I don't need the bells and
whistles and I want it to fit in the BRAM of the FPGA so it will load when I
load the hardware configuration.
-- 
View this message in context: http://www.nabble.com/small-bootloader-that-passes-arguments-tf4793411.html#a13712778
Sent from the linuxppc-embedded mailing list archive at Nabble.com.

^ permalink raw reply

* Re: [linux-pm] Re: [RFC] powermac: proper sleep management
From: Alan Stern @ 2007-11-12 19:52 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-pm, David Woodhouse, linuxppc-dev list
In-Reply-To: <1194885177.5229.45.camel@johannes.berg>

On Mon, 12 Nov 2007, Johannes Berg wrote:

> > Looks good to me, +/- a couple of things:
> > 
> >  - We _REALLY_ want the freezer to be optional and not enabled by
> > default on PowerPC. Maybe make it a compile option ?
> 
> Well, Alan is going to tell you that USB will break. If we need
> confirmation for that I can do the test he suggested to you or Paul a
> while ago.

Isn't it true that the freezer _already_ isn't enabled on PPC?  So 
leaving it off wouldn't break anything more than it is broken now.

Alan Stern

^ permalink raw reply

* Re: [RFC] powermac: proper sleep management
From: Benjamin Herrenschmidt @ 2007-11-12 20:24 UTC (permalink / raw)
  To: Johannes Berg
  Cc: linuxppc-dev list, linux-pm, David Woodhouse, Paul Mackerras
In-Reply-To: <1194885177.5229.45.camel@johannes.berg>


On Mon, 2007-11-12 at 17:32 +0100, Johannes Berg wrote:
> > Looks good to me, +/- a couple of things:
> > 
> >  - We _REALLY_ want the freezer to be optional and not enabled by
> > default on PowerPC. Maybe make it a compile option ?
> 
> Well, Alan is going to tell you that USB will break. If we need
> confirmation for that I can do the test he suggested to you or Paul a
> while ago.

Then USB is broken today on powermacs and need to be fixed. We had a
clear agreement at KS this year that the freezer was at best a band-aid
and that drivers -had- to be fixed to cope regardless.

> Obviously. I don't have any of that. I'd appreciate if somebody could
> test on a 3400 powerbook to see if that pci config space save/restore
> stuff is really necessary or even interferes with the regular stuff.

Might not be that necessary anymore nowadays, the generic code ought to
do it, but I'll give a go, I have one of those (paulus old one) though
last I tried, the HD was dead.

Ben.

^ permalink raw reply

* [PATCH] cell: Convert #include of asm/of_{platform, device}.h into linux/of_{platform, device}.h.
From: Jon Loeliger @ 2007-11-12 20:26 UTC (permalink / raw)
  To: linuxppc-dev@ozlabs.org

From: Jon Loeliger <jdl@freescale.com>

Signed-off-by: Jon Loeliger <jdl@freescale.com>
---
 arch/powerpc/platforms/cell/cbe_cpufreq.c     |    3 ++-
 arch/powerpc/platforms/cell/cbe_cpufreq_pmi.c |    3 ++-
 arch/powerpc/platforms/cell/cbe_regs.c        |    4 ++--
 arch/powerpc/platforms/cell/iommu.c           |    2 +-
 arch/powerpc/platforms/cell/setup.c           |    2 +-
 5 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/platforms/cell/cbe_cpufreq.c b/arch/powerpc/platforms/cell/cbe_cpufreq.c
index 13d5a87..ec7c8f4 100644
--- a/arch/powerpc/platforms/cell/cbe_cpufreq.c
+++ b/arch/powerpc/platforms/cell/cbe_cpufreq.c
@@ -21,8 +21,9 @@
  */
 
 #include <linux/cpufreq.h>
+#include <linux/of_platform.h>
+
 #include <asm/machdep.h>
-#include <asm/of_platform.h>
 #include <asm/prom.h>
 #include <asm/cell-regs.h>
 #include "cbe_cpufreq.h"
diff --git a/arch/powerpc/platforms/cell/cbe_cpufreq_pmi.c b/arch/powerpc/platforms/cell/cbe_cpufreq_pmi.c
index 6a2c1b0..69288f6 100644
--- a/arch/powerpc/platforms/cell/cbe_cpufreq_pmi.c
+++ b/arch/powerpc/platforms/cell/cbe_cpufreq_pmi.c
@@ -23,7 +23,8 @@
 #include <linux/kernel.h>
 #include <linux/types.h>
 #include <linux/timer.h>
-#include <asm/of_platform.h>
+#include <linux/of_platform.h>
+
 #include <asm/processor.h>
 #include <asm/prom.h>
 #include <asm/pmi.h>
diff --git a/arch/powerpc/platforms/cell/cbe_regs.c b/arch/powerpc/platforms/cell/cbe_regs.c
index 16a9b07..a839c6c 100644
--- a/arch/powerpc/platforms/cell/cbe_regs.c
+++ b/arch/powerpc/platforms/cell/cbe_regs.c
@@ -9,13 +9,13 @@
 #include <linux/percpu.h>
 #include <linux/types.h>
 #include <linux/module.h>
+#include <linux/of_device.h>
+#include <linux/of_platform.h>
 
 #include <asm/io.h>
 #include <asm/pgtable.h>
 #include <asm/prom.h>
 #include <asm/ptrace.h>
-#include <asm/of_device.h>
-#include <asm/of_platform.h>
 #include <asm/cell-regs.h>
 
 /*
diff --git a/arch/powerpc/platforms/cell/iommu.c b/arch/powerpc/platforms/cell/iommu.c
index faabc3f..179ba2e 100644
--- a/arch/powerpc/platforms/cell/iommu.c
+++ b/arch/powerpc/platforms/cell/iommu.c
@@ -26,13 +26,13 @@
 #include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/notifier.h>
+#include <linux/of_platform.h>
 
 #include <asm/prom.h>
 #include <asm/iommu.h>
 #include <asm/machdep.h>
 #include <asm/pci-bridge.h>
 #include <asm/udbg.h>
-#include <asm/of_platform.h>
 #include <asm/lmb.h>
 #include <asm/cell-regs.h>
 
diff --git a/arch/powerpc/platforms/cell/setup.c b/arch/powerpc/platforms/cell/setup.c
index 98e7ef8..4f6347c 100644
--- a/arch/powerpc/platforms/cell/setup.c
+++ b/arch/powerpc/platforms/cell/setup.c
@@ -30,6 +30,7 @@
 #include <linux/console.h>
 #include <linux/mutex.h>
 #include <linux/memory_hotplug.h>
+#include <linux/of_platform.h>
 
 #include <asm/mmu.h>
 #include <asm/processor.h>
@@ -51,7 +52,6 @@
 #include <asm/spu_priv1.h>
 #include <asm/udbg.h>
 #include <asm/mpic.h>
-#include <asm/of_platform.h>
 #include <asm/cell-regs.h>
 
 #include "interrupt.h"
-- 
1.5.3

^ permalink raw reply related

* Re: [linux-pm] Re: [RFC] powermac: proper sleep management
From: Alan Stern @ 2007-11-12 20:40 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: linuxppc-dev list, Johannes Berg, David Woodhouse, linux-pm
In-Reply-To: <1194899041.18185.55.camel@pasglop>

On Tue, 13 Nov 2007, Benjamin Herrenschmidt wrote:

> 
> On Mon, 2007-11-12 at 17:32 +0100, Johannes Berg wrote:
> > > Looks good to me, +/- a couple of things:
> > > 
> > >  - We _REALLY_ want the freezer to be optional and not enabled by
> > > default on PowerPC. Maybe make it a compile option ?
> > 
> > Well, Alan is going to tell you that USB will break. If we need
> > confirmation for that I can do the test he suggested to you or Paul a
> > while ago.
> 
> Then USB is broken today on powermacs and need to be fixed. We had a
> clear agreement at KS this year that the freezer was at best a band-aid
> and that drivers -had- to be fixed to cope regardless.

More accurately, freezing user tasks is at best a band-aid.  However 
some kernel threads do need to be frozen, and keeping the freezer 
around for their use makes sense.  It has less overhead -- I think 
-- than adding new code to do the freezing in each of these threads.

(It's true that USB drivers in general aren't written to operate in a
freezerless system-suspend environment.  That's a harder problem and
it will have to be fixed driver-by-driver, over time.  The same may be
true for lots of non-USB char device drivers as well.  Pick your 
favorite char device driver: How will it behave if a user task submits 
an I/O request after the device has been suspended?)

Alan Stern

^ permalink raw reply

* Re: [linux-pm] Re: [RFC] powermac: proper sleep management
From: Benjamin Herrenschmidt @ 2007-11-12 20:56 UTC (permalink / raw)
  To: Alan Stern; +Cc: linuxppc-dev list, Johannes Berg, David Woodhouse, linux-pm
In-Reply-To: <Pine.LNX.4.44L0.0711121534070.3128-100000@netrider.rowland.org>


On Mon, 2007-11-12 at 15:40 -0500, Alan Stern wrote:
> On Tue, 13 Nov 2007, Benjamin Herrenschmidt wrote:
> 
> > 
> > On Mon, 2007-11-12 at 17:32 +0100, Johannes Berg wrote:
> > > > Looks good to me, +/- a couple of things:
> > > > 
> > > >  - We _REALLY_ want the freezer to be optional and not enabled by
> > > > default on PowerPC. Maybe make it a compile option ?
> > > 
> > > Well, Alan is going to tell you that USB will break. If we need
> > > confirmation for that I can do the test he suggested to you or Paul a
> > > while ago.
> > 
> > Then USB is broken today on powermacs and need to be fixed. We had a
> > clear agreement at KS this year that the freezer was at best a band-aid
> > and that drivers -had- to be fixed to cope regardless.
> 
> More accurately, freezing user tasks is at best a band-aid.  However 
> some kernel threads do need to be frozen, and keeping the freezer 
> around for their use makes sense.  It has less overhead -- I think 
> -- than adding new code to do the freezing in each of these threads.

I remember fixing various issues so that khubd would be safe when non
frozen (among other things) a while ago. Did you guys break it all
again ?

Ben.

^ permalink raw reply

* Re: Gianfar ethernet device
From: Jon Smirl @ 2007-11-12 21:25 UTC (permalink / raw)
  To: benh; +Cc: PowerPC dev list
In-Reply-To: <9e4733910711111716oea3572fq9bc42221f805e11@mail.gmail.com>

On 11/11/07, Jon Smirl <jonsmirl@gmail.com> wrote:
> On 11/11/07, Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:
> >
> > > The real solution is that gianfar support belongs in a device driver,
> > > not in a common file. That whole fsl_soc.c file is a catch-all of
> > > things that belong in device drivers. I haven't looked at every line
> > > in it, but 90%+ of the code should be moved into device drivers.
> > >
> > > I'm preparing a patch that moves the i2c driver out of fsl_soc.c and
> > > into i2c_mpc.c.
> >
> > The problem is how do you instantiate it. I'm working on some solution
> > for that but it's not there yet.

What's an example of a device that can't be instantiated?

>
> Are there powerpc platforms without device trees?
>
> Standard of_platform driver works fine to instantiate the i2c driver
> on mpc5200.
>
> static struct of_device_id mpc_i2c_of_match[] = {
>         {
>                 .compatible     = "fsl-i2c",
>         },
> };
> MODULE_DEVICE_TABLE(of, mpc_i2c_of_match);
>
> /* Structure for a device driver */
> static struct of_platform_driver mpc_i2c_driver = {
>         .match_table    = mpc_i2c_of_match,
>         .probe          = mpc_i2c_probe,
>         .remove         = __devexit_p(mpc_i2c_remove),
>         .driver         = {
>                 .owner  = THIS_MODULE,
>                 .name   = DRV_NAME,
>         },
> };
>
> static int __init mpc_i2c_init(void)
> {
>         int rv;
>
>         rv = of_register_platform_driver(&mpc_i2c_driver);
>         if (rv) {
>                 printk(KERN_ERR DRV_NAME " of_register_platform_driver failed (%i)\n", rv);
>                 return rv;
>         }
>         return 0;
> }
>
> module_init(mpc_i2c_init);
>
> ----------------------------------------------------------------------------------------------
>
> i2c and alsa soc core instantiate like this, asoc v2 is not in tree
> yet. These cores used to create platform drivers, but that was wrong,
> they don't have any hardware associated with them.
>
> static int __init i2c_init(void)
> {
>         int retval;
>
>         retval = bus_register(&i2c_bus_type);
>         if (retval)
>                 return retval;
>         return class_register(&i2c_adapter_class);
> }
>
> subsys_initcall(i2c_init);
>
> --
> Jon Smirl
> jonsmirl@gmail.com
>


-- 
Jon Smirl
jonsmirl@gmail.com

^ permalink raw reply

* Re: [linux-pm] Re: [RFC] powermac: proper sleep management
From: Alan Stern @ 2007-11-12 21:52 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: linuxppc-dev list, Johannes Berg, David Woodhouse, linux-pm
In-Reply-To: <1194900998.18185.57.camel@pasglop>

On Tue, 13 Nov 2007, Benjamin Herrenschmidt wrote:

> I remember fixing various issues so that khubd would be safe when non
> frozen (among other things) a while ago. Did you guys break it all
> again ?

Sorry, I don't know what fixes you're referring to.  But come to 
think of it, some changes I added to the PM core a few months ago 
(locking every device prior to system sleep) would also make khubd 
and ksuspend_usbd safe, since they acquire the device lock before 
trying to resume anything.

So I take back what I said.  It's no longer true that those two USB 
kernel threads need to be frozen for system sleep.  (I should test and 
make sure that really works...)

But aren't there other kernel threads scattered around that still 
want to be frozen?  For instance, drivers/misc/tifm_core.c calls 
create_freezeable_workqueue().  And set_freezable() gets called in lots 
of places.

Alan Stern

^ permalink raw reply

* Re: [PATCH v4 04/13] [POWERPC] Add generic support for simple MPC5200 based boards
From: Marian Balakowicz @ 2007-11-12 22:22 UTC (permalink / raw)
  To: Stephen Rothwell; +Cc: linuxppc-dev
In-Reply-To: <20071110113133.86aa3de2.sfr@canb.auug.org.au>

Stephen Rothwell wrote:
> On Fri, 09 Nov 2007 18:12:02 +0100 Marian Balakowicz <m8@semihalf.com> wrote:
>> +++ b/arch/powerpc/platforms/52xx/mpc5200_simple.c
>>
>> +static int __init mpc5200_simple_probe(void)
>> +{
>> +	unsigned long node = of_get_flat_dt_root();
> 
> You need to include asm/prom.h to use the flattened device tree accessors.

Right, but this one is already included in mpc52xx.h.

>> +	/* list of the supported boards */
>> +	const char *board[] = {	
>> +		"tqc,tqm5200",
>> +		"promess,motionpro",
>> +		"schindler,cm5200",
>> +		NULL
>> +	};
> 
> Make that static.

Board table is no longer needed after kernel is initialized, it would
be nice to declare it static and __initdata, but that would be quite
ugly as it's a table of pointers and each string would require
separate statement too. If we don't do it then what's the benefit of
making it static?

Cheers,
m.

^ permalink raw reply

* Re: [PATCH v4 00/13] [POWERPC] Add TQM5200/CM5200/Motion-PRO board support
From: Marian Balakowicz @ 2007-11-12 22:26 UTC (permalink / raw)
  To: Grant Likely; +Cc: linuxppc-dev
In-Reply-To: <fa686aa40711091852wa1210d3t3c44d4e43f5ee40d@mail.gmail.com>

Grant Likely wrote:
> On 11/9/07, Grant Likely <grant.likely@secretlab.ca> wrote:
>> On 11/9/07, Marian Balakowicz <m8@semihalf.com> wrote:
>>> Please review, and if everything is ok schedule for 2.6.24-rc3.
>> Just to be clear, I won't be picking up these changes until the 2.6.25
>> merge window.
>>
>> The .24 tree is closed for new board support patches and is in bug fix
>> only mode.
> 
> Ummm; on rereading this (after getting gently nudged on IRC) I realize
> my reply was both inaccurate and just plain rude.  Sorry about that,
> it was unintentional.

Not a problem, really, no worries.

> Yes, I'll be picking up your patches into my tree fairly soon (before
> the .25 merge window opens), but I cannot ask Paul to pick it up for
> 2.6.24 because .24 is only open for bug fixes.

Understand, thanks!

Cheers,
Marian

^ permalink raw reply

* Re: [PATCH v4 04/13] [POWERPC] Add generic support for simple MPC5200 based boards
From: Marian Balakowicz @ 2007-11-12 22:28 UTC (permalink / raw)
  To: Wolfgang Denk; +Cc: linuxppc-dev
In-Reply-To: <20071110124327.1C46A248D3@gemini.denx.de>

Wolfgang Denk wrote:
> In message <20071109171202.16289.2618.stgit@hekate.izotz.org> you wrote:
>> This patch adds support for 'mpc5200-simple-platform' compatible
>> boards which do not need a platform specific setup. Such boards
>> are supported assuming the following:
> ...
>> +	const char *board[] = {	
>> +		"tqc,tqm5200",
>> +		"promess,motionpro",
>> +		"schindler,cm5200",
>> +		NULL
>> +	};
> 
> would it make sense to sort this list alphabetiacally? At the moment
> we can setill easily find each board, but assume that list grows to 50
> boards names...

Yes, that may be helpful, will change that.

Cheers,
Marian

^ permalink raw reply

* RE: [PATCH] [POWERPC] Optimize counting distinct entries in therelocation sections
From: Medve Emilian @ 2007-11-12 22:31 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: sfr, rusty, linuxppc-embedded, linuxppc-dev
In-Reply-To: <598D5675D34BE349929AF5EDE9B03E270174DB3E@az33exm24.fsl.freescale.net>

Hello Paul,


> > Actually I notice that count_relocs is counting all relocs, not just
> > the R_PPC_REL24 ones, which are all that we actually care about in
> > sizing the PLT.  And I would be willing to bet that every single
> > R_PPC_REL24 reloc has r_addend =3D=3D 0.
>=20
> I'll count only the R_PPC_REL24 and I'll validate if they=20
> have r_addend
> =3D=3D 0.

Seems like there are R_PPC_REL24 with r_addend !=3D 0. Within a set of =
41
modules (featuring 5457 R_PPC_REL24 relocations) already included within
the kernel tree I found 37 such relocations (R_PPC_REL24) with r_addend
!=3D 0. In my test case, from 35K relocations, 7K are R_PPC_REL24 and =
from
those only 8 have r_addend !=3D 0.

> > Also I notice that even with your patch, the actual process of doing
> > the relocations will take time proportional to the product of the
> > number of PLT entries times the number of R_PPC_REL24 relocations,
> > since we do a linear search through the PLT entries each time.
>=20
> The reason I started working on this patch was because the kernel
> detected a soft lockup in count_relocs(). It didn't complain=20
> about other
> parts so I did nothing about them.

Since the time hog in my case (and other's cases, reflected by the
previous patches) seems to be count_relocs(), would it be acceptable as
an incremental improvement to fix this now and address the relocation
process performance (later) if needed?

I'll resubmit the patch incorporating some of the feedback from you and
Rusty.


Cheers,
Emil.

^ permalink raw reply

* Re: [PATCH] sungem: fix suspend regression due to NAPI changes
From: Benjamin Herrenschmidt @ 2007-11-12 22:32 UTC (permalink / raw)
  To: Johannes Berg
  Cc: netdev, Stephen Hemminger, David S. Miller, linuxppc-dev list
In-Reply-To: <1194889547.4456.4.camel@johannes.berg>


On Mon, 2007-11-12 at 18:45 +0100, Johannes Berg wrote:
> Commit bea3348e (the NAPI changes) made sungem unconditionally enable
> NAPI when resuming and unconditionally disable when suspending, this,
> however, makes napi_disable() hang when suspending when the interface
> was taken down before suspend because taking the interface down also
> disables NAPI. This patch makes touching the napi struct in
> suspend/resume code paths depend on having the interface up, thereby
> fixing the hang on suspend.
> 
> The patch also moves the napi_disable() in gem_close() under the lock so
> that the NAPI state is always modified atomically together with the
> "opened" variable.
> 
> Signed-off-by: Johannes Berg <johannes@sipsolutions.net>

Thanks for fixing that !

Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---

> ---
>  drivers/net/sungem.c |   11 +++++------
>  1 file changed, 5 insertions(+), 6 deletions(-)
> 
> --- everything.orig/drivers/net/sungem.c	2007-11-12 18:22:49.948748047 +0100
> +++ everything/drivers/net/sungem.c	2007-11-12 18:24:30.708748481 +0100
> @@ -2333,10 +2333,10 @@ static int gem_close(struct net_device *
>  {
>  	struct gem *gp = dev->priv;
>  
> -	napi_disable(&gp->napi);
> -
>  	mutex_lock(&gp->pm_mutex);
>  
> +	napi_disable(&gp->napi);
> +
>  	gp->opened = 0;
>  	if (!gp->asleep)
>  		gem_do_stop(dev, 0);
> @@ -2355,8 +2355,6 @@ static int gem_suspend(struct pci_dev *p
>  
>  	mutex_lock(&gp->pm_mutex);
>  
> -	napi_disable(&gp->napi);
> -
>  	printk(KERN_INFO "%s: suspending, WakeOnLan %s\n",
>  	       dev->name,
>  	       (gp->wake_on_lan && gp->opened) ? "enabled" : "disabled");
> @@ -2370,6 +2368,8 @@ static int gem_suspend(struct pci_dev *p
>  
>  	/* If the driver is opened, we stop the MAC */
>  	if (gp->opened) {
> +		napi_disable(&gp->napi);
> +
>  		/* Stop traffic, mark us closed */
>  		netif_device_detach(dev);
>  
> @@ -2460,6 +2460,7 @@ static int gem_resume(struct pci_dev *pd
>  		/* Re-attach net device */
>  		netif_device_attach(dev);
>  
> +		napi_enable(&gp->napi);
>  	}
>  
>  	spin_lock_irqsave(&gp->lock, flags);
> @@ -2479,8 +2480,6 @@ static int gem_resume(struct pci_dev *pd
>  	spin_unlock(&gp->tx_lock);
>  	spin_unlock_irqrestore(&gp->lock, flags);
>  
> -	napi_enable(&gp->napi);
> -
>  	mutex_unlock(&gp->pm_mutex);
>  
>  	return 0;
> 

^ permalink raw reply

* Re: [PATCH 1/4] Merge dtc and libfdt upstream source
From: David Gibson @ 2007-11-12 22:43 UTC (permalink / raw)
  To: Scott Wood; +Cc: linuxppc-dev, Paul Mackerras
In-Reply-To: <20071112171240.GA4394@loki.buserror.net>

On Mon, Nov 12, 2007 at 11:12:40AM -0600, Scott Wood wrote:
> On Mon, Nov 12, 2007 at 03:15:24PM +1100, David Gibson wrote:
> > This very large patch incorporates a copy of dtc (including libfdt)
> > into the kernel source, in arch/powerpc/boot/dtc-src.  This patch only
> > imports the upstream sources verbatim, later patches are needed to
> > actually link it into the kernel Makefiles and use the embedded code
> > during the kernel build.
> 
> Maybe it should go somewhere outside arch/powerpc, so it can be used by
> other architectures down the road.

If other architectures want to use it down the road, we can move it
down the road.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

^ permalink raw reply

* [PATCH] remove prod_processor()
From: Nathan Lynch @ 2007-11-12 22:51 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Paul Mackerras

prod_processor() is unused, and that's a good thing, since it does not
supply the required proc id parameter to H_PROD.

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

diff --git a/arch/powerpc/platforms/pseries/plpar_wrappers.h b/arch/powerpc/platforms/pseries/plpar_wrappers.h
index d003c80..d8680b5 100644
--- a/arch/powerpc/platforms/pseries/plpar_wrappers.h
+++ b/arch/powerpc/platforms/pseries/plpar_wrappers.h
@@ -8,11 +8,6 @@ static inline long poll_pending(void)
 	return plpar_hcall_norets(H_POLL_PENDING);
 }
 
-static inline long prod_processor(void)
-{
-	return plpar_hcall_norets(H_PROD);
-}
-
 static inline long cede_processor(void)
 {
 	return plpar_hcall_norets(H_CEDE);
-- 
1.5.3.4.206.g58ba4

^ permalink raw reply related

* dtc: Add missing dependencies for tests
From: David Gibson @ 2007-11-12 22:52 UTC (permalink / raw)
  To: Jon Loeliger; +Cc: linuxppc-dev

At present, the Makefiles will not rebuild trees.o or the dtb files
derived from it if testdata.h is updated.  This is incorrect, and is
because of missing dependency information.

This patch fixes the problem by making sure that dependency
information is generated from trees.S and dumptrees.c.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>

Index: dtc/Makefile
===================================================================
--- dtc.orig/Makefile	2007-11-12 17:57:11.000000000 +1100
+++ dtc/Makefile	2007-11-12 17:57:23.000000000 +1100
@@ -188,6 +188,10 @@ clean: libfdt_clean tests_clean
 	@$(VECHO) DEP $<
 	$(CC) $(CPPFLAGS) -MM -MG -MT "$*.o $@" $< > $@
 
+%.d: %.S
+	@$(VECHO) DEP $<
+	$(CC) $(CPPFLAGS) -MM -MG -MT "$*.o $@" $< > $@
+
 %.i:	%.c
 	@$(VECHO) CPP $@
 	$(CC) $(CPPFLAGS) -E $< > $@
Index: dtc/tests/Makefile.tests
===================================================================
--- dtc.orig/tests/Makefile.tests	2007-11-12 17:56:29.000000000 +1100
+++ dtc/tests/Makefile.tests	2007-11-12 18:02:44.000000000 +1100
@@ -21,7 +21,8 @@ TESTS_TREES = $(TESTS_TREES_L:%=$(TESTS_
 
 TESTS_TARGETS = $(TESTS) $(TESTS_TREES)
 
-TESTS_DEPFILES = $(TESTS:%=%.d) $(TESTS_PREFIX)testutils.d
+TESTS_DEPFILES = $(TESTS:%=%.d) \
+	$(addprefix $(TESTS_PREFIX),testutils.d trees.d dumptrees.d)
 
 TESTS_CLEANFILES_L =  *.output vgcore.* *.dtb *.test.dts
 TESTS_CLEANFILES = $(TESTS_CLEANFILES_L:%=$(TESTS_PREFIX)%)

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

^ permalink raw reply

* [1/2] libfdt: Add phandle related functions
From: David Gibson @ 2007-11-12 22:59 UTC (permalink / raw)
  To: Jon Loeliger; +Cc: linuxppc-dev

This patch adds fdt_get_phandle() and fdt_node_offset_by_phandle()
functions to libfdt.  fdt_get_phandle() will retreive the phandle
value of a given node, and fdt_node_offset_by_phandle() will locate a
node given a phandle.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>

Index: dtc/libfdt/libfdt.h
===================================================================
--- dtc.orig/libfdt/libfdt.h	2007-11-12 19:11:55.000000000 +1100
+++ dtc/libfdt/libfdt.h	2007-11-12 20:11:12.000000000 +1100
@@ -78,29 +78,32 @@
 	/* FDT_ERR_BADPATH: Function was passed a badly formatted path
 	 * (e.g. missing a leading / for a function which requires an
 	 * absolute path) */
-#define FDT_ERR_BADSTATE	6
+#define FDT_ERR_BADPHANDLE	6
+	/* FDT_ERR_BADPHANDLE: Function was passed an invalid phandle
+	 * value.  phandle values of 0 and -1 are not permitted. */
+#define FDT_ERR_BADSTATE	7
 	/* FDT_ERR_BADSTATE: Function was passed an incomplete device
 	 * tree created by the sequential-write functions, which is
 	 * not sufficiently complete for the requested operation. */
 
 /* Error codes: codes for bad device tree blobs */
-#define FDT_ERR_TRUNCATED	7
+#define FDT_ERR_TRUNCATED	8
 	/* FDT_ERR_TRUNCATED: Structure block of the given device tree
 	 * ends without an FDT_END tag. */
-#define FDT_ERR_BADMAGIC	8
+#define FDT_ERR_BADMAGIC	9
 	/* FDT_ERR_BADMAGIC: Given "device tree" appears not to be a
 	 * device tree at all - it is missing the flattened device
 	 * tree magic number. */
-#define FDT_ERR_BADVERSION	9
+#define FDT_ERR_BADVERSION	10
 	/* FDT_ERR_BADVERSION: Given device tree has a version which
 	 * can't be handled by the requested operation.  For
 	 * read-write functions, this may mean that fdt_open_into() is
 	 * required to convert the tree to the expected version. */
-#define FDT_ERR_BADSTRUCTURE	10
+#define FDT_ERR_BADSTRUCTURE	11
 	/* FDT_ERR_BADSTRUCTURE: Given device tree has a corrupt
 	 * structure block or other serious error (e.g. misnested
 	 * nodes, or subnodes preceding properties). */
-#define FDT_ERR_BADLAYOUT	11
+#define FDT_ERR_BADLAYOUT	12
 	/* FDT_ERR_BADLAYOUT: For read-write functions, the given
 	 * device tree has it's sub-blocks in an order that the
 	 * function can't handle (memory reserve map, then structure,
@@ -108,12 +111,12 @@
 	 * into a form suitable for the read-write operations. */
 
 /* "Can't happen" error indicating a bug in libfdt */
-#define FDT_ERR_INTERNAL	12
+#define FDT_ERR_INTERNAL	13
 	/* FDT_ERR_INTERNAL: libfdt has failed an internal assertion.
 	 * Should never be returned, if it is, it indicates a bug in
 	 * libfdt itself. */
 
-#define FDT_ERR_MAX		12
+#define FDT_ERR_MAX		13
 
 /**********************************************************************/
 /* Low-level functions (you probably don't need these)                */
@@ -412,6 +415,20 @@
 }
 
 /**
+ * fdt_get_phandle - retreive the phandle of a given node
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: structure block offset of the node
+ *
+ * fdt_get_phandle() retrieves the phandle of the device tree node at
+ * structure block offset nodeoffset.
+ *
+ * returns:
+ *	the phandle of the node at nodeoffset, on succes (!= 0, != -1)
+ *	0, if the node has no phandle, or another error occurs
+ */
+uint32_t fdt_get_phandle(const void *fdt, int nodeoffset);
+
+/**
  * fdt_get_path - determine the full path of a node
  * @fdt: pointer to the device tree blob
  * @nodeoffset: offset of the node whose path to find
@@ -558,6 +575,27 @@
 				  const void *propval, int proplen);
 
 /**
+ * fdt_node_offset_by_phandle - find the node with a given phandle
+ * @fdt: pointer to the device tree blob
+ * @phandle: phandle value
+ *
+ * fdt_node_offset_by_prop_value() returns the offset of the node
+ * which has the given phandle value.  If there is more than one node
+ * in the tree with the given phandle (an invalid tree), results are
+ * undefined.
+ *
+ * returns:
+ *	structure block offset of the located node (>= 0), on success
+ *	-FDT_ERR_NOTFOUND, no node with that phandle exists
+ *	-FDT_ERR_BADPHANDLE, given phandle value was invalid (0 or -1)
+ *	-FDT_ERR_BADMAGIC,
+ *	-FDT_ERR_BADVERSION,
+ *	-FDT_ERR_BADSTATE,
+ *	-FDT_ERR_BADSTRUCTURE, standard meanings
+ */
+int fdt_node_offset_by_phandle(const void *fdt, uint32_t phandle);
+
+/**
  * fdt_node_check_compatible: check a node's compatible property
  * @fdt: pointer to the device tree blob
  * @nodeoffset: offset of a tree node
Index: dtc/tests/testdata.h
===================================================================
--- dtc.orig/tests/testdata.h	2007-11-12 19:11:55.000000000 +1100
+++ dtc/tests/testdata.h	2007-11-12 19:52:35.000000000 +1100
@@ -23,6 +23,9 @@
 #define TEST_VALUE_1	cell_to_fdt(0xdeadbeef)
 #define TEST_VALUE_2	cell_to_fdt(123456789)
 
+#define PHANDLE_1	0x2000
+#define PHANDLE_2	0x2001
+
 #define TEST_STRING_1	"hello world"
 #define TEST_STRING_2	"nastystring: \a\b\t\n\v\f\r\\\""
 #define TEST_STRING_3	"\xde\xad\xbe\xef"
Index: dtc/tests/trees.S
===================================================================
--- dtc.orig/tests/trees.S	2007-11-12 19:11:55.000000000 +1100
+++ dtc/tests/trees.S	2007-11-12 19:52:49.000000000 +1100
@@ -100,9 +100,11 @@
 	END_NODE
 
 	BEGIN_NODE("subnode@2")
+	PROP_INT(test_tree1, phandle, cell_to_fdt(PHANDLE_1))
 	PROP_INT(test_tree1, prop_int, TEST_VALUE_2)
 
 	BEGIN_NODE("subsubnode@0")
+	PROP_INT(test_tree1, phandle, cell_to_fdt(PHANDLE_2))
 	PROP_STR(test_tree1, compatible, "subsubnode2\0subsubnode")
 	PROP_INT(test_tree1, prop_int, TEST_VALUE_2)
 	END_NODE
@@ -116,6 +118,7 @@
 	STRING(test_tree1, compatible, "compatible")
 	STRING(test_tree1, prop_int, "prop-int")
 	STRING(test_tree1, prop_str, "prop-str")
+	STRING(test_tree1, phandle, "linux,phandle")
 test_tree1_strings_end:
 test_tree1_end:
 
Index: dtc/tests/sw_tree1.c
===================================================================
--- dtc.orig/tests/sw_tree1.c	2007-11-12 19:11:55.000000000 +1100
+++ dtc/tests/sw_tree1.c	2007-11-12 19:56:39.000000000 +1100
@@ -69,8 +69,10 @@
 	CHECK(fdt_end_node(fdt));
 
 	CHECK(fdt_begin_node(fdt, "subnode@2"));
+	CHECK(fdt_property_typed(fdt, "linux,phandle", cpu_to_fdt32(PHANDLE_1)));
 	CHECK(fdt_property_typed(fdt, "prop-int", TEST_VALUE_2));
 	CHECK(fdt_begin_node(fdt, "subsubnode@0"));
+	CHECK(fdt_property_typed(fdt, "linux,phandle", cpu_to_fdt32(PHANDLE_2)));
 	CHECK(fdt_property(fdt, "compatible", "subsubnode2\0subsubnode",
 			   23));
 	CHECK(fdt_property_typed(fdt, "prop-int", TEST_VALUE_2));
Index: dtc/tests/test_tree1.dts
===================================================================
--- dtc.orig/tests/test_tree1.dts	2007-11-12 19:42:00.000000000 +1100
+++ dtc/tests/test_tree1.dts	2007-11-12 19:42:02.000000000 +1100
@@ -19,9 +19,11 @@
 	};
 
 	subnode@2 {
+		linux,phandle = <0x2000>;
 		prop-int = <123456789>;
 
 		subsubnode@0 {
+			linux,phandle = <0x2001>;
 			compatible = "subsubnode2", "subsubnode";
 			prop-int = <0726746425>;
 		};
Index: dtc/tests/Makefile.tests
===================================================================
--- dtc.orig/tests/Makefile.tests	2007-11-12 19:42:01.000000000 +1100
+++ dtc/tests/Makefile.tests	2007-11-13 09:34:30.000000000 +1100
@@ -1,7 +1,8 @@
 LIB_TESTS_L = get_mem_rsv \
 	root_node find_property subnode_offset path_offset \
-	get_name getprop get_path supernode_atdepth_offset parent_offset \
-	node_offset_by_prop_value \
+	get_name getprop get_phandle \
+	get_path supernode_atdepth_offset parent_offset \
+	node_offset_by_prop_value node_offset_by_phandle \
 	node_check_compatible node_offset_by_compatible \
 	notfound \
 	setprop_inplace nop_property nop_node \
Index: dtc/tests/get_phandle.c
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ dtc/tests/get_phandle.c	2007-11-12 19:53:11.000000000 +1100
@@ -0,0 +1,58 @@
+/*
+ * libfdt - Flat Device Tree manipulation
+ *	Testcase for fdt_get_phandle()
+ * Copyright (C) 2006 David Gibson, IBM Corporation.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdint.h>
+
+#include <fdt.h>
+#include <libfdt.h>
+
+#include "tests.h"
+#include "testdata.h"
+
+void check_phandle(void *fdt, const char *path, uint32_t checkhandle)
+{
+	int offset;
+	uint32_t phandle;
+
+	offset = fdt_path_offset(fdt, path);
+	if (offset < 0)
+		FAIL("Couldn't find %s", path);
+
+	phandle = fdt_get_phandle(fdt, offset);
+	if (phandle != checkhandle)
+		FAIL("fdt_get_phandle(%s) returned 0x%x instead of 0x%x\n",
+		     path, phandle, checkhandle);
+}
+
+int main(int argc, char *argv[])
+{
+	void *fdt;
+
+	test_init(argc, argv);
+	fdt = load_blob_arg(argc, argv);
+
+	check_phandle(fdt, "/", 0);
+	check_phandle(fdt, "/subnode@2", PHANDLE_1);
+	check_phandle(fdt, "/subnode@2/subsubnode@0", PHANDLE_2);
+
+	PASS();
+}
Index: dtc/tests/run_tests.sh
===================================================================
--- dtc.orig/tests/run_tests.sh	2007-11-12 19:42:00.000000000 +1100
+++ dtc/tests/run_tests.sh	2007-11-12 20:49:37.000000000 +1100
@@ -39,10 +39,12 @@
     run_test path_offset $TREE
     run_test get_name $TREE
     run_test getprop $TREE
+    run_test get_phandle $TREE
     run_test get_path $TREE
     run_test supernode_atdepth_offset $TREE
     run_test parent_offset $TREE
     run_test node_offset_by_prop_value $TREE
+    run_test node_offset_by_phandle $TREE
     run_test node_check_compatible $TREE
     run_test node_offset_by_compatible $TREE
     run_test notfound $TREE
@@ -131,12 +133,16 @@
     run_test dtc.sh -I dts -O dtb -o dtc_escapes.test.dtb escapes.dts
     run_test string_escapes dtc_escapes.test.dtb
 
+    run_test dtc.sh -I dts -O dtb -o dtc_references.test.dtb references.dts
+    run_test references dtc_references.test.dtb
+
     # Check -Odts mode preserve all dtb information
     for tree in test_tree1.dtb dtc_tree1.test.dtb dtc_escapes.test.dtb ; do
 	run_test dtc.sh -I dtb -O dts -o odts_$tree.test.dts $tree
 	run_test dtc.sh -I dts -O dtb -o odts_$tree.test.dtb odts_$tree.test.dts
 	run_test dtbs_equal_ordered $tree odts_$tree.test.dtb
     done
+
 }
 
 while getopts "vdt:" ARG ; do
Index: dtc/libfdt/fdt_ro.c
===================================================================
--- dtc.orig/libfdt/fdt_ro.c	2007-11-12 19:11:55.000000000 +1100
+++ dtc/libfdt/fdt_ro.c	2007-11-12 20:08:39.000000000 +1100
@@ -293,6 +293,18 @@
 	return prop->data;
 }
 
+uint32_t fdt_get_phandle(const void *fdt, int nodeoffset)
+{
+	const uint32_t *php;
+	int len;
+
+	php = fdt_getprop(fdt, nodeoffset, "linux,phandle", &len);
+	if (!php || (len != sizeof(*php)))
+		return 0;
+
+	return fdt32_to_cpu(*php);
+}
+
 int fdt_get_path(const void *fdt, int nodeoffset, char *buf, int buflen)
 {
 	uint32_t tag;
@@ -478,6 +490,15 @@
 	return -FDT_ERR_NOTFOUND;
 }
 
+int fdt_node_offset_by_phandle(const void *fdt, uint32_t phandle)
+{
+	if ((phandle == 0) || (phandle == -1))
+		return -FDT_ERR_BADPHANDLE;
+	phandle = cpu_to_fdt32(phandle);
+	return fdt_node_offset_by_prop_value(fdt, -1, "linux,phandle",
+					     &phandle, sizeof(phandle));
+}
+
 int _stringlist_contains(const void *strlist, int listlen, const char *str)
 {
 	int len = strlen(str);
Index: dtc/tests/rw_tree1.c
===================================================================
--- dtc.orig/tests/rw_tree1.c	2007-11-12 19:11:55.000000000 +1100
+++ dtc/tests/rw_tree1.c	2007-11-12 19:57:10.000000000 +1100
@@ -85,8 +85,12 @@
 	CHECK(fdt_setprop_typed(fdt, offset, "prop-int", TEST_VALUE_1));
 
 	OFF_CHECK(offset, fdt_add_subnode(fdt, 0, "subnode@2"));
+	CHECK(fdt_setprop_typed(fdt, offset, "linux,phandle",
+				cpu_to_fdt32(PHANDLE_1)));
 	CHECK(fdt_setprop_typed(fdt, offset, "prop-int", TEST_VALUE_2));
 	OFF_CHECK(offset, fdt_add_subnode(fdt, offset, "subsubnode@0"));
+	CHECK(fdt_setprop_typed(fdt, offset, "linux,phandle",
+				cpu_to_fdt32(PHANDLE_2)));
 	CHECK(fdt_setprop(fdt, offset, "compatible",
 			  "subsubnode2\0subsubnode", 23));
 	CHECK(fdt_setprop_typed(fdt, offset, "prop-int", TEST_VALUE_2));
Index: dtc/tests/test_tree1_dts0.dts
===================================================================
--- dtc.orig/tests/test_tree1_dts0.dts	2007-11-12 19:42:34.000000000 +1100
+++ dtc/tests/test_tree1_dts0.dts	2007-11-12 19:42:56.000000000 +1100
@@ -17,9 +17,11 @@
 	};
 
 	subnode@2 {
+		linux,phandle = <2000>;
 		prop-int = <d# 123456789>;
 
 		subsubnode@0 {
+			linux,phandle = <2001>;
 			compatible = "subsubnode2", "subsubnode";
 			prop-int = <o# 0726746425>;
 		};
Index: dtc/tests/node_offset_by_phandle.c
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ dtc/tests/node_offset_by_phandle.c	2007-11-12 20:06:50.000000000 +1100
@@ -0,0 +1,64 @@
+/*
+ * libfdt - Flat Device Tree manipulation
+ *	Testcase for fdt_node_offset_by_phandle()
+ * Copyright (C) 2006 David Gibson, IBM Corporation.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdint.h>
+#include <stdarg.h>
+
+#include <fdt.h>
+#include <libfdt.h>
+
+#include "tests.h"
+#include "testdata.h"
+
+void check_search(void *fdt, uint32_t phandle, int target)
+{
+	int offset;
+
+	offset = fdt_node_offset_by_phandle(fdt, phandle);
+
+	if (offset != target)
+		FAIL("fdt_node_offset_by_phandle(0x%x) returns %d "
+		     "instead of %d", phandle, offset, target);
+}
+
+int main(int argc, char *argv[])
+{
+	void *fdt;
+	int subnode2_offset, subsubnode2_offset;
+
+	test_init(argc, argv);
+	fdt = load_blob_arg(argc, argv);
+
+	subnode2_offset = fdt_path_offset(fdt, "/subnode@2");
+	subsubnode2_offset = fdt_path_offset(fdt, "/subnode@2/subsubnode@0");
+
+	if ((subnode2_offset < 0) || (subsubnode2_offset < 0))
+		FAIL("Can't find required nodes");
+
+	check_search(fdt, PHANDLE_1, subnode2_offset);
+	check_search(fdt, PHANDLE_2, subsubnode2_offset);
+	check_search(fdt, ~PHANDLE_1, -FDT_ERR_NOTFOUND);
+	check_search(fdt, 0, -FDT_ERR_BADPHANDLE);
+	check_search(fdt, -1, -FDT_ERR_BADPHANDLE);
+
+	PASS();
+}

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

^ permalink raw reply

* [2/2] dtc: Add testcase for dtc references
From: David Gibson @ 2007-11-12 23:02 UTC (permalink / raw)
  To: Jon Loeliger; +Cc: linuxppc-dev
In-Reply-To: <20071112225938.GG1219@localhost.localdomain>

This patch adds a testcase for dtc's reference-to-phandle
functionality.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>

Index: dtc/tests/references.dts
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ dtc/tests/references.dts	2007-11-12 20:47:05.000000000 +1100
@@ -0,0 +1,23 @@
+/dts-v1/;
+
+/ {
+  	/* Explicit phandles */
+	n1: node1 {
+		linux,phandle = <0x2000>;
+		ref = <&/node2>; /* reference precedes target */
+		lref = <&n2>;
+	};
+	n2: node2 {
+	      	linux,phandle = <0x1>;
+		ref = <&/node1>; /* reference after target */
+		lref = <&n1>;
+	};
+
+	/* Implicit phandles */
+	n3: node3 {
+	    	ref = <&/node4>;
+		lref = <&n4>;
+	};
+	n4: node4 {
+	};
+};
Index: dtc/tests/Makefile.tests
===================================================================
--- dtc.orig/tests/Makefile.tests	2007-11-12 20:49:56.000000000 +1100
+++ dtc/tests/Makefile.tests	2007-11-12 20:50:01.000000000 +1100
@@ -9,7 +9,8 @@
 	sw_tree1 \
 	move_and_save mangle-layout \
 	open_pack rw_tree1 setprop del_property del_node \
-	string_escapes dtbs_equal_ordered
+	string_escapes references \
+	dtbs_equal_ordered
 LIB_TESTS = $(LIB_TESTS_L:%=$(TESTS_PREFIX)%)
 
 LIBTREE_TESTS_L = truncated_property
Index: dtc/tests/references.c
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ dtc/tests/references.c	2007-11-12 21:23:33.000000000 +1100
@@ -0,0 +1,100 @@
+/*
+ * libfdt - Flat Device Tree manipulation
+ *	Testcase for phandle references in dtc
+ * Copyright (C) 2006 David Gibson, IBM Corporation.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdint.h>
+
+#include <fdt.h>
+#include <libfdt.h>
+
+#include "tests.h"
+#include "testdata.h"
+
+void check_ref(const void *fdt, int node, uint32_t checkref)
+{
+	const uint32_t *p;
+	uint32_t ref;
+	int len;
+
+	p = fdt_getprop(fdt, node, "ref", &len);
+	if (!p)
+		FAIL("fdt_getprop(%d, \"ref\"): %s", node, fdt_strerror(len));
+	if (len != sizeof(*p))
+		FAIL("'ref' in node at %d has wrong size (%d instead of %d)",
+		     node, len, sizeof(*p));
+	ref = fdt32_to_cpu(*p);
+	if (ref != checkref)
+		FAIL("'ref' in node at %d has value 0x%x instead of 0x%x",
+		     node, ref, checkref);
+
+	p = fdt_getprop(fdt, node, "lref", &len);
+	if (!p)
+		FAIL("fdt_getprop(%d, \"lref\"): %s", node, fdt_strerror(len));
+	if (len != sizeof(*p))
+		FAIL("'lref' in node at %d has wrong size (%d instead of %d)",
+		     node, len, sizeof(*p));
+	ref = fdt32_to_cpu(*p);
+	if (ref != checkref)
+		FAIL("'lref' in node at %d has value 0x%x instead of 0x%x",
+		     node, ref, checkref);
+}
+
+int main(int argc, char *argv[])
+{
+	void *fdt;
+	int n1, n2, n3, n4;
+	uint32_t h1, h2, h4;
+
+	test_init(argc, argv);
+	fdt = load_blob_arg(argc, argv);
+
+	n1 = fdt_path_offset(fdt, "/node1");
+	if (n1 < 0)
+		FAIL("fdt_path_offset(/node1): %s", fdt_strerror(n1));
+	n2 = fdt_path_offset(fdt, "/node2");
+	if (n2 < 0)
+		FAIL("fdt_path_offset(/node2): %s", fdt_strerror(n2));
+	n3 = fdt_path_offset(fdt, "/node3");
+	if (n3 < 0)
+		FAIL("fdt_path_offset(/node3): %s", fdt_strerror(n3));
+	n4 = fdt_path_offset(fdt, "/node4");
+	if (n4 < 0)
+		FAIL("fdt_path_offset(/node4): %s", fdt_strerror(n4));
+
+	h1 = fdt_get_phandle(fdt, n1);
+	h2 = fdt_get_phandle(fdt, n2);
+	h4 = fdt_get_phandle(fdt, n4);
+
+	if (h1 != 0x2000)
+		FAIL("/node1 has wrong phandle, 0x%x instead of 0x%x",
+		     h1, 0x2000);
+	if (h2 != 0x1)
+		FAIL("/node2 has wrong phandle, 0x%x instead of 0x%x",
+		     h2, 0x1);
+	if ((h4 == 0x2000) || (h4 == 0x1) || (h4 == 0))
+		FAIL("/node4 has bad phandle, 0x%x", h4);
+
+	check_ref(fdt, n1, h2);
+	check_ref(fdt, n2, h1);
+	check_ref(fdt, n3, h4);
+
+	PASS();
+}


-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

^ permalink raw reply

* Re: [RFC] PMU: replace information ioctls and schedule for removal
From: Paul Mackerras @ 2007-11-12 23:15 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linuxppc-dev list
In-Reply-To: <1194885218.5229.47.camel@johannes.berg>

Johannes Berg writes:

> Does anybody need that? I'm not against adding it but we never showed it
> and I haven't seen anyone ask for it.

pmud uses the PMU version, but I think it gets it by issuing a PMU
command.

Paul.

^ permalink raw reply

* Re: Do not depend on MAX_ORDER when grouping pages by mobility
From: Stephen Rothwell @ 2007-11-13  0:44 UTC (permalink / raw)
  To: Mel Gorman; +Cc: ppc-dev
In-Reply-To: <20071112155452.GB6653@skynet.ie>

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

On Mon, 12 Nov 2007 15:54:53 +0000 mel@skynet.ie (Mel Gorman) wrote:
>
> Ordinarily, the size of a pageblock is determined from the hugepage size.
> On PPC64, the hugepage size is determined at runtime based on the ability
> of the machine. If the machine does not support hugepages, HPAGE_SHIFT is
> 0. This results in pageblock_order being set to -PAGE_SHIFT and a crash
> results shortly afterwards.
> 
> This patch checks that HPAGE_SHIFT is a sensible value before using the
> hugepage size. If it is 0, MAX_ORDER-1 is used instead as this is a sensible
> value of pageblock_order.
> 
> Signed-off-by: Mel Gorman <mel@csn.ul.ie>

Looks good. Legacy iSeries boots fine with this and David Gibson has run
his libhugetlbfs test suite on a Power5+ machine also running the same
kernel (ppc64_defconfig).

I would be good if we could get this in for 2.6.24 (since, as far as
legacy iSeries is concerned, this is a regression from 2.6.23).  I am not
sure what other testing needs to be done.

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply

* Re: [PATCH] cell: Convert #include of asm/of_{platform, device}.h into linux/of_{platform, device}.h.
From: Stephen Rothwell @ 2007-11-13  1:02 UTC (permalink / raw)
  To: Jon Loeliger; +Cc: linuxppc-dev@ozlabs.org
In-Reply-To: <1194899211.3396.15.camel@ld0161-tx32>

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

Hi Jon,

Thanks for this.

On Mon, 12 Nov 2007 14:26:51 -0600 Jon Loeliger <jdl@freescale.com> wrote:
>
> From: Jon Loeliger <jdl@freescale.com>
> 
> Signed-off-by: Jon Loeliger <jdl@freescale.com>

Acked-by: Stephen Rothwell <sfr@canb.auug.org.au> Built a ppc64_defconfig

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply

* Re: [PATCH v4 04/13] [POWERPC] Add generic support for simple MPC5200 based boards
From: Stephen Rothwell @ 2007-11-13  1:15 UTC (permalink / raw)
  To: Marian Balakowicz; +Cc: linuxppc-dev
In-Reply-To: <4738D218.9060503@semihalf.com>

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

On Mon, 12 Nov 2007 23:22:16 +0100 Marian Balakowicz <m8@semihalf.com> wrote:
>
> Stephen Rothwell wrote:
> > On Fri, 09 Nov 2007 18:12:02 +0100 Marian Balakowicz <m8@semihalf.com> wrote:
> >> +++ b/arch/powerpc/platforms/52xx/mpc5200_simple.c
> >>
> >> +static int __init mpc5200_simple_probe(void)
> >> +{
> >> +	unsigned long node = of_get_flat_dt_root();
> > 
> > You need to include asm/prom.h to use the flattened device tree accessors.
> 
> Right, but this one is already included in mpc52xx.h.

But you should directly include it since you are using stuff declared in
there.  Depending on indirect includes is fragile (someone might take it
out of mpc52xx.h one day).

> >> +	/* list of the supported boards */
> >> +	const char *board[] = {	
> >> +		"tqc,tqm5200",
> >> +		"promess,motionpro",
> >> +		"schindler,cm5200",
> >> +		NULL
> >> +	};
> > 
> > Make that static.
> 
> Board table is no longer needed after kernel is initialized, it would
> be nice to declare it static and __initdata, but that would be quite
> ugly as it's a table of pointers and each string would require
> separate statement too. If we don't do it then what's the benefit of
> making it static?

Except the way it currently is, the data stays in the kernel image.  If
you declared it static and __initdata then at least the table would
actually go away at run time.  True, to make the strings go away is
harder.

Doesn't actually matter much.

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply

* Re: [PATCH] sungem: fix suspend regression due to NAPI changes
From: David Miller @ 2007-11-13  2:09 UTC (permalink / raw)
  To: benh; +Cc: netdev, johannes, shemminger, linuxppc-dev
In-Reply-To: <1194906766.18185.79.camel@pasglop>

From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Date: Tue, 13 Nov 2007 09:32:46 +1100

> 
> On Mon, 2007-11-12 at 18:45 +0100, Johannes Berg wrote:
> > Commit bea3348e (the NAPI changes) made sungem unconditionally enable
> > NAPI when resuming and unconditionally disable when suspending, this,
> > however, makes napi_disable() hang when suspending when the interface
> > was taken down before suspend because taking the interface down also
> > disables NAPI. This patch makes touching the napi struct in
> > suspend/resume code paths depend on having the interface up, thereby
> > fixing the hang on suspend.
> > 
> > The patch also moves the napi_disable() in gem_close() under the lock so
> > that the NAPI state is always modified atomically together with the
> > "opened" variable.
> > 
> > Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
> 
> Thanks for fixing that !
> 
> Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

Indeed, thanks a lot Johannes.

Patch applied.

^ permalink raw reply


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