Re: Memory mapped IO vs Port IO

Jesse Barnes
2003-09-12T16:27:38Z

On Fri, Sep 12, 2003 at 09:10:25AM -0700, Anthony Dominic Truong wrote:
> Andi Kleen wrote:
> > #ifdef CONFIG_MMIO
> > writel(... )
> > readl(...)
> > #else
> > outl( ... )
> > inl ( ...)
> > #endif
> >
> > to
> > if (dev->mmio) {
> > writel();
> > real();
> > } else {
> > outl();
> > inl();
> > }
> >
> > and you will have a hard time to benchmark the difference on any non
> > ancient system
> > in actual driver operation.
> >
> > -Andi
> >
> Hello,
> Wouldn't it be better if we set the IN and OUT function pointers to the
> right functions during driver init. based on the setting of dev->mmio.
> And throughout the driver, we just call the IN and OUT functions by
> their pointers. Then we don't have to do if (dev->mmio) every time.
> It's similar to the concept of virtual member function in C++.

I'd rather not see any more pointer dereferences or even branches than
absolutely necessary. Right now, readX/writeX and inX/outX are usually
inlines, and outX and writeX can be very fast. So I'd prefer either a
global CONFIG_MMIO option or consistent driver specific options that
explain what the difference between MMIO and port I/O actually is.

Jesse