Subject: Re: LAN Adapter driver
To: None <port-dreamcast@netbsd.org>
From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
List: port-dreamcast
Date: 09/25/2002 00:47:01
In article <yf9ofan8m01.fsf@mc.pp.se>
marcus@mc.pp.se wrote:
> > Anyway, Broadband Adapter is connected over gapspci bridge,
> > so it should have own bus_space functions, I think.
>
> It doesn't really make sense to duplicate the code to access the G2
> bus into each device driver that uses a device on the G2 bus. That
> only leads to poor code maintainability. If we need to change the way
> the G2 bus itself is accessed, we should only have to change one file.
Well, I'm not sure what do you mean "to duplicate the code,"
but do you check implementation of mac68k bus_space?
On mac68k, bus_space_handle_t is structure which has
pointers of each access method. In this method, you can
specify independ functions for each device but you don't
have to change each device driver.
> If the there was a way to specify stride, then the Lan
> Adapter bus_space would not be needed either. Since bus_space_map
> takes a "flags" parameter, maybe we could add a flag to
> g2bus_bus_space_map which selects stride mode?
Some ports handle "stride" in this way. arc has members in
bus_space_tag_t and each read/write functions/macros handle it
by thierselves. amiga switches methods for each stride by bus.
mac68k switches them by device.
> The bus_space_handle_t
> would have to be changed into something more complicated for this to
> work though, I expect.
Yes, and it might cause some overhead, but portability
is more inportant, I guess :-)
> > BTW, wdc adapter made by Kiyoshi Ikehara also requires different
> > bus_space functions.
>
> What does it require which is missing from the current bus_space
> implementation?
He said he had to use bus_space_{read,write}_2() even on 8 bit access.
I'm not sure it's hardware problem or driver problem, though.
> We should add those things rather than have multiple
> implementations, I think.
Again, I won't suggest "multiple implementation."
I'd just like to have a way to switch access functions
for each devices.
> > Do you mean all devices on g2bus have to call G2_LOCK and G2_UNLOCK?
>
> All accesses through the g2bus (either to devices or to memory) need
> the locking. It is needed because of a hardware bug in the bus itself.
Ok, I see.
> The locking should be provided by the bus driver, not the individual
> device drivers.
Yes, I think so too.
---
Izumi Tsutsui
tsutsui@ceres.dti.ne.jp