public inbox for linux-sh@vger.kernel.org
 help / color / mirror / Atom feed
* ioremap() on SH
@ 2008-02-14 14:36 Franck Bui-Huu
  2008-02-14 14:57 ` Paul Mundt
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Franck Bui-Huu @ 2008-02-14 14:36 UTC (permalink / raw)
  To: linux-sh

Hello,

I'm puzzled by the implementation of ioremap() on SH architecture.

Here it is:

        if (likely(PXSEG(offset) < P3SEG && PXSEG(last_addr) < P3SEG)) {
                if (unlikely(flags & _PAGE_CACHABLE))
                        return (void __iomem *)P1SEGADDR(offset);

                return (void __iomem *)P2SEGADDR(offset);
        }

        return __ioremap(offset, size, flags);

where 'offset' is a physical address...

If I understand correctly PXSEG(x) is used to get the segment of a
_virtual_ address, so doing PXSEG(offset) looks weird.

Furthermore, it looks like the virtual to physical address translation is
similar to MIPS 32 bits architecture. Therefore only the low 512Mo of the
physical address space can be accessed through P1/P2 segments.

So this test:

        if (likely(PXSEG(offset) < P3SEG && PXSEG(last_addr) < P3SEG)) {

                /* simply map the address into P2 seg */

        }

where P3SEG = 0xc0000000 seems wrong too.

Why not simply doing something like this ?

        if (unlikely(offset >= offset + size))
                return NULL;

        if (offset + size < 0x20000000)
                return (void __iomem *)P2SEGADDR(offset);

        return __ioremap(offset, size, flags);

Thanks

                Franck

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2008-02-18 13:44 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-14 14:36 ioremap() on SH Franck Bui-Huu
2008-02-14 14:57 ` Paul Mundt
2008-02-14 16:42 ` Franck Bui-Huu
2008-02-14 17:09 ` Paul Mundt
2008-02-14 19:39 ` Franck Bui-Huu
2008-02-15 13:15 ` Stuart MENEFY
2008-02-15 21:12 ` Franck Bui-Huu
2008-02-18 13:44 ` Stuart MENEFY

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox