sc->targets[target]->id |= scf << (24 + SCNTL3_SCF_SHIFT); if (((sc->features & SF_CHIP_C10) == 0) && (sync < 25)) sc->targets[target]->id |= SCNTL3_ULTRA << 24; sc->targets[target]->id |= (offset & 0xff) << 8; goto end;
for (i = 0; i < sizeof(scf_period) / sizeof(scf_period[0]); i++) { if (sc->clock_period != scf_period[i].clock) continue; if (scf_period[i].period == sync) {  siop_target->offset = offset; siop_target->period = sync; sc->targets[target]->id &= ~(SCNTL3_SCF_MASK << 24); sc->targets[target]->id |= scf_period[i].scf << (24 + SCNTL3_SCF_SHIFT); if (sync < 25 &&  (sc->features & SF_BUS_ULTRA3) == 0) sc->targets[target]->id |= SCNTL3_ULTRA << 24; else sc->targets[target]->id &= ~(SCNTL3_ULTRA << 24); sc->targets[target]->id &= ~(SXFER_MO_MASK << 8); sc->targets[target]->id |= (offset & SXFER_MO_MASK) << 8; sc->targets[target]->id &= ~0xff;  goto end; } }
siop_sdtr_neg(siop_cmd)	struct siop_cmd *siop_cmd;{	struct siop_softc *sc = siop_cmd->siop_sc;	struct siop_target *siop_target = siop_cmd->siop_target;	int target = siop_cmd->xs->sc_link->target;	int sync, offset, scf;	int send_msgout = 0;	struct siop_xfer_common *tables = &siop_cmd->siop_xfer->tables;	sync = tables->msg_in[3];	offset = tables->msg_in[4];	/* revert to async until told otherwise */	sc->targets[target]->id    &= 0x0fff0000; /* Keep SCNTL3.EWS, SCNTL3.CCF and id */	sc->targets[target]->flags &= ~(TARF_ISDT | TARF_ISQAS | TARF_ISIUS);	if (siop_target->status == TARST_SYNC_NEG) {		/* we initiated sync negotiation */#ifdef DEBUG		printf("%s: sdtr for target %d: sync %d offset %d\n",		    sc->sc_dev.dv_xname, target, sync, offset);#endif		scf = siop_period_factor_to_scf(sc, sync, sc->targets[target]->flags);		if (offset > sc->maxoff || scf == 0)			goto reject;		sc->targets[target]->id |= scf << (24 + SCNTL3_SCF_SHIFT);		if (((sc->features & SF_CHIP_C10) == 0) && (sync < 25))			sc->targets[target]->id |= SCNTL3_ULTRA << 24;		sc->targets[target]->id |= (offset & 0xff) << 8;		goto end;		/*		 * We didn't find it in our table, so stay async and send reject		 * msg.		 */reject:		send_msgout = 1;		tables->t_msgout.count= htole32(1);		tables->msg_out[0] = MSG_MESSAGE_REJECT;	} else { /* target initiated sync neg */#ifdef DEBUG		printf("%s: target initiated sdtr for target %d: sync %d offset %d\n",		    sc->sc_dev.dv_xname, target, sync, offset);		printf("sdtr (target): sync %d offset %d\n", sync, offset);#endif		if (sync < sc->min_st_sync)			sync = sc->min_st_sync;		scf = siop_period_factor_to_scf(sc, sync, sc->targets[target]->flags);		if ((sc->targets[target]->flags & TARF_SYNC) == 0		    || offset == 0		    || scf == 0) {			goto async;		}		if ((offset > 31) && ((sc->targets[target]->flags & TARF_ISDT) == 0))			offset = 31;		if (offset > sc->maxoff)			offset = sc->maxoff;		sc->targets[target]->id |= scf << (24 + SCNTL3_SCF_SHIFT);		if (((sc->features & SF_CHIP_C10) == 0) && (sync < 25))			sc->targets[target]->id |= SCNTL3_ULTRA << 24;		sc->targets[target]->id |= (offset & 0xff) << 8;		siop_sdtr_msg(siop_cmd, 0, sync, offset);		send_msgout = 1;		goto end;async:		siop_sdtr_msg(siop_cmd, 0, 0, 0);		send_msgout = 1;	}end:#ifdef DEBUG	printf("id now 0x%x\n", sc->targets[target]->id);#endif	tables->id = htole32(sc->targets[target]->id);	bus_space_write_1(sc->sc_rt, sc->sc_rh, SIOP_SCNTL3,	    (sc->targets[target]->id >> 24) & 0xff);	bus_space_write_1(sc->sc_rt, sc->sc_rh, SIOP_SXFER,	    (sc->targets[target]->id >> 8) & 0xff);	if (siop_target->status != TARST_PROBING) {		siop_target->status = TARST_OK;		siop_print_info(sc, target);	}	if (send_msgout) {		return SIOP_NEG_MSGOUT;	} else {		return SIOP_NEG_ACK;	}}