LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* 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

* [PATCH] powerpc: Fix early btext debug on PowerMac
From: Benjamin Herrenschmidt @ 2007-11-13  2:46 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev

The early btext debug wouldn't work on PowerMac when booted from BootX
due to the code looking for the wrong property name.

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

 arch/powerpc/kernel/btext.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Index: linux-work/arch/powerpc/kernel/btext.c
===================================================================
--- linux-work.orig/arch/powerpc/kernel/btext.c	2007-11-13 13:39:09.000000000 +1100
+++ linux-work/arch/powerpc/kernel/btext.c	2007-11-13 13:43:23.000000000 +1100
@@ -186,7 +186,9 @@ int btext_initialize(struct device_node 
 		pitch = *prop;
 	if (pitch == 1)
 		pitch = 0x1000;
-	prop = of_get_property(np, "address", NULL);
+	prop = of_get_property(np, "linux,bootx-addr", NULL);
+	if (prop == NULL)
+		prop = of_get_property(np, "address", NULL);
 	if (prop)
 		address = *prop;
 

^ permalink raw reply

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

Medve Emilian writes:

> Seems like there are R_PPC_REL24 with r_addend != 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
> != 0. In my test case, from 35K relocations, 7K are R_PPC_REL24 and from
> those only 8 have r_addend != 0.

I did a quick scan and the ones with r_addend != 0 all seem to be
references to .text from the .init.text, .exit.text or .fixup
sections.  Assuming we can get those allocated near each other they
shouldn't need trampolines.

Rusty, do we manage to put .init.text and .fixup near .text?

Also, do you know what we see in r_info for a relocation that is
relative to a section rather than a symbol?

Paul.

^ permalink raw reply

* printk/console_init
From: Siva Prasad @ 2007-11-13  2:54 UTC (permalink / raw)
  To: linuxppc-dev, linuxppc-embedded

Hi,

I am using 2.6.19 Linux on 8641D based system.

I am using early printk's and it works fine until console_init() is
executed. After that it does not, as the early printk's get disabled,
which is fine. However, I don't see any prints after that at all, that
are based on regular printk statements. I looked directly into the
memory at __log_buf and found all the print messages. It is just not
coming out to the serial port properly.

It would be great if some one can tell me various parameters that I need
to consider changing, to successfully port the serial driver for a new
board.

Based on the early printk's, I am getting the following messages...

Using MPC86xx HPCN machine description
Total memory =3D 1024MB; using 2048kB for hash table (at cfe00000)
Linux version 2.6.19 (sprasad@cider.bivio.net) (gcc version 4.1.1
20060525 (Red Hat 4.1.1-1)) #115 SMP Mon Nov 12 18:21:43 PST 2007
Found legacy serial port 0 for /soc8641@ff700000/serial@4500
  mem=3Dff704500, taddr=3Dff704500, irq=3D1a, clk=3D1496250, speed=3D0
Found MPC86xx PCIE host bridge at 0x00000000ff708000. Firmware bus
number: 0->254
Found MPC86xx PCIE host bridge at 0x00000000ff709000. Firmware bus
number: 0->255
MPC86xx HPCN board from Freescale Semiconductor
Zone PFN ranges:
  DMA             0 ->   196608
  Normal     196608 ->   196608
  HighMem    196608 ->   262144
early_node_map[1] active PFN ranges
    0:        0 ->   262144
start_kernel: 8 22000000.
Built 1 zonelists.  Total pages: 260096
Kernel command line: console=3DttyS0,115200 root=3D/dev/sda8
mpic: Setting up MPIC " MPIC     " version 1.2 at ff740000, max 2 CPUs
mpic: ISU size: 16, shift: 4, mask: f
mpic: Initializing for 80 sources
PID hash table entries: 4096 (order: 12, 16384 bytes)
time_init: decrementer frequency =3D 150.000000 MHz
time_init: processor frequency   =3D 1496.250000 MHz
<........ Nothing gets printed after this .......>

Thanks
Siva

^ permalink raw reply

* Re: [PATCH 1/3] powerpc: mv64x60 - Fix PCI MEM->System Mem window setup
From: Paul Mackerras @ 2007-11-13  2:59 UTC (permalink / raw)
  To: Mark A. Greer; +Cc: linuxppc-dev
In-Reply-To: <20071108015415.GA14900@mag.az.mvista.com>

Mark A. Greer writes:

> mv64x60_config_pci_windows() is now changed to make the windows match
> as described above.
> 
> Signed-off-by: Mark A. Greer <mgreer@mvista.com>

Are any of this series required for 2.6.24?

Paul.

^ permalink raw reply

* how to improve linux tcp/ip(UDP) efficiency on mpc8541 833Mhz.
From: huangyun @ 2007-11-13  2:48 UTC (permalink / raw)
  To: linuxppc-embedded


hi,everbody:
      I have run linux-2.6.15 on my mpc8541 custom board. but when i test
TSEC use UDP, i found it's efficinecy is lower.
my test enviroment: i only run a UDP recieve program and not to handle data
recieved. when i recevie 400Mbps data, 79% of MPC8541 have be consumed.
so i think tcp/ip protocal have consume my mpc8541 resource.  i dont know
how to improve tcp/ip code or TSEC driver(gianfar.c).
      can somebody help me ?



 lucky.huang

^ permalink raw reply

* Re: MPC5200B - Mapping Micrel Ethernet Controller Chip
From: Grant Likely @ 2007-11-13  3:50 UTC (permalink / raw)
  To: Sri nava kala devi Valteti, TLS-Chennai
  Cc: Prakash Palanisamy, TLS-Chennai, linuxppc-embedded
In-Reply-To: <66E8AEE9980BB44CA5FCAD39EBA56AC602D55576@CHN-HCLT-EVS02.HCLT.CORP.HCL.IN>

On 11/12/07, Sri nava kala devi Valteti, TLS-Chennai
<srinavakalav@hcl.in> wrote:
>
> We are using MPC5200B based custom board. In that we have an external Micrel's ethernet controller mapped at 0xE0000000.
>
> We have taken Lite5200 code as a reference to port linux to our new board. We have integrated the ethernet driver given by the vendor (Micrel).
>
> Unfortunately, we are not able to access the chip mapped at 0xE0000000.

Are you *sure* it's mapped at physical address 0xe0000000? (ie. have
you verified that you can access the device registers via u-boot or a
debugger?)  The chip selects on the 5200 are programmable so you need
to make sure that the chip select wired to the Micrel device is
actually configured for base address 0xe0000000.

