Changeset View
Changeset View
Standalone View
Standalone View
sys/cam/cam_periph.c
Show First 20 Lines • Show All 744 Lines • ▼ Show 20 Lines | camperiphfree(struct cam_periph *periph) | ||||
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)); | 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_stack_ccb(&ccb.ccb_h, sizeof(ccb), | ||||
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: | ||||
xpt_path_inq(&ccb.cpi, periph->path); | xpt_path_inq(&ccb.cpi, periph->path); | ||||
arg = &ccb; | arg = &ccb; | ||||
break; | break; | ||||
default: | default: | ||||
▲ Show 20 Lines • Show All 568 Lines • ▼ Show 20 Lines | |||||
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_stack_ccb(&crs.ccb_h, sizeof(crs), 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 106 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_stack_ccb( | ||||
xpt_setup_ccb(&cgds.ccb_h, periph->path, CAM_PRIORITY_NORMAL); | &cgds.ccb_h, sizeof(cgds), 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, | ||||
struct timeval* event_time, u_int duration_ms) | struct timeval* event_time, u_int duration_ms) | ||||
▲ Show 20 Lines • Show All 54 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_stack_ccb(&cgds.ccb_h, sizeof(cgds), ccb->ccb_h.path, | ||||
xpt_setup_ccb(&cgds.ccb_h, | |||||
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 | ||||
* the QUEUE FULL as if it were a BUSY condition. | * the QUEUE FULL as if it were a BUSY condition. | ||||
*/ | */ | ||||
if (cgds.dev_active != 0) { | if (cgds.dev_active != 0) { | ||||
▲ Show 20 Lines • Show All 99 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_stack_ccb(&cgd.ccb_h, sizeof(cgd), ccb->ccb_h.path, | ||||
xpt_setup_ccb(&cgd.ccb_h, ccb->ccb_h.path, CAM_PRIORITY_NORMAL); | 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 503 Lines • Show Last 20 Lines |