summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/arch/mac68k/dev/if_ae_nubus.c13
-rw-r--r--sys/arch/mac68k/dev/if_sn_nubus.c59
-rw-r--r--sys/arch/mac68k/dev/nubus.c81
-rw-r--r--sys/arch/mac68k/dev/nubus.h5
4 files changed, 144 insertions, 14 deletions
diff --git a/sys/arch/mac68k/dev/if_ae_nubus.c b/sys/arch/mac68k/dev/if_ae_nubus.c
index 856057d9847..a8a95ce924d 100644
--- a/sys/arch/mac68k/dev/if_ae_nubus.c
+++ b/sys/arch/mac68k/dev/if_ae_nubus.c
@@ -1,5 +1,5 @@
/* $NetBSD: if_ae_nubus.c,v 1.11 1997/03/19 08:04:39 scottr Exp $ */
-/* $OpenBSD: if_ae_nubus.c,v 1.4 1997/03/25 04:58:43 briggs Exp $ */
+/* $OpenBSD: if_ae_nubus.c,v 1.5 1997/04/08 04:14:45 briggs Exp $ */
/*
* Copyright (C) 1997 Scott Reynolds
@@ -348,11 +348,20 @@ ae_nb_card_vendor(na)
int vendor;
switch (na->drsw) {
- case NUBUS_DRSW_3COM:
case NUBUS_DRSW_APPLE:
case NUBUS_DRSW_TECHWORKS:
vendor = AE_VENDOR_APPLE;
break;
+ case NUBUS_DRSW_3COM:
+ switch (na->drhw) {
+ case NUBUS_DRHW_APPLE_SN:
+ vendor = AE_VENDOR_UNKNOWN;
+ break;
+ default: /* Apple, others, supported by AE */
+ vendor = AE_VENDOR_APPLE;
+ break;
+ }
+ break;
case NUBUS_DRSW_ASANTE:
vendor = AE_VENDOR_ASANTE;
break;
diff --git a/sys/arch/mac68k/dev/if_sn_nubus.c b/sys/arch/mac68k/dev/if_sn_nubus.c
index 977d14ce759..5c2ab3f2dc1 100644
--- a/sys/arch/mac68k/dev/if_sn_nubus.c
+++ b/sys/arch/mac68k/dev/if_sn_nubus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_sn_nubus.c,v 1.4 1997/03/29 23:26:49 briggs Exp $ */
+/* $OpenBSD: if_sn_nubus.c,v 1.5 1997/04/08 04:14:46 briggs Exp $ */
/*
* Copyright (C) 1997 Allen Briggs
@@ -54,6 +54,8 @@
static int sn_nubus_match __P((struct device *, void *, void *));
static void sn_nubus_attach __P((struct device *, struct device *, void *));
static int sn_nb_card_vendor __P((struct nubus_attach_args *));
+static int sn_nb_get_enaddr __P((struct nubus_attach_args *,
+ u_int8_t *, int));
struct cfattach sn_nubus_ca = {
sizeof(struct sn_softc), sn_nubus_match, sn_nubus_attach
@@ -78,14 +80,14 @@ sn_nubus_match(parent, vcf, aux)
if (na->category == NUBUS_CATEGORY_NETWORK &&
na->type == NUBUS_TYPE_ETHERNET) {
switch (sn_nb_card_vendor(na)) {
- default:
- rv = UNSUPP;
- break;
- /* This is it for now... */
+ case AE_VENDOR_APPLE:
case AE_VENDOR_DAYNA:
rv = 1;
break;
+
+ default:
+ break;
}
}
@@ -155,6 +157,22 @@ sn_nubus_attach(parent, self, aux)
success = 1;
break;
+ case AE_VENDOR_APPLE:
+ sc->snr_dcr = DCR_ASYNC | DCR_WAIT0 | DCR_DW32 |
+ DCR_DMABLOCK | DCR_RFT16 | DCR_TFT16;
+ sc->snr_dcr2 = 0;
+
+ if (bus_space_subregion(bst, bsh, 0x00180000, SN_REGSIZE,
+ &sc->sc_regh)) {
+ printf(": failed to map register space.\n");
+ break;
+ }
+
+ sn_nb_get_enaddr(na, sc->sc_arpcom.ac_enaddr, na, 0x8);
+
+ success = 1;
+ break;
+
default:
/*
* You can't actually get this default, the snmatch
@@ -165,6 +183,7 @@ sn_nubus_attach(parent, self, aux)
sc->snr_dcr = DCR_SYNC | DCR_WAIT0 | DCR_DW32 |
DCR_DMABLOCK | DCR_RFT16 | DCR_TFT16;
sc->snr_dcr2 = 0;
+ printf(": attachment incomplete.\n");
return;
}
@@ -198,6 +217,15 @@ sn_nb_card_vendor(na)
switch (na->drsw) {
case NUBUS_DRSW_3COM:
+ switch (na->drhw) {
+ case NUBUS_DRHW_APPLE_SN:
+ vendor = AE_VENDOR_APPLE;
+ break;
+ default:
+ vendor = AE_VENDOR_UNKNOWN;
+ break;
+ }
+ break;
case NUBUS_DRSW_APPLE:
case NUBUS_DRSW_TECHWORKS:
vendor = AE_VENDOR_APPLE;
@@ -237,3 +265,24 @@ sn_nb_card_vendor(na)
}
return vendor;
}
+
+static int
+sn_nb_get_enaddr(na, ep, rsrc1)
+ struct nubus_attach_args *na;
+ u_int8_t *ep;
+ int rsrc1;
+{
+ nubus_dir dir;
+ nubus_dirent dirent;
+
+ nubus_get_main_dir(na->fmt, &dir);
+ if (nubus_find_rsrc(na->fmt, &dir, na->rsrcid, &dirent) <= 0)
+ return 1;
+ nubus_get_dir_from_rsrc(na->fmt, &dirent, &dir);
+ if (nubus_find_rsrc(na->fmt, &dir, rsrc1, &dirent) <= 0)
+ return 1;
+ if (nubus_get_ind_data(na->fmt, &dirent, ep, ETHER_ADDR_LEN) <= 0)
+ return 1;
+
+ return 0;
+}
diff --git a/sys/arch/mac68k/dev/nubus.c b/sys/arch/mac68k/dev/nubus.c
index 5d11e093d5a..174ec6d0960 100644
--- a/sys/arch/mac68k/dev/nubus.c
+++ b/sys/arch/mac68k/dev/nubus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nubus.c,v 1.9 1997/03/12 13:15:58 briggs Exp $ */
+/* $OpenBSD: nubus.c,v 1.10 1997/04/08 04:14:46 briggs Exp $ */
/* $NetBSD: nubus.c,v 1.32 1997/02/28 07:54:02 scottr Exp $ */
/*
@@ -108,6 +108,7 @@ nubus_attach(parent, self, aux)
nubus_dir dir;
nubus_dirent dirent;
nubus_type slottype;
+ u_long entry;
int i, rsrcid;
printf("\n");
@@ -116,13 +117,54 @@ nubus_attach(parent, self, aux)
if (probe_slot(i, &fmtblock) <= 0)
continue;
- if ((rsrcid = nubus_video_resource(i)) == (-1))
- rsrcid = 0x80;
+ rsrcid = 0x80;
nubus_get_main_dir(&fmtblock, &dir);
- if (nubus_find_rsrc(&fmtblock, &dir, rsrcid, &dirent) <= 0)
- continue;
+ /*
+ * Get the resource for the first function on the card.
+ * This is assumed to be at resource ID 0x80. If we can
+ * not find this entry (as we can not on some video cards),
+ * check to see if we can get a different ID from the list
+ * of video resources given to us by the booter. If that
+ * doesn't work either, take the first resource following
+ * the board resource.
+ */
+ if (nubus_find_rsrc(&fmtblock, &dir, rsrcid, &dirent) <= 0) {
+ if ((rsrcid = nubus_video_resource(i)) == -1) {
+ /*
+ * Since nubus_find_rsrc failed, the directory
+ * is back at its base.
+ */
+ entry = dir.curr_ent;
+
+ /*
+ * All nubus cards should have a board
+ * resource, but be sure that's what it
+ * is before we skip it.
+ */
+ rsrcid = GetByte(&fmtblock, entry);
+ if (rsrcid == 0x1)
+ entry =
+ IncPtr(&fmtblock, dir.curr_ent, 4);
+
+ rsrcid = GetByte(&fmtblock, entry);
+#ifdef DEBUG
+ if (nubus_debug & NDB_FOLLOW)
+ printf("\tUsing rsrc 0x%x.\n", rsrcid);
+#endif
+ if (rsrcid == 0xff)
+ continue; /* end of chain */
+ }
+ /*
+ * Try to find the resource passed by the booter
+ * or the one we just tracked down.
+ */
+ if (nubus_find_rsrc(&fmtblock, &dir,
+ rsrcid, &dirent) <= 0) {
+ continue;
+ }
+ }
nubus_get_dir_from_rsrc(&fmtblock, &dirent, &dir);
@@ -134,6 +176,35 @@ nubus_attach(parent, self, aux)
(caddr_t) &slottype, sizeof(nubus_type)) <= 0)
continue;
+ /*
+ * If this is a display card, try to pull out the correct
+ * display mode as passed by the booter.
+ */
+ if (slottype.category == NUBUS_CATEGORY_DISPLAY) {
+ int r;
+
+ if ((r = nubus_video_resource(i)) != -1) {
+
+ nubus_get_main_dir(&fmtblock, &dir);
+
+ if (nubus_find_rsrc(&fmtblock, &dir,
+ r, &dirent) <= 0)
+ continue;
+
+ nubus_get_dir_from_rsrc(&fmtblock,
+ &dirent, &dir);
+
+ if (nubus_find_rsrc(&fmtblock, &dir,
+ NUBUS_RSRC_TYPE, &dirent) <= 0)
+ continue;
+
+ if (nubus_get_ind_data(&fmtblock, &dirent,
+ (caddr_t) &slottype,
+ sizeof(nubus_type)) <= 0)
+ continue;
+ }
+ }
+
na_args.slot = i;
na_args.rsrcid = rsrcid;
na_args.category = slottype.category;
diff --git a/sys/arch/mac68k/dev/nubus.h b/sys/arch/mac68k/dev/nubus.h
index 22bef0d8c7a..59e9f67b89f 100644
--- a/sys/arch/mac68k/dev/nubus.h
+++ b/sys/arch/mac68k/dev/nubus.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: nubus.h,v 1.9 1997/04/01 13:52:34 briggs Exp $ */
+/* $OpenBSD: nubus.h,v 1.10 1997/04/08 04:14:47 briggs Exp $ */
/* $NetBSD: nubus.h,v 1.17 1997/02/24 06:20:07 scottr Exp $ */
/*
@@ -72,8 +72,9 @@
#define NUBUS_DRSW_FOCUS 0x011A
#define NUBUS_DRHW_INTERLAN 0x0100
#define NUBUS_DRHW_KINETICS 0x0106
-#define NUBUS_DRHW_SONIC 0x0110
#define NUBUS_DRHW_CABLETRON 0x0109
+#define NUBUS_DRHW_SONIC 0x0110
+#define NUBUS_DRHW_APPLE_SN 0x0119
#define NUBUS_CATEGORY_COMMUNICATIONS 0x0006
#define NUBUS_TYPE_RS232 0x0002