ae(4) update

Martin Reindl <[email protected]> Wed, 3 Nov 2004 23:14:42 +0100
Newsgroups gmane.os.openbsd.mac68k
Organization catai.org
Message-ID <[email protected]>
Hi,

I'd like to get some feedback for the patch below. Its purpose is to
make ae(4) support more nubus ethernet cards and catch up with netbsd a
bit. If you have a currently unsupported Cabletron, Apple, Dayna,
Asante or TFL LAN nic, this is your chance. Even if you don't, please
test to be sure it breaks nothing :)

Patch can also be found at:
http://locore.net/ae.diff

Best regards,
Martin

Index: src/sys/arch/mac68k/dev/if_ae_nubus.c
===================================================================
RCS file: /data/cvs/openbsd/src/sys/arch/mac68k/dev/if_ae_nubus.c,v
retrieving revision 1.9
diff -u -r1.9 if_ae_nubus.c
--- src/sys/arch/mac68k/dev/if_ae_nubus.c2 Apr 2004 21:01:44 -00001.9
+++ src/sys/arch/mac68k/dev/if_ae_nubus.c3 Nov 2004 21:37:31 -0000
@@ -105,6 +105,7 @@
 case AE_VENDOR_FARALLON:
 case AE_VENDOR_INTERLAN:
 case AE_VENDOR_KINETICS:
+case AE_VENDOR_CABLETRON:
 rv = 1;
 break;
 case AE_VENDOR_DAYNA:
@@ -351,8 +352,19 @@
 
 switch (na->drsw) {
 case NUBUS_DRSW_APPLE:
+if (na->drhw == NUBUS_DRHW_ASANTE_LC) {
+vendor = AE_VENDOR_UNKNOWN;
+break;
+}
+/* FALLTHROUGH */
+case NUBUS_DRSW_DAYNA2:
 case NUBUS_DRSW_TECHWORKS:
-vendor = AE_VENDOR_APPLE;
+case NUBUS_DRSW_TFLLAN:
+if (na->drhw == NUBUS_DRHW_CABLETRON) {
+vendor = AE_VENDOR_CABLETRON;
+} else {
+vendor = AE_VENDOR_APPLE;
+}
 break;
 case NUBUS_DRSW_3COM:
 switch (na->drhw) {
@@ -402,6 +414,7 @@
 {
 nubus_dir dir;
 nubus_dirent dirent;
+int rv;
 
 /*
  * XXX - note hardwired resource IDs here (0x80); these are
@@ -409,7 +422,18 @@
  * we find out more about Ethernet card resources.
  */
 nubus_get_main_dir(na->fmt, &dir);
-if (nubus_find_rsrc(na->fmt, &dir, 0x80, &dirent) <= 0)
+switch (ae_nb_card_vendor(na)) {
+case AE_VENDOR_APPLE:
+if (na->drsw == NUBUS_DRSW_TFLLAN) {/* TFL LAN E410/E420 */
+rv = nubus_find_rsrc(na->fmt, &dir, 0x80, &dirent);
+break;
+}
+/* FALLTHROUGH */
+default:
+rv = nubus_find_rsrc(na->fmt, &dir, 0x80, &dirent);
+break;
+}
+if (rv <= 0)
 return 1;
 nubus_get_dir_from_rsrc(na->fmt, &dirent, &dir);
 if (nubus_find_rsrc(na->fmt, &dir, 0x80, &dirent) <= 0)
Index: src/sys/arch/mac68k/dev/if_aereg.h
===================================================================
RCS file: /data/cvs/openbsd/src/sys/arch/mac68k/dev/if_aereg.h,v
retrieving revision 1.6
diff -u -r1.6 if_aereg.h
--- src/sys/arch/mac68k/dev/if_aereg.h3 Jun 2002 20:01:36 -00001.6
+++ src/sys/arch/mac68k/dev/if_aereg.h3 Nov 2004 21:37:31 -0000
@@ -34,6 +34,7 @@
 #define AE_VENDOR_FARALLON0x04/* Farallon EtherMac II-TP */
 #define AE_VENDOR_FOCUS0x05/* FOCUS Enhancements EtherLAN */
 #define AE_VENDOR_KINETICS0x06/* Kinetics EtherPort SE/30 */
+#define AE_VENDOR_CABLETRON0x07/* Cabletron Ethernet */
 
 /*
  * Compile-time config flags
Index: src/sys/arch/mac68k/dev/nubus.h
===================================================================
RCS file: /data/cvs/openbsd/src/sys/arch/mac68k/dev/nubus.h,v
retrieving revision 1.18
diff -u -r1.18 nubus.h
--- src/sys/arch/mac68k/dev/nubus.h22 Apr 2002 20:15:55 -00001.18
+++ src/sys/arch/mac68k/dev/nubus.h3 Nov 2004 21:37:32 -0000
@@ -71,15 +71,21 @@
 #define NUBUS_CATEGORY_NETWORK0x0004
 #define  NUBUS_TYPE_ETHERNET0x0001
 #define   NUBUS_DRSW_3COM0x0000
+#define  NUBUS_DRSW_CABLETRON0x0001
 #define   NUBUS_DRSW_GATOR0x0103
 #define   NUBUS_DRSW_ASANTE0x0104
 #define   NUBUS_DRSW_TECHWORKS0x0109
 #define  NUBUS_DRSW_DAYNA0x010B
 #define   NUBUS_DRSW_FARALLON0x010C
+#define  NUBUS_DRSW_DAYNA20x0115
 #define   NUBUS_DRSW_FOCUS0x011A
+#define  NUBUS_DRSW_ASANTEF0x011D
+#define  NUBUS_DRSW_TFLLAN0x011E
 #define    NUBUS_DRHW_INTERLAN0x0100
+#define   NUBUS_DRHW_ASANTEF0x0101
 #define    NUBUS_DRHW_KINETICS0x0106
 #define    NUBUS_DRHW_CABLETRON0x0109
+#define   NUBUS_DRHW_NUVOLINK0x010B
 #define    NUBUS_DRHW_ASANTE_LC0x010F
 #define    NUBUS_DRHW_SONIC0x0110
 #define    NUBUS_DRHW_APPLE_SNT0x0118