restart = dmacsr & (HIFN_DMACSR_S_OVER | HIFN_DMACSR_D_OVER | HIFN_DMACSR_R_OVER);
restart = dmacsr & (HIFN_DMACSR_D_OVER | HIFN_DMACSR_R_OVER);
hifn_intr(arg)	void *arg;{	struct hifn_softc *sc = arg;	struct hifn_dma *dma = sc->sc_dma;	u_int32_t dmacsr, restart;	int i, u;	dmacsr = READ_REG_1(sc, HIFN_1_DMA_CSR);#ifdef HIFN_DEBUG	printf("%s: irq: stat %08x ien %08x u %d/%d/%d/%d\n",	    sc->sc_dv.dv_xname,	    dmacsr, READ_REG_1(sc, HIFN_1_DMA_IER),	    dma->cmdu, dma->srcu, dma->dstu, dma->resu);#endif	/* Nothing in the DMA unit interrupted */	if ((dmacsr & sc->sc_dmaier) == 0)		return (0);	WRITE_REG_1(sc, HIFN_1_DMA_CSR, dmacsr & sc->sc_dmaier);	if ((sc->sc_flags & HIFN_HAS_PUBLIC) &&	    (dmacsr & HIFN_DMACSR_PUBDONE))		WRITE_REG_1(sc, HIFN_1_PUB_STATUS,		    READ_REG_1(sc, HIFN_1_PUB_STATUS) | HIFN_PUBSTS_DONE);	restart = dmacsr & (HIFN_DMACSR_S_OVER | HIFN_DMACSR_D_OVER |	    HIFN_DMACSR_R_OVER);	if (restart)		printf("%s: overrun %x\n", sc->sc_dv.dv_xname, dmacsr);	restart = dmacsr & (HIFN_DMACSR_C_ABORT | HIFN_DMACSR_S_ABORT |	    HIFN_DMACSR_D_ABORT | HIFN_DMACSR_R_ABORT);	if (restart) {		printf("%s: abort, resetting.\n", sc->sc_dv.dv_xname);		hifnstats.hst_abort++;		hifn_abort(sc);		return (1);	}	if ((dmacsr & HIFN_DMACSR_C_WAIT) && (dma->cmdu == 0)) {		/*		 * If no slots to process and we receive a "waiting on		 * command" interrupt, we disable the "waiting on command"		 * (by clearing it).		 */		sc->sc_dmaier &= ~HIFN_DMAIER_C_WAIT;		WRITE_REG_1(sc, HIFN_1_DMA_IER, sc->sc_dmaier);	}	/* clear the rings */	i = dma->resk; u = dma->resu;	while (u != 0) {		HIFN_RESR_SYNC(sc, i,		    BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);		if (dma->resr[i].l & htole32(HIFN_D_VALID)) {			HIFN_RESR_SYNC(sc, i,			    BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);			break;		}		if (i != HIFN_D_RES_RSIZE) {			struct hifn_command *cmd;			u_int8_t *macbuf = NULL;			HIFN_RES_SYNC(sc, i, BUS_DMASYNC_POSTREAD);			cmd = dma->hifn_commands[i];			if (cmd->base_masks & HIFN_BASE_CMD_MAC) {				macbuf = dma->result_bufs[i];				macbuf += 12;			}			hifn_callback(sc, cmd, macbuf);			hifnstats.hst_opackets++;			u--;		}		if (++i == (HIFN_D_RES_RSIZE + 1))			i = 0;	}	dma->resk = i; dma->resu = u;	i = dma->srck; u = dma->srcu;	while (u != 0) {		HIFN_SRCR_SYNC(sc, i,		    BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);		if (dma->srcr[i].l & htole32(HIFN_D_VALID)) {			HIFN_SRCR_SYNC(sc, i,			    BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);			break;		}		if (++i == (HIFN_D_SRC_RSIZE + 1))			i = 0;		else			u--;	}	dma->srck = i; dma->srcu = u;	i = dma->cmdk; u = dma->cmdu;	while (u != 0) {		HIFN_CMDR_SYNC(sc, i,		    BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);		if (dma->cmdr[i].l & htole32(HIFN_D_VALID)) {			HIFN_CMDR_SYNC(sc, i,			    BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);			break;		}		if (i != HIFN_D_CMD_RSIZE) {			u--;			HIFN_CMD_SYNC(sc, i, BUS_DMASYNC_POSTWRITE);		}		if (++i == (HIFN_D_CMD_RSIZE + 1))			i = 0;	}	dma->cmdk = i; dma->cmdu = u;	return (1);}