Subject: Re: ncr53cxxx driver design issues
To: None <thorpej@zembu.com>
From: Lennart Augustsson <lennart@augustsson.net>
List: tech-kern
Date: 04/18/2000 09:07:42
Jason R Thorpe wrote:

> While I completely understand where Eduardo is coming from, we already have
> some ways to deal with the byte-order problem in DMA'd data structures, of
> sorts...
>
> If you'll take a look at the SMC 83c170 Ethernet driver, you'll note that
> it does:
>
> #if BYTE_ORDER == BIG_ENDIAN
>         ... put the device into "data structures are big-endian" mode ...
> #else
>         ... put the device into "data structures are little-endian" mode ...
> #endif

But that doesn't necessarily work.  That assumes that host byte order is
the same as the bus byte order.


> As far as handling both 720 and 810 in the same driver, making the
> byte-order decision at runtime:
>
>         <example 810 front-end code>
>         sc->sc_byteorder = LITTLE_ENDIAN;

This kind of thing would work, but I think there should be support for it
in the bus_dma framework.


> I acknowledge that Eduardo would like some sort of generic bus_dma
> enhancement for this, but it seems to me like we're then adding a lot
> of overhead (like the function calls, comparisons, etc.) in places
> where we *KNOW* we won't need it (e.g. any PCI device which is
> hardwired as little-endian).

Yes, if you have a driver that lives in dev/pci you can assume you're on
a pci bus.  But all driver in dev/ic can make no such assumption, they should
properly handle being on either kind of bus.  I'm not sure there are any
drivers that do?


--

        -- Lennart