Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 13 Jun 1999 13:46:43 -0400 (EDT)
From:      wpaul@ctr.columbia.edu (Bill Paul)
To:        rene@canyon.demon.nl (Rene de Vries)
Cc:        freebsd-alpha@freebsd.org
Subject:   Re: Problems getting the 'rl' driver to work
Message-ID:  <199906131746.NAA01613@sirius.ctr.columbia.edu>
In-Reply-To: <199906121708.TAA28335@canyon.demon.nl> from "Rene de Vries" at Jun 12, 99 07:08:26 pm

next in thread | previous in thread | raw e-mail | index | archive | help
Of all the gin joints in all the towns in all the world, Rene de Vries
had to walk into mine and say:
 
> Hello,
> 
> Due to a hardware failure I had to replace my DE500 card for the ultra-cheap
> RealTek 8139.

There is a saying that goes "that's like putting a jet engine on a
rowboat." What you are attempting to do is exactly the opposite of
that saying. Perhaps like trying to put oars on an aircraft carrier.

> I know that the rl driver is slow, but the alpha is only my
> extra test machine adn does not need to be fast. So I thought, it should be
> possible to modify the existing rl driver to work on my alpha. I'm having
> some problems doing this.
> 
> After some hacking (correctly setting sc->rl_btag for alpha) the driver
> compiled, but I got the following panic:

> rl0: <RealTek 8139 10/100BaseTX> rev 0x10 int a irq 5 on pci0.12.0
> 
> unexpected machine check:

[...]
 
> With the help of some printf statments I found that the problem must be in
> calling the 'CSR_WRITE_1(sc, RL_COMMAND, RL_CMD_RESET);' macro, which
> translates to a 'bus_space_write_1'. I know that there is a problem/feature
> on alphas keeping them from accessing memory at unaligned adresses, but I
> assumed that that whould be handled in writeb (called from bus_space_write).

I don't think this is the real problem. The situation is complicated
somewhat by the fact that gdb on FreeBSD/Alpha isn't smart enough to
debug kernel crash dumps (at least, I don't think it is) otherwise you
would have a better way to track down the problem. The 3Com XL driver
uses byte-wite I/O accesses in a few places and has no problems, so
I'm doubtful that this is really what's tripping you up.

Ideally, there should be only two things that need to be fixed in order
to make this driver work with the Alpha:

- rl_btag has to be set correctly, which you say you already did
- Receive buffer handling has to be tweaked to force longword alignment
  of packet payload data.

The RealTek driver uses m_devget()/m_copyback() to read packet data
out of the receive buffer and into mbuf chains. The problem is that
m_devget() doesn't allow you to specifty an offset into the mbuf
data area, so all data starts at the very beginning of the mbuf,
which is longword aligned. The ethernet header is only 14 bytes long
though, so the actual packet data is only word aligned. The simplest
thing to do is to copy two extra bytes from the receive buffer starting
from the current buffer position minus 2. You can then use m_adj()
to shave off the 2 leading bytes after the copying is done and
end up with the proper alignment.

I have some code to do this but I can't test it until Monday because
my sample RealTek card is at work, and me and my alpha are at home.
In the meantime, I would suggest trying to find another card.

-Bill

-- 
=============================================================================
-Bill Paul            (212) 854-6020 | System Manager, Master of Unix-Fu
Work:         wpaul@ctr.columbia.edu | Center for Telecommunications Research
Home:  wpaul@skynet.ctr.columbia.edu | Columbia University, New York City
=============================================================================
"Mulder, toads just fell from the sky!" "I guess their parachutes didn't open."
=============================================================================


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-alpha" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199906131746.NAA01613>