Subject: Re: m68k comman part (was Re: mips ports ...)
To: Charles M. Hannum <mycroft@MIT.EDU>
From: Chris G Demetriou <Chris_G_Demetriou@UX2.SP.CS.CMU.EDU>
Date: 03/21/1996 00:36:04
> In order to really do this properly, the m68k ports should probably
> implement the <machine/bus.h> interface designed by cgd...then, it might
> even be possible to share things like the 8390 driver with the i386 port...
> No. On the i386, the cards are mapped through I/O space; on the
> others, they're mapped in memory space. Chris's interface does not
> deal with such conflicts.
Nor can it, without imposing unnecessary speed penalties on devices
that don't need to deal with that case.
i figure, if you're writing a device that has to deal with that case,
and you _really_ _really_ _really_ want it to work with both memory
and I/O spaces, you'll do one of two things:
(1) #ifdef, which is plenty fast, but will only let you
use one method, in any given kernel, or
(2) run-time test a flag, which is slower, but which will
let you do whatever you want.
I wasn't willing to force people to abide by my decision for what to
do, so i left it to driver authors. Quite frankly, i don't think
_either_ decision makes sense, for all sets of drivers, and were I to
do it beneath the interface, i'd _have_ to do (2) on the i386. (Which
would suck, especially for simple memory reads/writes. On the alpha,
all is memory mapped, so memory and I/O space reads are equally
efficient, bus access and cycle issues aside.)
You will not that I/O and memory operations do have the same set of
arguments, etc., though on different architectures their arguments'
types may be different.