Subject: port-i386/26877: i386 PS/2 MCA: we can't find shared ram address for 8013
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 19:36:54
>Number: 26877
>Category: port-i386
>Synopsis: i386 PS/2 MCA: we can't find shared ram address for 8013
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: port-i386-maintainer
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue Sep 07 19:38:00 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator: Dave Barnes
>Release: 2.0_BETA
>Organization:
>Environment:
IBM PS/2 mod 50z with Reply PowerBoard Upgrade
NetBSD 2.0_BETA Sept 5 snapshot from releng.netbsd.org
>Description:
Some shared ram address combinations for the Elite Plus wd8013 series and IBM PS/2 Adapter/A Ethernet cards are not set correctly. Some combinations result in error message....
>How-To-Repeat:
Test Case: wd8013 set to 0xd000 and 8k of shared ram -
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
we0: cannot find Shared Ram Base Address
>Fix:
--- dev/mca/if_we_mca.c.orig 2004-09-07 14:18:21.000000000 -0500
+++ dev/mca/if_we_mca.c 2004-09-07 14:18:44.000000000 -0500
@@ -130,33 +130,6 @@
3, 4, 10, 15,
};
-/* memory position and shared RAM sizes for WD8013-type of cards */
-static const struct {
- u_int8_t id;
- int maddr;
- int memsize;
-} we_mca_elite_mem[] = {
- { 0x10, 0x0C0000, 16384 },
- { 0x12, 0x0C4000, 16384 },
- { 0x14, 0x0C8000, 16384 },
- { 0x16, 0x0CC000, 16384 },
- { 0x18, 0x0D0000, 16384 },
- { 0x1A, 0x0D4000, 16384 },
- { 0x1C, 0x0D8000, 16384 },
- { 0x1E, 0x0DC000, 16384 },
- { 0x90, 0xFC0000, 16384 },
- { 0x94, 0xFC8000, 16384 },
- { 0x98, 0xFD0000, 16384 },
- { 0x9A, 0xFD8000, 16384 },
- { 0x9C, 0x0C0000, 16384 },
- { 0x00, 0x0C0000, 8192 },
- { 0x01, 0x0C2000, 8192 },
- { 0x02, 0x0C4000, 8192 },
- { 0x03, 0x0C6000, 8192 },
- { 0, 0, 0 },
-};
-
-
static const struct we_mca_product *we_mca_lookup __P((int));
static const struct we_mca_product *
@@ -229,10 +202,17 @@
* \____/ \__ enable: 0=adapter disabled, 1=adapter enabled
* \___________ Adapter I/O Space: 0x0800-0x081F + XX * 0x1000
*
+ *
* 8013: POS register 3: (adf pos1)
* 7 6 5 4 3 2 1 0
- * X 0 Shared Ram Base Address - mask 0x9f
- * see wd_elite_mem[] array for details
+ * | X 0 | \_____/
+ * | | \_____ Shared Ram Base Address
+ * | | 0xc0000 + ((xx & 0x0f) * 0x2000)
+ * | \____________ Ram size: 0 = 8k, 1 = 16k
+ * | some size and address combinations are
+ * | not supported, varies by card :(
+ * \__________________ If set, add 0xf00000 to shared RAM base addr
+ * puts shared RAM near top of 16MB address space
*
* 8013: POS register 5: (adf pos3)
* 7 6 5 4 3 2 1 0
@@ -258,24 +238,14 @@
sc->mem_size = WD_MEMSIZE;
} else {
/* SMC Elite */
- int i, id;
iobase = 0x800 + (((pos2 & 0xf0) >> 4) * 0x1000);
irq = we_mca_irq[(pos5 & 0x0c) >> 2];
/* find location of shared mem and it's size */
- id = (pos3 & 0x9f);
- for(i=0; we_mca_elite_mem[i].maddr; i++)
- if (we_mca_elite_mem[i].id == id)
- break;
- if (we_mca_elite_mem[i].maddr == 0) {
- printf("\n%s: cannot find Shared Ram Base Address\n",
- sc->sc_dev.dv_xname);
- return;
- }
+ maddr = 0xc0000 + ((pos3 & 0x0f) * 0x2000) + ((pos3 & 0x80) ? 0xf00000 : 0);
+ sc->mem_size = ((pos3 & 0x10) ? 16384 : 8192);
- maddr = we_mca_elite_mem[i].maddr;
- sc->mem_size = we_mca_elite_mem[i].memsize;
}
nict = asict = ma->ma_iot;
=====================================================================
Dmesg for test case after above patch:
NetBSD 2.0_BETA (2004/08/16 DJB.ps2:2.0_BETA) #7: Mon Sep 6 21:01:05 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 0x800-0x81f mem 0xd0000-0xd1fff irq 3: EtherCard PLUS Elite/A (8013EP/A)
we0: WD8013EP/A Ethernet (16-bit)
we0: Ethernet address 00:00:c0:fb:dd:09
>Release-Note:
>Audit-Trail:
>Unformatted: