ahc_outb(ahc, SCB_RESIDUAL_DATACNT + 3, data_cnt >> 24); ahc_outb(ahc, SCB_RESIDUAL_DATACNT + 2, data_cnt >> 16); ahc_outb(ahc, SCB_RESIDUAL_DATACNT + 1, data_cnt >> 8); ahc_outb(ahc, SCB_RESIDUAL_DATACNT, data_cnt); } } }
ahc_outb(ahc, SCB_RESID_DCNT + 2, data_cnt >> 16); ahc_outb(ahc, SCB_RESID_DCNT + 1, data_cnt >> 8); ahc_outb(ahc, SCB_RESID_DCNT, data_cnt);  ahc_outb(ahc, SHADDR + 3, data_addr >> 24); ahc_outb(ahc, SHADDR + 2, data_addr >> 16); ahc_outb(ahc, SHADDR + 1, data_addr >> 8); ahc_outb(ahc, SHADDR, data_addr); } } }
ahc_handle_ign_wide_residue(struct ahc_softc *ahc, struct ahc_devinfo *devinfo){	u_int scb_index;	struct scb *scb;	scb_index = ahc_inb(ahc, SCB_TAG);	scb = ahc_lookup_scb(ahc, scb_index);	/*	 * XXX Actually check data direction in the sequencer?	 * Perhaps add datadir to some spare bits in the hscb?	 */	if ((ahc_inb(ahc, SEQ_FLAGS) & DPHASE) == 0	 || ahc_get_transfer_dir(scb) != CAM_DIR_IN) {		/*		 * Ignore the message if we haven't		 * seen an appropriate data phase yet.		 */	} else {		/*		 * If the residual occurred on the last		 * transfer and the transfer request was		 * expected to end on an odd count, do		 * nothing.  Otherwise, subtract a byte		 * and update the residual count accordingly.		 */		uint32_t sgptr;		sgptr = ahc_inb(ahc, SCB_RESIDUAL_SGPTR);		if ((sgptr & SG_LIST_NULL) != 0		 && ahc_inb(ahc, DATA_COUNT_ODD) == 1) {			/*			 * If the residual occurred on the last			 * transfer and the transfer request was			 * expected to end on an odd count, do			 * nothing.			 */		} else {			struct ahc_dma_seg *sg;			uint32_t data_cnt;			uint32_t data_addr;			uint32_t sglen;			/* Pull in the rest of the sgptr */			sgptr |= (ahc_inb(ahc, SCB_RESIDUAL_SGPTR + 3) << 24)			      | (ahc_inb(ahc, SCB_RESIDUAL_SGPTR + 2) << 16)			      | (ahc_inb(ahc, SCB_RESIDUAL_SGPTR + 1) << 8);			sgptr &= SG_PTR_MASK;			data_cnt = (ahc_inb(ahc, SCB_RESIDUAL_DATACNT+3) << 24)				 | (ahc_inb(ahc, SCB_RESIDUAL_DATACNT+2) << 16)				 | (ahc_inb(ahc, SCB_RESIDUAL_DATACNT+1) << 8)				 | (ahc_inb(ahc, SCB_RESIDUAL_DATACNT));			data_addr = (ahc_inb(ahc, SHADDR + 3) << 24)				  | (ahc_inb(ahc, SHADDR + 2) << 16)				  | (ahc_inb(ahc, SHADDR + 1) << 8)				  | (ahc_inb(ahc, SHADDR));			data_cnt += 1;			data_addr -= 1;			sg = ahc_sg_bus_to_virt(scb, sgptr);			/*			 * The residual sg ptr points to the next S/G			 * to load so we must go back one.			 */			sg--;			sglen = ahc_le32toh(sg->len) & AHC_SG_LEN_MASK;			if (sg != scb->sg_list			 && sglen < (data_cnt & AHC_SG_LEN_MASK)) {				sg--;				sglen = ahc_le32toh(sg->len);				/*				 * Preserve High Address and SG_LIST bits				 * while setting the count to 1.				 */				data_cnt = 1 | (sglen & (~AHC_SG_LEN_MASK));				data_addr = ahc_le32toh(sg->addr)					  + (sglen & AHC_SG_LEN_MASK) - 1;				/*				 * Increment sg so it points to the				 * "next" sg.				 */				sg++;				sgptr = ahc_sg_virt_to_bus(scb, sg);				ahc_outb(ahc, SCB_RESIDUAL_SGPTR + 3,					 sgptr >> 24);				ahc_outb(ahc, SCB_RESIDUAL_SGPTR + 2,					 sgptr >> 16);				ahc_outb(ahc, SCB_RESIDUAL_SGPTR + 1,					 sgptr >> 8);				ahc_outb(ahc, SCB_RESIDUAL_SGPTR, sgptr);			}			ahc_outb(ahc, SCB_RESIDUAL_DATACNT + 3, data_cnt >> 24);			ahc_outb(ahc, SCB_RESIDUAL_DATACNT + 2, data_cnt >> 16);			ahc_outb(ahc, SCB_RESIDUAL_DATACNT + 1, data_cnt >> 8);			ahc_outb(ahc, SCB_RESIDUAL_DATACNT, data_cnt);		}	}}