Casper.Dik at Sun.COM wrote:
>> #if AH_BYTE_ORDER == AH_BIG_ENDIAN
>> #define _OS_REG_WRITE(_ah, _reg, _val) do {                              \
>>      if ( (_reg) >= 0x4000 && (_reg) < 0x5000)                           \
>>              *((volatile u_int32_t *)((_ah)->ah_sh + (_reg))) =          \
>>                      __bswap32((_val));                                  \
>>      else                                                                \
>>              *((volatile u_int32_t *)((_ah)->ah_sh + (_reg))) = (_val);  \
>> } while (0)
>> #define _OS_REG_READ(_ah, _reg) \
>>      (((_reg) >= 0x4000 && (_reg) < 0x5000) ? \
>>              __bswap32(*((volatile u_int32_t *)((_ah)->ah_sh + (_reg)))) : \
>>              *((volatile u_int32_t *)((_ah)->ah_sh + (_reg))))
>> #else /* AH_LITTLE_ENDIAN */
>> [...]
>>
>> It seems to me that this code should use ddi_get32/ddi_put32 on Solaris,
>> but (having never done any driver programming on Solaris), I haven't
>> investigated much further yet.  I had planned to use dtrace to figure out
>> with empty implementations of those functions how they are used on
>> Solaris/SPARC.
>>     
>
> It would appear so, but that does require a little endian mapping to
> be established.
>
> Jeez, is Linux so broken you need to do your own byteswapping for register
> accesses?
>
> Casper
>   

A couple of things:

1) atheros HAL on SPARC defines AH_REGOPS_FUNC, which determines whether
these register accesses have to be present or not.

2) yes, Linux is brain damaged in this regard.  Other free OS' (NetBSD
for one) are not.

3) You have to establish a mapping with ddi_regs_map_setup().  Its not hard.

4) There are other changes in the Atheros ABI that you haven't hit upon yet.

All of these things are easily overcome.  It will take me about a day to
make a sparcv9-compatible atheros, and to update both sparc and x86
ports to the latest released HAL (0.9.17.2).  I've worked with Sam
Leffler already on the NetBSD port of the Atheros driver, btw.

-- 
Garrett D'Amore, Principal Software Engineer
Tadpole Computer / Computing Technologies Division,
General Dynamics C4 Systems
http://www.tadpolecomputer.com/
Phone: 951 325-2134  Fax: 951 325-2191


Reply via email to