FreeBSD/sys/dev/mps/mps_sas.c
/*
 * No Need to call "MPI2_SAS_OP_REMOVE_DEVICE" For Volume removal.
 * Otherwise Volume Delete is same as Bare Drive Removal.
 */
No Need to call "MPI2_SAS_OP_REMOVE_DEVICE" For Volume removal.
Otherwise Volume Delete is same as Bare Drive Removal.
No Need to call " MPI2_SAS_OP_REMOVE_DEVICE " For Volume removal . Otherwise Volume Delete is same as Bare Drive Removal .
void
mpssas_prepare_volume_remove(struct mpssas_softc *sassc, uint16_t handle)
{
	MPI2_SCSI_TASK_MANAGE_REQUEST *req;
	struct mps_softc *sc;
	struct mps_command *cm;
	struct mpssas_target *targ = NULL;
	MPS_FUNCTRACE(sassc->sc);
	sc = sassc->sc;
#ifdef WD_SUPPORT
	if (sc->WD_available && (sc->WD_hide_expose ==
	    MPS_WD_EXPOSE_ALWAYS)) {
		return;
	}
#endif 
	targ = mpssas_find_target_by_handle(sassc, 0, handle);
	if (targ == NULL) {
		mps_dprint(sc, MPS_ERROR,
		   "%s %d : invalid handle 0x%x \n", __func__,__LINE__, handle);
		return;
	}
	targ->flags |= MPSSAS_TARGET_INREMOVAL;
	cm = mpssas_alloc_tm(sc);
	if (cm == NULL) {
		mps_dprint(sc, MPS_ERROR,
		    "%s: command alloc failure\n", __func__);
		return;
	}
	mpssas_rescan_target(sc, targ);
	req = (MPI2_SCSI_TASK_MANAGE_REQUEST *)cm->cm_req;
	req->DevHandle = targ->handle;
	req->Function = MPI2_FUNCTION_SCSI_TASK_MGMT;
	req->TaskType = MPI2_SCSITASKMGMT_TASKTYPE_TARGET_RESET;
	req->MsgFlags = MPI2_SCSITASKMGMT_MSGFLAGS_LINK_RESET;
	cm->cm_targ = targ;
	cm->cm_data = NULL;
	cm->cm_desc.HighPriority.RequestFlags =
	    MPI2_REQ_DESCRIPT_FLAGS_HIGH_PRIORITY;
	cm->cm_complete = mpssas_remove_volume;
	cm->cm_complete_data = (void *)(uintptr_t)handle;
	mps_dprint(sc, MPS_INFO, "%s: Sending reset for target ID %d\n",
	    __func__, targ->tid);
	mpssas_prepare_for_tm(sc, cm, targ, CAM_LUN_WILDCARD);
	mps_map_command(sc, cm);
}
void mpssas_prepare_volume_remove ( struct mpssas_softc * sassc , uint16_t handle ) { MPI2_SCSI_TASK_MANAGE_REQUEST * req ; struct mps_softc * sc ; struct mps_command * cm ; struct mpssas_target * targ = NULL ; MPS_FUNCTRACE ( sassc -> sc ) ; sc = sassc -> sc ; #ifdef WD_SUPPORT if ( sc -> WD_available && ( sc -> WD_hide_expose == MPS_WD_EXPOSE_ALWAYS ) ) { return ; } #endif targ = mpssas_find_target_by_handle ( sassc , 0 , handle ) ; if ( targ == NULL ) { mps_dprint ( sc , MPS_ERROR , " \n " , __func__ , __LINE__ , handle ) ; return ; } targ -> flags |= MPSSAS_TARGET_INREMOVAL ; cm = mpssas_alloc_tm ( sc ) ; if ( cm == NULL ) { mps_dprint ( sc , MPS_ERROR , " \n " , __func__ ) ; return ; } mpssas_rescan_target ( sc , targ ) ; req = ( MPI2_SCSI_TASK_MANAGE_REQUEST * ) cm -> cm_req ; req -> DevHandle = targ -> handle ; req -> Function = MPI2_FUNCTION_SCSI_TASK_MGMT ; req -> TaskType = MPI2_SCSITASKMGMT_TASKTYPE_TARGET_RESET ; req -> MsgFlags = MPI2_SCSITASKMGMT_MSGFLAGS_LINK_RESET ; cm -> cm_targ = targ ; cm -> cm_data = NULL ; cm -> cm_desc . HighPriority . RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_HIGH_PRIORITY ; cm -> cm_complete = mpssas_remove_volume ; cm -> cm_complete_data = ( void * ) ( uintptr_t ) handle ; mps_dprint ( sc , MPS_INFO , " \n " , __func__ , targ -> tid ) ; mpssas_prepare_for_tm ( sc , cm , targ , CAM_LUN_WILDCARD ) ; mps_map_command ( sc , cm ) ; }
No Need to call "MPI2_SAS_OP_REMOVE_DEVICE" For Volume removal.
No Need to call " MPI2_SAS_OP_REMOVE_DEVICE " For Volume removal .
/*
	 * If this is a WD controller, determine if the disk should be exposed
	 * to the OS or not.  If disk should be exposed, return from this
	 * function without doing anything.
	 */ //WD_SUPPORT /* FIXME: what is the action? */ /* We don't know about this device? */ /* SAS Hard Link Reset / SATA Link Reset */