On Fri, 22 Jan 1999, Thomas Schenk wrote:

> >I'm fairly certain that it is the virtual to physical mapping macros that are
> >producing incorrect results.  Please try changing linux/include/asm-i386/io.h
> >from:
> >
> >#define __io_virt(x)         ((void *)(PAGE_OFFSET | (unsigned long)(x)))
> >#define __io_phys(x)         ((unsigned long)(x) & ~PAGE_OFFSET)
> >
> >to:
> >
> >#define __io_virt(x)         ((void *)((unsigned long)(x) + PAGE_OFFSET))
> >#define __io_phys(x)         ((unsigned long)(x) - PAGE_OFFSET)

the + - variant just hides the real bug. If it makes a difference, then
this is clearly a bug somewhere in a driver. __io_virt(__io_virt(x))
should never be done in a driver. It would be very nice to debug the
driver bug, the bug could have other side-effects too. To debug 'invalid'
(ie. nested) uses of __io_virt() and __io_phys():

#define __io_virt(x)   ({ \
        void * __res; \
        if (x >= PAGE_OFFSET) { \
                printk("__io_virt bug in %s:%d!\n", __FILE__, __LINE__); \
                __res = x; \
        } else \
                __res = ((void *)(PAGE_OFFSET | (unsigned long)(x))); \
        __res;
})

#define __io_phys(x)   ({ \
        unsigned long __res; \
        if (x <= PAGE_OFFSET) { \
                printk("__io_phys bug in %s:%d!\n", __FILE__, __LINE__); \
                __res = x; \
        } else \
                __res = ((unsigned long)(x) & ~PAGE_OFFSET);
        __res;
})

Do these debugging variants print anything suspicious? Thanks,

-- mingo

-
Linux SMP list: FIRST see FAQ at http://www.irisa.fr/prive/mentre/smp-faq/
To Unsubscribe: send "unsubscribe linux-smp" to [EMAIL PROTECTED]

Reply via email to