Subject: Re: Broadband adapter again...
To: Marcus Comstedt <marcus@idonex.se>
From: Jason R Thorpe <thorpej@zembu.com>
List: port-dreamcast
Date: 01/29/2001 07:53:48
On Mon, Jan 29, 2001 at 03:37:58AM +0100, Marcus Comstedt wrote:

 > 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...)

Then you should implement your own bus_space, and not use the "generic"
sh3 versions, which as you have pointed out, are not generic enough.

Take a look at how the Alpha port implements bus_space.

-- 
        -- Jason R. Thorpe <thorpej@zembu.com>