Hi,
I don't expect you to know the ultimate answer to this question - hoping
Geert, as m68k kernel maintainer will voice an opinion.
Having authored a little of the code in io_mm.h and raw_io.h, I know
from experience how many pitfalls lie hidden in that file.
On 17/09/18 06:05, ALeX Kazik wrote:
Hi,
@Michael: sorry for the duplicate, added a sentence.
I wonder whether this hunk could be moved to arch/m68k/include/asm/io_mm.h?
At least I don't know and I'm not a kernel developer I just adapted
the patch and made it presentable (after some help from the
demiag-m68k list).
As far as I can see, inb() and outb() won't be used by any other driver
than apne.c on Amiga.
Almost all 8390 *.c files use inb() and outb(), which includes six
more drivers which are available when Amiga is the only supported
platform (some require ZORRO). At least I think they are used because
of "#define ei_inb(_p) inb(_p)" in 8390.h.
The Hydra, Zorro8390 and AX88796/XSurf100 all include lib8390.c. That
driver core uses the ei_inb() macro that is defined in the respective
platform driver wrappers (and the definitions there all use read_8() and
such, that is, MMIO accessors). Not a problem there. You should adjust
your Kconfig conditional to leave out these drivers. There is also no
need to include MAC8390, ARM_ETHERH, AX88796 and MCF8390 (they all use
the lib8390 core, hence ei_inb() which resolves to raw_io accessors in
all cases except for MCF8390, but that one ought to include io_no.h, and
building a kernel for both Coldfire and classic m68k won't work anyway).
Leaves apne.c, ne.c, ne2k-pci, axnet_cs.c, pcnet_cs.c, stnic.c,
smc-ultra.c and wd.c to consider, which all link 8390.o or 8380p.o.
Leaving aside apne.c, is one of those others actually used on Amiga,
Mac, Q40, or Atari?
(I know for a fact that ne.c is used on Atari, but with that driver
forcing inb() to resolve to either the Atari ROM port accessor code or
raw in_8(), I can't see how even unpatched apne.c would work in a kernel
that includes Atari ne.c support. Let's leave that aside for the purpose
of this discussion.)
And I don't think to make the changes globally available since the
patch changes the behaviour of inb/outb for all 8390 drivers already.
Yes, I agree that your patch changes the IO access for all 8390 drivers
that do use inb(), but that does _not_ include Hydra, Zorro8390 and
Xsurf00, Mac8390, EtherH and AX88796 (see above). Neither EtherH nor
MCF8390 can be configured for a classic m68k kernel.
My suggestion is merely meant as a fallback option (in case your patch
to the 8390.h header file is rejected).
On second thought - might be better to leave io_mm.h well alone for now.
I'll send another reply to your patch with just the comment regarding
the Kconfig changes to netdev, so that's properly on-record for Dave.
Cheers,
Michael