diff options
Diffstat (limited to 'sys/arch/mac68k/dev/if_sn_nubus.c')
-rw-r--r-- | sys/arch/mac68k/dev/if_sn_nubus.c | 59 |
1 files changed, 54 insertions, 5 deletions
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; +} |