diff options
author | Jason Wright <jason@cvs.openbsd.org> | 1999-01-07 03:14:44 +0000 |
---|---|---|
committer | Jason Wright <jason@cvs.openbsd.org> | 1999-01-07 03:14:44 +0000 |
commit | 49d391539aaaca3fe99f8af6ba26270f9004cd3d (patch) | |
tree | 44e944934f73ed0129f83a5bdb9c1fdfcfc66f62 /sys/arch/sparc/dev | |
parent | 3c69591551bdd895632b3df688b934194da15b78 (diff) |
Take advantage of kernel printf %b
Diffstat (limited to 'sys/arch/sparc/dev')
-rw-r--r-- | sys/arch/sparc/dev/be.c | 90 | ||||
-rw-r--r-- | sys/arch/sparc/dev/bereg.h | 18 | ||||
-rw-r--r-- | sys/arch/sparc/dev/hme.c | 67 | ||||
-rw-r--r-- | sys/arch/sparc/dev/hmereg.h | 8 |
4 files changed, 41 insertions, 142 deletions
diff --git a/sys/arch/sparc/dev/be.c b/sys/arch/sparc/dev/be.c index 16fac1dd2fd..b465a12fc19 100644 --- a/sys/arch/sparc/dev/be.c +++ b/sys/arch/sparc/dev/be.c @@ -1,4 +1,4 @@ -/* $OpenBSD: be.c,v 1.18 1998/11/02 05:50:59 jason Exp $ */ +/* $OpenBSD: be.c,v 1.19 1999/01/07 03:14:42 jason Exp $ */ /* * Copyright (c) 1998 Theo de Raadt and Jason L. Wright. @@ -380,63 +380,15 @@ beqint(sc, why) if (why & BE_CR_STAT_RXIRQ) r |= 1; - if (why & BE_CR_STAT_BERROR) { + if (why & BE_CR_STAT_ERRORS) { r |= 1; rst = 1; - printf("%s: bigmac error\n", sc->sc_dev.dv_xname); } - if (why & BE_CR_STAT_TXDERR) { - r |= 1; - rst = 1; - printf("%s: bogus tx descriptor\n", sc->sc_dev.dv_xname); - } - - if (why & (BE_CR_STAT_TXLERR | BE_CR_STAT_TXPERR | BE_CR_STAT_TXSERR)) { - r |= 1; - rst = 1; - printf("%s: tx dma error ( ", sc->sc_dev.dv_xname); - if (why & BE_CR_STAT_TXLERR) - printf("Late "); - if (why & BE_CR_STAT_TXPERR) - printf("Parity "); - if (why & BE_CR_STAT_TXSERR) - printf("Generic "); - printf(")\n"); - } - - if (why & BE_CR_STAT_RXDROP) { - r |= 1; - rst = 1; - printf("%s: out of rx descriptors\n", sc->sc_dev.dv_xname); - } - - if (why & BE_CR_STAT_RXSMALL) { - r |= 1; - rst = 1; - printf("%s: rx descriptor too small\n", sc->sc_dev.dv_xname); - } - - if (why & (BE_CR_STAT_RXLERR | BE_CR_STAT_RXPERR | BE_CR_STAT_RXSERR)) { - r |= 1; - rst = 1; - printf("%s: rx dma error ( ", sc->sc_dev.dv_xname); - if (why & BE_CR_STAT_RXLERR) - printf("Late "); - if (why & BE_CR_STAT_RXPERR) - printf("Parity "); - if (why & BE_CR_STAT_RXSERR) - printf("Generic "); - printf(")\n"); - } - - if (!r) { - rst = 1; - printf("%s: unexpected error interrupt %08x\n", - sc->sc_dev.dv_xname, why); - } - - if (rst) { + if (rst || r == 0) { + printf("%s:%s qstat=%b\n", sc->sc_dev.dv_xname, + (r) ? "" : " unexpected", + why, BE_CR_STAT_BITS); printf("%s: resetting\n", sc->sc_dev.dv_xname); bereset(sc); } @@ -452,34 +404,18 @@ beeint(sc, why) struct besoftc *sc; u_int32_t why; { - int r = 0, rst = 0; + int r = 0; - if (why & BE_BR_STAT_RFIFOVF) { + if (why & (BE_BR_STAT_RFIFOVF | BE_BR_STAT_TFIFO_UND | + BE_BR_STAT_MAXPKTERR)) { r |= 1; - rst = 1; - printf("%s: receive fifo overrun\n", sc->sc_dev.dv_xname); - } - if (why & BE_BR_STAT_TFIFO_UND) { - r |= 1; - rst = 1; - printf("%s: transmit fifo underrun\n", sc->sc_dev.dv_xname); - } - if (why & BE_BR_STAT_MAXPKTERR) { - r |= 1; - rst = 1; - printf("%s: max packet size error\n", sc->sc_dev.dv_xname); } - if (!r) { - rst = 1; - printf("%s: unexpected error interrupt %08x\n", - sc->sc_dev.dv_xname, why); - } + printf("%s:%s stat=%b\n", sc->sc_dev.dv_xname, + (r) ? "" : " unexpected", why, BE_BR_STAT_BITS); - if (rst) { - printf("%s: resetting\n", sc->sc_dev.dv_xname); - bereset(sc); - } + printf("%s: resetting\n", sc->sc_dev.dv_xname); + bereset(sc); return r; } diff --git a/sys/arch/sparc/dev/bereg.h b/sys/arch/sparc/dev/bereg.h index ff8a99489c9..1cab775c1da 100644 --- a/sys/arch/sparc/dev/bereg.h +++ b/sys/arch/sparc/dev/bereg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bereg.h,v 1.7 1998/09/15 22:36:21 jason Exp $ */ +/* $OpenBSD: bereg.h,v 1.8 1999/01/07 03:14:42 jason Exp $ */ /* * Copyright (c) 1998 Theo de Raadt and Jason L. Wright. @@ -104,6 +104,8 @@ struct be_bregs { #define BE_BR_STAT_FCNTEXP 0x00004000 /* first-collision cntr exp */ #define BE_BR_STAT_DTIMEXP 0x00008000 /* defer-timer expired */ +#define BE_BR_STAT_BITS "\20\1RX\2RCNT\3ACNT\4CCNT\5LCNT\6RFIFO\7CVCNT\11TX\12TFIFO\13TMAXPKT\14NCNT\15ECNT\16LCCNT\17ECNT\20DTIME" + /* be_bregs.imask: interrupt mask. */ #define BE_BR_IMASK_GOTFRAME 0x00000001 /* received a frame */ #define BE_BR_IMASK_RCNTEXP 0x00000002 /* rx frame cntr expired */ @@ -178,6 +180,20 @@ struct be_cregs { #define BE_CR_STAT_RXPERR 0x00000002 /* rx parity error */ #define BE_CR_STAT_RXSERR 0x00000001 /* rx sbus error ack */ +/* + * All bits except rxirq/txirq + */ +#define BE_CR_STAT_ERRORS \ + (BE_CR_STAT_BERROR | \ + BE_CR_STAT_TXDERR | BE_CR_STAT_TXLERR | \ + BE_CR_STAT_TXPERR | BE_CR_STAT_TXSERR | \ + BE_CR_STAT_RXDROP | BE_CR_STAT_RXSMALL | \ + BE_CR_STAT_RXLERR | BE_CR_STAT_RXPERR | \ + BE_CR_STAT_RXSERR) + +#define BE_CR_STAT_BITS \ + "\20\1RXS\2RXP\3RXL\4RXSMALL\5RXDROP\6RX\21TXS\22TXP\23TXL\24TXD\26TX\40BE" + /* be_cregs.qmask: qec error interrupt mask. */ #define BE_CR_QMASK_TXDERR 0x00080000 /* tx descriptor is bad */ #define BE_CR_QMASK_TXLERR 0x00040000 /* tx late error */ diff --git a/sys/arch/sparc/dev/hme.c b/sys/arch/sparc/dev/hme.c index b327c2af067..1c169ff1755 100644 --- a/sys/arch/sparc/dev/hme.c +++ b/sys/arch/sparc/dev/hme.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hme.c,v 1.14 1998/12/14 17:37:24 jason Exp $ */ +/* $OpenBSD: hme.c,v 1.15 1999/01/07 03:14:42 jason Exp $ */ /* * Copyright (c) 1998 Jason L. Wright (jason@thought.net) @@ -772,68 +772,9 @@ hme_eint(sc, why) struct hme_softc *sc; u_int32_t why; { - if (why & GR_STAT_RFIFOVF) { /* probably dma error */ - printf("%s: receive fifo overflow\n", sc->sc_dev.dv_xname); - hmereset(sc); - } - - if (why & GR_STAT_STSTERR) { - printf("%s: SQE test failed: resetting\n", sc->sc_dev.dv_xname); - hmereset(sc); - } - - if (why & GR_STAT_TFIFO_UND) { /* probably dma error */ - printf("%s: tx fifo underrun\n", sc->sc_dev.dv_xname); - hmereset(sc); - } - - if (why & GR_STAT_MAXPKTERR) { /* driver bug */ - printf("%s: tx max packet size error\n", sc->sc_dev.dv_xname); - hmereset(sc); - } - - if (why & GR_STAT_NORXD) { /* driver bug */ - printf("%s: out of receive descriptors\n", sc->sc_dev.dv_xname); - hmereset(sc); - } - - if (why & GR_STAT_EOPERR) { - printf("%s: eop not set in tx descriptor\n", - sc->sc_dev.dv_xname); - hmereset(sc); - } - - if (why & (GR_STAT_RXERR | GR_STAT_RXPERR | GR_STAT_RXTERR)) { - printf("%s: rx dma error < ", sc->sc_dev.dv_xname); - if (why & GR_STAT_RXERR) - printf("Generic "); - if (why & GR_STAT_RXPERR); - printf("Parity "); - if (why & GR_STAT_RXTERR) - printf("RxTag "); - printf(" >\n"); - hmereset(sc); - } - - if (why & - (GR_STAT_TXEACK|GR_STAT_TXLERR|GR_STAT_TXPERR|GR_STAT_TXTERR)) { - printf("%s: rx dma error < ", sc->sc_dev.dv_xname); - if (why & GR_STAT_TXEACK) - printf("Generic "); - if (why & GR_STAT_TXLERR); - printf("Late "); - if (why & GR_STAT_TXPERR) - printf("Parity "); - if (why & GR_STAT_TXTERR); - printf("TxTag "); - printf(" >\n"); - hmereset(sc); - } - - if (why & (GR_STAT_SLVERR | GR_STAT_SLVPERR)) { - printf("%s: sbus %s error accessing registers\n", - sc->sc_dev.dv_xname, - (why & GR_STAT_SLVPERR) ? "parity" : "generic"); + if (why & GR_STAT_ALL_ERRORS) { + printf("%s: stat=%b, resetting.\n", sc->sc_dev.dv_xname, + why, GR_STAT_BITS); hmereset(sc); } diff --git a/sys/arch/sparc/dev/hmereg.h b/sys/arch/sparc/dev/hmereg.h index c8c79a5d9f5..26a5a781a01 100644 --- a/sys/arch/sparc/dev/hmereg.h +++ b/sys/arch/sparc/dev/hmereg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: hmereg.h,v 1.6 1998/09/10 17:34:32 jason Exp $ */ +/* $OpenBSD: hmereg.h,v 1.7 1999/01/07 03:14:43 jason Exp $ */ /* * Copyright (c) 1998 Jason L. Wright (jason@thought.net) @@ -109,6 +109,12 @@ struct hme_gr { GR_STAT_RFIFOVF | GR_STAT_LCNTEXP | GR_STAT_CCNTEXP | \ GR_STAT_ACNTEXP) +#define GR_STAT_BITS \ + "\20\1RX\2RCNT\3ACNT\4CCNT\5LCNT\6RFIFO\7CVCNT\10STST" \ + "\11TX\12TFIFO\13MAXPKT\14NCNT\15ECNT\16LCCNT\17FCNT" \ + "\20DTIME\21RXHOST\22NORXD\23RXE\24EXLATE\25RXP\26RXT\27EOP" \ + "\30MIF\31TXHOST\32TXALL\33TXE\34TXL\35TXP\36TXT\37SLV" \ + "\40SLVP" /* hme_gr.stat (interrupt status register) */ #define GR_IMASK_GOTFRAME 0x00000001 /* frame received */ |