ae(4) ethernet cards with 64KB memory fix
Xavier Santolaria <[email protected]> Fri, 9 Apr 2004 14:15:38 +0200
| Newsgroups | gmane.os.openbsd.mac68k |
|---|---|
| Message-ID | <[email protected]> |
hi..
I'd like people who own ae(4) ethernet cards with 64KB memory to test
the following diff that comes from NetBSD.
Currently only 32KB are detected ... diff should fix that.
This has already been successfully tested on Martin Reindl's Quadra 950
with a Farallon EtherWave Nubus with 64KB memory.
Thanks.
Xavier.
Index: if_ae.c
===================================================================
RCS file: /cvs/src/sys/arch/mac68k/dev/if_ae.c,v
retrieving revision 1.21
diff -u -r1.21 if_ae.c
--- if_ae.c 12 Mar 2003 19:11:02 -0000 1.21
+++ if_ae.c 9 Apr 2004 10:10:00 -0000
@@ -80,7 +80,7 @@
bus_space_handle_t bsh;
int ofs;
{
- int i1, i2, i3, i4;
+ int i1, i2, i3, i4, i8;
/*
* banks; also assume it will generally mirror in upper banks
@@ -90,11 +90,29 @@
i2 = (8192 * 1);
i3 = (8192 * 2);
i4 = (8192 * 3);
+ i8 = (8192 * 4);
- bus_space_write_2(bst, bsh, ofs + i1, 0x1111);
- bus_space_write_2(bst, bsh, ofs + i2, 0x2222);
- bus_space_write_2(bst, bsh, ofs + i3, 0x3333);
+ bus_space_write_2(bst, bsh, ofs + i8, 0x8888);
bus_space_write_2(bst, bsh, ofs + i4, 0x4444);
+ bus_space_write_2(bst, bsh, ofs + i3, 0x3333);
+ bus_space_write_2(bst, bsh, ofs + i2, 0x2222);
+ bus_space_write_2(bst, bsh, ofs + i1, 0x1111);
+
+ /*
+ * 1) If the memory range is decoded completely, it does not
+ * matter what we write first: High tags written into
+ * the void are lost.
+ * 2) If the memory range is not decoded completely (banks are
+ * mirrored), high tags are overwritten by lower ones.
+ * 3) Lazy implementation of pathological cases - none found yet.
+ */
+
+ if (bus_space_read_2(bst, bsh, ofs + i1) == 0x1111 &&
+ bus_space_read_2(bst, bsh, ofs + i2) == 0x2222 &&
+ bus_space_read_2(bst, bsh, ofs + i3) == 0x3333 &&
+ bus_space_read_2(bst, bsh, ofs + i4) == 0x4444 &&
+ bus_space_read_2(bst, bsh, ofs + i8) == 0x8888)
+ return 8192 * 8;
if (bus_space_read_2(bst, bsh, ofs + i1) == 0x1111 &&
bus_space_read_2(bst, bsh, ofs + i2) == 0x2222 &&