There are up to 8 CS pins on the MPC5200B; LP_CS0 through LP_CS7.  See
section 9.7.1 in the MPC5200B user manual for details on how to
configure them.

> We performed the following steps to access the chip:
>
> i) We mapped this address range of the Ethernet Controller Chip in function "mpc52xx_map_io" as
>
> "io_block_mapping(0xE0000000, 0xE0000000, 0x10000000, _PAGE_IO)"

You don't want to call this.  ioremap is the only function you should
need to call.  But *first*, you must make sure the CS pin is
configured correctly.

Cheers,
g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
grant.likely@secretlab.ca
(403) 399-0195

^ permalink raw reply

* Re: [PATCH] [POWERPC] Optimize counting distinct entries in therelocation sections
From: Rusty Russell @ 2007-11-13  4:27 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: sfr, linuxppc-embedded, linuxppc-dev
In-Reply-To: <18233.4267.193447.339119@cargo.ozlabs.ibm.com>

On Tuesday 13 November 2007 13:49:15 Paul Mackerras wrote:
> Medve Emilian writes:
> > Seems like there are R_PPC_REL24 with r_addend != 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
> > != 0. In my test case, from 35K relocations, 7K are R_PPC_REL24 and from
> > those only 8 have r_addend != 0.
>
> I did a quick scan and the ones with r_addend != 0 all seem to be
> references to .text from the .init.text, .exit.text or .fixup
> sections.  Assuming we can get those allocated near each other they
> shouldn't need trampolines.
>
> Rusty, do we manage to put .init.text and .fixup near .text?

