Changeset View
Changeset View
Standalone View
Standalone View
sys/cam/cam_periph.c
Show First 20 Lines • Show All 740 Lines • ▼ Show 20 Lines | if ((periph->flags & CAM_PERIPH_ANNOUNCED) && !rebooting) | ||||
xpt_print(periph->path, "Periph destroyed\n"); | xpt_print(periph->path, "Periph destroyed\n"); | ||||
else | else | ||||
CAM_DEBUG(periph->path, CAM_DEBUG_INFO, ("Periph destroyed\n")); | CAM_DEBUG(periph->path, CAM_DEBUG_INFO, ("Periph destroyed\n")); | ||||
if (periph->flags & CAM_PERIPH_NEW_DEV_FOUND) { | if (periph->flags & CAM_PERIPH_NEW_DEV_FOUND) { | ||||
union ccb ccb; | union ccb ccb; | ||||
void *arg; | void *arg; | ||||
memset(&ccb, 0, sizeof(ccb)); | |||||
switch (periph->deferred_ac) { | switch (periph->deferred_ac) { | ||||
case AC_FOUND_DEVICE: | case AC_FOUND_DEVICE: | ||||
ccb.ccb_h.func_code = XPT_GDEV_TYPE; | ccb.ccb_h.func_code = XPT_GDEV_TYPE; | ||||
xpt_setup_ccb(&ccb.ccb_h, periph->path, CAM_PRIORITY_NORMAL); | xpt_setup_ccb(&ccb.ccb_h, periph->path, CAM_PRIORITY_NORMAL); | ||||
xpt_action(&ccb); | xpt_action(&ccb); | ||||
arg = &ccb; | arg = &ccb; | ||||
break; | break; | ||||
case AC_PATH_REGISTERED: | case AC_PATH_REGISTERED: | ||||
▲ Show 20 Lines • Show All 556 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
void | void | ||||
cam_freeze_devq(struct cam_path *path) | cam_freeze_devq(struct cam_path *path) | ||||
{ | { | ||||
struct ccb_hdr ccb_h; | struct ccb_hdr ccb_h; | ||||
CAM_DEBUG(path, CAM_DEBUG_TRACE, ("cam_freeze_devq\n")); | CAM_DEBUG(path, CAM_DEBUG_TRACE, ("cam_freeze_devq\n")); | ||||
memset(&ccb_h, 0, sizeof(ccb_h)); | |||||
xpt_setup_ccb(&ccb_h, path, /*priority*/1); | xpt_setup_ccb(&ccb_h, path, /*priority*/1); | ||||
ccb_h.func_code = XPT_NOOP; | ccb_h.func_code = XPT_NOOP; | ||||
ccb_h.flags = CAM_DEV_QFREEZE; | ccb_h.flags = CAM_DEV_QFREEZE; | ||||
xpt_action((union ccb *)&ccb_h); | xpt_action((union ccb *)&ccb_h); | ||||
} | } | ||||
u_int32_t | u_int32_t | ||||
cam_release_devq(struct cam_path *path, u_int32_t relsim_flags, | cam_release_devq(struct cam_path *path, u_int32_t relsim_flags, | ||||
u_int32_t openings, u_int32_t arg, | u_int32_t openings, u_int32_t arg, | ||||
int getcount_only) | int getcount_only) | ||||
{ | { | ||||
struct ccb_relsim crs; | struct ccb_relsim crs; | ||||
CAM_DEBUG(path, CAM_DEBUG_TRACE, ("cam_release_devq(%u, %u, %u, %d)\n", | CAM_DEBUG(path, CAM_DEBUG_TRACE, ("cam_release_devq(%u, %u, %u, %d)\n", | ||||
relsim_flags, openings, arg, getcount_only)); | relsim_flags, openings, arg, getcount_only)); | ||||
memset(&crs, 0, sizeof(crs)); | |||||
xpt_setup_ccb(&crs.ccb_h, path, CAM_PRIORITY_NORMAL); | xpt_setup_ccb(&crs.ccb_h, path, CAM_PRIORITY_NORMAL); | ||||
crs.ccb_h.func_code = XPT_REL_SIMQ; | crs.ccb_h.func_code = XPT_REL_SIMQ; | ||||
crs.ccb_h.flags = getcount_only ? CAM_DEV_QFREEZE : 0; | crs.ccb_h.flags = getcount_only ? CAM_DEV_QFREEZE : 0; | ||||
crs.release_flags = relsim_flags; | crs.release_flags = relsim_flags; | ||||
crs.openings = openings; | crs.openings = openings; | ||||
crs.release_timeout = arg; | crs.release_timeout = arg; | ||||
xpt_action((union ccb *)&crs); | xpt_action((union ccb *)&crs); | ||||
return (crs.qfrozen_cnt); | return (crs.qfrozen_cnt); | ||||
▲ Show 20 Lines • Show All 107 Lines • ▼ Show 20 Lines | cam_periph_async(struct cam_periph *periph, u_int32_t code, | ||||
} | } | ||||
} | } | ||||
void | void | ||||
cam_periph_bus_settle(struct cam_periph *periph, u_int bus_settle) | cam_periph_bus_settle(struct cam_periph *periph, u_int bus_settle) | ||||
{ | { | ||||
struct ccb_getdevstats cgds; | struct ccb_getdevstats cgds; | ||||
memset(&cgds, 0, sizeof(cgds)); | |||||
xpt_setup_ccb(&cgds.ccb_h, periph->path, CAM_PRIORITY_NORMAL); | xpt_setup_ccb(&cgds.ccb_h, periph->path, CAM_PRIORITY_NORMAL); | ||||
cgds.ccb_h.func_code = XPT_GDEV_STATS; | cgds.ccb_h.func_code = XPT_GDEV_STATS; | ||||
xpt_action((union ccb *)&cgds); | xpt_action((union ccb *)&cgds); | ||||
cam_periph_freeze_after_event(periph, &cgds.last_reset, bus_settle); | cam_periph_freeze_after_event(periph, &cgds.last_reset, bus_settle); | ||||
} | } | ||||
void | void | ||||
cam_periph_freeze_after_event(struct cam_periph *periph, | cam_periph_freeze_after_event(struct cam_periph *periph, | ||||
▲ Show 20 Lines • Show All 55 Lines • ▼ Show 20 Lines | camperiphscsistatuserror(union ccb *ccb, union ccb **orig_ccb, | ||||
{ | { | ||||
/* no decrement */ | /* no decrement */ | ||||
struct ccb_getdevstats cgds; | struct ccb_getdevstats cgds; | ||||
/* | /* | ||||
* First off, find out what the current | * First off, find out what the current | ||||
* transaction counts are. | * transaction counts are. | ||||
*/ | */ | ||||
memset(&cgds, 0, sizeof(cgds)); | |||||
xpt_setup_ccb(&cgds.ccb_h, | xpt_setup_ccb(&cgds.ccb_h, | ||||
ccb->ccb_h.path, | ccb->ccb_h.path, | ||||
CAM_PRIORITY_NORMAL); | CAM_PRIORITY_NORMAL); | ||||
cgds.ccb_h.func_code = XPT_GDEV_STATS; | cgds.ccb_h.func_code = XPT_GDEV_STATS; | ||||
xpt_action((union ccb *)&cgds); | xpt_action((union ccb *)&cgds); | ||||
/* | /* | ||||
* If we were the only transaction active, treat | * If we were the only transaction active, treat | ||||
▲ Show 20 Lines • Show All 102 Lines • ▼ Show 20 Lines | if ((periph->flags & CAM_PERIPH_RECOVERY_INPROG) && !recoveryccb) { | ||||
*action &= ~SSQ_PRINT_SENSE; | *action &= ~SSQ_PRINT_SENSE; | ||||
} else { | } else { | ||||
scsi_sense_action err_action; | scsi_sense_action err_action; | ||||
struct ccb_getdev cgd; | struct ccb_getdev cgd; | ||||
/* | /* | ||||
* Grab the inquiry data for this device. | * Grab the inquiry data for this device. | ||||
*/ | */ | ||||
memset(&cgd, 0, sizeof(cgd)); | |||||
xpt_setup_ccb(&cgd.ccb_h, ccb->ccb_h.path, CAM_PRIORITY_NORMAL); | xpt_setup_ccb(&cgd.ccb_h, ccb->ccb_h.path, CAM_PRIORITY_NORMAL); | ||||
cgd.ccb_h.func_code = XPT_GDEV_TYPE; | cgd.ccb_h.func_code = XPT_GDEV_TYPE; | ||||
xpt_action((union ccb *)&cgd); | xpt_action((union ccb *)&cgd); | ||||
err_action = scsi_error_action(&ccb->csio, &cgd.inq_data, | err_action = scsi_error_action(&ccb->csio, &cgd.inq_data, | ||||
sense_flags); | sense_flags); | ||||
error = err_action & SS_ERRMASK; | error = err_action & SS_ERRMASK; | ||||
▲ Show 20 Lines • Show All 504 Lines • Show Last 20 Lines |