Subject: port-i386/26871: i386 PS/2 MCA: we driver incorrect i/o address
To: None <gnats-bugs@gnats.NetBSD.org>
From: at <djb_pizza@www.netbsd.org, ieee.org@www.netbsd.org>
List: netbsd-bugs
Date: 09/07/2004 00:07:09
>Number: 26871
>Category: port-i386
>Synopsis: i386 PS/2 MCA: we driver incorrect i/o address
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: port-i386-maintainer
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue Sep 07 00:08:00 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator: Dave Barnes
>Release: 2.0_BETA
>Organization:
>Environment:
PS/2 mod 50z with Reply PowerBoard upgrade (Microchannel)
>Description:
Driver for WD8003 gets wrong i/o addresses when the adapter is set for i/o address greater than 0x2ff. Supported adapter i/o addresses are 0x200 - 0x3ff.
>How-To-Repeat:
Set WD8003 to i/o address greater than 0x2ff. The test case was set at 0x340.
==========
NetBSD 2.0_BETA (2004/08/16 DJB.ps2:2.0_BETA) #3: Mon Sep 6 16:30:12 CDT 2004
root@PapaJohn:/usr/src/sys/arch/i386/compile/DJB
total memory = 32380 KB
avail memory = 30136 KB
mainbus0 (root)
cpu0 at mainbus0: (uniprocessor)
cpu0: AMD Am5x86 W/T 133/160 (486-class), id 0x4e4
cpu0: features 1<FPU>
mca0 at mainbus0
tra0 at mca0 slot 1 ports 0x1200-0x1220 irq 9: Tiara LANCard/E2
tra0: Ethernet address 08:00:1a:02:81:ed
we0 at mca0 slot 3 port 0x240-0x25f mem 0xd0000-0xd3fff irq 10: WD EtherCard PLUS/A (WD8003E/A or WD8003ET/A)
we0: WD8003E/A or WD8003ET/A Ethernet (16-bit)
we0: failed to clear shared memory at offset 0x0
we0: configuration failed
isa0 at mainbus0
>Fix:
--- dev/mca/if_we_mca.c.orig 2004-09-06 16:41:10.000000000 -0500
+++ dev/mca/if_we_mca.c 2004-09-06 18:54:58.000000000 -0500
@@ -129,7 +129,7 @@
static const int we_mca_irq[] = {
3, 4, 10, 15,
};
-
+
/* memory position and shared RAM sizes for WD8013-type of cards */
static const struct {
u_int8_t id;
@@ -156,7 +156,7 @@
{ 0, 0, 0 },
};
-
+
static const struct we_mca_product *we_mca_lookup __P((int));
static const struct we_mca_product *
@@ -205,15 +205,15 @@
/*
* POS registers differ a lot between 8003 and 8013, so they are
* divided to two sections.
- *
+ *
* 8003: POS register 2: (adf pos0)
* 7 6 5 4 3 2 1 0
- * 0 0 1 \___/ \__ enable: 0=adapter disabled, 1=adapter enabled
- * \_____ Adapter IO Space: 0x200-0x29F + XX*0x20
+ * 0 0 1 \_____/ \_ enable: 0=adapter disabled, 1=adapter enabled
+ * \____ Adapter I/O Space: 0x200-0x21F + XX * 0x20 (0x200-0x3FF)
*
* 8003: POS register 3: (adf pos1)
* 7 6 5 4 3 2 1 0
- * 1 1 0 \__/ 1 X
+ * 1 1 0 \___/ 1 X
* \______ Shared Ram Space (16K Bytes):
* 0xC0000-0xC3FFF + XX * 0x4000
*
@@ -252,7 +252,7 @@
if (wep->we_flag & WD_8003) {
/* WD8003 based */
- iobase = 0x200 + (((pos2 & 0x0e) >> 1) * 0x020);
+ iobase = 0x200 + (((pos2 & 0x1e) >> 1) * 0x020);
maddr = 0xC0000 + (((pos3 & 0x1c) >> 2) * 0x04000);
irq = we_mca_irq[(pos5 & 0x03)];
sc->mem_size = WD_MEMSIZE;
@@ -273,7 +273,7 @@
sc->sc_dev.dv_xname);
return;
}
-
+
maddr = we_mca_elite_mem[i].maddr;
sc->mem_size = we_mca_elite_mem[i].memsize;
}
================================================================
dmesg output after patch:
NetBSD 2.0_BETA (2004/08/16 DJB.ps2:2.0_BETA) #4: Mon Sep 6 16:43:40 CDT 2004
root@PapaJohn:/usr/src/sys/arch/i386/compile/DJB
total memory = 32380 KB
avail memory = 30136 KB
mainbus0 (root)
cpu0 at mainbus0: (uniprocessor)
cpu0: AMD Am5x86 W/T 133/160 (486-class), id 0x4e4
cpu0: features 1<FPU>
mca0 at mainbus0
tra0 at mca0 slot 1 ports 0x1200-0x1220 irq 9: Tiara LANCard/E2
tra0: Ethernet address 08:00:1a:02:81:ed
we0 at mca0 slot 3 port 0x340-0x35f mem 0xd0000-0xd3fff irq 10: WD EtherCard PLUS/A (WD8003E/A or WD8003ET/A)
we0: WD8003E/A or WD8003ET/A Ethernet (16-bit)
we0: Ethernet address 00:00:c0:e1:49:2d
isa0 at mainbus0
>Release-Note:
>Audit-Trail:
>Unformatted: