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

From: Nate Case <[email-masked]>
Date: Thu, 08 May 2008 18:26:32 -0500

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.

Signed-off-by: Nate Case <[email-masked]>
---
 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;
-- 
1.5.4.4