[PATCH] POWERPC: Support ISA legacy addresses in of_address_to_resource()

Benjamin Herrenschmidt benh at kernel.crashing.org
Fri May 9 14:31:20 EST 2008


On Thu, 2008-05-08 at 18:26 -0500, Nate Case wrote:
> When mapping an open firmware device tree node to a resource,
> check if the device is on the "isa" legacy bus.  In this case,
> pci_address_to_pio() should not be used since that function is only
> for addresses above the 64KB reserved region.
> 
> This was necessary to get IPMI working on a board that accesses
> the IPMI controller via the legacy I/O region.

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.

> Signed-off-by: Nate Case <ncase at xes-inc.com>
> ---
>  arch/powerpc/kernel/prom_parse.c |   10 +++++++++-
>  1 files changed, 9 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/powerpc/kernel/prom_parse.c b/arch/powerpc/kernel/prom_parse.c
> index 90eb3a3..28d354d 100644
> --- a/arch/powerpc/kernel/prom_parse.c
> +++ b/arch/powerpc/kernel/prom_parse.c
> @@ -622,7 +622,15 @@ static int __of_address_to_resource(struct device_node *dev, const u32 *addrp,
>  	memset(r, 0, sizeof(struct resource));
>  	if (flags & IORESOURCE_IO) {
>  		unsigned long port;
> -		port = pci_address_to_pio(taddr);
> +		struct device_node *parent;
> +
> +		parent = of_get_parent(dev);
> +		if (of_bus_isa_match(parent))
> +			port = (unsigned long) taddr;
> +		else
> +			port = pci_address_to_pio(taddr);
> +		of_node_put(parent);
> +
>  		if (port == (unsigned long)-1)
>  			return -EINVAL;
>  		r->start = port;




More information about the Linuxppc-dev mailing list