Definitely not.  That's why we trampoline between them.  But since we discard 
the init sections and the tramps with them, I wouldn't bother uniquifing 
them: just alloc that many.

> Also, do you know what we see in r_info for a relocation that is
> relative to a section rather than a symbol?

Can't remember off the top of my head, sorry.

Rusty.

^ permalink raw reply

* [PATCH] [POWERPC] Silence an annoying boot message
From: Stephen Rothwell @ 2007-11-13  4:41 UTC (permalink / raw)
  To: paulus; +Cc: Olof Johansson, ppc-dev
In-Reply-To: <1194857556.18185.33.camel@pasglop>

vmemmap_populate will printk (with KERN_WARNING) for a lot of pages
if CONFIG_SPARSEMEM_VMEMMAP is enabled (at least it does on iSeries).
Use pr_debug for it instead.

Replace the only other use of DBG in this file with pr_debug as well.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 arch/powerpc/mm/init_64.c |   16 ++++------------
 1 files changed, 4 insertions(+), 12 deletions(-)

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --git a/arch/powerpc/mm/init_64.c b/arch/powerpc/mm/init_64.c
index d9c82d3..c0f5cff 100644
--- a/arch/powerpc/mm/init_64.c
+++ b/arch/powerpc/mm/init_64.c
@@ -19,8 +19,6 @@
  *
  */
 
-#undef DEBUG
-
 #include <linux/signal.h>
 #include <linux/sched.h>
 #include <linux/kernel.h>
@@ -66,12 +64,6 @@
 
 #include "mmu_decl.h"
 
-#ifdef DEBUG
-#define DBG(fmt...) printk(fmt)
-#else
-#define DBG(fmt...)
-#endif
-
 #if PGTABLE_RANGE > USER_VSID_RANGE
 #warning Limited user VSID range means pagetable space is wasted
 #endif
@@ -175,8 +167,8 @@ void pgtable_cache_init(void)
 		int size = pgtable_cache_size[i];
 		const char *name = pgtable_cache_name[i];
 
