Subject: Re: needs MI wdc changes to support macppc's wdc
To: None <tech-kern@netbsd.org>
From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
List: tech-kern
Date: 11/04/1998 01:04:06
In article <19981025155117.A2656@cosinus.cs.uni-bonn.de>
ignatios@theory.cs.uni-bonn.de writes:

> Look at the Amiga bus-space stuff for an example. Many Amiga ZBUS boards
> are addressed at odd/even spacing, some Amiga or DraCo mainbus chips are
> addressed every 4 bytes.

Tsubai sent me bus.h patch for macppc which contained `stride' bits
in bus_space_tag like amiga bus.h.

I make two kernels and compare its wdc performance.
One is using offset array to access wdc registers, and
another is using modified bus.h and `stride' in bus_space_tag
to map wdc address space. There are no difference at least
in single user mode.

In article <199810260022.QAA22350@lestat.nas.nasa.gov>
thorpej@nas.nasa.gov writes:

>  > The mac68k wdc has non-contiguous offsets, too.  I think it's also every
>  > 16 bytes.  I think that the cleanest solution is to make the bus_space*()
>  > functions handle the register addressing, but I don't know if anyone has
>  > measured any performance penalties that you might incur from doing so
>  > (for the regions that don't need the offset modified).
> 
> Is that true for every obio device?  If not, then it shouldn't be done
> in the space tag, but a "regmap" think like the dp8390 ethernet driver
> uses would be more appropriate, used by ALL front-ends.

According to Tsubai, most of macppc obio devices are 16 byte
aligned, but some PowerBook has following device:

media-bay at obio0 offset 0x34 not configured

so not *all* devices are aligned on macppc obio. And
I hear mac68k wdc is 4 byte aligned, but some devices are not.
In mac68k/obio/if_sn_obio.c, sc->sc_reg_map[] array for dp8390
are set as `((i * 4) + 2)'.

I think it is better to use offset array to access wdc register,
though it would make some overheads on archs which have only contiguous
addressed wdc (like i386).

Any suggestions?
---
Izumi Tsutsui
tsutsui@ceres.dti.ne.jp