Move the NuBus-specific watchdog function from if_ae.c to if_ae_nubus.c,

and allow the attach function to override the default watchdog.  Also,
do some minor cosmetic surgery (rename bus space tags/handles and some
KNFing I missed the first time around).
This commit is contained in:
scottr 1997-02-28 07:52:44 +00:00
parent 359101fb43
commit 17fdd597df
4 changed files with 121 additions and 88 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_ae.c,v 1.54 1997/02/25 06:36:04 scottr Exp $ */
/* $NetBSD: if_ae.c,v 1.55 1997/02/28 07:52:44 scottr Exp $ */
/*
* Device driver for National Semiconductor DS8390/WD83C690 based ethernet
@ -73,11 +73,11 @@ static inline int ae_ring_copy __P((struct ae_softc *, int, caddr_t, int));
#define ETHER_ADDR_LEN 6
#define REG_MAP(sc, reg) ((sc)->regs_rev ? (0x0f-(reg))<<2 : (reg)<<2)
#define NIC_GET(sc, reg) (bus_space_read_1((sc)->sc_reg_tag, \
(sc)->sc_reg_handle, \
#define NIC_GET(sc, reg) (bus_space_read_1((sc)->sc_regt, \
(sc)->sc_regh, \
(REG_MAP(sc, reg))))
#define NIC_PUT(sc, reg, val) (bus_space_write_1((sc)->sc_reg_tag, \
(sc)->sc_reg_handle, \
#define NIC_PUT(sc, reg, val) (bus_space_write_1((sc)->sc_regt, \
(sc)->sc_regh, \
(REG_MAP(sc, reg)), (val)))
struct cfdriver ae_cd = {
@ -151,11 +151,11 @@ aesetup(sc)
sc->mem_ring = sc->rec_page_start << ED_PAGE_SHIFT;
/* Now zero memory and verify that it is clear. */
bus_space_set_region_2(sc->sc_buf_tag, sc->sc_buf_handle, 0,
0, sc->mem_size / 2);
bus_space_set_region_2(sc->sc_buft, sc->sc_bufh,
0, 0, sc->mem_size / 2);
for (i = 0; i < sc->mem_size; ++i)
if (bus_space_read_1(sc->sc_buf_tag, sc->sc_buf_handle, i))
if (bus_space_read_1(sc->sc_buft, sc->sc_bufh, i))
printf("%s: failed to clear shared memory - check configuration\n",
sc->sc_dev.dv_xname);
@ -167,7 +167,8 @@ printf("%s: failed to clear shared memory - check configuration\n",
ifp->if_softc = sc;
ifp->if_start = aestart;
ifp->if_ioctl = aeioctl;
ifp->if_watchdog = aewatchdog;
if (!ifp->if_watchdog)
ifp->if_watchdog = aewatchdog;
ifp->if_flags =
IFF_BROADCAST | IFF_SIMPLEX | IFF_NOTRAILERS | IFF_MULTICAST;
@ -224,7 +225,6 @@ aestop(sc)
* Device timeout/watchdog routine. Entered if the device neglects to generate
* an interrupt after a transmit has been started on it.
*/
static int aeintr_ctr = 0;
void
aewatchdog(ifp)
@ -232,25 +232,6 @@ aewatchdog(ifp)
{
struct ae_softc *sc = ifp->if_softc;
#if 1
/*
* This is a kludge! The via code seems to miss slot interrupts
* sometimes. This kludges around that by calling the handler
* by hand if the watchdog is activated. -- XXX (akb)
*/
int i;
i = aeintr_ctr;
(*via2itab[1]) ((void *) 1);
if (i != aeintr_ctr) {
log(LOG_ERR, "%s: device timeout, recovered\n",
sc->sc_dev.dv_xname);
return;
}
#endif
log(LOG_ERR, "%s: device timeout\n", sc->sc_dev.dv_xname);
++sc->sc_arpcom.ac_if.if_oerrors;
@ -521,7 +502,7 @@ loop:
* The byte count includes a 4 byte header that was added by
* the NIC.
*/
bus_space_read_region_1(sc->sc_buf_tag, sc->sc_buf_handle,
bus_space_read_region_1(sc->sc_buft, sc->sc_bufh,
packet_ptr, &packet_hdr, sizeof(struct ae_ring));
lenp = (u_int8_t *)&packet_hdr.count; /* sigh. */
len = lenp[0] | (lenp[1] << 8);
@ -606,8 +587,6 @@ aeintr(arg, slot)
struct ifnet *ifp = &sc->sc_arpcom.ac_if;
u_char isr;
aeintr_ctr++;
/* Set NIC to page 0 registers. */
NIC_PUT(sc, ED_P0_CR, sc->cr_proto | ED_CR_PAGE_0 | ED_CR_STA);
@ -941,8 +920,8 @@ ae_ring_copy(sc, src, dst, amount)
caddr_t dst;
int amount;
{
bus_space_tag_t bst = sc->sc_buf_tag;
bus_space_handle_t bsh = sc->sc_buf_handle;
bus_space_tag_t bst = sc->sc_buft;
bus_space_handle_t bsh = sc->sc_bufh;
int tmp_amount;
/* Does copy wrap to lower addr in ring buffer? */
@ -1112,8 +1091,8 @@ ae_put(sc, m, buf)
/* Finish the last word. */
if (wantbyte) {
savebyte[1] = *data;
bus_space_write_region_2(sc->sc_buf_tag,
sc->sc_buf_handle, buf, savebyte, 1);
bus_space_write_region_2(sc->sc_buft,
sc->sc_bufh, buf, savebyte, 1);
buf += 2;
data++;
len--;
@ -1121,8 +1100,8 @@ ae_put(sc, m, buf)
}
/* Output contiguous words. */
if (len > 1) {
bus_space_write_region_2(sc->sc_buf_tag,
sc->sc_buf_handle, buf, data, len >> 1);
bus_space_write_region_2(sc->sc_buft,
sc->sc_bufh, buf, data, len >> 1);
buf += len & ~1;
data += len & ~1;
len &= 1;
@ -1137,7 +1116,7 @@ ae_put(sc, m, buf)
if (wantbyte) {
savebyte[1] = 0;
bus_space_write_region_2(sc->sc_buf_tag, sc->sc_buf_handle,
bus_space_write_region_2(sc->sc_buft, sc->sc_bufh,
buf, savebyte, 1);
}
return (totlen);

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_ae_nubus.c,v 1.3 1997/02/25 06:36:06 scottr Exp $ */
/* $NetBSD: if_ae_nubus.c,v 1.4 1997/02/28 07:52:45 scottr Exp $ */
/*
* Copyright (C) 1997 Scott Reynolds
@ -36,6 +36,7 @@
#include <sys/errno.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <sys/syslog.h>
#include <sys/systm.h>
#include <net/if.h>
@ -55,8 +56,9 @@
static int ae_nubus_match __P((struct device *, struct cfdata *, void *));
static void ae_nubus_attach __P((struct device *, struct device *, void *));
static int ae_card_vendor __P((struct nubus_attach_args *na));
static int ae_get_enaddr __P((struct nubus_attach_args *na, u_int8_t *ep));
static int ae_nb_card_vendor __P((struct nubus_attach_args *));
static int ae_nb_get_enaddr __P((struct nubus_attach_args *, u_int8_t *));
static void ae_nb_watchdog __P((struct ifnet *));
struct cfattach ae_nubus_ca = {
sizeof(struct ae_softc), ae_nubus_match, ae_nubus_attach
@ -80,7 +82,7 @@ ae_nubus_match(parent, cf, aux)
if (na->category == NUBUS_CATEGORY_NETWORK &&
na->type == NUBUS_TYPE_ETHERNET) {
switch (ae_card_vendor(na)) {
switch (ae_nb_card_vendor(na)) {
case AE_VENDOR_APPLE:
case AE_VENDOR_ASANTE:
case AE_VENDOR_FARALLON:
@ -112,6 +114,7 @@ ae_nubus_attach(parent, self, aux)
{
struct ae_softc *sc = (struct ae_softc *) self;
struct nubus_attach_args *na = (struct nubus_attach_args *) aux;
struct ifnet *ifp = &sc->sc_arpcom.ac_if;
bus_space_tag_t bst;
bus_space_handle_t bsh;
int success;
@ -126,11 +129,11 @@ ae_nubus_attach(parent, self, aux)
return;
}
sc->sc_reg_tag = sc->sc_buf_tag = bst;
sc->sc_regt = sc->sc_buft = bst;
sc->sc_flags = self->dv_cfdata->cf_flags;
sc->regs_rev = 0;
sc->use16bit = 1;
sc->vendor = ae_card_vendor(na);
sc->vendor = ae_nb_card_vendor(na);
strncpy(sc->type_str, nubus_get_card_name(na->fmt),
INTERFACE_NAME_LEN);
sc->type_str[INTERFACE_NAME_LEN-1] = '\0';
@ -143,7 +146,7 @@ ae_nubus_attach(parent, self, aux)
case AE_VENDOR_ASANTE:
sc->regs_rev = 1;
if (bus_space_subregion(bst, bsh,
AE_REG_OFFSET, AE_REG_SIZE, &sc->sc_reg_handle)) {
AE_REG_OFFSET, AE_REG_SIZE, &sc->sc_regh)) {
printf(": failed to map register space\n");
break;
}
@ -153,7 +156,7 @@ ae_nubus_attach(parent, self, aux)
break;
}
if (bus_space_subregion(bst, bsh,
AE_DATA_OFFSET, sc->mem_size, &sc->sc_buf_handle)) {
AE_DATA_OFFSET, sc->mem_size, &sc->sc_bufh)) {
printf(": failed to map register space\n");
break;
}
@ -163,7 +166,7 @@ ae_nubus_attach(parent, self, aux)
sc->sc_arpcom.ac_enaddr[i] =
bus_space_read_1(bst, bsh, (AE_ROM_OFFSET + i * 2));
#else
if (ae_get_enaddr(na, sc->sc_arpcom.ac_enaddr)) {
if (ae_nb_get_enaddr(na, sc->sc_arpcom.ac_enaddr)) {
printf(": can't find MAC address\n");
break;
}
@ -174,13 +177,13 @@ ae_nubus_attach(parent, self, aux)
case AE_VENDOR_DAYNA:
if (bus_space_subregion(bst, bsh,
DP_REG_OFFSET, AE_REG_SIZE, &sc->sc_reg_handle)) {
DP_REG_OFFSET, AE_REG_SIZE, &sc->sc_regh)) {
printf(": failed to map register space\n");
break;
}
sc->mem_size = 8192;
if (bus_space_subregion(bst, bsh,
DP_DATA_OFFSET, sc->mem_size, &sc->sc_buf_handle)) {
DP_DATA_OFFSET, sc->mem_size, &sc->sc_bufh)) {
printf(": failed to map register space\n");
break;
}
@ -190,7 +193,7 @@ ae_nubus_attach(parent, self, aux)
sc->sc_arpcom.ac_enaddr[i] =
bus_space_read_1(bst, bsh, (DP_ROM_OFFSET + i * 2));
#else
if (ae_get_enaddr(na, sc->sc_arpcom.ac_enaddr)) {
if (ae_nb_get_enaddr(na, sc->sc_arpcom.ac_enaddr)) {
printf(": can't find MAC address\n");
break;
}
@ -202,7 +205,7 @@ ae_nubus_attach(parent, self, aux)
case AE_VENDOR_FARALLON:
sc->regs_rev = 1;
if (bus_space_subregion(bst, bsh,
AE_REG_OFFSET, AE_REG_SIZE, &sc->sc_reg_handle)) {
AE_REG_OFFSET, AE_REG_SIZE, &sc->sc_regh)) {
printf(": failed to map register space\n");
break;
}
@ -212,7 +215,7 @@ ae_nubus_attach(parent, self, aux)
break;
}
if (bus_space_subregion(bst, bsh,
AE_DATA_OFFSET, sc->mem_size, &sc->sc_buf_handle)) {
AE_DATA_OFFSET, sc->mem_size, &sc->sc_bufh)) {
printf(": failed to map register space\n");
break;
}
@ -232,7 +235,7 @@ ae_nubus_attach(parent, self, aux)
case AE_VENDOR_INTERLAN:
if (bus_space_subregion(bst, bsh,
GC_REG_OFFSET, AE_REG_SIZE, &sc->sc_reg_handle)) {
GC_REG_OFFSET, AE_REG_SIZE, &sc->sc_regh)) {
printf(": failed to map register space\n");
break;
}
@ -242,7 +245,7 @@ ae_nubus_attach(parent, self, aux)
break;
}
if (bus_space_subregion(bst, bsh,
GC_DATA_OFFSET, sc->mem_size, &sc->sc_buf_handle)) {
GC_DATA_OFFSET, sc->mem_size, &sc->sc_bufh)) {
printf(": failed to map register space\n");
break;
}
@ -256,7 +259,7 @@ ae_nubus_attach(parent, self, aux)
sc->sc_arpcom.ac_enaddr[i] =
bus_space_read_1(bst, bsh, (GC_ROM_OFFSET + i * 4));
#else
if (ae_get_enaddr(na, sc->sc_arpcom.ac_enaddr)) {
if (ae_nb_get_enaddr(na, sc->sc_arpcom.ac_enaddr)) {
printf(": can't find MAC address\n");
break;
}
@ -268,7 +271,7 @@ ae_nubus_attach(parent, self, aux)
case AE_VENDOR_KINETICS:
sc->use16bit = 0;
if (bus_space_subregion(bst, bsh,
KE_REG_OFFSET, AE_REG_SIZE, &sc->sc_reg_handle)) {
KE_REG_OFFSET, AE_REG_SIZE, &sc->sc_regh)) {
printf(": failed to map register space\n");
break;
}
@ -278,11 +281,11 @@ ae_nubus_attach(parent, self, aux)
break;
}
if (bus_space_subregion(bst, bsh,
KE_DATA_OFFSET, sc->mem_size, &sc->sc_buf_handle)) {
KE_DATA_OFFSET, sc->mem_size, &sc->sc_bufh)) {
printf(": failed to map register space\n");
break;
}
if (ae_get_enaddr(na, sc->sc_arpcom.ac_enaddr)) {
if (ae_nb_get_enaddr(na, sc->sc_arpcom.ac_enaddr)) {
printf(": can't find MAC address\n");
break;
}
@ -299,11 +302,13 @@ ae_nubus_attach(parent, self, aux)
return;
}
ifp->if_watchdog = ae_nb_watchdog; /* Override watchdog */
aesetup(sc);
/* make sure interrupts are vectored to us */
add_nubus_intr(na->slot, aeintr, sc);
#ifdef MAC68K_BROKEN_VIDEO
/*
* XXX -- enable nubus interrupts here. Should be done elsewhere,
* but that currently breaks with some nubus video cards'
@ -311,10 +316,11 @@ ae_nubus_attach(parent, self, aux)
* have an ethernet card... i.e., we do it here.
*/
enable_nubus_intr();
#endif
}
static int
ae_card_vendor(na)
ae_nb_card_vendor(na)
struct nubus_attach_args *na;
{
int vendor;
@ -359,7 +365,7 @@ ae_card_vendor(na)
}
static int
ae_get_enaddr(na, ep)
ae_nb_get_enaddr(na, ep)
struct nubus_attach_args *na;
u_int8_t *ep;
{
@ -382,3 +388,24 @@ ae_get_enaddr(na, ep)
return 0;
}
static void
ae_nb_watchdog(ifp)
struct ifnet *ifp;
{
struct ae_softc *sc = ifp->if_softc;
#if 1
/*
* This is a kludge! The via code seems to miss slot interrupts
* sometimes. This kludges around that by calling the handler
* by hand if the watchdog is activated. -- XXX (akb)
*/
(*via2itab[1])((void *) 1);
#endif
log(LOG_ERR, "%s: device timeout\n", sc->sc_dev.dv_xname);
++sc->sc_arpcom.ac_if.if_oerrors;
aereset(sc);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_aevar.h,v 1.3 1997/02/25 06:36:07 scottr Exp $ */
/* $NetBSD: if_aevar.h,v 1.4 1997/02/28 07:52:46 scottr Exp $ */
/*
* Device driver for National Semiconductor DS8390/WD83C690 based ethernet
@ -22,10 +22,10 @@
*/
struct ae_softc {
struct device sc_dev;
bus_space_tag_t sc_reg_tag; /* NIC register space tag */
bus_space_handle_t sc_reg_handle; /* NIC register space handle */
bus_space_tag_t sc_buf_tag; /* Buffer space tag */
bus_space_handle_t sc_buf_handle; /* Buffer space handle */
bus_space_tag_t sc_regt; /* NIC register space tag */
bus_space_handle_t sc_regh; /* NIC register space handle */
bus_space_tag_t sc_buft; /* Buffer space tag */
bus_space_handle_t sc_bufh; /* Buffer space handle */
/* struct intrhand sc_ih; */

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_ae_nubus.c,v 1.3 1997/02/25 06:36:06 scottr Exp $ */
/* $NetBSD: if_ae_nubus.c,v 1.4 1997/02/28 07:52:45 scottr Exp $ */
/*
* Copyright (C) 1997 Scott Reynolds
@ -36,6 +36,7 @@
#include <sys/errno.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <sys/syslog.h>
#include <sys/systm.h>
#include <net/if.h>
@ -55,8 +56,9 @@
static int ae_nubus_match __P((struct device *, struct cfdata *, void *));
static void ae_nubus_attach __P((struct device *, struct device *, void *));
static int ae_card_vendor __P((struct nubus_attach_args *na));
static int ae_get_enaddr __P((struct nubus_attach_args *na, u_int8_t *ep));
static int ae_nb_card_vendor __P((struct nubus_attach_args *));
static int ae_nb_get_enaddr __P((struct nubus_attach_args *, u_int8_t *));
static void ae_nb_watchdog __P((struct ifnet *));
struct cfattach ae_nubus_ca = {
sizeof(struct ae_softc), ae_nubus_match, ae_nubus_attach
@ -80,7 +82,7 @@ ae_nubus_match(parent, cf, aux)
if (na->category == NUBUS_CATEGORY_NETWORK &&
na->type == NUBUS_TYPE_ETHERNET) {
switch (ae_card_vendor(na)) {
switch (ae_nb_card_vendor(na)) {
case AE_VENDOR_APPLE:
case AE_VENDOR_ASANTE:
case AE_VENDOR_FARALLON:
@ -112,6 +114,7 @@ ae_nubus_attach(parent, self, aux)
{
struct ae_softc *sc = (struct ae_softc *) self;
struct nubus_attach_args *na = (struct nubus_attach_args *) aux;
struct ifnet *ifp = &sc->sc_arpcom.ac_if;
bus_space_tag_t bst;
bus_space_handle_t bsh;
int success;
@ -126,11 +129,11 @@ ae_nubus_attach(parent, self, aux)
return;
}
sc->sc_reg_tag = sc->sc_buf_tag = bst;
sc->sc_regt = sc->sc_buft = bst;
sc->sc_flags = self->dv_cfdata->cf_flags;
sc->regs_rev = 0;
sc->use16bit = 1;
sc->vendor = ae_card_vendor(na);
sc->vendor = ae_nb_card_vendor(na);
strncpy(sc->type_str, nubus_get_card_name(na->fmt),
INTERFACE_NAME_LEN);
sc->type_str[INTERFACE_NAME_LEN-1] = '\0';
@ -143,7 +146,7 @@ ae_nubus_attach(parent, self, aux)
case AE_VENDOR_ASANTE:
sc->regs_rev = 1;
if (bus_space_subregion(bst, bsh,
AE_REG_OFFSET, AE_REG_SIZE, &sc->sc_reg_handle)) {
AE_REG_OFFSET, AE_REG_SIZE, &sc->sc_regh)) {
printf(": failed to map register space\n");
break;
}
@ -153,7 +156,7 @@ ae_nubus_attach(parent, self, aux)
break;
}
if (bus_space_subregion(bst, bsh,
AE_DATA_OFFSET, sc->mem_size, &sc->sc_buf_handle)) {
AE_DATA_OFFSET, sc->mem_size, &sc->sc_bufh)) {
printf(": failed to map register space\n");
break;
}
@ -163,7 +166,7 @@ ae_nubus_attach(parent, self, aux)
sc->sc_arpcom.ac_enaddr[i] =
bus_space_read_1(bst, bsh, (AE_ROM_OFFSET + i * 2));
#else
if (ae_get_enaddr(na, sc->sc_arpcom.ac_enaddr)) {
if (ae_nb_get_enaddr(na, sc->sc_arpcom.ac_enaddr)) {
printf(": can't find MAC address\n");
break;
}
@ -174,13 +177,13 @@ ae_nubus_attach(parent, self, aux)
case AE_VENDOR_DAYNA:
if (bus_space_subregion(bst, bsh,
DP_REG_OFFSET, AE_REG_SIZE, &sc->sc_reg_handle)) {
DP_REG_OFFSET, AE_REG_SIZE, &sc->sc_regh)) {
printf(": failed to map register space\n");
break;
}
sc->mem_size = 8192;
if (bus_space_subregion(bst, bsh,
DP_DATA_OFFSET, sc->mem_size, &sc->sc_buf_handle)) {
DP_DATA_OFFSET, sc->mem_size, &sc->sc_bufh)) {
printf(": failed to map register space\n");
break;
}
@ -190,7 +193,7 @@ ae_nubus_attach(parent, self, aux)
sc->sc_arpcom.ac_enaddr[i] =
bus_space_read_1(bst, bsh, (DP_ROM_OFFSET + i * 2));
#else
if (ae_get_enaddr(na, sc->sc_arpcom.ac_enaddr)) {
if (ae_nb_get_enaddr(na, sc->sc_arpcom.ac_enaddr)) {
printf(": can't find MAC address\n");
break;
}
@ -202,7 +205,7 @@ ae_nubus_attach(parent, self, aux)
case AE_VENDOR_FARALLON:
sc->regs_rev = 1;
if (bus_space_subregion(bst, bsh,
AE_REG_OFFSET, AE_REG_SIZE, &sc->sc_reg_handle)) {
AE_REG_OFFSET, AE_REG_SIZE, &sc->sc_regh)) {
printf(": failed to map register space\n");
break;
}
@ -212,7 +215,7 @@ ae_nubus_attach(parent, self, aux)
break;
}
if (bus_space_subregion(bst, bsh,
AE_DATA_OFFSET, sc->mem_size, &sc->sc_buf_handle)) {
AE_DATA_OFFSET, sc->mem_size, &sc->sc_bufh)) {
printf(": failed to map register space\n");
break;
}
@ -232,7 +235,7 @@ ae_nubus_attach(parent, self, aux)
case AE_VENDOR_INTERLAN:
if (bus_space_subregion(bst, bsh,
GC_REG_OFFSET, AE_REG_SIZE, &sc->sc_reg_handle)) {
GC_REG_OFFSET, AE_REG_SIZE, &sc->sc_regh)) {
printf(": failed to map register space\n");
break;
}
@ -242,7 +245,7 @@ ae_nubus_attach(parent, self, aux)
break;
}
if (bus_space_subregion(bst, bsh,
GC_DATA_OFFSET, sc->mem_size, &sc->sc_buf_handle)) {
GC_DATA_OFFSET, sc->mem_size, &sc->sc_bufh)) {
printf(": failed to map register space\n");
break;
}
@ -256,7 +259,7 @@ ae_nubus_attach(parent, self, aux)
sc->sc_arpcom.ac_enaddr[i] =
bus_space_read_1(bst, bsh, (GC_ROM_OFFSET + i * 4));
#else
if (ae_get_enaddr(na, sc->sc_arpcom.ac_enaddr)) {
if (ae_nb_get_enaddr(na, sc->sc_arpcom.ac_enaddr)) {
printf(": can't find MAC address\n");
break;
}
@ -268,7 +271,7 @@ ae_nubus_attach(parent, self, aux)
case AE_VENDOR_KINETICS:
sc->use16bit = 0;
if (bus_space_subregion(bst, bsh,
KE_REG_OFFSET, AE_REG_SIZE, &sc->sc_reg_handle)) {
KE_REG_OFFSET, AE_REG_SIZE, &sc->sc_regh)) {
printf(": failed to map register space\n");
break;
}
@ -278,11 +281,11 @@ ae_nubus_attach(parent, self, aux)
break;
}
if (bus_space_subregion(bst, bsh,
KE_DATA_OFFSET, sc->mem_size, &sc->sc_buf_handle)) {
KE_DATA_OFFSET, sc->mem_size, &sc->sc_bufh)) {
printf(": failed to map register space\n");
break;
}
if (ae_get_enaddr(na, sc->sc_arpcom.ac_enaddr)) {
if (ae_nb_get_enaddr(na, sc->sc_arpcom.ac_enaddr)) {
printf(": can't find MAC address\n");
break;
}
@ -299,11 +302,13 @@ ae_nubus_attach(parent, self, aux)
return;
}
ifp->if_watchdog = ae_nb_watchdog; /* Override watchdog */
aesetup(sc);
/* make sure interrupts are vectored to us */
add_nubus_intr(na->slot, aeintr, sc);
#ifdef MAC68K_BROKEN_VIDEO
/*
* XXX -- enable nubus interrupts here. Should be done elsewhere,
* but that currently breaks with some nubus video cards'
@ -311,10 +316,11 @@ ae_nubus_attach(parent, self, aux)
* have an ethernet card... i.e., we do it here.
*/
enable_nubus_intr();
#endif
}
static int
ae_card_vendor(na)
ae_nb_card_vendor(na)
struct nubus_attach_args *na;
{
int vendor;
@ -359,7 +365,7 @@ ae_card_vendor(na)
}
static int
ae_get_enaddr(na, ep)
ae_nb_get_enaddr(na, ep)
struct nubus_attach_args *na;
u_int8_t *ep;
{
@ -382,3 +388,24 @@ ae_get_enaddr(na, ep)
return 0;
}
static void
ae_nb_watchdog(ifp)
struct ifnet *ifp;
{
struct ae_softc *sc = ifp->if_softc;
#if 1
/*
* This is a kludge! The via code seems to miss slot interrupts
* sometimes. This kludges around that by calling the handler
* by hand if the watchdog is activated. -- XXX (akb)
*/
(*via2itab[1])((void *) 1);
#endif
log(LOG_ERR, "%s: device timeout\n", sc->sc_dev.dv_xname);
++sc->sc_arpcom.ac_if.if_oerrors;
aereset(sc);
}