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 02:07:52
In article <yf9k7lb8i99.fsf@mc.pp.se>
marcus@mc.pp.se wrote:
> The thing was that I read your message as
> "Each device should have independent bus_space(9) functions"
> ^^^^^^
> which was not what you actually wrote. Hence the odd excursion. I
> think we basically agree here already.
Oops, sorry for my poor English..
I should say "it should be able to have" and so.
> Yeah. Changing the function pointer like on Amiga would be more
> efficient, but I'm not sure how to let the device driver select stride
> in this case, since the tag is already created in the attach_args when
> the driver is called. Of course, we could pre-create tags for all the
> necessary strides and pass them all in the attach_args, and then the
> driver can chose any tag it likes. Maybe this is the nicest solution;
> it would be as efficient as before, and we don't have to change the
> bus_space_handle_t since only the tag would be different. What do you
> think?
Because bus_space_tag_t is used to describe bus, it is created
in the attach_args. If we put the funtion pointers into bus space tag,
all devices on the bus should have the same stride.
If each device on the same bus could have different stride,
we should put the pointers into bus space handle,
which describes device specific things.
(man page says it describes mapping of a range of bus_space, though.)
On the other hand, macppc put stride into bus space tag in its
lower bits at each device attachment. (see macppc/dev/wdc_obio.c)
It does not pass bus space tag from attach_args to MI drivers directly.
We could change the function pointers in bus space tag similarly, but
I don't know whether such implementation is acceptable.
Another possible way is to prepare independent bus space tag for gapspci.
> > 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.
>
> Ok. If this is really needed, we could add a flag / tag for this as
> well. Shouldn't be a problem.
Maybe it has less overhead to switch function pointers rather than
checking flags on each access, but I will check that is really
needed for the devices. Anyway, it is actually something like
bridge device (it also has ISA NE2000) so we might have to prepare
another bus space tag for it.
---
Izumi Tsutsui
tsutsui@ceres.dti.ne.jp