FreeBSD/sys/dev/esp/ncr53c9x.c
/*
 * Read the NCR registers, and save their contents for later use.
 * NCR_STAT, NCR_STEP & NCR_INTR are mostly zeroed out when reading
 * NCR_INTR - so make sure it is the last read.
 *
 * I think that (from reading the docs) most bits in these registers
 * only make sense when the DMA CSR has an interrupt showing.  Call only
 * if an interrupt is pending.
 */
Read the NCR registers, and save their contents for later use.
NCR_STAT, NCR_STEP & NCR_INTR are mostly zeroed out when reading
NCR_INTR - so make sure it is the last read.

I think that (from reading the docs) most bits in these registers
only make sense when the DMA CSR has an interrupt showing.  Call only
if an interrupt is pending.
Read the NCR registers and save their contents for later use . NCR_STAT NCR_STEP & NCR_INTR are mostly zeroed out when reading NCR_INTR - so make sure it is the last read . I think that ( from reading the docs ) most bits in these registers only make sense when the DMA CSR has an interrupt showing . Call only if an interrupt is pending .
static inline void
ncr53c9x_readregs(struct ncr53c9x_softc *sc)
{
	NCR_LOCK_ASSERT(sc, MA_OWNED);
	sc->sc_espstat = NCR_READ_REG(sc, NCR_STAT);
	sc->sc_espstep = NCR_READ_REG(sc, NCR_STEP) & NCRSTEP_MASK;
	if (sc->sc_rev == NCR_VARIANT_FAS366)
		sc->sc_espstat2 = NCR_READ_REG(sc, NCR_STAT2);
	sc->sc_espintr = NCR_READ_REG(sc, NCR_INTR);
	sc->sc_phase = (sc->sc_espintr & NCRINTR_DIS) ?
	    BUSFREE_PHASE : sc->sc_espstat & NCRSTAT_PHASE;
	NCR_INTS(("regs[intr=%02x,stat=%02x,step=%02x,stat2=%02x] ",
	    sc->sc_espintr, sc->sc_espstat, sc->sc_espstep, sc->sc_espstat2));
}
static inline void ncr53c9x_readregs ( struct ncr53c9x_softc * sc ) { NCR_LOCK_ASSERT ( sc , MA_OWNED ) ; sc -> sc_espstat = NCR_READ_REG ( sc , NCR_STAT ) ; sc -> sc_espstep = NCR_READ_REG ( sc , NCR_STEP ) & NCRSTEP_MASK ; if ( sc -> sc_rev == NCR_VARIANT_FAS366 ) sc -> sc_espstat2 = NCR_READ_REG ( sc , NCR_STAT2 ) ; sc -> sc_espintr = NCR_READ_REG ( sc , NCR_INTR ) ; sc -> sc_phase = ( sc -> sc_espintr & NCRINTR_DIS ) ? BUSFREE_PHASE : sc -> sc_espstat & NCRSTAT_PHASE ; NCR_INTS ( ( " " , sc -> sc_espintr , sc -> sc_espstat , sc -> sc_espstep , sc -> sc_espstat2 ) ) ; }
Read the NCR registers, and save their contents for later use.
Read the NCR registers and save their contents for later use .
/* Only the step bits are of interest. */ /*
	 * Determine the SCSI bus phase, return either a real SCSI bus phase
	 * or some pseudo phase we use to detect certain exceptions.
	 */