Re: RFC: outb 0x80 in inb_p, outb_p harmful on some modern AMD64 with MCP51 laptops

Alan Cox
2007-12-11T14:33:47Z

> That could be true if outb_p were used only in architecture dependent
> code, but it's not. It's used in drivers that are supposed to run on
> all sorts of platforms. Why does a megaraid controller need delays on
> i386 but not on Sparc, PowerPC, Alpha and others? Is it buggy on most
> platforms, or just unnecessarily slow on Intel?

Each platform provides its own versions of the various _p functions which
work as required for that platform.

As to megaraid, I don't have the docs so I couldn't specifically tell you
but the use in that driver looks dubious as its not an ISA/LPC device.

> It's most commonly a zero delay. Only in the minority of architectures
> is it otherwise. If a delay is needed, then put one in, but don't put
> in a paper promise that's more likely to be ignored than observed.

Most of those platforms have hardware that was designed not to need those
delays and they know that their CMOS clock etc are not clocked at half
the LPC bus clock. Thus they don't need _p.

> without need. Not surprising since it has such a vague specific
> meaning. One could say, Linux on i386 is liberally sprinkled with

"vague specific" ? sorry don't follow you.

Its an ISA bus delay on systems that need it (or an LPC bus delay on
newer ones).

> I really prefer accurate code, but I'm also pragmatic and realise that
> it's far too much work to fix this any time soon. But if it were to be
> fixed, then perhaps _p would take an additional parameter, measured in
> cycles of delay.

measured in what, against what, for which bus.

inb_p/outb_p are really only meaningful for ISA/LPC bus devices. In those
cases it is precisely defined. Its use for PCI devices is a bit suspect
and as a general rule probably wrong.

Alan