Subject: Re: sharing drivers (was re: m68k comman...)
To: Julian Bean <jules@mailbox.co.uk>
From: Jason Thorpe <thorpej@nas.nasa.gov>
List: current-users
Date: 03/22/1996 09:28:08
On Fri, 22 Mar 1996 10:16:20 +0000 
 jules@mailbox.co.uk (Julian Bean) wrote:

 > I don't have a great deal of experience with driver code, but can't we
 > #define all the interfaces to the driver data.  Something like:
 > 
 > #define  ADriverRegA  (*(int *)(0xAddress))
 > #define  ADriverRegB  (*(int *)(0xAddress))
 > 
 > in <machince/ADriver.h>, on a memory mapped machine, and have equivalent
 > code on the I/O space machines.

The problem with this is that you end up exporting a whole bunch of gunk 
to userland, and you have N different header files that basically do the 
same thing, just slightly differently.

Then, we get into the issue that was addressed by the local device 
attachment changes that went in recently (I'll post some detail about 
them later ... I've had lots of requests for that, and I was a dork for 
not posting about it in the first place :-)

I'll use the Alpha (seems like it's a popular example now-a-days :-) to 
demonstrate the problem....The alpha comes in TurboChannel, ISA/EISA, and 
ISA/EISA/PCI flavors.  The stock network interface on the TC systems is a 
LANCE-based card ... There are also ISA-based cards for these systems.  
So, you then need to have two header files for each of the different drivers:

	<machine/if_le_isa_machdep.h>
	<machine/if_le_tc_machdep.h>

"Ick."

--------------------------------------------------------------------------
Jason R. Thorpe                                       thorpej@nas.nasa.gov
NASA Ames Research Center                               Home: 408.866.1912
NAS: M/S 258-6                                          Work: 415.604.0935
Moffett Field, CA 94035                                Pager: 415.428.6939