-		DBG("Allocating page table cache %s (#%d) "
-		    "for size: %08x...\n", name, i, size);
+		pr_debug("Allocating page table cache %s (#%d) "
+			"for size: %08x...\n", name, i, size);
 		pgtable_cache[i] = kmem_cache_create(name,
 						     size, size,
 						     SLAB_PANIC,
@@ -239,8 +231,8 @@ int __meminit vmemmap_populate(struct page *start_page,
 		if (!p)
 			return -ENOMEM;
 
-		printk(KERN_WARNING "vmemmap %08lx allocated at %p, "
-		                    "physical %08lx.\n", start, p, __pa(p));
+		pr_debug("vmemmap %08lx allocated at %p, physical %08lx.\n",
+			start, p, __pa(p));
 
 		mapped = htab_bolt_mapping(start, start + page_size,
 					__pa(p), mode_rw, mmu_linear_psize,
-- 
1.5.3.5

^ permalink raw reply related

* [PATCH 1/2] powerpc: Make isa_mem_base common to 32 and 64 bits
From: Benjamin Herrenschmidt @ 2007-11-13  4:43 UTC (permalink / raw)
  To: linuxppc-dev

This defines isa_mem_base on both 32 and 64 bits (it used to be 32 bits
only). This avoids a few ifdef's in later patches and potentially can
allow support for VGA text mode on 64 bits powerpc.

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

Small cleanup pre-requisite for my next patch

 arch/powerpc/kernel/pci-common.c |    4 ++++
 arch/powerpc/kernel/pci_32.c     |    1 -
 include/asm-powerpc/io.h         |    5 +++--
 3 files changed, 7 insertions(+), 3 deletions(-)

Index: linux-work/arch/powerpc/kernel/pci-common.c
===================================================================
--- linux-work.orig/arch/powerpc/kernel/pci-common.c	2007-11-13 14:11:11.000000000 +1100
+++ linux-work/arch/powerpc/kernel/pci-common.c	2007-11-13 14:15:43.000000000 +1100
@@ -52,6 +52,10 @@ int global_phb_number;		/* Global phb co
 
 extern struct list_head hose_list;
 
+/* ISA Memory physical address (or 0 if none) */
+resource_size_t isa_mem_base    = 0;
+
+
 /*
  * pci_controller(phb) initialized common variables.
  */
Index: linux-work/include/asm-powerpc/io.h
===================================================================
--- linux-work.orig/include/asm-powerpc/io.h	2007-11-13 14:12:01.000000000 +1100
+++ linux-work/include/asm-powerpc/io.h	2007-11-13 14:12:48.000000000 +1100
@@ -50,15 +50,16 @@ extern int check_legacy_ioport(unsigned 
 #define PCI_DRAM_OFFSET	pci_dram_offset
 #else
 #define _IO_BASE	pci_io_base
-#define _ISA_MEM_BASE	0
+#define _ISA_MEM_BASE	isa_mem_base
 #define PCI_DRAM_OFFSET	0
 #endif
 
 extern unsigned long isa_io_base;
-extern unsigned long isa_mem_base;
 extern unsigned long pci_io_base;
 extern unsigned long pci_dram_offset;
 
+extern resource_size_t isa_mem_base;
+
 #if defined(CONFIG_PPC32) && defined(CONFIG_PPC_INDIRECT_IO)
 #error CONFIG_PPC_INDIRECT_IO is not yet supported on 32 bits
 #endif
Index: linux-work/arch/powerpc/kernel/pci_32.c
===================================================================
--- linux-work.orig/arch/powerpc/kernel/pci_32.c	2007-11-13 14:16:15.000000000 +1100
+++ linux-work/arch/powerpc/kernel/pci_32.c	2007-11-13 14:16:17.000000000 +1100
@@ -32,7 +32,6 @@
 #endif
 
 unsigned long isa_io_base     = 0;
-unsigned long isa_mem_base    = 0;
 unsigned long pci_dram_offset = 0;
 int pcibios_assign_bus_offset = 1;
 

^ permalink raw reply

* [PATCH 2/2] powerpc: Merge pci_process_bridge_OF_ranges()
From: Benjamin Herrenschmidt @ 2007-11-13  4:43 UTC (permalink / raw)
  To: linuxppc-dev

This patch merges the 32 and 64 bits implementations of
pci_process_bridge_OF_ranges(). The new function is cleaner than both
the old ones supports 64 bits ranges on ppc32 which is necessary for
the 4xx port.

It also adds some better (hopefully) output to the kernel log which
should help disagnose problems and makes better use of existing OF
parsing helpers (avoiding a few bugs of both implementations along
the way).

There are still a few unfortunate ifdef's but there is no way around
these for now at least not until some other bits of the PCI code are
made common.

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

Tested on a few pSeries, PowerMac G5, and a 32 bits PowerMacs and
a BriQ. Please let me know if it misbehaves anywhere else.

 arch/powerpc/kernel/pci-common.c |  176 +++++++++++++++++++++++++++++++++++++++
 arch/powerpc/kernel/pci_32.c     |  114 -------------------------
 arch/powerpc/kernel/pci_64.c     |   93 --------------------
 include/asm-powerpc/pci-bridge.h |    1 
 4 files changed, 177 insertions(+), 207 deletions(-)

Index: linux-work/arch/powerpc/kernel/pci-common.c
===================================================================
--- linux-work.orig/arch/powerpc/kernel/pci-common.c	2007-11-13 14:15:43.000000000 +1100
+++ linux-work/arch/powerpc/kernel/pci-common.c	2007-11-13 14:41:54.000000000 +1100
@@ -479,3 +479,179 @@ void pci_resource_to_user(const struct p
 	*start = rsrc->start - offset;
 	*end = rsrc->end - offset;
 }
+
+/**
+ * pci_process_bridge_OF_ranges - Parse PCI bridge resources from device tree
+ * @hose: newly allocated pci_controller to be setup
+ * @dev: device node of the host bridge
+ * @primary: set if primary bus (32 bits only, soon to be deprecated)
+ *
+ * This function will parse the "ranges" property of a PCI host bridge device
+ * node and setup the resource mapping of a pci controller based on its
+ * content.
+ *
+ * Life would be boring if it wasn't for a few issues that we have to deal
+ * with here:
+ *
+ *   - We can only cope with one IO space range and up to 3 Memory space
+ *     ranges. However, some machines (thanks Apple !) tend to split their
+ *     space into lots of small contiguous ranges. So we have to coalesce.
+ *
+ *   - We can only cope with all memory ranges having the same offset
+ *     between CPU addresses and PCI addresses. Unfortunately, some bridges
+ *     are setup for a large 1:1 mapping along with a small "window" which
+ *     maps PCI address 0 to some arbitrary high address of the CPU space in
+ *     order to give access to the ISA memory hole.
+ *     The way out of here that I've chosen for now is to always set the
+ *     offset based on the first resource found, then override it if we
+ *     have a different offset and the previous was set by an ISA hole.
+ *
+ *   - Some busses have IO space not starting at 0, which causes trouble with
+ *     the way we do our IO resource renumbering. The code somewhat deals with
+ *     it for 64 bits but I would expect problems on 32 bits.
+ *
+ *   - Some 32 bits platforms such as 4xx can have physical space larger than
+ *     32 bits so we need to use 64 bits values for the parsing
+ */
+void __devinit pci_process_bridge_OF_ranges(struct pci_controller *hose,
+					    struct device_node *dev,
+					    int primary)
+{
+	const u32 *ranges;
+	int rlen;
+	int pna = of_n_addr_cells(dev);
+	int np = pna + 5;
+	int memno = 0, isa_hole = -1;
+	u32 pci_space;
+	unsigned long long pci_addr, cpu_addr, pci_next, cpu_next, size;
+	unsigned long long isa_mb = 0;
+	struct resource *res;
+
+	printk(KERN_INFO "PCI host bridge %s %s ranges:\n",
+	       dev->full_name, primary ? "(primary)" : "");
+
+	/* Get ranges property */
+	ranges = of_get_property(dev, "ranges", &rlen);
+	if (ranges == NULL)
+		return;
+
+	/* Parse it */
+	while ((rlen -= np * 4) >= 0) {
+		/* Read next ranges element */
+		pci_space = ranges[0];
+		pci_addr = of_read_number(ranges + 1, 2);
+		cpu_addr = of_translate_address(dev, ranges + 3);
+		size = of_read_number(ranges + pna + 3, 2);
+		ranges += np;
+		if (cpu_addr == OF_BAD_ADDR || size == 0)
+			continue;
+
+		/* Now consume following elements while they are contiguous */
+		for (;rlen >= np * sizeof(u32); ranges += np, rlen -= np * 4) {
+			if (ranges[0] != pci_space)
+				break;
+			pci_next = of_read_number(ranges + 1, 2);
+			cpu_next = of_translate_address(dev, ranges + 3);
+			if (pci_next != pci_addr + size ||
+			    cpu_next != cpu_addr + size)
+				break;
+			size += of_read_number(ranges + pna + 3, 2);
+		}
+
+		/* Act based on address space type */
+		res = NULL;
+		switch ((pci_space >> 24) & 0x3) {
+		case 1:		/* PCI IO space */
+			printk(KERN_INFO
+			       "  IO 0x%016llx..0x%016llx -> 0x%016llx\n",
+			       cpu_addr, cpu_addr + size - 1, pci_addr);
+
+			/* We support only one IO range */
+			if (hose->pci_io_size) {
+				printk(KERN_WARNING
+				       " \\--> Skipped (too many) !\n");
+				continue;
+			}
+#ifdef CONFIG_PPC32
+			/* On 32 bits, limit I/O space to 16MB */
+			if (size > 0x01000000)
+				size = 0x01000000;
+
+			/* 32 bits needs to map IOs here */
+			hose->io_base_virt = ioremap(cpu_addr, size);
+
+			/* Expect trouble if pci_addr is not 0 */
+			if (primary)
+				isa_io_base =
+					(unsigned long)hose->io_base_virt;
+#endif /* CONFIG_PPC32 */
+			/* pci_io_size and io_base_phys always represent IO
+			 * space starting at 0 so we factor in pci_addr
+			 */
+			hose->pci_io_size = pci_addr + size;
+			hose->io_base_phys = cpu_addr - pci_addr;
+
+			/* Build resource */
+			res = &hose->io_resource;
+			res->flags = IORESOURCE_IO;
+			res->start = pci_addr;
+			break;
+		case 2:		/* PCI Memory space */
+			printk(KERN_INFO
+			       " MEM 0x%016llx..0x%016llx -> 0x%016llx %s\n",
+			       cpu_addr, cpu_addr + size - 1, pci_addr,
+			       (pci_space & 0x40000000) ? "Prefetch" : "");
+
+			/* We support only 3 memory ranges */
+			if (memno >= 3) {
+				printk(KERN_WARNING
+				       " \\--> Skipped (too many) !\n");
+				continue;
+			}
+			/* Handles ISA memory hole space here */
+			if (pci_addr == 0) {
+				isa_mb = cpu_addr;
+				isa_hole = memno;
+				if (primary)
+					isa_mem_base = cpu_addr;
+			}
+
+			/* We get the PCI/Mem offset from the first range or the,
+			 * current one if the offset came from an ISA hole.
+			 * If they don't match, bugger.
+			 */
+			if (memno == 0 ||
+			    (isa_hole >= 0 && pci_addr != 0 &&
+			     hose->pci_mem_offset == isa_mb))
+				hose->pci_mem_offset = cpu_addr - pci_addr;
+			else if (pci_addr != 0 &&
+				 hose->pci_mem_offset != cpu_addr - pci_addr) {
+				printk(KERN_WARNING
+				       " \\--> Skipped (offset mismatch) !\n");
+				continue;
+			}
+
+			/* Build resource */
+			res = &hose->mem_resources[memno++];
+			res->flags = IORESOURCE_MEM;
+			if (pci_space & 0x40000000)
+				res->flags |= IORESOURCE_PREFETCH;
+			res->start = cpu_addr;
+			break;
+		}
+		if (res != NULL) {
+			res->name = dev->full_name;
+			res->end = res->start + size - 1;
+			res->parent = NULL;
+			res->sibling = NULL;
+			res->child = NULL;
+		}
+	}
+
+	/* Out of paranoia, let's put the ISA hole last if any */
+	if (isa_hole >= 0 && memno > 0 && isa_hole != (memno-1)) {
+		struct resource tmp = hose->mem_resources[isa_hole];
+		hose->mem_resources[isa_hole] = hose->mem_resources[memno-1];
+		hose->mem_resources[memno-1] = tmp;
+	}
+}
Index: linux-work/arch/powerpc/kernel/pci_32.c
===================================================================
--- linux-work.orig/arch/powerpc/kernel/pci_32.c	2007-11-13 14:16:17.000000000 +1100
+++ linux-work/arch/powerpc/kernel/pci_32.c	2007-11-13 14:16:24.000000000 +1100
@@ -842,120 +842,6 @@ pci_device_from_OF_node(struct device_no
 }
 EXPORT_SYMBOL(pci_device_from_OF_node);
 
-void __init
-pci_process_bridge_OF_ranges(struct pci_controller *hose,
-			   struct device_node *dev, int primary)
-{
-	static unsigned int static_lc_ranges[256] __initdata;
-	const unsigned int *dt_ranges;
-	unsigned int *lc_ranges, *ranges, *prev, size;
-	int rlen = 0, orig_rlen;
-	int memno = 0;
-	struct resource *res;
-	int np, na = of_n_addr_cells(dev);
-	np = na + 5;
-
-	/* First we try to merge ranges to fix a problem with some pmacs
-	 * that can have more than 3 ranges, fortunately using contiguous
-	 * addresses -- BenH
-	 */
-	dt_ranges = of_get_property(dev, "ranges", &rlen);
-	if (!dt_ranges)
-		return;
-	/* Sanity check, though hopefully that never happens */
-	if (rlen > sizeof(static_lc_ranges)) {
-		printk(KERN_WARNING "OF ranges property too large !\n");
-		rlen = sizeof(static_lc_ranges);
-	}
-	lc_ranges = static_lc_ranges;
-	memcpy(lc_ranges, dt_ranges, rlen);
-	orig_rlen = rlen;
-
-	/* Let's work on a copy of the "ranges" property instead of damaging
-	 * the device-tree image in memory
-	 */
-	ranges = lc_ranges;
-	prev = NULL;
-	while ((rlen -= np * sizeof(unsigned int)) >= 0) {
-		if (prev) {
-			if (prev[0] == ranges[0] && prev[1] == ranges[1] &&
-				(prev[2] + prev[na+4]) == ranges[2] &&
-				(prev[na+2] + prev[na+4]) == ranges[na+2]) {
-				prev[na+4] += ranges[na+4];
-				ranges[0] = 0;
-				ranges += np;
-				continue;
-			}
-		}
-		prev = ranges;
-		ranges += np;
-	}
-
-	/*
-	 * The ranges property is laid out as an array of elements,
-	 * each of which comprises:
-	 *   cells 0 - 2:	a PCI address
-	 *   cells 3 or 3+4:	a CPU physical address
-	 *			(size depending on dev->n_addr_cells)
-	 *   cells 4+5 or 5+6:	the size of the range
-	 */
-	ranges = lc_ranges;
-	rlen = orig_rlen;
-	while (ranges && (rlen -= np * sizeof(unsigned int)) >= 0) {
-		res = NULL;
-		size = ranges[na+4];
-		switch ((ranges[0] >> 24) & 0x3) {
-		case 1:		/* I/O space */
-			if (ranges[2] != 0)
-				break;
-			hose->io_base_phys = ranges[na+2];
-			/* limit I/O space to 16MB */
-			if (size > 0x01000000)
-				size = 0x01000000;
-			hose->io_base_virt = ioremap(ranges[na+2], size);
-			if (primary)
-				isa_io_base = (unsigned long) hose->io_base_virt;
-			res = &hose->io_resource;
-			res->flags = IORESOURCE_IO;
-			res->start = ranges[2];
-			DBG("PCI: IO 0x%llx -> 0x%llx\n",
-			    (u64)res->start, (u64)res->start + size - 1);
-			break;
-		case 2:		/* memory space */
-			memno = 0;
-			if (ranges[1] == 0 && ranges[2] == 0
-			    && ranges[na+4] <= (16 << 20)) {
-				/* 1st 16MB, i.e. ISA memory area */
-				if (primary)
-					isa_mem_base = ranges[na+2];
-				memno = 1;
-			}
-			while (memno < 3 && hose->mem_resources[memno].flags)
-				++memno;
-			if (memno == 0)
-				hose->pci_mem_offset = ranges[na+2] - ranges[2];
-			if (memno < 3) {
-				res = &hose->mem_resources[memno];
-				res->flags = IORESOURCE_MEM;
-				if(ranges[0] & 0x40000000)
-					res->flags |= IORESOURCE_PREFETCH;
-				res->start = ranges[na+2];
-				DBG("PCI: MEM[%d] 0x%llx -> 0x%llx\n", memno,
-				    (u64)res->start, (u64)res->start + size - 1);
-			}
-			break;
-		}
-		if (res != NULL) {
-			res->name = dev->full_name;
-			res->end = res->start + size - 1;
-			res->parent = NULL;
-			res->sibling = NULL;
-			res->child = NULL;
-		}
-		ranges += np;
-	}
-}
-
 /* We create the "pci-OF-bus-map" property now so it appears in the
  * /proc device tree
  */
Index: linux-work/arch/powerpc/kernel/pci_64.c
===================================================================
--- linux-work.orig/arch/powerpc/kernel/pci_64.c	2007-11-13 14:15:43.000000000 +1100
+++ linux-work/arch/powerpc/kernel/pci_64.c	2007-11-13 14:16:24.000000000 +1100
@@ -592,99 +592,6 @@ int pci_proc_domain(struct pci_bus *bus)
 	}
 }
 
-void __devinit pci_process_bridge_OF_ranges(struct pci_controller *hose,
-					    struct device_node *dev, int prim)
-{
-	const unsigned int *ranges;
-	unsigned int pci_space;
-	unsigned long size;
-	int rlen = 0;
-	int memno = 0;
-	struct resource *res;
-	int np, na = of_n_addr_cells(dev);
-	unsigned long pci_addr, cpu_phys_addr;
-
-	np = na + 5;
-
-	/* From "PCI Binding to 1275"
-	 * The ranges property is laid out as an array of elements,
-	 * each of which comprises:
-	 *   cells 0 - 2:	a PCI address
-	 *   cells 3 or 3+4:	a CPU physical address
-	 *			(size depending on dev->n_addr_cells)
-	 *   cells 4+5 or 5+6:	the size of the range
-	 */
-	ranges = of_get_property(dev, "ranges", &rlen);
-	if (ranges == NULL)
-		return;
-	hose->io_base_phys = 0;
-	while ((rlen -= np * sizeof(unsigned int)) >= 0) {
-		res = NULL;
-		pci_space = ranges[0];
-		pci_addr = ((unsigned long)ranges[1] << 32) | ranges[2];
-		cpu_phys_addr = of_translate_address(dev, &ranges[3]);
-		size = ((unsigned long)ranges[na+3] << 32) | ranges[na+4];
-		ranges += np;
-		if (size == 0)
-			continue;
-
-		/* Now consume following elements while they are contiguous */
-		while (rlen >= np * sizeof(unsigned int)) {
-			unsigned long addr, phys;
-
-			if (ranges[0] != pci_space)
-				break;
-			addr = ((unsigned long)ranges[1] << 32) | ranges[2];
-			phys = ranges[3];
-			if (na >= 2)
-				phys = (phys << 32) | ranges[4];
-			if (addr != pci_addr + size ||
-			    phys != cpu_phys_addr + size)
-				break;
-
-			size += ((unsigned long)ranges[na+3] << 32)
-				| ranges[na+4];
-			ranges += np;
-			rlen -= np * sizeof(unsigned int);
-		}
-
-		switch ((pci_space >> 24) & 0x3) {
-		case 1:		/* I/O space */
-			hose->io_base_phys = cpu_phys_addr - pci_addr;
-			/* handle from 0 to top of I/O window */
-			hose->pci_io_size = pci_addr + size;
-
-			res = &hose->io_resource;
-			res->flags = IORESOURCE_IO;
-			res->start = pci_addr;
-			DBG("phb%d: IO 0x%lx -> 0x%lx\n", hose->global_number,
-				    res->start, res->start + size - 1);
-			break;
-		case 2:		/* memory space */
-			memno = 0;
-			while (memno < 3 && hose->mem_resources[memno].flags)
-				++memno;
-
-			if (memno == 0)
-				hose->pci_mem_offset = cpu_phys_addr - pci_addr;
-			if (memno < 3) {
-				res = &hose->mem_resources[memno];
-				res->flags = IORESOURCE_MEM;
-				res->start = cpu_phys_addr;
-				DBG("phb%d: MEM 0x%lx -> 0x%lx\n", hose->global_number,
-					    res->start, res->start + size - 1);
-			}
-			break;
-		}
-		if (res != NULL) {
-			res->name = dev->full_name;
-			res->end = res->start + size - 1;
-			res->parent = NULL;
-			res->sibling = NULL;
-			res->child = NULL;
-		}
-	}
-}
 
 #ifdef CONFIG_HOTPLUG
 
Index: linux-work/include/asm-powerpc/pci-bridge.h
===================================================================
--- linux-work.orig/include/asm-powerpc/pci-bridge.h	2007-11-13 14:15:43.000000000 +1100
+++ linux-work/include/asm-powerpc/pci-bridge.h	2007-11-13 14:16:24.000000000 +1100
@@ -27,6 +27,7 @@ struct pci_controller {
 
 	void __iomem *io_base_virt;
 	resource_size_t io_base_phys;
+	resource_size_t pci_io_size;
 
 	/* Some machines (PReP) have a non 1:1 mapping of
 	 * the PCI memory space in the CPU bus space

^ 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