Subject: PCMCIA weirdness
To: None <port-i386@netbsd.org>
From: Chris King <colanderman@gmail.com>
List: port-i386
Date: 12/01/2004 17:48:11
I recently installed NetBSD 1.6.2 on an old Toshiba T1960CS laptop
(486DX, 8MB RAM), and have been having some problems with PCMCIA. 
I've tried three devices, and have had a different problem with each
(all of which have been reported seperately before):

1) Compact Flash memory card in PCMCIA/CF adaptor.

The kernel recognizes the device, but reports it as having random
amounts of memory (e.g. 1142MB, when it really only has 64MB).  Any
attempt to mount it causes a stream of "setmulti" errors, and
terminates with a "device unconfigured" error.  The card works fine in
a Sharp Zaurus.  The same problem was reported in
http://mail-index.netbsd.org/port-i386/2000/12/04/0005.html.

I attempted to rectify the problem by configuring atapibus on wdc, and
sd on atapibus, under the belief that the card supported ATAPI, but
the sd drivers would not recognize the card (even after disabling the
wd drivers for the card).  Do CF memory cards not support ATAPI, or
did I configure something wrong?  Is this even a solution?

2) Linksys EtherFast ethernet card (ne).

The kernel recognizes the device, and it is able to send data (e.g.
pings and DHCP requests), but upon receiving data (e.g. pongs and DHCP
responses) I get errors reading "NIC memory corrupt - invalid packet
length 48573" and such.  The same problem was reported in
http://monkey.org/openbsd/archive/tech/9905/msg00011.html.

3) NetGear MA701 802.11b card (wi) in PCMCIA/CF adaptor.

The kernel recognizes the device, but immediately drops into the
debugger.  The IP is pointing to a "pushl" instruction, and any
attempt to resume the kernel (using next) results in subsequent halts
at "ret" and "iret" instructions, leading me to believe the stack was
corrupt.  Hoping it was simply a stack overflow (though I guess that
would be unlikely), I increased the parameter UPAGES in param.h from 2
to 4, but the error still occured (at the same instruction, no less). 
This leads me to believe either the stack pointer is being corrupted,
or the stack is overflowing in a recursive function, but I could be
very wrong (I'd check with a debug build, but it's hard to load a 17MB
kernel in 8MB of RAM).  Similar problems have been reported (first
three results
for Google of wi netbsd kernel panic), but none where wi crashes
immediately.

Any ideas as to what's causing these problems?  I can only assume
they're all related, possibly (but hopefully not) to the laptop's lack
of memory.  Are there easy workarounds?  Installing more memory isn't
really an option, since the case is sealed tight and its external
memory card format is quite hard to find.  The kernel (custom
compiled, same problems happen with GENERIC though) is only 1.5MB, and
there's usually over 1MB free after I log in.

Thanks!