Subject: Re: problem with bus_space_map
To: Anand Lalgondar <solarflares@fastmail.fm>
From: Thor Lancelot Simon <tls@rek.tjls.com>
List: tech-kern
Date: 02/13/2004 00:51:13
On Fri, Feb 13, 2004 at 10:19:19AM +0530, Anand Lalgondar wrote:
> 
> > > The on-chip devices and the on-board devices will be allocated some fixed
> > > physical address that are mapped to some virtual address. All of the
> > > devices may not require bus_space functionality to be implemeted. But, it
> > 
> > In NetBSD all device drivers should use bus_space :)
> > device drivers not using bus_space are machine-dependant, so they can
> > update
> > the bus_space informations if needed.
> > 
> Thats true and I compeletely agree. But, when you want to write a driver
> to an on-chip or on-board pheripheral device the first thing would be to
> test the basic functionality of the device without bothering about the
> bus_space tag/handle. Finally when the basic flow is ready then you have

I disagree.  Given a bus_space implementation for the port in question,
using bus_space can make driver writing _faster_, because it makes the
logic of things like updating device registers _clearer_, and thus
much less error prone.

Certainly it is hard to concieve of using bus_space making a driver
development process much longer, unless you're porting an entire
driver from an operating system which doesn't have bus_space (and
even then, converting to bus_space is the right way to make _sure_
you didn't miss any endianness assumptions, etc.)

Thor