FreeBSD/sys/dev/mps/mps.c
/*
 * This is the routine to enqueue commands ansynchronously.
 * Note that the only error path here is from bus_dmamap_load(), which can
 * return EINPROGRESS if it is waiting for resources.  Other than this, it's
 * assumed that if you have a command in-hand, then you have enough credits
 * to use it.
 */
This is the routine to enqueue commands ansynchronously.
Note that the only error path here is from bus_dmamap_load(), which can
return EINPROGRESS if it is waiting for resources.  Other than this, it's
assumed that if you have a command in-hand, then you have enough credits
to use it.
This is the routine to enqueue commands ansynchronously . Note that the only error path here is from bus_dmamap_load () which can return EINPROGRESS if it is waiting for resources . Other than this it ' s assumed that if you have a command in - hand then you have enough credits to use it .
int
mps_map_command(struct mps_softc *sc, struct mps_command *cm)
{
	int error = 0;
	if (cm->cm_flags & MPS_CM_FLAGS_USE_UIO) {
		error = bus_dmamap_load_uio(sc->buffer_dmat, cm->cm_dmamap,
		    &cm->cm_uio, mps_data_cb2, cm, 0);
	} else if (cm->cm_flags & MPS_CM_FLAGS_USE_CCB) {
		error = bus_dmamap_load_ccb(sc->buffer_dmat, cm->cm_dmamap,
		    cm->cm_data, mps_data_cb, cm, 0);
	} else if ((cm->cm_data != NULL) && (cm->cm_length != 0)) {
		error = bus_dmamap_load(sc->buffer_dmat, cm->cm_dmamap,
		    cm->cm_data, cm->cm_length, mps_data_cb, cm, 0);
	} else {
		if (cm->cm_sge != NULL)
			mps_add_dmaseg(cm, 0, 0, 0, 1);
		mps_enqueue_request(sc, cm);	
	}
	return (error);
}
int mps_map_command ( struct mps_softc * sc , struct mps_command * cm ) { int error = 0 ; if ( cm -> cm_flags & MPS_CM_FLAGS_USE_UIO ) { error = bus_dmamap_load_uio ( sc -> buffer_dmat , cm -> cm_dmamap , & cm -> cm_uio , mps_data_cb2 , cm , 0 ) ; } else if ( cm -> cm_flags & MPS_CM_FLAGS_USE_CCB ) { error = bus_dmamap_load_ccb ( sc -> buffer_dmat , cm -> cm_dmamap , cm -> cm_data , mps_data_cb , cm , 0 ) ; } else if ( ( cm -> cm_data != NULL ) && ( cm -> cm_length != 0 ) ) { error = bus_dmamap_load ( sc -> buffer_dmat , cm -> cm_dmamap , cm -> cm_data , cm -> cm_length , mps_data_cb , cm , 0 ) ; } else { if ( cm -> cm_sge != NULL ) mps_add_dmaseg ( cm , 0 , 0 , 0 , 1 ) ; mps_enqueue_request ( sc , cm ) ; } return ( error ) ; }
This is the routine to enqueue commands ansynchronously.
This is the routine to enqueue commands ansynchronously .
/* Add a zero-length element as needed */