FreeBSD/sys/dev/firewire/sbp_targ.c
/*
 * directly execute a read or write to the initiator
 * address space and set hand(sbp_targ_cam_done) to 
 * process the completion from the SIM to the target.
 * set orbi->refcount to inidicate that a read/write
 * is inflight to/from the initiator.
 */
directly execute a read or write to the initiator
address space and set hand(sbp_targ_cam_done) to
process the completion from the SIM to the target.
set orbi->refcount to inidicate that a read/write
is inflight to/from the initiator.
directly execute a read or write to the initiator address space and set hand ( sbp_targ_cam_done ) to process the completion from the SIM to the target . set orbi - > refcount to inidicate that a read / write is inflight to / from the initiator .
static void
sbp_targ_xfer_buf(struct orb_info *orbi, u_int offset,
    uint16_t dst_hi, uint32_t dst_lo, u_int size,
    void (*hand)(struct fw_xfer *))
{
	struct fw_xfer *xfer;
	u_int len, ccb_dir, off = 0;
	char *ptr;
	if (debug > 1)
		printf("%s: offset=%d size=%d\n", __func__, offset, size);
	ccb_dir = orbi->ccb->ccb_h.flags & CAM_DIR_MASK;
	ptr = (char *)orbi->ccb->csio.data_ptr + offset;
	while (size > 0) {
		len = MIN(size, 2048 );
		size -= len;
		orbi->refcount ++;
		if (ccb_dir == CAM_DIR_OUT) {
			if (debug)
				printf("%s: CAM_DIR_OUT --> read block in?\n",__func__);
			xfer = fwmem_read_block(orbi->fwdev,
			   (void *)orbi, FWSPD_S400,
			    dst_hi, dst_lo + off, len,
			    ptr + off, hand);
		} else {
			if (debug)
				printf("%s: CAM_DIR_IN --> write block out?\n",__func__);
			xfer = fwmem_write_block(orbi->fwdev,
			   (void *)orbi, FWSPD_S400,
			    dst_hi, dst_lo + off, len,
			    ptr + off, hand);
		}
		if (xfer == NULL) {
			printf("%s: xfer == NULL", __func__);
			orbi->refcount--;
		}
		off += len;
	}
}
static void sbp_targ_xfer_buf ( struct orb_info * orbi , u_int offset , uint16_t dst_hi , uint32_t dst_lo , u_int size , void ( * hand ) ( struct fw_xfer * ) ) { struct fw_xfer * xfer ; u_int len , ccb_dir , off = 0 ; char * ptr ; if ( debug > 1 ) printf ( " \n " , __func__ , offset , size ) ; ccb_dir = orbi -> ccb -> ccb_h . flags & CAM_DIR_MASK ; ptr = ( char * ) orbi -> ccb -> csio . data_ptr + offset ; while ( size > 0 ) { len = MIN ( size , 2048 ) ; size -= len ; orbi -> refcount ++ ; if ( ccb_dir == CAM_DIR_OUT ) { if ( debug ) printf ( " \n " , __func__ ) ; xfer = fwmem_read_block ( orbi -> fwdev , ( void * ) orbi , FWSPD_S400 , dst_hi , dst_lo + off , len , ptr + off , hand ) ; } else { if ( debug ) printf ( " \n " , __func__ ) ; xfer = fwmem_write_block ( orbi -> fwdev , ( void * ) orbi , FWSPD_S400 , dst_hi , dst_lo + off , len , ptr + off , hand ) ; } if ( xfer == NULL ) { printf ( " " , __func__ ) ; orbi -> refcount -- ; } off += len ; } }
directly execute a read or write to the initiator
 address space and set hand(sbp_targ_cam_done) to
 process the completion from the SIM to the target.
directly execute a read or write to the initiator address space and set hand ( sbp_targ_cam_done ) to process the completion from the SIM to the target .
/* XXX assume dst_lo + off doesn't overflow */ /* XXX */ /*spd*/ /*spd*/ /* XXX what should we do?? */