if ((sc->features & SF_CHIP_C10) == 0) if (sstat & SSTAT2_ORF1) dbc++;
if ((sstat & SSTAT2_ORF1) && (sc->features & SF_CHIP_DFBC) == 0) dbc++;
siop_sdp(siop_cmd)	struct siop_cmd *siop_cmd;{	/* save data pointer. Handle async only for now */	int offset, dbc, sstat;	struct siop_softc *sc = siop_cmd->siop_sc;	struct scr_table *table; /* table to patch */	if ((siop_cmd->xs->flags & (SCSI_DATA_OUT | SCSI_DATA_IN))	    == 0)	    return; /* no data pointers to save */	offset = bus_space_read_1(sc->sc_rt, sc->sc_rh, SIOP_SCRATCHA + 1);	if (offset >= SIOP_NSG) {		printf("%s: bad offset in siop_sdp (%d)\n",		    sc->sc_dev.dv_xname, offset);		return;	}	table = &siop_cmd->siop_xfer->tables.data[offset];#ifdef DEBUG_DR	printf("sdp: offset %d count=%d addr=0x%x ", offset,	    table->count, table->addr);#endif	dbc = bus_space_read_4(sc->sc_rt, sc->sc_rh, SIOP_DBC) & 0x00ffffff;	if (siop_cmd->xs->flags & SCSI_DATA_OUT) {		/* need to account for stale data in FIFO */		if (sc->features & SF_CHIP_C10)			dbc += bus_space_read_2(sc->sc_rt, sc->sc_rh, SIOP_DFBC);		else {			int dfifo = bus_space_read_1(sc->sc_rt, sc->sc_rh, SIOP_DFIFO);			if (sc->features & SF_CHIP_FIFO) {				dfifo |= (bus_space_read_1(sc->sc_rt, sc->sc_rh,					      SIOP_CTEST5) & CTEST5_BOMASK) << 8;				dbc += (dfifo - (dbc & 0x3ff)) & 0x3ff;			} else {				dbc += (dfifo - (dbc & 0x7f)) & 0x7f;			}		}		sstat = bus_space_read_1(sc->sc_rt, sc->sc_rh, SIOP_SSTAT0);		if (sstat & SSTAT0_OLF)			dbc++;		if ((sc->features & SF_CHIP_C10) == 0)			if (sstat & SSTAT0_ORF)				dbc++;		if (siop_cmd->siop_target->flags & TARF_ISWIDE) {			sstat = bus_space_read_1(sc->sc_rt, sc->sc_rh,			    SIOP_SSTAT2);			if (sstat & SSTAT2_OLF1)				dbc++;			if ((sc->features & SF_CHIP_C10) == 0)				if (sstat & SSTAT2_ORF1)					dbc++;		}		/* clear the FIFO */		bus_space_write_1(sc->sc_rt, sc->sc_rh, SIOP_CTEST3,		    bus_space_read_1(sc->sc_rt, sc->sc_rh, SIOP_CTEST3) |		    CTEST3_CLF);	}	table->addr =	    htole32(letoh32(table->addr) + letoh32(table->count) - dbc);	table->count = htole32(dbc);#ifdef DEBUG_DR	printf("now count=%d addr=0x%x\n", table->count, table->addr);#endif}