NetBSD Problem Report #9660
Received: (qmail 8245 invoked from network); 23 Mar 2000 01:13:57 -0000
Message-Id: <200003230059.TAA21341@lop-nor.ihack.net>
Date: Wed, 22 Mar 2000 19:59:36 -0500 (EST)
From: root@ihack.net
Reply-To: mycroft@netbsd.org
To: gnats-bugs@gnats.netbsd.org
Subject: awi driver fails on non-PC platforms
X-Send-Pr-Version: 3.95
>Number: 9660
>Category: kern
>Synopsis: awi driver fails on non-PC platforms
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: onoe
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Mar 22 17:15:00 +0000 2000
>Closed-Date: Wed Jul 07 00:25:12 +0000 2004
>Last-Modified: Wed Jul 07 00:25:12 +0000 2004
>Originator: Charles M. Hannum
>Release: -current as of 20000322
>Organization:
Internetwork Hacker
>Environment:
IBM WorkPad z50 (hpcmips)
>Description:
Due to unaligned memory accesses in awi_rxint() and awi_txint(), the
awi driver crashes on platforms that do not permit unaligned memory
accesses.
Such accesses are expected, because the descriptors are not guaranteed
to be aligned.
>How-To-Repeat:
Try to use an awi card on a hpcmips platform. (Presumably the same
problem will occur on an Alpha.)
>Fix:
Alter awi_rxint() and awi_txint() to use byte accesses.
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->analyzed
State-Changed-By: onoe
State-Changed-When: Wed Mar 22 22:29:40 PST 2000
State-Changed-Why:
awi_read_4/awi_write_4 issues bus_space_read_4/bus_space_write_4
unaligned if shared memory is mapped. should be replaced to multiple
bus_space_read_1.
Responsible-Changed-From-To: kern-bug-people->onoe
Responsible-Changed-By: onoe
Responsible-Changed-When: Wed Mar 22 22:29:40 PST 2000
Responsible-Changed-Why:
I'll try to fix
.
From: Atsushi Onoe <onoe@sm.sony.co.jp>
To: root@ihack.net
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: kern/9660: awi driver fails on non-PC platforms
Date: Thu, 23 Mar 2000 16:00:25 +0900 (JST)
> >Fix:
> Alter awi_rxint() and awi_txint() to use byte accesses.
I've modified rather am79c930.c since am79c930 controller itself allows
unaligned access to the firmware and to the system.
Does this patch solve your problem?
Atsushi
Index: dev/ic/am79c930.c
===================================================================
RCS file: /cvsroot/syssrc/sys/dev/ic/am79c930.c,v
retrieving revision 1.4
diff -u -r1.4 am79c930.c
--- am79c930.c 2000/03/22 11:22:22 1.4
+++ am79c930.c 2000/03/23 06:53:07
@@ -290,7 +290,16 @@
u_int32_t off;
u_int16_t val;
{
- bus_space_write_2(sc->sc_memt, sc->sc_memh, off, val);
+ bus_space_tag_t t = sc->sc_memt;
+ bus_space_handle_t h = sc->sc_memh;
+
+ /* could be unaligned */
+ if ((off & 0x1) == 0)
+ bus_space_write_2(t, h, off, val);
+ else {
+ bus_space_write_1(t, h, off, val & 0xff);
+ bus_space_write_1(t, h, off+1, (val >> 8) & 0xff);
+ }
}
static void mem_write_4 (sc, off, val)
@@ -298,7 +307,18 @@
u_int32_t off;
u_int32_t val;
{
- bus_space_write_4(sc->sc_memt, sc->sc_memh, off, val);
+ bus_space_tag_t t = sc->sc_memt;
+ bus_space_handle_t h = sc->sc_memh;
+
+ /* could be unaligned */
+ if ((off & 0x3) == 0)
+ bus_space_write_4(t, h, off, val);
+ else {
+ bus_space_write_1(t, h, off, val & 0xff);
+ bus_space_write_1(t, h, off+1, (val >> 8) & 0xff);
+ bus_space_write_1(t, h, off+2, (val >> 16) & 0xff);
+ bus_space_write_1(t, h, off+3, (val >> 24) & 0xff);
+ }
}
static void mem_write_bytes (sc, off, ptr, len)
@@ -322,14 +342,28 @@
struct am79c930_softc *sc;
u_int32_t off;
{
- return bus_space_read_2(sc->sc_memt, sc->sc_memh, off);
+ /* could be unaligned */
+ if ((off & 0x1) == 0)
+ return bus_space_read_2(sc->sc_memt, sc->sc_memh, off);
+ else
+ return
+ bus_space_read_1(sc->sc_memt, sc->sc_memh, off ) |
+ (bus_space_read_1(sc->sc_memt, sc->sc_memh, off+1) << 8);
}
static u_int32_t mem_read_4 (sc, off)
struct am79c930_softc *sc;
u_int32_t off;
{
- return bus_space_read_4(sc->sc_memt, sc->sc_memh, off);
+ /* could be unaligned */
+ if ((off & 0x3) == 0)
+ return bus_space_read_4(sc->sc_memt, sc->sc_memh, off);
+ else
+ return
+ bus_space_read_1(sc->sc_memt, sc->sc_memh, off ) |
+ (bus_space_read_1(sc->sc_memt, sc->sc_memh, off+1) << 8) |
+ (bus_space_read_1(sc->sc_memt, sc->sc_memh, off+2) <<16) |
+ (bus_space_read_1(sc->sc_memt, sc->sc_memh, off+3) <<24);
}
From: "Charles M. Hannum" <root@ihack.net>
To: Atsushi Onoe <onoe@sm.sony.co.jp>
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: kern/9660: awi driver fails on non-PC platforms
Date: Fri, 24 Mar 2000 10:54:03 -0500 (EST)
With your change, the awi driver now mostly works on a WorkPad z50
(hpcmips). There are still two problems I noticed:
* If the card is active when it is ejected, it does not detach
properly. This is probably due to the interrupt line being held.
We need to do something about this in general; perhaps disable
socket interrupts in pcic_intr() when we lose card detect.
* I get a bunch of `failed to lock interrupt' messages when the card
is first activated.
Other than that, it appears to work. I haven't been able to test it
extensively due to some... security issues... here.
pcmcia0: CIS version PC Card Standard 5.0
pcmcia0: CIS info: Nokia, C020 WLAN Card, ,
pcmcia0: Manufacturer code 0x23d, product 0x20c0
pcmcia0: function 0: network adapter, ccr addr 800 mask 3
pcmcia0: function 0, config table entry 1: I/O card; irq mask ffff; iomask 6, iospace 0-3f; io8 powerdown
awi0 at pcmcia0 function 0 port 0x15000440-0x1500047f: Nokia C020 WLAN Card
pcmcia0: card irq 3
awi0: IEEE802.11 (DS 2Mbps) address 00:e0:03:04:1b:f2
awi0: supplying EUI64: 00:e0:03:ff:fe:04:1b:f2
pcmcia0: card irq 3
awi0: failed to lock interrupt
awi0: failed to lock interrupt
awi0: failed to lock interrupt
awi0: failed to lock interrupt
awi0: failed to lock interrupt
awi0: failed to lock interrupt
awi0: failed to lock interrupt
awi0: failed to lock interrupt
awi0: failed to lock interrupt
awi0: failed to lock interrupt
awi0: failed to lock interrupt
awi0: failed to lock interrupt
awi0: failed to lock interrupt
awi0: failed to lock interrupt
awi0: failed to lock interrupt
awi0: failed to lock interrupt
awi0: failed to lock interrupt
awi0: failed to lock interrupt
awi0: failed to lock interrupt
awi0: failed to lock interrupt
awi0: failed to lock interrupt
awi0: failed to lock interrupt
awi0: failed to lock interrupt
awi0: failed to lock interrupt
awi0: failed to lock interrupt
awi0: failed to lock interrupt
awi0: failed to lock interrupt
awi0: failed to lock interrupt
awi0: failed to lock interrupt
awi0: failed to lock interrupt
awi0: failed to lock interrupt
awi0: failed to lock interrupt
awi0: associated with 00:e0:03:04:05:cd ssid "Nokia WLAN" channel 6 signal 63
State-Changed-From-To: analyzed->closed
State-Changed-By: mycroft
State-Changed-When: Wed Jul 7 00:20:52 UTC 2004
State-Changed-Why:
This was fixed 4 years ago.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.