Subject: Re: diff betw. bus_space_{read,write} and
To: None <bouyer@antioche.lip6.fr>
From: Ken Nakata <kenn@synap.ne.jp>
List: tech-kern
Date: 08/25/1998 09:49:10
On Tue, 25 Aug 1998 07:34:59 +0900, Ken Nakata wrote:
> On Tue, 28 Jul 1998 06:03:06 +0200, Manuel Bouyer wrote:
> > On Aug 24, Ken Nakata wrote
> > > Since mac68k bus_space_{read,write}{,_multi}_2() do not byte-swap, and
> > > making them conditionally do so depending on the tag would give all
> > > other bus_space_{read,write}*() a performance hit,
> > 
> > Why ? Just do it like for ATARI: redefine them for the tag passed to
> > the independant wdc part.
> 
> Ok, I admit I'm not familiar enough with bus_space implementation in
> general.  I'll take a look at atari's.

Ok, I did, and I concluded moving toward atari-like bus_space
implementation from mac68k bus_space implementation itself gives a
performance hit to every single bus_space_{read,write}*.

Consider the following definition of bus_space_read_multi_2() in
mac68k:

#define	bus_space_read_multi_2(t, h, o, a, c) do {			\
	(void) t;							\
	__asm __volatile ("						\
		movl	%0,a0					;	\
		movl	%1,a1					;	\
		movl	%2,d0					;	\
	1:	movw	a0@,a1@+				;	\
		subql	#1,d0					;	\
		jne	1b"					:	\
								:	\
		    "r" ((h) + (o)), "g" (a), "g" (c)		:	\
		    "a0","a1","d0");					\
} while (0)

It's much simpler than atari's, and if you look at this, you'll notice
tag isn't even used at all.

OTOH, atari bus_space_tag_t is a huge struct full of pointers to
bus_space_{read,write}* methods, and any bus_space_{read,write}* call
always involves at least one level of memory indirect reference.
Wouldn't you call this a performance hit, when compared to what we
have in mac68k now?

Perhaps this cost is justified on atari since ataris have ISA bus, but
AFAIK, IDE bus is _the_ _only_ LE bus present in any 68k Mac model,
and I just don't think it's worth converting mac68k bus_space
implementation into something like atari's only for using the MI wdc.c
without modification.  I'm not sure what Scott (Reynolds, mac68k
portmaster) would think, but at least for now, I opt for keeping a
separate copy of wdc.c in arch/mac68k/dev.

Thanks for your enlightening discussion,

Ken