Fix some diagnostic output with a patch from Jonathan O'Brien.

This commit is contained in:
pk 1999-11-05 19:00:44 +00:00
parent f52d155148
commit 23c39b410d

View File

@ -1,4 +1,4 @@
/* $NetBSD: stp4020.c,v 1.5 1999/07/06 21:44:11 thorpej Exp $ */
/* $NetBSD: stp4020.c,v 1.6 1999/11/05 19:00:44 pk Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -129,6 +129,9 @@ struct cfattach nell_ca = {
sizeof(struct stp4020_softc), stp4020match, stp4020attach
};
#ifdef STP4020_DEBUG
static void stp4020_dump_regs __P((struct stp4020_socket *));
#endif
static int stp4020_rd_sockctl __P((struct stp4020_socket *, int));
static void stp4020_wr_sockctl __P((struct stp4020_socket *, int, int));
@ -356,34 +359,6 @@ stp4020attach(parent, self, aux)
bus_intr_establish(sa->sa_bustag, sa->sa_intr[0].sbi_pri,
0, stp4020_iointr, sc);
#ifdef STP4020_DEBUG
/*
* Dump control and status registers.
*/
for (i = 0; i < STP4020_NSOCK; i++) {
char bits[64];
struct stp4020_socket *h;
h = &sc->sc_socks[i];
printf("socket[%d] registers:\n", i);
bitmask_snprintf(stp4020_rd_sockctl(h, STP4020_ICR0_IDX),
STP4020_ICR0_BITS, bits, sizeof(bits));
printf("\tICR0=%s\n", bits);
bitmask_snprintf(stp4020_rd_sockctl(h, STP4020_ICR1_IDX),
STP4020_ICR1_BITS, bits, sizeof(bits));
printf("\tICR1=%s\n", bits);
bitmask_snprintf(stp4020_rd_sockctl(h, STP4020_ISR0_IDX),
STP4020_ISR0_IOBITS, bits, sizeof(bits));
printf("\tISR0=%s\n", bits);
bitmask_snprintf(stp4020_rd_sockctl(h, STP4020_ISR1_IDX),
STP4020_ISR1_BITS, bits, sizeof(bits));
printf("\tISR1=%s\n", bits);
}
#endif
rev = stp4020_rd_sockctl(&sc->sc_socks[0], STP4020_ISR1_IDX) &
STP4020_ISR1_REV_M;
printf(": rev %x\n", rev);
@ -401,6 +376,9 @@ stp4020attach(parent, self, aux)
struct stp4020_socket *h = &sc->sc_socks[i];
h->sock = i;
h->sc = sc;
#ifdef STP4020_DEBUG
stp4020_dump_regs(h);
#endif
stp4020_attach_socket(h);
}
}
@ -1010,3 +988,31 @@ extern int cold;
#endif
tsleep(&ticks, 0, "stp4020_delay", ticks);
}
#ifdef STP4020_DEBUG
void
stp4020_dump_regs(h)
struct stp4020_socket *h;
{
char bits[64];
/*
* Dump control and status registers.
*/
printf("socket[%d] registers:\n", h->sock);
bitmask_snprintf(stp4020_rd_sockctl(h, STP4020_ICR0_IDX),
STP4020_ICR0_BITS, bits, sizeof(bits));
printf("\tICR0=%s\n", bits);
bitmask_snprintf(stp4020_rd_sockctl(h, STP4020_ICR1_IDX),
STP4020_ICR1_BITS, bits, sizeof(bits));
printf("\tICR1=%s\n", bits);
bitmask_snprintf(stp4020_rd_sockctl(h, STP4020_ISR0_IDX),
STP4020_ISR0_IOBITS, bits, sizeof(bits));
printf("\tISR0=%s\n", bits);
bitmask_snprintf(stp4020_rd_sockctl(h, STP4020_ISR1_IDX),
STP4020_ISR1_BITS, bits, sizeof(bits));
printf("\tISR1=%s\n", bits);
}
#endif /* STP4020_DEBUG */