* dtc: Use for_each_marker_of_type in asm_emit_data()
From: David Gibson @ 2008-02-28 9:58 UTC (permalink / raw)
To: Jon Loeliger; +Cc: linuxppc-dev
For no good reason, asm_emit_data() open-codes the equivalent of the
for_each_marker_of_type macro. Use the macro instead.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---
flattree.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
Index: dtc/flattree.c
===================================================================
--- dtc.orig/flattree.c 2008-02-28 20:53:51.000000000 +1100
+++ dtc/flattree.c 2008-02-28 20:56:56.000000000 +1100
@@ -162,14 +162,10 @@
{
FILE *f = e;
int off = 0;
- struct marker *m;
+ struct marker *m = d.markers;
- m = d.markers;
- while (m) {
- if (m->type == LABEL)
- emit_offset_label(f, m->ref, m->offset);
- m = m->next;
- }
+ for_each_marker_of_type(m, LABEL)
+ emit_offset_label(f, m->ref, m->offset);
while ((d.len - off) >= sizeof(u32)) {
fprintf(f, "\t.long\t0x%x\n",
--
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
* dtc: Test and fix conversion to/from old dtb versions
From: David Gibson @ 2008-02-28 9:55 UTC (permalink / raw)
To: Jon Loeliger; +Cc: linuxppc-dev
This patch adds testcases which test dtc when used to convert between
different dtb versions. These tests uncovered a couple of bugs
handling old dtb versions, which are also fixed.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Index: dtc/tests/run_tests.sh
===================================================================
--- dtc.orig/tests/run_tests.sh 2008-02-28 16:58:46.000000000 +1100
+++ dtc/tests/run_tests.sh 2008-02-28 20:53:39.000000000 +1100
@@ -173,6 +173,19 @@
run_test dtbs_equal_ordered $tree odts_$tree.test.dtb
done
+ # Check version conversions
+ for tree in test_tree1.dtb ; do
+ for aver in 1 2 3 16 17; do
+ atree="ov${aver}_$tree.test.dtb"
+ run_test dtc.sh -I dtb -O dtb -V$aver -o $atree $tree
+ for bver in 16 17; do
+ btree="ov${bver}_$atree"
+ run_test dtc.sh -I dtb -O dtb -V$bver -o $btree $atree
+ run_test dtbs_equal_ordered $btree $tree
+ done
+ done
+ done
+
# Check some checks
run_test dtc-checkfails.sh duplicate_node_names -- -I dts -O dtb dup-nodename.dts
run_test dtc-checkfails.sh duplicate_property_names -- -I dts -O dtb dup-propname.dts
Index: dtc/flattree.c
===================================================================
--- dtc.orig/flattree.c 2008-02-28 17:02:36.000000000 +1100
+++ dtc/flattree.c 2008-02-28 20:53:39.000000000 +1100
@@ -410,7 +410,7 @@
* the reserve buffer, add the reserve map terminating zeroes,
* the device tree itself, and finally the strings.
*/
- blob = data_append_data(blob, &fdt, sizeof(fdt));
+ blob = data_append_data(blob, &fdt, vi->hdr_size);
blob = data_append_align(blob, 8);
blob = data_merge(blob, reservebuf);
blob = data_append_zeroes(blob, sizeof(struct fdt_reserve_entry));
@@ -809,7 +809,7 @@
struct boot_info *dt_from_blob(FILE *f)
{
- u32 magic, totalsize, version, size_str, size_dt;
+ u32 magic, totalsize, version, size_dt;
u32 off_dt, off_str, off_mem_rsvmap;
int rc;
char *blob;
@@ -889,11 +889,13 @@
if (off_str > totalsize)
die("String table offset exceeds total size\n");
- size_str = -1;
if (version >= 3) {
- size_str = be32_to_cpu(fdt->size_dt_strings);
+ u32 size_str = be32_to_cpu(fdt->size_dt_strings);
if (off_str+size_str > totalsize)
die("String table extends past total size\n");
+ inbuf_init(&strbuf, blob + off_str, blob + off_str + size_str);
+ } else {
+ inbuf_init(&strbuf, blob + off_str, blob + totalsize);
}
if (version >= 17) {
@@ -911,10 +913,6 @@
inbuf_init(&memresvbuf,
blob + off_mem_rsvmap, blob + totalsize);
inbuf_init(&dtbuf, blob + off_dt, blob + totalsize);
- if (size_str >= 0)
- inbuf_init(&strbuf, blob + off_str, blob + off_str + size_str);
- else
- inbuf_init(&strbuf, blob + off_str, blob + totalsize);
reservelist = flat_read_mem_reserve(&memresvbuf);
--
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
* dtc: Strip redundant "name" properties
From: David Gibson @ 2008-02-28 9:53 UTC (permalink / raw)
To: Jon Loeliger; +Cc: linuxppc-dev
If an input device tree has "name" properties which are correct, then
they are redundant (because they can be derived from the unit name).
Therefore, extend the checking code for correctness of "name"
properties to remove them if they are correct. dtc will still insert
name properties in the output if that's of a sufficiently old version
to require them.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Index: dtc/checks.c
===================================================================
--- dtc.orig/checks.c 2008-02-27 15:07:31.000000000 +1100
+++ dtc/checks.c 2008-02-27 21:00:30.000000000 +1100
@@ -316,9 +316,14 @@
static void check_name_properties(struct check *c, struct node *root,
struct node *node)
{
- struct property *prop;
+ struct property **pp, *prop = NULL;
+
+ for (pp = &node->proplist; *pp; pp = &((*pp)->next))
+ if (streq((*pp)->name, "name")) {
+ prop = *pp;
+ break;
+ }
- prop = get_property(node, "name");
if (!prop)
return; /* No name property, that's fine */
@@ -326,6 +331,12 @@
|| (memcmp(prop->val.val, node->name, node->basenamelen) != 0))
FAIL(c, "\"name\" property in %s is incorrect (\"%s\" instead"
" of base node name)", node->fullpath, prop->val.val);
+
+ /* The name property is correct, and therefore redundant. Delete it */
+ *pp = prop->next;
+ free(prop->name);
+ data_free(prop->val);
+ free(prop);
}
CHECK_IS_STRING(name_is_string, "name", ERROR);
NODE_CHECK(name_properties, NULL, ERROR, &name_is_string);
--
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: [PATCH 1/2] firewire: endianess fix
From: Stefan Richter @ 2008-02-28 8:41 UTC (permalink / raw)
To: benh
Cc: Kristian Hoegsberg, linux-kernel, linuxppc-dev, sparclinux,
linux1394-devel, Sam Ravnborg, Harvey Harrison
In-Reply-To: <1204166506.15052.336.camel@pasglop>
Benjamin Herrenschmidt wrote:
> Do we have the workaround for the old Apple UniNorth in the new FW OHCI
> driver (for selfID swapping iirc ?)
According to ohci1394.c, it selfIDs and headers of incoming packets are
not byte-swapped by the old Apple Uninorth FireWire part. And no,
firewire-ohci doesn't have the workaround yet.
It should be trivial to copy'n'paste ohci1394's workaround into fw-ohci,
but it would be good if someone could test before and after.
BTW, since that code is touched everytime a packet is received, we
should enclose such a workaround in #ifdef CONFIG_PPC_PMAC &&
CONFIG_PPC32, shouldn't we? (As a second step after adding the workaround.)
--
Stefan Richter
-=====-==--- --=- ===--
http://arcgraph.de/sr/
^ permalink raw reply
* Re: 2.6.25-rc3 on mpc8548amc doesn't boot
From: maxime louvel @ 2008-02-28 8:31 UTC (permalink / raw)
To: Kumar Gala; +Cc: linuxppc-embedded
In-Reply-To: <dda529d0802272356p5db9066s5a9aaa336e74ab81@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1535 bytes --]
Hi,
I have a question for submitting my changes:
As I said I have commented a few line in arch/powerpc/boot/Makefile
#$(obj)/4xx.o: BOOTCFLAGS += -mcpu=405
#$(obj)/ebony.o: BOOTCFLAGS += -mcpu=405
#$(obj)/cuboot-taishan.o: BOOTCFLAGS += -mcpu=405
#$(obj)/cuboot-katmai.o: BOOTCFLAGS += -mcpu=405
#$(obj)/treeboot-walnut.o: BOOTCFLAGS += -mcpu=40
I guess that shouldn't be integrated in my patch, should I ?
For what I have found on websearch that should come from my gcc version (
3.4.3 with specific stuff).
But still I needed that...
thanks,
Maxime
On Thu, Feb 28, 2008 at 7:56 AM, maxime louvel <m.louvel@gmail.com> wrote:
> Hi,
>
> I wanted first to check how the kernel is behaving, with a few tests.
> Then what is the best solution to do this ?
> A patch from the 2.6.25-rc3 vanilla kernel ?
>
> cheers,
> Maxime
>
>
> On Thu, Feb 28, 2008 at 7:03 AM, Kumar Gala <galak@kernel.crashing.org>
> wrote:
>
> >
> > On Feb 27, 2008, at 10:25 AM, maxime louvel wrote:
> >
> > > Hi again,
> > >
> > > I am answering my self sorry for the spam...
> > > Just to say that my problem has been solve if someone has something
> > > similar...
> > > My changes were good, I just didn't compile the good file...
> >
> > Any plans to submit patches to add support for this board to the kernel?
> >
> > - k
> >
> >
>
>
> --
> Maxime Louvel
> 0044 7964 5555 80
> 43 Allen road
> Whitemore reans
> WV60AW Wolverhampton
> United Kingdom
>
--
Maxime Louvel
0044 7964 5555 80
43 Allen road
Whitemore reans
WV60AW Wolverhampton
United Kingdom
[-- Attachment #2: Type: text/html, Size: 2317 bytes --]
^ permalink raw reply
* Re: [RFC][PATCH] ibm_newemac: PowerPC 440EP/440GR EMAC PHY clock workaround
From: Benjamin Herrenschmidt @ 2008-02-28 7:54 UTC (permalink / raw)
To: Josh Boyer; +Cc: linuxppc-dev
In-Reply-To: <20080226090210.6816c130@zod.rchland.ibm.com>
On Tue, 2008-02-26 at 09:02 -0600, Josh Boyer wrote:
> Seems the code will do the right thing since everything is using
> flags. I suppose my question can be withdrawn. It is slightly
> confusing to do it that way though. Perhaps a function to do
> read-modify-writes on DCRs would be welcome. dcr_modify anyone?
Yup, we probably want to expose a dcri_clrset(), though I would also
expose then __mtdcri/__mfdcri (non locked version) and the spinlock in
case somebody wants to do something fancy.
Cheers,
Ben.
^ permalink raw reply
* Re: 2.6.25-rc3 on mpc8548amc doesn't boot
From: maxime louvel @ 2008-02-28 7:56 UTC (permalink / raw)
To: Kumar Gala; +Cc: linuxppc-embedded
In-Reply-To: <B3C9F997-0D0B-4033-9FED-F8B6B7F5DABC@kernel.crashing.org>
[-- Attachment #1: Type: text/plain, Size: 730 bytes --]
Hi,
I wanted first to check how the kernel is behaving, with a few tests.
Then what is the best solution to do this ?
A patch from the 2.6.25-rc3 vanilla kernel ?
cheers,
Maxime
On Thu, Feb 28, 2008 at 7:03 AM, Kumar Gala <galak@kernel.crashing.org>
wrote:
>
> On Feb 27, 2008, at 10:25 AM, maxime louvel wrote:
>
> > Hi again,
> >
> > I am answering my self sorry for the spam...
> > Just to say that my problem has been solve if someone has something
> > similar...
> > My changes were good, I just didn't compile the good file...
>
> Any plans to submit patches to add support for this board to the kernel?
>
> - k
>
>
--
Maxime Louvel
0044 7964 5555 80
43 Allen road
Whitemore reans
WV60AW Wolverhampton
United Kingdom
[-- Attachment #2: Type: text/html, Size: 1135 bytes --]
^ permalink raw reply
* Re: 2.6.25-rc3 on mpc8548amc doesn't boot
From: Kumar Gala @ 2008-02-28 7:03 UTC (permalink / raw)
To: maxime louvel; +Cc: linuxppc-embedded
In-Reply-To: <dda529d0802270825p527fd1b5i3e5a72a16bd95a75@mail.gmail.com>
On Feb 27, 2008, at 10:25 AM, maxime louvel wrote:
> Hi again,
>
> I am answering my self sorry for the spam...
> Just to say that my problem has been solve if someone has something
> similar...
> My changes were good, I just didn't compile the good file...
Any plans to submit patches to add support for this board to the kernel?
- k
^ permalink raw reply
* Re: [PATCH 1/2] firewire: endianess fix
From: Benjamin Herrenschmidt @ 2008-02-28 6:25 UTC (permalink / raw)
To: Jarod Wilson
Cc: Kristian Hoegsberg, linux-kernel, linuxppc-dev, Stefan Richter,
sparclinux, linux1394-devel, Sam Ravnborg, Harvey Harrison
In-Reply-To: <200802272221.38985.jwilson@redhat.com>
> Under Mac OS X, system.log says "FireWire (OHCI) Apple ID 31 built-in now
> active". Could still be lucent though, judging by the subsys device ID of
> 5811, which matches up w/the Lucent/Agere FW323. But no, apparently I don't
> have the interesting one.
Well, it's interesting in the sense that it's a "normal" OHCI then on a
BE machine :-) My Pismo, which had the weirdo one, unfortunately died a
while ago. I'll see if I can find another machine with that one in.
Cheers,
Ben.
^ permalink raw reply
* dtc: Fix indentation of fixup_phandle_references
From: David Gibson @ 2008-02-28 5:42 UTC (permalink / raw)
To: Jon Loeliger; +Cc: linuxppc-dev
Somehow the indentation of this function is messed up - 7 spaces
instead of 1 tab (probably a bad copy paste from a patch file). This
patch fixes it.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Index: dtc/checks.c
===================================================================
--- dtc.orig/checks.c 2008-02-28 16:40:04.000000000 +1100
+++ dtc/checks.c 2008-02-28 16:40:13.000000000 +1100
@@ -337,23 +337,23 @@
static void fixup_phandle_references(struct check *c, struct node *dt,
struct node *node, struct property *prop)
{
- struct marker *m = prop->val.markers;
- struct node *refnode;
- cell_t phandle;
-
- for_each_marker_of_type(m, REF_PHANDLE) {
- assert(m->offset + sizeof(cell_t) <= prop->val.len);
-
- refnode = get_node_by_ref(dt, m->ref);
- if (! refnode) {
- FAIL(c, "Reference to non-existent node or label \"%s\"\n",
- m->ref);
- continue;
- }
-
- phandle = get_node_phandle(dt, refnode);
- *((cell_t *)(prop->val.val + m->offset)) = cpu_to_be32(phandle);
- }
+ struct marker *m = prop->val.markers;
+ struct node *refnode;
+ cell_t phandle;
+
+ for_each_marker_of_type(m, REF_PHANDLE) {
+ assert(m->offset + sizeof(cell_t) <= prop->val.len);
+
+ refnode = get_node_by_ref(dt, m->ref);
+ if (! refnode) {
+ FAIL(c, "Reference to non-existent node or label \"%s\"\n",
+ m->ref);
+ continue;
+ }
+
+ phandle = get_node_phandle(dt, refnode);
+ *((cell_t *)(prop->val.val + m->offset)) = cpu_to_be32(phandle);
+ }
}
CHECK(phandle_references, NULL, NULL, fixup_phandle_references, NULL, ERROR,
&duplicate_node_names, &explicit_phandles);
--
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: [PATCH 1/2] firewire: endianess fix
From: Jarod Wilson @ 2008-02-28 3:33 UTC (permalink / raw)
To: linux1394-devel
Cc: Kristian Hoegsberg, linux-kernel, linuxppc-dev, Stefan Richter,
sparclinux, Sam Ravnborg, Harvey Harrison
In-Reply-To: <200802271458.28401.jwilson@redhat.com>
On Wednesday 27 February 2008 02:58:28 pm Jarod Wilson wrote:
> On Saturday 23 February 2008 06:24:17 am Stefan Richter wrote:
> > The generation of incoming requests was filled in in wrong byte order on
> > machines with big endian CPU.
> >
> > Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
> > Cc: sparclinux@vger.kernel.org
> > Cc: linuxppc-dev@ozlabs.org
> > ---
> >
> > This patch is a shot in the dark, based on a warning when building with
> > C=1 CHECKFLAGS="-D__CHECK_ENDIAN__". Is it really a fix, or was the
> > previous code accidentally correct?
> >
> > This needs to be tested on different big endian PCs, if possible with
> > the Apple Uninorth FireWire controller and other types of controllers.
> > One test which involves ohci->request_generation is simply with an SBP-2
> > device (harddisk, CD-ROM...). Does SBP-2 login etc. work?
>
> Works just fine with the Apple UniNorth controller in my powerbook in
> cursory testing. Tested with multiple sbp2 hard disks, plugging and
> unplugging, mounting and unmounting, etc.
>
> > If possible, also test whether the device remains accessible after
> > forcing a bus reset, e.g. by "echo br short > firecontrol". You need
> > the easy to build utility firecontrol and a libraw1394 with "juju"
> > backend. See wiki.linux1394.org for directions.
>
> Forgot to check that it survived bus resets. Will try to double-check that
> tonight.
Survives bus resets just fine, including with ongoing I/O from an sbp2 disk.
--
Jarod Wilson
jwilson@redhat.com
^ permalink raw reply
* Re: [PATCH 1/2] firewire: endianess fix
From: Jarod Wilson @ 2008-02-28 3:21 UTC (permalink / raw)
To: benh
Cc: Kristian Hoegsberg, linux-kernel, linuxppc-dev, Stefan Richter,
sparclinux, linux1394-devel, Sam Ravnborg, Harvey Harrison
In-Reply-To: <1204166422.15052.334.camel@pasglop>
On Wednesday 27 February 2008 09:40:22 pm Benjamin Herrenschmidt wrote:
> On Wed, 2008-02-27 at 14:58 -0500, Jarod Wilson wrote:
> > On Saturday 23 February 2008 06:24:17 am Stefan Richter wrote:
> > > The generation of incoming requests was filled in in wrong byte order
> > > on machines with big endian CPU.
> > >
> > > Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
> > > Cc: sparclinux@vger.kernel.org
> > > Cc: linuxppc-dev@ozlabs.org
> > > ---
> > >
> > > This patch is a shot in the dark, based on a warning when building with
> > > C=1 CHECKFLAGS="-D__CHECK_ENDIAN__". Is it really a fix, or was the
> > > previous code accidentally correct?
> > >
> > > This needs to be tested on different big endian PCs, if possible with
> > > the Apple Uninorth FireWire controller and other types of controllers.
> > > One test which involves ohci->request_generation is simply with an
> > > SBP-2 device (harddisk, CD-ROM...). Does SBP-2 login etc. work?
> >
> > Works just fine with the Apple UniNorth controller in my powerbook in
> > cursory testing. Tested with multiple sbp2 hard disks, plugging and
> > unplugging, mounting and unmounting, etc.
>
> Which specific rev/version of the uninorth controller ?
lspci says Apple Computer Inc. UniNorth 2 FireWire (rev 81), pci id 106b:0031,
subsys id 106b:5811.
(Its a circa 2004 Aluminum 15" PowerBook G4 @ 1.67GHz, fwiw).
> There is the "interesting" one has vendorID Apple and deviceID 0x0018,
> the normal ones have different deviceIDs (and are just lucent
> controllers afaik).
Under Mac OS X, system.log says "FireWire (OHCI) Apple ID 31 built-in now
active". Could still be lucent though, judging by the subsys device ID of
5811, which matches up w/the Lucent/Agere FW323. But no, apparently I don't
have the interesting one.
--
Jarod Wilson
jwilson@redhat.com
^ permalink raw reply
* Re: [PATCH 1/2] firewire: endianess fix
From: Benjamin Herrenschmidt @ 2008-02-28 2:41 UTC (permalink / raw)
To: Stefan Richter
Cc: Kristian Hoegsberg, linux-kernel, linuxppc-dev, sparclinux,
Jarod Wilson, linux1394-devel, Sam Ravnborg, Harvey Harrison
In-Reply-To: <tkrat.9e19fa31951506af@s5r6.in-berlin.de>
On Sat, 2008-02-23 at 12:24 +0100, Stefan Richter wrote:
> The generation of incoming requests was filled in in wrong byte order on
> machines with big endian CPU.
>
> Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
> Cc: sparclinux@vger.kernel.org
> Cc: linuxppc-dev@ozlabs.org
> ---
>
> This patch is a shot in the dark, based on a warning when building with
> C=1 CHECKFLAGS="-D__CHECK_ENDIAN__". Is it really a fix, or was the
> previous code accidentally correct?
>
> This needs to be tested on different big endian PCs, if possible with
> the Apple Uninorth FireWire controller and other types of controllers.
> One test which involves ohci->request_generation is simply with an SBP-2
> device (harddisk, CD-ROM...). Does SBP-2 login etc. work?
Do we have the workaround for the old Apple UniNorth in the new FW OHCI
driver (for selfID swapping iirc ?)
There are several variants of Apple OHCI's here, but afaik only one with
a "problem".
Cheers,
Ben.
^ permalink raw reply
* Re: [PATCH 1/2] firewire: endianess fix
From: Benjamin Herrenschmidt @ 2008-02-28 2:40 UTC (permalink / raw)
To: Jarod Wilson
Cc: Kristian Hoegsberg, linux-kernel, linuxppc-dev, Stefan Richter,
sparclinux, linux1394-devel, Sam Ravnborg, Harvey Harrison
In-Reply-To: <200802271458.28401.jwilson@redhat.com>
On Wed, 2008-02-27 at 14:58 -0500, Jarod Wilson wrote:
> On Saturday 23 February 2008 06:24:17 am Stefan Richter wrote:
> > The generation of incoming requests was filled in in wrong byte order on
> > machines with big endian CPU.
> >
> > Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
> > Cc: sparclinux@vger.kernel.org
> > Cc: linuxppc-dev@ozlabs.org
> > ---
> >
> > This patch is a shot in the dark, based on a warning when building with
> > C=1 CHECKFLAGS="-D__CHECK_ENDIAN__". Is it really a fix, or was the
> > previous code accidentally correct?
> >
> > This needs to be tested on different big endian PCs, if possible with
> > the Apple Uninorth FireWire controller and other types of controllers.
> > One test which involves ohci->request_generation is simply with an SBP-2
> > device (harddisk, CD-ROM...). Does SBP-2 login etc. work?
>
> Works just fine with the Apple UniNorth controller in my powerbook in cursory
> testing. Tested with multiple sbp2 hard disks, plugging and unplugging,
> mounting and unmounting, etc.
Which specific rev/version of the uninorth controller ?
There is the "interesting" one has vendorID Apple and deviceID 0x0018,
the normal ones have different deviceIDs (and are just lucent
controllers afaik).
Ben.
^ permalink raw reply
* Re: [dtc] breaking out libfdt from dtc so other progs can use it
From: David Gibson @ 2008-02-28 1:41 UTC (permalink / raw)
To: Jerone Young; +Cc: linuxppc-dev
In-Reply-To: <1204141243.18831.12.camel@thinkpad.austin.ibm.com>
On Wed, Feb 27, 2008 at 01:40:43PM -0600, Jerone Young wrote:
> Currently the dtc source code has libfdt integrated in it. This seems to
> have become place for upstream libfdt changes. Now we all know everyone
> (linux kernel, cuboot) also have their own versions over libfdt. But if
> another userspace app wants to use libfdt , it has to copy it from the
> dtc source and try to maintain it's own copy.
>
> The question I have is can libfdt be split out from dtc source, and
> become it's own thing. This way other userspace apps can easily download
> it and link with it?
>
> The reason I ask is I have added dynamic manipulation support of device
> trees in memory into qemu for KVM. But the issue is keeping a copy of
> libfdt in the KVM userspace repository, which is getting some opposition
> (understandably). But this would be much easier if there was a libfdt
> repo for the library so that we wouldn't need to keep our own copy.
Um.. libfdt was moved into the dtc repo for convenience, both for us
writing it (they help to test each other), and for those using it -
don't have to have separate pulls for these closely related tools.
I don't understand why you're finding the merged libfdt inconvenient.
"make" will build both dtc and libfdt, and libfdt can be easily taken
out and embedded on other projects.
--
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: patchwork missing patches?
From: Josh Boyer @ 2008-02-28 1:35 UTC (permalink / raw)
To: Paul Mackerras; +Cc: linuxppc-dev, jk
In-Reply-To: <18373.60272.351572.363687@cargo.ozlabs.ibm.com>
On Thu, 28 Feb 2008 10:00:00 +1100
Paul Mackerras <paulus@samba.org> wrote:
> Josh Boyer writes:
>
> > I'm trying to find some patches that went to the list recently in
> > patchwork and they seem to be missing. Here are a few:
> >
> > http://ozlabs.org/pipermail/linuxppc-dev/2008-February/052196.html
>
> That one was in "awaiting upstream" state since I put it in the
> bundle, then realized it should probably go through your tree, and
> didn't apply it. I've put it back to "new" state now.
Ok. Not sure why I couldn't find it under the "All" state earlier. I
see it now.
> > http://ozlabs.org/pipermail/linuxppc-dev/2008-February/052164.html
>
> I seem to recall putting that one in "changes requested" state, but
> now I can't find it either. Strange...
"changes requested" is what I was expecting, but didn't see it.
Strange indeed.
> > http://ozlabs.org/pipermail/linuxppc-dev/2008-February/052129.html
>
> Not sure where that one has gone.
It's not overly important, since it was whitespace corrupted and I have
a fixed version anyway. But it's still odd it's not on patchwork.
> > http://ozlabs.org/pipermail/linuxppc-dev/2008-February/052050.html
>
> I have been deleting patches that go through other maintainers to try
> to keep the number of patches down to a manageable level, and that
> includes ibm_newemac patches, since they go through Jeff Garzik.
> That's probably what happened to this one. I'll leave ibm_newemac
> patches alone if you promise to clean them up periodically. :)
Oh, I didn't realize you could actually outright delete them. I tend
to look after ibm_newemac because it's mostly related to 4xx and I get
to bug BenH to do the jgarzik bugging because he said he wants to be
the maintainer. I have no problems cleaning them up.
josh
^ permalink raw reply
* [patch 0/6] RFC: PCI: consolidate pcibios_enable_resources() implementations, v2
From: Bjorn Helgaas @ 2008-02-28 0:04 UTC (permalink / raw)
To: linux-pci, linux-arch
Cc: Chris Zankel, Grant Grundler, linux-parisc, Matthew Wilcox,
Kyle McMartin, linuxppc-dev, Paul Mackerras, linux-arm-kernel,
Russell King
There are many implementations of pcibios_enable_resources() that differ
in minor ways that look more like bugs than architectural differences.
This patch series consolidates most of them to use the x86 version.
Changes between v1 and v2:
- Moved ARM bridge enable to new platform_pci_enable_device(),
called by pcibios_enable_device()
- Moved PA-RISC SERR & PERR enable to new platform_pci_enable_device(),
called by pcibios_enable_device()
- In the generic pcibios_enable_resources(), adopted powerpc resource
collision detection (check for (!r->parent) instead of
(!r->start && r->end))
- In the generic pcibios_enable_resources(), added a little more detail to
the resource collision error message
- Moved consolidated pcibios_enable_resources() from bios.c to setup-res.c
Thanks for the comments on the first version. I think this addresses
all of them.
Any other comments would be welcome.
Bjorn
--
^ permalink raw reply
* [patch 6/6] PCI: consolidate several pcibios_enable_resources() implementations
From: Bjorn Helgaas @ 2008-02-28 0:04 UTC (permalink / raw)
To: linux-pci, linux-arch
Cc: Chris Zankel, Grant Grundler, linux-parisc, Matthew Wilcox,
Kyle McMartin, linuxppc-dev, Paul Mackerras, linux-arm-kernel,
Russell King
In-Reply-To: <20080228000437.880811124@ldl.fc.hp.com>
There are many implementations of pcibios_enable_resources() that differ
in minor ways that look more like bugs than architectural differences.
This patch consolidates most of them to use the version annotated below.
This is the original x86 version, except that it uses the resource
collision check from powerpc at (5):
int pcibios_enable_resources(struct pci_dev *dev, int mask)
{
u16 cmd, old_cmd;
int i;
struct resource *r;
(0)
pci_read_config_word(dev, PCI_COMMAND, &cmd);
old_cmd = cmd;
(1) for (i = 0; i < PCI_NUM_RESOURCES; i++) {
(2) if (!(mask & (1 << i)))
continue;
r = &dev->resource[i];
(3) if (!(r->flags & (IORESOURCE_IO | IORESOURCE_MEM)))
continue;
(4) if ((i == PCI_ROM_RESOURCE) &&
(!(r->flags & IORESOURCE_ROM_ENABLE)))
continue;
(5) if (!r->parent) {
dev_err(&dev->dev, "device not available because of "
"BAR %d [%llx:%llx] collisions\n", i,
(unsigned long long) r->start,
(unsigned long long) r->end);
return -EINVAL;
}
if (r->flags & IORESOURCE_IO)
cmd |= PCI_COMMAND_IO;
if (r->flags & IORESOURCE_MEM)
cmd |= PCI_COMMAND_MEMORY;
}
(6)
(7) if (cmd != old_cmd) {
dev_info(&dev->dev, "enabling device (%04x -> %04x)\n",
old_cmd, cmd);
pci_write_config_word(dev, PCI_COMMAND, cmd);
}
return 0;
}
Compared with the above version, other architectures have the following
functional differences:
alpha: ignores mask at (2), has no PCI_ROM_RESOURCE check at (4),
has no collision check at (5)
arm: checks only 6 resources at (1), has no PCI_ROM_RESOURCE check at (4),
always fully enables bridges at (6)
cris: checks only 6 resources at (1), has a different ROM
resource check at (4) and (6) that ignores IORESOURCE_ROM_ENABLE
frv: checks only 6 resources at (1), has a different ROM
resource check at (4) and (6) that ignores IORESOURCE_ROM_ENABLE
ia64: checks for NULL dev at (0)
mips: has no IORESOURCE_{IO,MEM} check at (3), has a different
ROM resource check at (4) and (6) that ignores IORESOURCE_ROM_ENABLE
mn10300: checks only 6 resources at (1), has no IORESOURCE_{IO,MEM}
check at (3), has a different ROM resource check at (4) and (6)
that ignores IORESOURCE_ROM_ENABLE
parisc: checks DEVICE_COUNT_RESOURCE (12) instead of PCI_NUM_RESOURCES (11)
resources at (1), has no IORESOURCE_{IO,MEM} check at (3),
has no PCI_ROM_RESOURCE check at (4), has no collision check at (5)
always turns on PCI_COMMAND_SERR | PCI_COMMAND_PARITY at (6),
writes cmd even if unchanged at (7)
powerpc: has a different collision check at (5)
ppc: checks only 6 resources at (1), has no IORESOURCE_{IO,MEM} check
at (3), has a different ROM resource check at (4) and (6) that
ignores IORESOURCE_ROM_ENABLE, has a different collision check using
IORESOURCE_UNSET at (5)
sh: checks only 6 resources at (1), has no IORESOURCE_{IO,MEM} check
at (3), has a different ROM resource check at (4) and (6) that
ignores IORESOURCE_ROM_ENABLE
sparc64: has no IORESOURCE_{IO,MEM} check at (3), has no PCI_ROM_RESOURCE
check at (4)
v850: checks only 6 resources at (1), has no IORESOURCE_{IO,MEM} check
at (3), has no PCI_ROM_RESOURCE check at (4)
xtensa: checks only 6 resources at (1), has no IORESOURCE_{IO,MEM} check
at (3), has a different ROM resource check at (4) and (6) that
ignores IORESOURCE_ROM_ENABLE
x86: has a different collision check at (5)
The mips/pmc-sierra implementation of pcibios_enable_resources() is
cluttered with a bunch of titan stuff, so I can't immediately consolidate
it with the others. So I made the generic version "weak" so pmc-sierra
can override it.
Not-Yet-Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
---
arch/alpha/kernel/pci.c | 27 --------------------
arch/arm/kernel/bios32.c | 37 ----------------------------
arch/cris/arch-v32/drivers/pci/bios.c | 32 ------------------------
arch/frv/mb93090-mb00/pci-frv.c | 32 ------------------------
arch/ia64/pci/pci.c | 42 --------------------------------
arch/mips/pci/pci.c | 32 ------------------------
arch/mn10300/unit-asb2305/pci-asb2305.c | 39 -----------------------------
arch/parisc/kernel/pci.c | 37 ----------------------------
arch/powerpc/kernel/pci-common.c | 36 ---------------------------
arch/ppc/kernel/pci.c | 33 -------------------------
arch/sh/drivers/pci/pci.c | 32 ------------------------
arch/sparc64/kernel/pci.c | 30 ----------------------
arch/v850/kernel/rte_mb_a_pci.c | 28 ---------------------
arch/x86/pci/i386.c | 38 ----------------------------
arch/x86/pci/pci.h | 1
arch/xtensa/kernel/pci.c | 31 -----------------------
drivers/pci/setup-res.c | 42 ++++++++++++++++++++++++++++++++
include/linux/pci.h | 1
18 files changed, 43 insertions(+), 507 deletions(-)
Index: work6/arch/alpha/kernel/pci.c
===================================================================
--- work6.orig/arch/alpha/kernel/pci.c 2008-02-27 14:37:14.000000000 -0700
+++ work6/arch/alpha/kernel/pci.c 2008-02-27 14:40:34.000000000 -0700
@@ -370,33 +370,6 @@
#endif
int
-pcibios_enable_resources(struct pci_dev *dev, int mask)
-{
- u16 cmd, oldcmd;
- int i;
-
- pci_read_config_word(dev, PCI_COMMAND, &cmd);
- oldcmd = cmd;
-
- for (i = 0; i < PCI_NUM_RESOURCES; i++) {
- struct resource *res = &dev->resource[i];
-
- if (res->flags & IORESOURCE_IO)
- cmd |= PCI_COMMAND_IO;
- else if (res->flags & IORESOURCE_MEM)
- cmd |= PCI_COMMAND_MEMORY;
- }
-
- if (cmd != oldcmd) {
- printk(KERN_DEBUG "PCI: Enabling device: (%s), cmd %x\n",
- pci_name(dev), cmd);
- /* Enable the appropriate bits in the PCI command register. */
- pci_write_config_word(dev, PCI_COMMAND, cmd);
- }
- return 0;
-}
-
-int
pcibios_enable_device(struct pci_dev *dev, int mask)
{
return pcibios_enable_resources(dev, mask);
Index: work6/arch/arm/kernel/bios32.c
===================================================================
--- work6.orig/arch/arm/kernel/bios32.c 2008-02-27 14:37:14.000000000 -0700
+++ work6/arch/arm/kernel/bios32.c 2008-02-27 14:40:34.000000000 -0700
@@ -654,43 +654,6 @@
res->start = (start + align - 1) & ~(align - 1);
}
-/**
- * pcibios_enable_resources - Enable I/O and memory.
- * @dev: PCI device to be enabled
- */
-int pcibios_enable_resources(struct pci_dev *dev, int mask)
-{
- u16 cmd, old_cmd;
- int idx;
- struct resource *r;
-
- pci_read_config_word(dev, PCI_COMMAND, &cmd);
- old_cmd = cmd;
- for (idx = 0; idx < 6; idx++) {
- /* Only set up the requested stuff */
- if (!(mask & (1 << idx)))
- continue;
-
- r = dev->resource + idx;
- if (!r->start && r->end) {
- printk(KERN_ERR "PCI: Device %s not available because"
- " of resource collisions\n", pci_name(dev));
- return -EINVAL;
- }
- if (r->flags & IORESOURCE_IO)
- cmd |= PCI_COMMAND_IO;
- if (r->flags & IORESOURCE_MEM)
- cmd |= PCI_COMMAND_MEMORY;
- }
-
- if (cmd != old_cmd) {
- printk("PCI: enabling device %s (%04x -> %04x)\n",
- pci_name(dev), old_cmd, cmd);
- pci_write_config_word(dev, PCI_COMMAND, cmd);
- }
- return 0;
-}
-
static int platform_pci_enable_device(struct pci_dev *dev)
{
u16 cmd, old_cmd;
Index: work6/arch/cris/arch-v32/drivers/pci/bios.c
===================================================================
--- work6.orig/arch/cris/arch-v32/drivers/pci/bios.c 2008-02-27 14:37:14.000000000 -0700
+++ work6/arch/cris/arch-v32/drivers/pci/bios.c 2008-02-27 14:40:34.000000000 -0700
@@ -55,38 +55,6 @@
}
}
-int pcibios_enable_resources(struct pci_dev *dev, int mask)
-{
- u16 cmd, old_cmd;
- int idx;
- struct resource *r;
-
- pci_read_config_word(dev, PCI_COMMAND, &cmd);
- old_cmd = cmd;
- for(idx=0; idx<6; idx++) {
- /* Only set up the requested stuff */
- if (!(mask & (1<<idx)))
- continue;
-
- r = &dev->resource[idx];
- if (!r->start && r->end) {
- printk(KERN_ERR "PCI: Device %s not available because of resource collisions\n", pci_name(dev));
- return -EINVAL;
- }
- if (r->flags & IORESOURCE_IO)
- cmd |= PCI_COMMAND_IO;
- if (r->flags & IORESOURCE_MEM)
- cmd |= PCI_COMMAND_MEMORY;
- }
- if (dev->resource[PCI_ROM_RESOURCE].start)
- cmd |= PCI_COMMAND_MEMORY;
- if (cmd != old_cmd) {
- printk("PCI: Enabling device %s (%04x -> %04x)\n", pci_name(dev), old_cmd, cmd);
- pci_write_config_word(dev, PCI_COMMAND, cmd);
- }
- return 0;
-}
-
int pcibios_enable_irq(struct pci_dev *dev)
{
dev->irq = EXT_INTR_VECT;
Index: work6/arch/frv/mb93090-mb00/pci-frv.c
===================================================================
--- work6.orig/arch/frv/mb93090-mb00/pci-frv.c 2008-02-27 14:37:14.000000000 -0700
+++ work6/arch/frv/mb93090-mb00/pci-frv.c 2008-02-27 14:40:34.000000000 -0700
@@ -231,38 +231,6 @@
pcibios_assign_resources();
}
-int pcibios_enable_resources(struct pci_dev *dev, int mask)
-{
- u16 cmd, old_cmd;
- int idx;
- struct resource *r;
-
- pci_read_config_word(dev, PCI_COMMAND, &cmd);
- old_cmd = cmd;
- for(idx=0; idx<6; idx++) {
- /* Only set up the requested stuff */
- if (!(mask & (1<<idx)))
- continue;
-
- r = &dev->resource[idx];
- if (!r->start && r->end) {
- printk(KERN_ERR "PCI: Device %s not available because of resource collisions\n", pci_name(dev));
- return -EINVAL;
- }
- if (r->flags & IORESOURCE_IO)
- cmd |= PCI_COMMAND_IO;
- if (r->flags & IORESOURCE_MEM)
- cmd |= PCI_COMMAND_MEMORY;
- }
- if (dev->resource[PCI_ROM_RESOURCE].start)
- cmd |= PCI_COMMAND_MEMORY;
- if (cmd != old_cmd) {
- printk("PCI: Enabling device %s (%04x -> %04x)\n", pci_name(dev), old_cmd, cmd);
- pci_write_config_word(dev, PCI_COMMAND, cmd);
- }
- return 0;
-}
-
/*
* If we set up a device for bus mastering, we need to check the latency
* timer as certain crappy BIOSes forget to set it properly.
Index: work6/arch/ia64/pci/pci.c
===================================================================
--- work6.orig/arch/ia64/pci/pci.c 2008-02-27 14:37:14.000000000 -0700
+++ work6/arch/ia64/pci/pci.c 2008-02-27 14:40:34.000000000 -0700
@@ -499,48 +499,6 @@
/* ??? FIXME -- record old value for shutdown. */
}
-static inline int
-pcibios_enable_resources (struct pci_dev *dev, int mask)
-{
- u16 cmd, old_cmd;
- int idx;
- struct resource *r;
- unsigned long type_mask = IORESOURCE_IO | IORESOURCE_MEM;
-
- if (!dev)
- return -EINVAL;
-
- pci_read_config_word(dev, PCI_COMMAND, &cmd);
- old_cmd = cmd;
- for (idx=0; idx<PCI_NUM_RESOURCES; idx++) {
- /* Only set up the desired resources. */
- if (!(mask & (1 << idx)))
- continue;
-
- r = &dev->resource[idx];
- if (!(r->flags & type_mask))
- continue;
- if ((idx == PCI_ROM_RESOURCE) &&
- (!(r->flags & IORESOURCE_ROM_ENABLE)))
- continue;
- if (!r->start && r->end) {
- printk(KERN_ERR
- "PCI: Device %s not available because of resource collisions\n",
- pci_name(dev));
- return -EINVAL;
- }
- if (r->flags & IORESOURCE_IO)
- cmd |= PCI_COMMAND_IO;
- if (r->flags & IORESOURCE_MEM)
- cmd |= PCI_COMMAND_MEMORY;
- }
- if (cmd != old_cmd) {
- printk("PCI: Enabling device %s (%04x -> %04x)\n", pci_name(dev), old_cmd, cmd);
- pci_write_config_word(dev, PCI_COMMAND, cmd);
- }
- return 0;
-}
-
int
pcibios_enable_device (struct pci_dev *dev, int mask)
{
Index: work6/arch/mips/pci/pci.c
===================================================================
--- work6.orig/arch/mips/pci/pci.c 2008-02-27 14:37:14.000000000 -0700
+++ work6/arch/mips/pci/pci.c 2008-02-27 14:40:34.000000000 -0700
@@ -163,38 +163,6 @@
subsys_initcall(pcibios_init);
-static int pcibios_enable_resources(struct pci_dev *dev, int mask)
-{
- u16 cmd, old_cmd;
- int idx;
- struct resource *r;
-
- pci_read_config_word(dev, PCI_COMMAND, &cmd);
- old_cmd = cmd;
- for (idx=0; idx < PCI_NUM_RESOURCES; idx++) {
- /* Only set up the requested stuff */
- if (!(mask & (1<<idx)))
- continue;
-
- r = &dev->resource[idx];
- if (!r->start && r->end) {
- printk(KERN_ERR "PCI: Device %s not available because of resource collisions\n", pci_name(dev));
- return -EINVAL;
- }
- if (r->flags & IORESOURCE_IO)
- cmd |= PCI_COMMAND_IO;
- if (r->flags & IORESOURCE_MEM)
- cmd |= PCI_COMMAND_MEMORY;
- }
- if (dev->resource[PCI_ROM_RESOURCE].start)
- cmd |= PCI_COMMAND_MEMORY;
- if (cmd != old_cmd) {
- printk("PCI: Enabling device %s (%04x -> %04x)\n", pci_name(dev), old_cmd, cmd);
- pci_write_config_word(dev, PCI_COMMAND, cmd);
- }
- return 0;
-}
-
/*
* If we set up a device for bus mastering, we need to check the latency
* timer as certain crappy BIOSes forget to set it properly.
Index: work6/arch/mn10300/unit-asb2305/pci-asb2305.c
===================================================================
--- work6.orig/arch/mn10300/unit-asb2305/pci-asb2305.c 2008-02-27 14:37:14.000000000 -0700
+++ work6/arch/mn10300/unit-asb2305/pci-asb2305.c 2008-02-27 14:40:34.000000000 -0700
@@ -218,45 +218,6 @@
pcibios_allocate_resources(1);
}
-int pcibios_enable_resources(struct pci_dev *dev, int mask)
-{
- u16 cmd, old_cmd;
- int idx;
- struct resource *r;
-
- pci_read_config_word(dev, PCI_COMMAND, &cmd);
- old_cmd = cmd;
-
- for (idx = 0; idx < 6; idx++) {
- /* Only set up the requested stuff */
- if (!(mask & (1 << idx)))
- continue;
-
- r = &dev->resource[idx];
-
- if (!r->start && r->end) {
- printk(KERN_ERR
- "PCI: Device %s not available because of"
- " resource collisions\n",
- pci_name(dev));
- return -EINVAL;
- }
-
- if (r->flags & IORESOURCE_IO)
- cmd |= PCI_COMMAND_IO;
- if (r->flags & IORESOURCE_MEM)
- cmd |= PCI_COMMAND_MEMORY;
- }
-
- if (dev->resource[PCI_ROM_RESOURCE].start)
- cmd |= PCI_COMMAND_MEMORY;
-
- if (cmd != old_cmd)
- pci_write_config_word(dev, PCI_COMMAND, cmd);
-
- return 0;
-}
-
/*
* If we set up a device for bus mastering, we need to check the latency
* timer as certain crappy BIOSes forget to set it properly.
Index: work6/arch/parisc/kernel/pci.c
===================================================================
--- work6.orig/arch/parisc/kernel/pci.c 2008-02-27 14:37:14.000000000 -0700
+++ work6/arch/parisc/kernel/pci.c 2008-02-27 14:40:34.000000000 -0700
@@ -276,43 +276,6 @@
/* The caller updates the end field, we don't. */
}
-
-/*
- * A driver is enabling the device. We make sure that all the appropriate
- * bits are set to allow the device to operate as the driver is expecting.
- * We enable the port IO and memory IO bits if the device has any BARs of
- * that type.
- */
-int pcibios_enable_resources(struct pci_dev *dev, int mask)
-{
- u16 cmd;
- int idx;
-
- pci_read_config_word(dev, PCI_COMMAND, &cmd);
-
- for (idx = 0; idx < DEVICE_COUNT_RESOURCE; idx++) {
- struct resource *r = &dev->resource[idx];
-
- /* only setup requested resources */
- if (!(mask & (1<<idx)))
- continue;
-
- if (r->flags & IORESOURCE_IO)
- cmd |= PCI_COMMAND_IO;
- if (r->flags & IORESOURCE_MEM)
- cmd |= PCI_COMMAND_MEMORY;
- }
-
-#if 0
- /* If bridge/bus controller has FBB enabled, child must too. */
- if (dev->bus->bridge_ctl & PCI_BRIDGE_CTL_FAST_BACK)
- cmd |= PCI_COMMAND_FAST_BACK;
-#endif
- DBGC("PCIBIOS: Enabling device %s cmd 0x%04x\n", pci_name(dev), cmd);
- pci_write_config_word(dev, PCI_COMMAND, cmd);
- return 0;
-}
-
/*
* A driver is enabling the device. We enable the PERR and SERR bits
* unconditionally. Drivers that do not need parity (eg graphics and
Index: work6/arch/powerpc/kernel/pci-common.c
===================================================================
--- work6.orig/arch/powerpc/kernel/pci-common.c 2008-02-27 14:37:14.000000000 -0700
+++ work6/arch/powerpc/kernel/pci-common.c 2008-02-27 14:40:34.000000000 -0700
@@ -1153,42 +1153,6 @@
EXPORT_SYMBOL_GPL(pcibios_claim_one_bus);
#endif /* CONFIG_HOTPLUG */
-int pcibios_enable_resources(struct pci_dev *dev, int mask)
-{
- u16 cmd, old_cmd;
- int idx;
- struct resource *r;
-
- pci_read_config_word(dev, PCI_COMMAND, &cmd);
- old_cmd = cmd;
- for (idx = 0; idx < PCI_NUM_RESOURCES; idx++) {
- /* Only set up the requested stuff */
- if (!(mask & (1 << idx)))
- continue;
- r = &dev->resource[idx];
- if (!(r->flags & (IORESOURCE_IO | IORESOURCE_MEM)))
- continue;
- if ((idx == PCI_ROM_RESOURCE) &&
- (!(r->flags & IORESOURCE_ROM_ENABLE)))
- continue;
- if (r->parent == NULL) {
- printk(KERN_ERR "PCI: Device %s not available because"
- " of resource collisions\n", pci_name(dev));
- return -EINVAL;
- }
- if (r->flags & IORESOURCE_IO)
- cmd |= PCI_COMMAND_IO;
- if (r->flags & IORESOURCE_MEM)
- cmd |= PCI_COMMAND_MEMORY;
- }
- if (cmd != old_cmd) {
- printk("PCI: Enabling device %s (%04x -> %04x)\n",
- pci_name(dev), old_cmd, cmd);
- pci_write_config_word(dev, PCI_COMMAND, cmd);
- }
- return 0;
-}
-
int pcibios_enable_device(struct pci_dev *dev, int mask)
{
if (ppc_md.pcibios_enable_device_hook)
Index: work6/arch/ppc/kernel/pci.c
===================================================================
--- work6.orig/arch/ppc/kernel/pci.c 2008-02-27 14:37:14.000000000 -0700
+++ work6/arch/ppc/kernel/pci.c 2008-02-27 14:40:34.000000000 -0700
@@ -578,39 +578,6 @@
}
-int
-pcibios_enable_resources(struct pci_dev *dev, int mask)
-{
- u16 cmd, old_cmd;
- int idx;
- struct resource *r;
-
- pci_read_config_word(dev, PCI_COMMAND, &cmd);
- old_cmd = cmd;
- for (idx=0; idx<6; idx++) {
- /* Only set up the requested stuff */
- if (!(mask & (1<<idx)))
- continue;
-
- r = &dev->resource[idx];
- if (r->flags & IORESOURCE_UNSET) {
- printk(KERN_ERR "PCI: Device %s not available because of resource collisions\n", pci_name(dev));
- return -EINVAL;
- }
- if (r->flags & IORESOURCE_IO)
- cmd |= PCI_COMMAND_IO;
- if (r->flags & IORESOURCE_MEM)
- cmd |= PCI_COMMAND_MEMORY;
- }
- if (dev->resource[PCI_ROM_RESOURCE].start)
- cmd |= PCI_COMMAND_MEMORY;
- if (cmd != old_cmd) {
- printk("PCI: Enabling device %s (%04x -> %04x)\n", pci_name(dev), old_cmd, cmd);
- pci_write_config_word(dev, PCI_COMMAND, cmd);
- }
- return 0;
-}
-
static int next_controller_index;
struct pci_controller * __init
Index: work6/arch/sh/drivers/pci/pci.c
===================================================================
--- work6.orig/arch/sh/drivers/pci/pci.c 2008-02-27 14:37:14.000000000 -0700
+++ work6/arch/sh/drivers/pci/pci.c 2008-02-27 14:40:34.000000000 -0700
@@ -131,38 +131,6 @@
}
}
-int pcibios_enable_resources(struct pci_dev *dev, int mask)
-{
- u16 cmd, old_cmd;
- int idx;
- struct resource *r;
-
- pci_read_config_word(dev, PCI_COMMAND, &cmd);
- old_cmd = cmd;
- for(idx=0; idx<6; idx++) {
- if (!(mask & (1 << idx)))
- continue;
- r = &dev->resource[idx];
- if (!r->start && r->end) {
- printk(KERN_ERR "PCI: Device %s not available because "
- "of resource collisions\n", pci_name(dev));
- return -EINVAL;
- }
- if (r->flags & IORESOURCE_IO)
- cmd |= PCI_COMMAND_IO;
- if (r->flags & IORESOURCE_MEM)
- cmd |= PCI_COMMAND_MEMORY;
- }
- if (dev->resource[PCI_ROM_RESOURCE].start)
- cmd |= PCI_COMMAND_MEMORY;
- if (cmd != old_cmd) {
- printk(KERN_INFO "PCI: Enabling device %s (%04x -> %04x)\n",
- pci_name(dev), old_cmd, cmd);
- pci_write_config_word(dev, PCI_COMMAND, cmd);
- }
- return 0;
-}
-
int pcibios_enable_device(struct pci_dev *dev, int mask)
{
return pcibios_enable_resources(dev, mask);
Index: work6/arch/sparc64/kernel/pci.c
===================================================================
--- work6.orig/arch/sparc64/kernel/pci.c 2008-02-27 14:37:14.000000000 -0700
+++ work6/arch/sparc64/kernel/pci.c 2008-02-27 14:40:34.000000000 -0700
@@ -946,36 +946,6 @@
{
}
-int pcibios_enable_resources(struct pci_dev *dev, int mask)
-{
- u16 cmd, oldcmd;
- int i;
-
- pci_read_config_word(dev, PCI_COMMAND, &cmd);
- oldcmd = cmd;
-
- for (i = 0; i < PCI_NUM_RESOURCES; i++) {
- struct resource *res = &dev->resource[i];
-
- /* Only set up the requested stuff */
- if (!(mask & (1<<i)))
- continue;
-
- if (res->flags & IORESOURCE_IO)
- cmd |= PCI_COMMAND_IO;
- if (res->flags & IORESOURCE_MEM)
- cmd |= PCI_COMMAND_MEMORY;
- }
-
- if (cmd != oldcmd) {
- printk(KERN_DEBUG "PCI: Enabling device: (%s), cmd %x\n",
- pci_name(dev), cmd);
- /* Enable the appropriate bits in the PCI command register. */
- pci_write_config_word(dev, PCI_COMMAND, cmd);
- }
- return 0;
-}
-
int pcibios_enable_device(struct pci_dev *dev, int mask)
{
return pcibios_enable_resources(dev, mask);
Index: work6/arch/v850/kernel/rte_mb_a_pci.c
===================================================================
--- work6.orig/arch/v850/kernel/rte_mb_a_pci.c 2008-02-27 14:37:14.000000000 -0700
+++ work6/arch/v850/kernel/rte_mb_a_pci.c 2008-02-27 14:40:34.000000000 -0700
@@ -217,34 +217,6 @@
}
\f
-int __nomods_init pcibios_enable_resources (struct pci_dev *dev, int mask)
-{
- u16 cmd, old_cmd;
- int idx;
- struct resource *r;
-
- pci_read_config_word(dev, PCI_COMMAND, &cmd);
- old_cmd = cmd;
- for (idx = 0; idx < 6; idx++) {
- r = &dev->resource[idx];
- if (!r->start && r->end) {
- printk(KERN_ERR "PCI: Device %s not available because "
- "of resource collisions\n", pci_name(dev));
- return -EINVAL;
- }
- if (r->flags & IORESOURCE_IO)
- cmd |= PCI_COMMAND_IO;
- if (r->flags & IORESOURCE_MEM)
- cmd |= PCI_COMMAND_MEMORY;
- }
- if (cmd != old_cmd) {
- printk("PCI: Enabling device %s (%04x -> %04x)\n",
- pci_name(dev), old_cmd, cmd);
- pci_write_config_word(dev, PCI_COMMAND, cmd);
- }
- return 0;
-}
-
int __nomods_init pcibios_enable_device (struct pci_dev *dev, int mask)
{
return pcibios_enable_resources(dev, mask);
Index: work6/arch/x86/pci/i386.c
===================================================================
--- work6.orig/arch/x86/pci/i386.c 2008-02-27 14:37:14.000000000 -0700
+++ work6/arch/x86/pci/i386.c 2008-02-27 14:40:34.000000000 -0700
@@ -238,44 +238,6 @@
*/
fs_initcall(pcibios_assign_resources);
-int pcibios_enable_resources(struct pci_dev *dev, int mask)
-{
- u16 cmd, old_cmd;
- int idx;
- struct resource *r;
-
- pci_read_config_word(dev, PCI_COMMAND, &cmd);
- old_cmd = cmd;
- for (idx = 0; idx < PCI_NUM_RESOURCES; idx++) {
- /* Only set up the requested stuff */
- if (!(mask & (1 << idx)))
- continue;
-
- r = &dev->resource[idx];
- if (!(r->flags & (IORESOURCE_IO | IORESOURCE_MEM)))
- continue;
- if ((idx == PCI_ROM_RESOURCE) &&
- (!(r->flags & IORESOURCE_ROM_ENABLE)))
- continue;
- if (!r->start && r->end) {
- printk(KERN_ERR "PCI: Device %s not available "
- "because of resource %d collisions\n",
- pci_name(dev), idx);
- return -EINVAL;
- }
- if (r->flags & IORESOURCE_IO)
- cmd |= PCI_COMMAND_IO;
- if (r->flags & IORESOURCE_MEM)
- cmd |= PCI_COMMAND_MEMORY;
- }
- if (cmd != old_cmd) {
- printk("PCI: Enabling device %s (%04x -> %04x)\n",
- pci_name(dev), old_cmd, cmd);
- pci_write_config_word(dev, PCI_COMMAND, cmd);
- }
- return 0;
-}
-
/*
* If we set up a device for bus mastering, we need to check the latency
* timer as certain crappy BIOSes forget to set it properly.
Index: work6/arch/x86/pci/pci.h
===================================================================
--- work6.orig/arch/x86/pci/pci.h 2008-02-27 14:37:14.000000000 -0700
+++ work6/arch/x86/pci/pci.h 2008-02-27 14:40:34.000000000 -0700
@@ -44,7 +44,6 @@
extern unsigned int pcibios_max_latency;
void pcibios_resource_survey(void);
-int pcibios_enable_resources(struct pci_dev *, int);
/* pci-pc.c */
Index: work6/arch/xtensa/kernel/pci.c
===================================================================
--- work6.orig/arch/xtensa/kernel/pci.c 2008-02-27 14:37:14.000000000 -0700
+++ work6/arch/xtensa/kernel/pci.c 2008-02-27 14:40:34.000000000 -0700
@@ -91,37 +91,6 @@
}
}
-int
-pcibios_enable_resources(struct pci_dev *dev, int mask)
-{
- u16 cmd, old_cmd;
- int idx;
- struct resource *r;
-
- pci_read_config_word(dev, PCI_COMMAND, &cmd);
- old_cmd = cmd;
- for(idx=0; idx<6; idx++) {
- r = &dev->resource[idx];
- if (!r->start && r->end) {
- printk (KERN_ERR "PCI: Device %s not available because "
- "of resource collisions\n", pci_name(dev));
- return -EINVAL;
- }
- if (r->flags & IORESOURCE_IO)
- cmd |= PCI_COMMAND_IO;
- if (r->flags & IORESOURCE_MEM)
- cmd |= PCI_COMMAND_MEMORY;
- }
- if (dev->resource[PCI_ROM_RESOURCE].start)
- cmd |= PCI_COMMAND_MEMORY;
- if (cmd != old_cmd) {
- printk("PCI: Enabling device %s (%04x -> %04x)\n",
- pci_name(dev), old_cmd, cmd);
- pci_write_config_word(dev, PCI_COMMAND, cmd);
- }
- return 0;
-}
-
struct pci_controller * __init pcibios_alloc_controller(void)
{
struct pci_controller *pci_ctrl;
Index: work6/drivers/pci/setup-res.c
===================================================================
--- work6.orig/drivers/pci/setup-res.c 2008-02-27 14:37:14.000000000 -0700
+++ work6/drivers/pci/setup-res.c 2008-02-27 16:53:59.000000000 -0700
@@ -263,3 +263,47 @@
}
}
}
+
+int __attribute__ ((weak)) pcibios_enable_resources(struct pci_dev *dev,
+ int mask)
+{
+ u16 cmd, old_cmd;
+ int i;
+ struct resource *r;
+
+ pci_read_config_word(dev, PCI_COMMAND, &cmd);
+ old_cmd = cmd;
+
+ for (i = 0; i < PCI_NUM_RESOURCES; i++) {
+ if (!(mask & (1 << i)))
+ continue;
+
+ r = &dev->resource[i];
+
+ if (!(r->flags & (IORESOURCE_IO | IORESOURCE_MEM)))
+ continue;
+ if ((i == PCI_ROM_RESOURCE) &&
+ (!(r->flags & IORESOURCE_ROM_ENABLE)))
+ continue;
+
+ if (!r->parent) {
+ dev_err(&dev->dev, "device not available because of "
+ "BAR %d [%llx:%llx] collisions\n", i,
+ (unsigned long long) r->start,
+ (unsigned long long) r->end);
+ return -EINVAL;
+ }
+
+ if (r->flags & IORESOURCE_IO)
+ cmd |= PCI_COMMAND_IO;
+ if (r->flags & IORESOURCE_MEM)
+ cmd |= PCI_COMMAND_MEMORY;
+ }
+
+ if (cmd != old_cmd) {
+ dev_info(&dev->dev, "enabling device (%04x -> %04x)\n",
+ old_cmd, cmd);
+ pci_write_config_word(dev, PCI_COMMAND, cmd);
+ }
+ return 0;
+}
Index: work6/include/linux/pci.h
===================================================================
--- work6.orig/include/linux/pci.h 2008-02-27 14:37:14.000000000 -0700
+++ work6/include/linux/pci.h 2008-02-27 14:40:34.000000000 -0700
@@ -616,6 +616,7 @@
void pci_assign_unassigned_resources(void);
void pdev_enable_device(struct pci_dev *);
void pdev_sort_resources(struct pci_dev *, struct resource_list *);
+int pcibios_enable_resources(struct pci_dev *, int mask);
void pci_fixup_irqs(u8 (*)(struct pci_dev *, u8 *),
int (*)(struct pci_dev *, u8, u8));
#define HAVE_PCI_REQ_REGIONS 2
--
^ permalink raw reply
* [patch 5/6] PARISC: move PERR & SERR enables out of pcibios_enable_resources()
From: Bjorn Helgaas @ 2008-02-28 0:04 UTC (permalink / raw)
To: linux-pci, linux-arch
Cc: Chris Zankel, Grant Grundler, linux-parisc, Matthew Wilcox,
Kyle McMartin, linuxppc-dev, Paul Mackerras, linux-arm-kernel,
Russell King
In-Reply-To: <20080228000437.880811124@ldl.fc.hp.com>
Move PERR and SERR enables from pcibios_enable_resources() to
platform_pci_enable_device() so the former matches other
architectures and can be shared.
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Index: work6/arch/parisc/kernel/pci.c
===================================================================
--- work6.orig/arch/parisc/kernel/pci.c 2008-02-27 11:30:02.000000000 -0700
+++ work6/arch/parisc/kernel/pci.c 2008-02-27 11:38:11.000000000 -0700
@@ -281,9 +281,7 @@
* A driver is enabling the device. We make sure that all the appropriate
* bits are set to allow the device to operate as the driver is expecting.
* We enable the port IO and memory IO bits if the device has any BARs of
- * that type, and we enable the PERR and SERR bits unconditionally.
- * Drivers that do not need parity (eg graphics and possibly networking)
- * can clear these bits if they want.
+ * that type.
*/
int pcibios_enable_resources(struct pci_dev *dev, int mask)
{
@@ -305,8 +303,6 @@
cmd |= PCI_COMMAND_MEMORY;
}
- cmd |= (PCI_COMMAND_SERR | PCI_COMMAND_PARITY);
-
#if 0
/* If bridge/bus controller has FBB enabled, child must too. */
if (dev->bus->bridge_ctl & PCI_BRIDGE_CTL_FAST_BACK)
@@ -317,9 +313,38 @@
return 0;
}
+/*
+ * A driver is enabling the device. We enable the PERR and SERR bits
+ * unconditionally. Drivers that do not need parity (eg graphics and
+ * possibly networking) can clear these bits if they want.
+ */
+static int platform_pci_enable_device(struct pci_dev *dev)
+{
+ u16 cmd, old_cmd;
+ int idx;
+
+ pci_read_config_word(dev, PCI_COMMAND, &cmd);
+ old_cmd = cmd;
+
+ cmd |= (PCI_COMMAND_SERR | PCI_COMMAND_PARITY);
+
+ if (cmd != old_cmd) {
+ dev_info(&dev->dev, "enabling SERR and PARITY (%04x -> %04x)\n",
+ old_cmd, cmd);
+ pci_write_config_word(dev, PCI_COMMAND, cmd);
+ }
+
+ return 0;
+}
+
int pcibios_enable_device(struct pci_dev *dev, int mask)
{
- return pcibios_enable_resources(dev, mask);
+ int err;
+
+ if ((err = pcibios_enable_resources(dev, mask)) < 0)
+ return err;
+
+ return platform_pci_enable_device(dev);
}
/* PA-RISC specific */
--
^ permalink raw reply
* [patch 1/6] PCI: split pcibios_enable_resources() out of pcibios_enable_device()
From: Bjorn Helgaas @ 2008-02-28 0:04 UTC (permalink / raw)
To: linux-pci, linux-arch
Cc: Chris Zankel, Grant Grundler, linux-parisc, Matthew Wilcox,
Kyle McMartin, linuxppc-dev, Paul Mackerras, linux-arm-kernel,
Russell King
In-Reply-To: <20080228000437.880811124@ldl.fc.hp.com>
On x86, pcibios_enable_device() is factored into
pcibios_enable_resources() and pcibios_enable_irq(). On several other
architectures, the functional equivalent of pcibios_enable_resources()
is expanded directly inside pcibios_enable_device().
This splits these pcibios_enable_device() implementations to make them
more similar to the x86 implementation.
There should be no functional change from this patch.
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
arch/alpha/kernel/pci.c | 8 +++++++-
arch/arm/kernel/bios32.c | 9 +++++++--
arch/parisc/kernel/pci.c | 6 +++++-
arch/powerpc/kernel/pci-common.c | 14 +++++++++-----
arch/sh/drivers/pci/pci.c | 7 ++++++-
arch/sparc64/kernel/pci.c | 7 ++++++-
arch/v850/kernel/rte_mb_a_pci.c | 7 ++++++-
7 files changed, 46 insertions(+), 12 deletions(-)
Index: work6/arch/alpha/kernel/pci.c
===================================================================
--- work6.orig/arch/alpha/kernel/pci.c 2008-02-18 10:43:50.000000000 -0700
+++ work6/arch/alpha/kernel/pci.c 2008-02-18 10:45:14.000000000 -0700
@@ -370,7 +370,7 @@
#endif
int
-pcibios_enable_device(struct pci_dev *dev, int mask)
+pcibios_enable_resources(struct pci_dev *dev, int mask)
{
u16 cmd, oldcmd;
int i;
@@ -396,6 +396,12 @@
return 0;
}
+int
+pcibios_enable_device(struct pci_dev *dev, int mask)
+{
+ return pcibios_enable_resources(dev, mask);
+}
+
/*
* If we set up a device for bus mastering, we need to check the latency
* timer as certain firmware forgets to set it properly, as seen
Index: work6/arch/arm/kernel/bios32.c
===================================================================
--- work6.orig/arch/arm/kernel/bios32.c 2008-02-18 10:43:50.000000000 -0700
+++ work6/arch/arm/kernel/bios32.c 2008-02-18 10:45:14.000000000 -0700
@@ -655,10 +655,10 @@
}
/**
- * pcibios_enable_device - Enable I/O and memory.
+ * pcibios_enable_resources - Enable I/O and memory.
* @dev: PCI device to be enabled
*/
-int pcibios_enable_device(struct pci_dev *dev, int mask)
+int pcibios_enable_resources(struct pci_dev *dev, int mask)
{
u16 cmd, old_cmd;
int idx;
@@ -697,6 +697,11 @@
return 0;
}
+int pcibios_enable_device(struct pci_dev *dev, int mask)
+{
+ return pcibios_enable_resources(dev, mask);
+}
+
int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
enum pci_mmap_state mmap_state, int write_combine)
{
Index: work6/arch/parisc/kernel/pci.c
===================================================================
--- work6.orig/arch/parisc/kernel/pci.c 2008-02-18 10:43:50.000000000 -0700
+++ work6/arch/parisc/kernel/pci.c 2008-02-18 10:45:14.000000000 -0700
@@ -285,7 +285,7 @@
* Drivers that do not need parity (eg graphics and possibly networking)
* can clear these bits if they want.
*/
-int pcibios_enable_device(struct pci_dev *dev, int mask)
+int pcibios_enable_resources(struct pci_dev *dev, int mask)
{
u16 cmd;
int idx;
@@ -317,6 +317,10 @@
return 0;
}
+int pcibios_enable_device(struct pci_dev *dev, int mask)
+{
+ return pcibios_enable_resources(dev, mask);
+}
/* PA-RISC specific */
void pcibios_register_hba(struct pci_hba_data *hba)
Index: work6/arch/powerpc/kernel/pci-common.c
===================================================================
--- work6.orig/arch/powerpc/kernel/pci-common.c 2008-02-18 10:43:50.000000000 -0700
+++ work6/arch/powerpc/kernel/pci-common.c 2008-02-18 10:45:14.000000000 -0700
@@ -1153,16 +1153,12 @@
EXPORT_SYMBOL_GPL(pcibios_claim_one_bus);
#endif /* CONFIG_HOTPLUG */
-int pcibios_enable_device(struct pci_dev *dev, int mask)
+int pcibios_enable_resources(struct pci_dev *dev, int mask)
{
u16 cmd, old_cmd;
int idx;
struct resource *r;
- if (ppc_md.pcibios_enable_device_hook)
- if (ppc_md.pcibios_enable_device_hook(dev))
- return -EINVAL;
-
pci_read_config_word(dev, PCI_COMMAND, &cmd);
old_cmd = cmd;
for (idx = 0; idx < PCI_NUM_RESOURCES; idx++) {
@@ -1193,3 +1189,11 @@
return 0;
}
+int pcibios_enable_device(struct pci_dev *dev, int mask)
+{
+ if (ppc_md.pcibios_enable_device_hook)
+ if (ppc_md.pcibios_enable_device_hook(dev))
+ return -EINVAL;
+
+ return pcibios_enable_resources(dev, mask);
+}
Index: work6/arch/sh/drivers/pci/pci.c
===================================================================
--- work6.orig/arch/sh/drivers/pci/pci.c 2008-02-18 10:43:50.000000000 -0700
+++ work6/arch/sh/drivers/pci/pci.c 2008-02-18 10:45:14.000000000 -0700
@@ -131,7 +131,7 @@
}
}
-int pcibios_enable_device(struct pci_dev *dev, int mask)
+int pcibios_enable_resources(struct pci_dev *dev, int mask)
{
u16 cmd, old_cmd;
int idx;
@@ -163,6 +163,11 @@
return 0;
}
+int pcibios_enable_device(struct pci_dev *dev, int mask)
+{
+ return pcibios_enable_resources(dev, mask);
+}
+
/*
* If we set up a device for bus mastering, we need to check and set
* the latency timer as it may not be properly set.
Index: work6/arch/sparc64/kernel/pci.c
===================================================================
--- work6.orig/arch/sparc64/kernel/pci.c 2008-02-18 10:43:50.000000000 -0700
+++ work6/arch/sparc64/kernel/pci.c 2008-02-18 10:45:14.000000000 -0700
@@ -946,7 +946,7 @@
{
}
-int pcibios_enable_device(struct pci_dev *dev, int mask)
+int pcibios_enable_resources(struct pci_dev *dev, int mask)
{
u16 cmd, oldcmd;
int i;
@@ -976,6 +976,11 @@
return 0;
}
+int pcibios_enable_device(struct pci_dev *dev, int mask)
+{
+ return pcibios_enable_resources(dev, mask);
+}
+
void pcibios_resource_to_bus(struct pci_dev *pdev, struct pci_bus_region *region,
struct resource *res)
{
Index: work6/arch/v850/kernel/rte_mb_a_pci.c
===================================================================
--- work6.orig/arch/v850/kernel/rte_mb_a_pci.c 2008-02-18 10:43:50.000000000 -0700
+++ work6/arch/v850/kernel/rte_mb_a_pci.c 2008-02-18 10:45:14.000000000 -0700
@@ -217,7 +217,7 @@
}
\f
-int __nomods_init pcibios_enable_device (struct pci_dev *dev, int mask)
+int __nomods_init pcibios_enable_resources (struct pci_dev *dev, int mask)
{
u16 cmd, old_cmd;
int idx;
@@ -245,6 +245,11 @@
return 0;
}
+int __nomods_init pcibios_enable_device (struct pci_dev *dev, int mask)
+{
+ return pcibios_enable_resources(dev, mask);
+}
+
\f
/* Resource allocation. */
static void __devinit pcibios_assign_resources (void)
--
^ permalink raw reply
* [patch 3/6] xtensa: make pcibios_enable_device() use pcibios_enable_resources()
From: Bjorn Helgaas @ 2008-02-28 0:04 UTC (permalink / raw)
To: linux-pci, linux-arch
Cc: Chris Zankel, Grant Grundler, linux-parisc, Matthew Wilcox,
Kyle McMartin, linuxppc-dev, Paul Mackerras, linux-arm-kernel,
Russell King
In-Reply-To: <20080228000437.880811124@ldl.fc.hp.com>
pcibios_enable_device() has an almost verbatim copy of
pcibios_enable_resources(), (the only difference is that
pcibios_enable_resources() turns on PCI_COMMAND_MEMORY if
there's a ROM resource).
The duplication might be intentional, but I don't see any callers
of pcibios_enable_resources() on xtensa, so I think it's more
likely a historical accident copied from ppc.
This patch removes the duplication, making pcibios_enable_device()
simply call pcibios_enable_resources() as x86 does.
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Index: work6/arch/xtensa/kernel/pci.c
===================================================================
--- work6.orig/arch/xtensa/kernel/pci.c 2008-02-18 10:43:50.000000000 -0700
+++ work6/arch/xtensa/kernel/pci.c 2008-02-18 11:32:12.000000000 -0700
@@ -238,31 +238,7 @@
int pcibios_enable_device(struct pci_dev *dev, int mask)
{
- u16 cmd, old_cmd;
- int idx;
- struct resource *r;
-
- pci_read_config_word(dev, PCI_COMMAND, &cmd);
- old_cmd = cmd;
- for (idx=0; idx<6; idx++) {
- r = &dev->resource[idx];
- if (!r->start && r->end) {
- printk(KERN_ERR "PCI: Device %s not available because "
- "of resource collisions\n", pci_name(dev));
- return -EINVAL;
- }
- if (r->flags & IORESOURCE_IO)
- cmd |= PCI_COMMAND_IO;
- if (r->flags & IORESOURCE_MEM)
- cmd |= PCI_COMMAND_MEMORY;
- }
- if (cmd != old_cmd) {
- printk("PCI: Enabling device %s (%04x -> %04x)\n",
- pci_name(dev), old_cmd, cmd);
- pci_write_config_word(dev, PCI_COMMAND, cmd);
- }
-
- return 0;
+ return pcibios_enable_resources(dev, mask);
}
#ifdef CONFIG_PROC_FS
--
^ permalink raw reply
* [patch 2/6] ppc: make pcibios_enable_device() use pcibios_enable_resources()
From: Bjorn Helgaas @ 2008-02-28 0:04 UTC (permalink / raw)
To: linux-pci, linux-arch
Cc: Chris Zankel, Grant Grundler, linux-parisc, Matthew Wilcox,
Kyle McMartin, linuxppc-dev, Paul Mackerras, linux-arm-kernel,
Russell King
In-Reply-To: <20080228000437.880811124@ldl.fc.hp.com>
pcibios_enable_device() has an almost verbatim copy of
pcibios_enable_resources(), (the only difference is that
pcibios_enable_resources() turns on PCI_COMMAND_MEMORY if
there's a ROM resource).
The duplication might be intentional, but I don't see any callers
of pcibios_enable_resources() on ppc, so I think it's more
likely a historical accident.
This patch removes the duplication, making pcibios_enable_device()
simply call pcibios_enable_resources() as x86 does.
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Index: work6/arch/ppc/kernel/pci.c
===================================================================
--- work6.orig/arch/ppc/kernel/pci.c 2008-02-18 10:43:50.000000000 -0700
+++ work6/arch/ppc/kernel/pci.c 2008-02-18 11:31:23.000000000 -0700
@@ -785,33 +785,11 @@
int pcibios_enable_device(struct pci_dev *dev, int mask)
{
- u16 cmd, old_cmd;
- int idx;
- struct resource *r;
-
if (ppc_md.pcibios_enable_device_hook)
if (ppc_md.pcibios_enable_device_hook(dev, 0))
return -EINVAL;
-
- pci_read_config_word(dev, PCI_COMMAND, &cmd);
- old_cmd = cmd;
- for (idx=0; idx<6; idx++) {
- r = &dev->resource[idx];
- if (r->flags & IORESOURCE_UNSET) {
- printk(KERN_ERR "PCI: Device %s not available because of resource collisions\n", pci_name(dev));
- return -EINVAL;
- }
- if (r->flags & IORESOURCE_IO)
- cmd |= PCI_COMMAND_IO;
- if (r->flags & IORESOURCE_MEM)
- cmd |= PCI_COMMAND_MEMORY;
- }
- if (cmd != old_cmd) {
- printk("PCI: Enabling device %s (%04x -> %04x)\n",
- pci_name(dev), old_cmd, cmd);
- pci_write_config_word(dev, PCI_COMMAND, cmd);
- }
- return 0;
+
+ return pcibios_enable_resources(dev, mask);
}
struct pci_controller*
--
^ permalink raw reply
* [patch 4/6] ARM: move bridge enable out of pcibios_enable_resources()
From: Bjorn Helgaas @ 2008-02-28 0:04 UTC (permalink / raw)
To: linux-pci, linux-arch
Cc: Chris Zankel, Grant Grundler, linux-parisc, Matthew Wilcox,
Kyle McMartin, linuxppc-dev, Paul Mackerras, linux-arm-kernel,
Russell King
In-Reply-To: <20080228000437.880811124@ldl.fc.hp.com>
Move bridge enable from pcibios_enable_resources() to
platform_pci_enable_device() so the former matches other
architectures and can be shared.
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Index: work6/arch/arm/kernel/bios32.c
===================================================================
--- work6.orig/arch/arm/kernel/bios32.c 2008-02-27 11:25:29.000000000 -0700
+++ work6/arch/arm/kernel/bios32.c 2008-02-27 11:55:59.000000000 -0700
@@ -683,15 +683,32 @@
cmd |= PCI_COMMAND_MEMORY;
}
+ if (cmd != old_cmd) {
+ printk("PCI: enabling device %s (%04x -> %04x)\n",
+ pci_name(dev), old_cmd, cmd);
+ pci_write_config_word(dev, PCI_COMMAND, cmd);
+ }
+ return 0;
+}
+
+static int platform_pci_enable_device(struct pci_dev *dev)
+{
+ u16 cmd, old_cmd;
+
+ pci_read_config_word(dev, PCI_COMMAND, &cmd);
+ old_cmd = cmd;
+
/*
- * Bridges (eg, cardbus bridges) need to be fully enabled
+ * Bridges (eg, cardbus bridges) need to be fully enabled.
+ * Most architectures do this in pci_enable_bridges(), not
+ * in the pci_enable_device() path.
*/
if ((dev->class >> 16) == PCI_BASE_CLASS_BRIDGE)
cmd |= PCI_COMMAND_IO | PCI_COMMAND_MEMORY;
if (cmd != old_cmd) {
- printk("PCI: enabling device %s (%04x -> %04x)\n",
- pci_name(dev), old_cmd, cmd);
+ dev_info(&dev->dev, "enabling bridge device (%04x -> %04x)\n",
+ old_cmd, cmd);
pci_write_config_word(dev, PCI_COMMAND, cmd);
}
return 0;
@@ -699,7 +716,12 @@
int pcibios_enable_device(struct pci_dev *dev, int mask)
{
- return pcibios_enable_resources(dev, mask);
+ int err;
+
+ if ((err = pcibios_enable_resources(dev, mask)) < 0)
+ return err;
+
+ return platform_pci_enable_device(dev);
}
int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
--
^ permalink raw reply
* Re: FW: [PATCH] Xilinx: BSP: Updated ML405 to match hardware used for testing
From: Stephen Rothwell @ 2008-02-28 0:01 UTC (permalink / raw)
To: John Linn; +Cc: linuxppc-dev, git-dev
In-Reply-To: <20080227231521.4673DE3006A@mail124-dub.bigfish.com>
[-- Attachment #1: Type: text/plain, Size: 569 bytes --]
Hi John,
n Wed, 27 Feb 2008 16:15:18 -0700 "John Linn" <John.Linn@xilinx.com> wrote:
>
> The default config file for the ML405 and the xparameters*.h file
> were updated to match the hardware used for testing. The platform
> data in virtex_devices.c was updated for the LL TEMAC driver
> which now uses the dcr_host field to determine if it should use
> DCR for the DMA.
>
> Signed-off-by: John Linn <john.linn>
This was badly wrapped as well.
--
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: FW: [PATCH] Xilinx: LL TEMAC/Bootstrap: Updated driver and bootstrap to pull mac addr from eeprom
From: Stephen Rothwell @ 2008-02-28 0:00 UTC (permalink / raw)
To: John Linn; +Cc: linuxppc-dev, git-dev
In-Reply-To: <20080227231452.DD4124507B7@mail190-dub.bigfish.com>
[-- Attachment #1: Type: text/plain, Size: 670 bytes --]
Hi John,
On Wed, 27 Feb 2008 16:14:50 -0700 "John Linn" <John.Linn@xilinx.com> wrote:
>
> The LL TEMAC driver was updated to use the mac address from the board
> data,
> to use the Marvell specific PHY code so that 10 Mbit works, and to use
> the
> dcr_host from the platform data rather than using conditional
> compilation
> for DCR with DMA. The bootstrap loader was changed to read the mac
> address
> from the eeprom into the board data.
>
> Signed-off-by: John Linn <john.linn@xilinx.com>
This patch was badly wrapped by something ...
--
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
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox