From: Nate Case <ncase@xes-inc.com>
To: benh@kernel.crashing.org
Cc: linuxppc-dev@ozlabs.org
Subject: Re: [PATCH] POWERPC: Support ISA legacy addresses in of_address_to_resource()
Date: Fri, 09 May 2008 16:31:19 -0500 [thread overview]
Message-ID: <1210368679.13845.315.camel@localhost.localdomain> (raw)
In-Reply-To: <1210307480.1421.132.camel@pasglop>
On Fri, 2008-05-09 at 14:31 +1000, Benjamin Herrenschmidt wrote:
> I don't understand that fix. Can you tell us more about the exact
> failure mode ? Especially, show us the device-tree bits and the
> addresses returned.
>
> I suspect the bug is in your device-tree that is forwarding IO
> addresses
> all the way without converting them to memory or something like that.
Your suspicion is correct in a way -- this allows IO port addresses to
make their way to 'struct resource' so that drivers can use inb(),
outb(), etc. After some thought, I'm not sure if a device tree using
I/O port addresses for a legacy node is considered a bug or not.
Here is the failure case my patch fixes:
isa@0,e00f0000 {
linux,phandle = <0x3ff93688>;
ranges = <0x1 0x0 0x0 0x0 0x1000>;
reg = <0x0 0xe00f0000 0x0 0x10000>;
class-code = <0x601ff>;
device-id = <0xa008>;
vendor-id = <0x1959>;
#address-cells = <0x2>;
#size-cells = <0x1>;
device_type = "isa";
ipmi@ca2 {
linux,phandle = <0x3ff93a00>;
reg = <0x1 0xca2 0x100>;
reg-spacing = <0x1>;
reg-size = <0x1>;
compatible = "ipmi-kcs";
device_type = "ipmi";
};
};
The address returned for ipmi@ for this case is 0x10ca2 instead of
0xca2.
The legacy "isa" bus node and the device nodes give the raw port
addresses (0xca2 in this case). In order for this to work, it has to be
assumed that ISA_IO_BASE is mapped properly on the platform so that the
port I/O functions will work with the raw port addresses.
The problem I encountered was that it would call pci_address_to_pio() on
the reg address of the ipmi node just because it had the IORESOURCE_IO
flag. This would result in the 'struct resource' getting the bogus
address of 0x10ca2 rather than 0xca2.
In my case, my real fix I have settled on is using the following instead
of using the I/O method:
isa@0,e00f0000 {
linux,phandle = <0x3ff93688>;
ranges = <0x0 0x0 0x0 0xfc800000 0x1000>;
reg = <0x0 0xe00f0000 0x0 0x10000>;
class-code = <0x601ff>;
device-id = <0xa008>;
vendor-id = <0x1959>;
#address-cells = <0x2>;
#size-cells = <0x1>;
device_type = "isa";
ipmi@ca2 {
linux,phandle = <0x3ff93a00>;
reg = <0x0 0xca2 0x100>;
reg-spacing = <0x1>;
reg-size = <0x1>;
compatible = "ipmi-kcs";
device_type = "ipmi";
};
};
That is, the typical MMIO case so that 'struct resource' ends up with
0xfc800ca2. This works fine without the patch of course. If legacy I/O
port addresses are not permitted in device trees this way and we don't
want to support it, then you can ignore my patch. However, it does seem
a little strange to me that __of_address_to_resource() assumes anything
with IORESOURCE_IO is a PCI device.
- Nate Case <ncase@xes-inc.com>
next prev parent reply other threads:[~2008-05-09 21:31 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-08 23:26 [PATCH] POWERPC: Support ISA legacy addresses in of_address_to_resource() Nate Case
2008-05-09 4:31 ` Benjamin Herrenschmidt
2008-05-09 21:31 ` Nate Case [this message]
2008-05-09 22:27 ` Benjamin Herrenschmidt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1210368679.13845.315.camel@localhost.localdomain \
--to=ncase@xes-inc.com \
--cc=benh@kernel.crashing.org \
--cc=linuxppc-dev@ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).