Several minor changes:
- Indent some comments appropriately per KNF. - Output all diagnostics using the device name rather than a static string. - Fix a (mostly marmless) bug in snintr(), where loss of heartbeat wasn't properly ignored and could mask the `receive descriptors exhausted' diagnostic.
This commit is contained in:
parent
7a55cafeeb
commit
1c9987dab4
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: if_sn.c,v 1.6 1997/03/17 13:11:24 briggs Exp $ */
|
||||
/* $NetBSD: if_sn.c,v 1.7 1997/03/20 17:47:51 scottr Exp $ */
|
||||
|
||||
/*
|
||||
* National Semiconductor SONIC Driver
|
||||
|
@ -127,26 +127,26 @@ snsetup(sc, lladdr)
|
|||
|
||||
sc->sc_csr = (struct sonic_reg *) sc->sc_regh;
|
||||
|
||||
/*
|
||||
* Disable caching on the SONIC's data space.
|
||||
*/
|
||||
/*
|
||||
* Disable caching on the SONIC's data space.
|
||||
*/
|
||||
physaccess((caddr_t) sc->space, (caddr_t) kvtop((caddr_t) sc->space),
|
||||
sizeof(sc->space), PG_V | PG_RW | PG_CI);
|
||||
|
||||
/*
|
||||
* Put the pup in reset mode (sninit() will fix it later)
|
||||
* and clear any interrupts.
|
||||
*/
|
||||
/*
|
||||
* Put the pup in reset mode (sninit() will fix it later)
|
||||
* and clear any interrupts.
|
||||
*/
|
||||
sc->sc_csr->s_cr = CR_RST;
|
||||
wbflush();
|
||||
sc->sc_csr->s_isr = 0x7fff;
|
||||
wbflush();
|
||||
|
||||
/*
|
||||
* because the SONIC is basically 16bit device it 'concatenates'
|
||||
* a higher buffer address to a 16 bit offset--this will cause wrap
|
||||
* around problems near the end of 64k !!
|
||||
*/
|
||||
/*
|
||||
* because the SONIC is basically 16bit device it 'concatenates'
|
||||
* a higher buffer address to a 16 bit offset--this will cause wrap
|
||||
* around problems near the end of 64k !!
|
||||
*/
|
||||
p = &sc->space[0];
|
||||
pp = (unsigned char *)ROUNDUP ((int)p, NBPG);
|
||||
p = pp;
|
||||
|
@ -675,7 +675,8 @@ camprogram(sc)
|
|||
continue;
|
||||
if (timeout == 0) {
|
||||
/* XXX */
|
||||
panic("sonic: CAM initialisation failed\n");
|
||||
panic("%s: CAM initialisation failed\n",
|
||||
sc->sc_dev.dv_xname);
|
||||
}
|
||||
timeout = 10000;
|
||||
while ((csr->s_isr & ISR_LCD) == 0 && timeout--)
|
||||
|
@ -684,7 +685,8 @@ camprogram(sc)
|
|||
if (csr->s_isr & ISR_LCD)
|
||||
csr->s_isr = ISR_LCD;
|
||||
else
|
||||
printf("sonic: CAM initialisation without interrupt\n");
|
||||
printf("%s: CAM initialisation without interrupt\n",
|
||||
sc->sc_dev.dv_xname);
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
@ -825,7 +827,8 @@ snintr(arg, slot)
|
|||
wbflush();
|
||||
|
||||
if (isr & (ISR_BR | ISR_LCD | ISR_PINT | ISR_TC))
|
||||
printf("sonic: unexpected interrupt status 0x%x\n", isr);
|
||||
printf("%s: unexpected interrupt status 0x%x\n",
|
||||
sc->sc_dev.dv_xname, isr);
|
||||
|
||||
if (isr & (ISR_TXDN | ISR_TXER))
|
||||
sonictxint(sc);
|
||||
|
@ -843,14 +846,19 @@ snintr(arg, slot)
|
|||
* if we can't detect a carrier that we have a
|
||||
* problem.
|
||||
*/
|
||||
;
|
||||
if (isr & ISR_RDE)
|
||||
printf("sonic: receive descriptors exhausted\n");
|
||||
printf("%s: receive descriptors exhausted\n",
|
||||
sc->sc_dev.dv_xname);
|
||||
if (isr & ISR_RBE)
|
||||
printf("sonic: receive buffers exhausted\n");
|
||||
printf("%s: receive buffers exhausted\n",
|
||||
sc->sc_dev.dv_xname);
|
||||
if (isr & ISR_RBAE)
|
||||
printf("sonic: receive buffer area exhausted\n");
|
||||
printf("%s: receive buffer area exhausted\n",
|
||||
sc->sc_dev.dv_xname);
|
||||
if (isr & ISR_RFO)
|
||||
printf("sonic: receive FIFO overrun\n");
|
||||
printf("%s: receive FIFO overrun\n",
|
||||
sc->sc_dev.dv_xname);
|
||||
}
|
||||
if (isr & (ISR_CRC | ISR_FAE | ISR_MP)) {
|
||||
#ifdef notdef
|
||||
|
@ -912,8 +920,9 @@ sonictxint(sc)
|
|||
/* XXX - Do stats here. */
|
||||
|
||||
if ((SRO(sc->bitmode, txp, TXP_STATUS) & TCR_PTX) == 0) {
|
||||
printf("sonic: Tx packet status=0x%x\n",
|
||||
SRO(sc->bitmode, txp, TXP_STATUS));
|
||||
printf("%s: Tx packet status=0x%x\n",
|
||||
sc->sc_dev.dv_xname,
|
||||
SRO(sc->bitmode, txp, TXP_STATUS));
|
||||
|
||||
/* XXX - DG This looks bogus */
|
||||
if (sc->mtd_hw != sc->mtd_free) {
|
||||
|
@ -950,7 +959,8 @@ sonicrxint(sc)
|
|||
while (SRO(bitmode, rda, RXPKT_INUSE) == 0) {
|
||||
unsigned status = SRO(bitmode, rda, RXPKT_STATUS);
|
||||
if ((status & RCR_LPKT) == 0)
|
||||
printf("sonic: more than one packet in RBA!\n");
|
||||
printf("%s: more than one packet in RBA!\n",
|
||||
sc->sc_dev.dv_xname);
|
||||
|
||||
orra = RBASEQ(SRO(bitmode, rda, RXPKT_SEQNO)) & RRAMASK;
|
||||
len = SRO(bitmode, rda, RXPKT_BYTEC) -
|
||||
|
@ -1043,7 +1053,8 @@ sonic_read(sc, pkt, len)
|
|||
printf(" (to %s)\n", ether_sprintf(et->ether_dhost));
|
||||
}
|
||||
if (len < ETHERMIN || len > ETHERMTU) {
|
||||
printf("sonic: invalid packet length %d bytes\n", len);
|
||||
printf("%s: invalid packet length %d bytes\n",
|
||||
sc->sc_dev.dv_xname, len);
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue