Subject: Re: i82544EI ethernet driver
To: Kate Feng <feng1@bnl.gov>
From: Allen Briggs <briggs@netbsd.org>
List: port-powerpc
Date: 11/15/2004 14:32:09
On Mon, Nov 15, 2004 at 02:28:48PM -0500, Kate Feng wrote:
> I am porting it to  a big-endian PowerPC.   Thus,
> 1) for data buffer,  I  think I  should add :
> 
>   sc->sc_ctrl |= CTRL_BEM;
> 
> prio to
> 
>   /* Write the control registers. */
>   CSR_WRITE(WMREG_CTRL, sc->sc_ctrl);
> 
> 
> 2) for the descriptor,  I should keep the original
> codes  htole32/le32toh, and le16toh....
> Meanwhile, I should  do
> 
> #define BYTE_ORDER    BIG_ENDIAN
> 
> 
> Is  that right ?

I would try to get it working as-is first.  You should not need to
modify the driver to get it to work.  Your bus_space routines for
the bus should take care of any CPU->PCI byte swapping and since
the chip is, by default, using little-endian, it will expect the
descriptors in memory to be little-endian (so you need to write
them with htole32 and friends, then read them with le32toh and
friends).  Does that make sense?

-allen

-- 
                  Use NetBSD!  http://www.netbsd.org/