/* $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
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;
-/* $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
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
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;
}
}
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
sc->snr_dcr = DCR_SYNC | DCR_WAIT0 | DCR_DW32 |
DCR_DMABLOCK | DCR_RFT16 | DCR_TFT16;
sc->snr_dcr2 = 0;
+ printf(": attachment incomplete.\n");
return;
}
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;
}
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;
+}
-/* $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 $ */
/*
nubus_dir dir;
nubus_dirent dirent;
nubus_type slottype;
+ u_long entry;
int i, rsrcid;
printf("\n");
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);
(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;
-/* $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 $ */
/*
#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