linux/arch/sparc/kernel
David S. Miller a83f982313 [SPARC]: Fix OF register translations under sub-PCI busses.
There is an implicit assumption in the code that ranges will translate
to something that can fit in 2 32-bit cells, or a 64-bit value.  For
certain kinds of things below PCI this isn't necessarily true.

Here is what the relevant OF device hierarchy looks like for one of
the serial controllers on an Ultra5:

    Node 0xf005f1e0
        ranges:      00000000.00000000.00000000.000001fe.01000000.00000000.01000000
                     01000000.00000000.00000000.000001fe.02000000.00000000.01000000
                     02000000.00000000.00000000.000001ff.00000000.00000001.00000000
                     03000000.00000000.00000000.000001ff.00000000.00000001.00000000
        device_type:  'pci'
        model:  'SUNW,sabre'

        Node 0xf005f9d4
            device_type:  'pci'
            model:  'SUNW,simba'

           Node 0xf0060d24
                ranges:  00000010.00000000 82010810.00000000.f0000000 01000000
			 00000014.00000000 82010814.00000000.f1000000 00800000
                name:  'ebus'

                Node 0xf0062dac
                    reg:  00000014.003083f8.00000008 --> 0x1ff.f13083f8
                    device_type:  'serial'
                    name:  'su'

So the correct translation here is:

1) Match "su" register to second ranges entry of 'ebus', which translates
   into a PCI triplet "82010814.00000000.f1000000" of size 00800000, which
   gives us "82010814.00000000.f13083f8".

2) Pass-through "SUNW,simba" since it lacks ranges property

3) Match "82010814.00000000.f13083f8" to third ranges property of PCI
   controller node 'SUNW,sabre', and we arrive at the final physical
   MMIO address of "0x1fff13083f8".

Due to the 2-cell assumption, we couldn't translate to a PCI 3-cell
value, and we couldn't perform a pass-thru on it either.

It was easiest to just stop splitting the ranges application operation
between two methods, ->map and ->translate, and just let ->map do all
the work.  That way it would work purely on 32-bit cell arrays instead
of having to "return" some value like a u64.

It's still not %100 correct because the out-of-range check is still
done using the 64 least significant bits of the range and address.
But it does work for all the cases I've thrown at it so far.

Signed-off-by: David S. Miller <davem@davemloft.net>
2006-07-13 01:50:15 -07:00
..
apc.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
asm-offsets.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
auxio.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
cpu.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
devices.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
ebus.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
entry.S Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
errtbls.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
etrap.S Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
head.S Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
idprom.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
init_task.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ioport.c [SPARC]: Add of_io{remap,unmap}(). 2006-06-29 16:37:16 -07:00
irq.c [PATCH] irq-flags: SPARC: Use the new IRQF_ constants 2006-07-02 13:58:48 -07:00
led.c [PATCH] arch/sparc/kernel/led.c __user annotations 2005-12-15 10:01:29 -08:00
Makefile [SPARC]: Port of_device layer and make ebus use it. 2006-06-23 23:15:47 -07:00
module.c [SPARC]: Handle UNWIND_INFO properly. 2006-05-12 12:45:50 -07:00
muldiv.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
of_device.c [SPARC]: Fix OF register translations under sub-PCI busses. 2006-07-13 01:50:15 -07:00
pcic.c [PATCH] irq-flags: SPARC: Use the new IRQF_ constants 2006-07-02 13:58:48 -07:00
pmc.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
process.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
prom.c [SPARC]: Add of_n_{addr,size}_cells(). 2006-06-29 16:37:10 -07:00
ptrace.c [PATCH] sparc: task_thread_info() 2006-01-12 09:08:53 -08:00
rtrap.S [SPARC]: Add support for *at(), ppoll, and pselect syscalls. 2006-01-19 02:42:49 -08:00
sclow.S kbuild: arm26,sparc use generic asm-offset support 2005-09-09 20:35:55 +02:00
semaphore.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
setup.c [PATCH] tty: Remove include of screen_info.h from tty.h 2006-07-10 13:24:16 -07:00
signal.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
smp.c [SPARC]: Mark smp init functions as cpuinit 2006-06-20 00:36:10 -07:00
sparc-stub.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
sparc_ksyms.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
sun4c_irq.c [PATCH] irq-flags: SPARC: Use the new IRQF_ constants 2006-07-02 13:58:48 -07:00
sun4d_irq.c [PATCH] irq-flags: SPARC: Use the new IRQF_ constants 2006-07-02 13:58:48 -07:00
sun4d_smp.c [SPARC]: Try to start getting SMP back into shape. 2006-03-23 22:36:19 -08:00
sun4m_irq.c [PATCH] irq-flags: SPARC: Use the new IRQF_ constants 2006-07-02 13:58:48 -07:00
sun4m_smp.c [SPARC]: Mark smp init functions as cpuinit 2006-06-20 00:36:10 -07:00
sun4setup.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
sunos_asm.S Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
sunos_ioctl.c [SPARC]: Kill remaining kbio.h references. 2005-11-07 14:12:21 -08:00
sys_solaris.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
sys_sparc.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
sys_sunos.c [PATCH] zoned vm counters: conversion of nr_pagecache to per zone counter 2006-06-30 11:25:34 -07:00
systbls.S Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
tadpole.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
tick14.c [PATCH] irq-flags: SPARC: Use the new IRQF_ constants 2006-07-02 13:58:48 -07:00
time.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
trampoline.S Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
traps.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
unaligned.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
vmlinux.lds.S [SPARC]: Use STABS_DEBUG and DWARF_DEBUG macros in vmlinux.lds.S 2005-12-28 13:22:54 -08:00
windows.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
wof.S Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
wuf.S Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00