Subject: Re: SCSI differences between 1.4.x & 1.5
To: None <ender@macbsd.com>
From: Allen Briggs <briggs@wasabisystems.com>
List: port-mac68k
Date: 12/16/2000 20:03:24
--H1spWtNR+x+ondvy
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

> is there a reason why doing the operation with a bus_space_read is so much
> slower than a variable dereference?

Yes.  At some point, I "enhanced" the bus_space calls to handle mixed
endian registers and padded/strided memory access.  In doing this, the
bus_space_read_4() went from being a macro for that variable dereference,
and became a function call.

I don't know if this is the problem, but it might be since the data
read/write routines will be calling this function a lot.  I'm still
compiling my kernel to test, and I did find a bug in my diff.  The
correct (I think) diff is attached.

The eventual solution might be to put the bus_space functions in bus.h
as static __inline__ functions.

-allen

-- 
 Allen Briggs                     briggs@wasabisystems.com
 http://www.wasabisystems.com/    Quality NetBSD CDs, Sales, Support, Service

--H1spWtNR+x+ondvy
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=diff

Index: esp.c
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/mac68k/obio/esp.c,v
retrieving revision 1.25
diff -u -r1.25 esp.c
--- esp.c	2000/06/05 07:59:52	1.25
+++ esp.c	2000/12/16 22:28:18
@@ -581,10 +581,7 @@
 esp_dafb_have_dreq(esc)
 	struct esp_softc *esc;
 {
-	u_int32_t r;
-
-	r = bus_space_read_4(esc->sc_tag, esc->sc_bsh, 0);
-	return (r & 0x200);
+	return (*(volatile u_int32_t *) (esc->sc_bsh.base) & 0x200);
 }
 
 static __inline__ int

--H1spWtNR+x+ondvy--