Changeset View
Changeset View
Standalone View
Standalone View
sys/cam/scsi/scsi_target.c
| Show First 20 Lines • Show All 357 Lines • ▼ Show 20 Lines | |||||
| /* Send the HBA the enable/disable message */ | /* Send the HBA the enable/disable message */ | ||||
| static cam_status | static cam_status | ||||
| targendislun(struct cam_path *path, int enable, int grp6_len, int grp7_len) | targendislun(struct cam_path *path, int enable, int grp6_len, int grp7_len) | ||||
| { | { | ||||
| struct ccb_en_lun en_ccb; | struct ccb_en_lun en_ccb; | ||||
| cam_status status; | cam_status status; | ||||
| /* Tell the lun to begin answering selects */ | /* Tell the lun to begin answering selects */ | ||||
| memset(&en_ccb, 0, sizeof(en_ccb)); | |||||
| xpt_setup_ccb(&en_ccb.ccb_h, path, CAM_PRIORITY_NORMAL); | xpt_setup_ccb(&en_ccb.ccb_h, path, CAM_PRIORITY_NORMAL); | ||||
| en_ccb.ccb_h.func_code = XPT_EN_LUN; | en_ccb.ccb_h.func_code = XPT_EN_LUN; | ||||
| /* Don't need support for any vendor specific commands */ | /* Don't need support for any vendor specific commands */ | ||||
| en_ccb.grp6_len = grp6_len; | en_ccb.grp6_len = grp6_len; | ||||
| en_ccb.grp7_len = grp7_len; | en_ccb.grp7_len = grp7_len; | ||||
| en_ccb.enable = enable ? 1 : 0; | en_ccb.enable = enable ? 1 : 0; | ||||
| xpt_action((union ccb *)&en_ccb); | xpt_action((union ccb *)&en_ccb); | ||||
| status = en_ccb.ccb_h.status & CAM_STATUS_MASK; | status = en_ccb.ccb_h.status & CAM_STATUS_MASK; | ||||
| ▲ Show 20 Lines • Show All 557 Lines • ▼ Show 20 Lines | |||||
| static union ccb * | static union ccb * | ||||
| targgetccb(struct targ_softc *softc, xpt_opcode type, int priority) | targgetccb(struct targ_softc *softc, xpt_opcode type, int priority) | ||||
| { | { | ||||
| union ccb *ccb; | union ccb *ccb; | ||||
| int ccb_len; | int ccb_len; | ||||
| ccb_len = targccblen(type); | ccb_len = targccblen(type); | ||||
| ccb = malloc(ccb_len, M_TARG, M_NOWAIT); | ccb = malloc(ccb_len, M_TARG, M_NOWAIT | M_ZERO); | ||||
| CAM_DEBUG(softc->path, CAM_DEBUG_PERIPH, ("getccb %p\n", ccb)); | CAM_DEBUG(softc->path, CAM_DEBUG_PERIPH, ("getccb %p\n", ccb)); | ||||
| if (ccb == NULL) { | if (ccb == NULL) { | ||||
| return (ccb); | return (ccb); | ||||
| } | } | ||||
| xpt_setup_ccb(&ccb->ccb_h, softc->path, priority); | xpt_setup_ccb(&ccb->ccb_h, softc->path, priority); | ||||
| ccb->ccb_h.func_code = type; | ccb->ccb_h.func_code = type; | ||||
| ccb->ccb_h.cbfcnp = targdone; | ccb->ccb_h.cbfcnp = targdone; | ||||
| ccb->ccb_h.targ_descr = targgetdescr(softc); | ccb->ccb_h.targ_descr = targgetdescr(softc); | ||||
| ▲ Show 20 Lines • Show All 80 Lines • ▼ Show 20 Lines | while ((descr = TAILQ_FIRST(&softc->work_queue)) != NULL) { | ||||
| TAILQ_REMOVE(&softc->work_queue, descr, tqe); | TAILQ_REMOVE(&softc->work_queue, descr, tqe); | ||||
| TAILQ_INSERT_TAIL(&softc->abort_queue, descr, tqe); | TAILQ_INSERT_TAIL(&softc->abort_queue, descr, tqe); | ||||
| } | } | ||||
| /* | /* | ||||
| * Then abort all pending CCBs. | * Then abort all pending CCBs. | ||||
| * targdone() will return the aborted CCB via user_ccb_queue | * targdone() will return the aborted CCB via user_ccb_queue | ||||
| */ | */ | ||||
| memset(&cab, 0, sizeof(cab)); | |||||
| xpt_setup_ccb(&cab.ccb_h, softc->path, CAM_PRIORITY_NORMAL); | xpt_setup_ccb(&cab.ccb_h, softc->path, CAM_PRIORITY_NORMAL); | ||||
| cab.ccb_h.func_code = XPT_ABORT; | cab.ccb_h.func_code = XPT_ABORT; | ||||
| cab.ccb_h.status = CAM_REQ_CMP_ERR; | cab.ccb_h.status = CAM_REQ_CMP_ERR; | ||||
| TAILQ_FOREACH(ccb_h, &softc->pending_ccb_queue, periph_links.tqe) { | TAILQ_FOREACH(ccb_h, &softc->pending_ccb_queue, periph_links.tqe) { | ||||
| CAM_DEBUG(softc->path, CAM_DEBUG_PERIPH, | CAM_DEBUG(softc->path, CAM_DEBUG_PERIPH, | ||||
| ("Aborting pending CCB %p\n", ccb_h)); | ("Aborting pending CCB %p\n", ccb_h)); | ||||
| cab.abort_ccb = (union ccb *)ccb_h; | cab.abort_ccb = (union ccb *)ccb_h; | ||||
| xpt_action((union ccb *)&cab); | xpt_action((union ccb *)&cab); | ||||
| ▲ Show 20 Lines • Show All 115 Lines • Show Last 20 Lines | |||||