diff options
author | David S. Miller <davem@davemloft.net> | 2009-12-09 01:39:09 -0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-12-18 13:44:08 -0800 |
commit | ec5e87a33f85e49acde6ee737c27d48595dd456a (patch) | |
tree | 3269d7fe07e7c8f459f6aa6aa16ab80625b86f5b /arch | |
parent | 91c1e7f6a857670528d6dec7640e5c305cee14e6 (diff) | |
download | lwn-ec5e87a33f85e49acde6ee737c27d48595dd456a.tar.gz lwn-ec5e87a33f85e49acde6ee737c27d48595dd456a.zip |
sparc64: Fix overly strict range type matching for PCI devices.
[ Upstream commit 4230fa3b89ea1c413766bd411a8315a3d05aa6c7 ]
When we are trying to see if a range property entry applies
to a given address, we are overly strict about the type.
We should only allow I/O ranges for I/O addresses, and only allow
CONFIG space ranges for CONFIG space address.
However for MEM ranges, they come in 32-bit and 64-bit flavors.
And a lack of an exact match is OK if the range is 32-bit and
the address is 64-bit. We can assign a 64-bit address properly
into a 32-bit parent range just fine.
So allow it.
Reported-by: Patrick Finnegan <pat@computer-refuge.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/sparc/kernel/of_device_64.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/arch/sparc/kernel/of_device_64.c b/arch/sparc/kernel/of_device_64.c index 881947e59e95..0a6f2d1798d1 100644 --- a/arch/sparc/kernel/of_device_64.c +++ b/arch/sparc/kernel/of_device_64.c @@ -104,9 +104,19 @@ static int of_bus_pci_map(u32 *addr, const u32 *range, int i; /* Check address type match */ - if ((addr[0] ^ range[0]) & 0x03000000) - return -EINVAL; + if (!((addr[0] ^ range[0]) & 0x03000000)) + goto type_match; + + /* Special exception, we can map a 64-bit address into + * a 32-bit range. + */ + if ((addr[0] & 0x03000000) == 0x03000000 && + (range[0] & 0x03000000) == 0x02000000) + goto type_match; + + return -EINVAL; +type_match: if (of_out_of_range(addr + 1, range + 1, range + na + pna, na - 1, ns)) return -EINVAL; |