Subject: Broadband adapter again...
To: None <port-dreamcast@netbsd.org>
From: Marcus Comstedt <marcus@idonex.se>
List: port-dreamcast
Date: 01/29/2001 03:37:58
Ok, I'm starting to have serious doubts about the splendour of
bus_space_*.  In the RTK device driver, the chip registers are
accessed through

   bus_space_read_2(sc->rtk_btag, sc->rtk_bhandle, reg)

This function is defined in <machine/bus.h> as

   u_int16_t
   bus_space_read_2(tag, bsh, offset)
   	   bus_space_tag_t tag;
   	   bus_space_handle_t bsh;
   	   bus_size_t offset;
   {
   	   return bswap16(*(volatile u_int16_t *)(bsh + offset));
   }

Now, this is not appropriate for the BB adapter.  The byte swapping
should _not_ be there, and there should also be some additional
raindancing around the read.  There doesn't seem to be any way to add
that in a way that is local to the G2 bus though, as the bus_space_tag
is not used.  (Also, this is in the general sh3 code, where G2 bus
peculiarities do not belong...)


  // Marcus