Changeset View
Changeset View
Standalone View
Standalone View
sys/cam/scsi/scsi_da.c
Show First 20 Lines • Show All 1,903 Lines • ▼ Show 20 Lines | dadiskgonecb(struct disk *dp) | ||||
da_periph_release(periph, DA_REF_GEOM); | da_periph_release(periph, DA_REF_GEOM); | ||||
} | } | ||||
static void | static void | ||||
daoninvalidate(struct cam_periph *periph) | daoninvalidate(struct cam_periph *periph) | ||||
{ | { | ||||
struct da_softc *softc; | struct da_softc *softc; | ||||
cam_periph_assert(periph, MA_OWNED); | |||||
softc = (struct da_softc *)periph->softc; | softc = (struct da_softc *)periph->softc; | ||||
/* | /* | ||||
* De-register any async callbacks. | * De-register any async callbacks. | ||||
*/ | */ | ||||
xpt_register_async(0, daasync, periph, periph->path); | xpt_register_async(0, daasync, periph, periph->path); | ||||
softc->flags |= DA_FLAG_PACK_INVALID; | softc->flags |= DA_FLAG_PACK_INVALID; | ||||
▲ Show 20 Lines • Show All 113 Lines • ▼ Show 20 Lines | case AC_UNIT_ATTENTION: | ||||
softc = (struct da_softc *)periph->softc; | softc = (struct da_softc *)periph->softc; | ||||
ccb = (union ccb *)arg; | ccb = (union ccb *)arg; | ||||
/* | /* | ||||
* Handle all UNIT ATTENTIONs except our own, | * Handle all UNIT ATTENTIONs except our own, | ||||
* as they will be handled by daerror(). | * as they will be handled by daerror(). | ||||
*/ | */ | ||||
cam_periph_lock(periph); | |||||
if (xpt_path_periph(ccb->ccb_h.path) != periph && | if (xpt_path_periph(ccb->ccb_h.path) != periph && | ||||
scsi_extract_sense_ccb(ccb, | scsi_extract_sense_ccb(ccb, | ||||
&error_code, &sense_key, &asc, &ascq)) { | &error_code, &sense_key, &asc, &ascq)) { | ||||
if (asc == 0x2A && ascq == 0x09) { | if (asc == 0x2A && ascq == 0x09) { | ||||
xpt_print(ccb->ccb_h.path, | xpt_print(ccb->ccb_h.path, | ||||
"Capacity data has changed\n"); | "Capacity data has changed\n"); | ||||
softc->flags &= ~DA_FLAG_PROBED; | softc->flags &= ~DA_FLAG_PROBED; | ||||
dareprobe(periph); | dareprobe(periph); | ||||
} else if (asc == 0x28 && ascq == 0x00) { | } else if (asc == 0x28 && ascq == 0x00) { | ||||
softc->flags &= ~DA_FLAG_PROBED; | softc->flags &= ~DA_FLAG_PROBED; | ||||
disk_media_changed(softc->disk, M_NOWAIT); | disk_media_changed(softc->disk, M_NOWAIT); | ||||
} else if (asc == 0x3F && ascq == 0x03) { | } else if (asc == 0x3F && ascq == 0x03) { | ||||
xpt_print(ccb->ccb_h.path, | xpt_print(ccb->ccb_h.path, | ||||
"INQUIRY data has changed\n"); | "INQUIRY data has changed\n"); | ||||
softc->flags &= ~DA_FLAG_PROBED; | softc->flags &= ~DA_FLAG_PROBED; | ||||
dareprobe(periph); | dareprobe(periph); | ||||
} | } | ||||
} | } | ||||
cam_periph_unlock(periph); | |||||
break; | break; | ||||
} | } | ||||
case AC_SCSI_AEN: | case AC_SCSI_AEN: | ||||
softc = (struct da_softc *)periph->softc; | softc = (struct da_softc *)periph->softc; | ||||
cam_periph_lock(periph); | |||||
if (!cam_iosched_has_work_flags(softc->cam_iosched, DA_WORK_TUR)) { | if (!cam_iosched_has_work_flags(softc->cam_iosched, DA_WORK_TUR)) { | ||||
if (da_periph_acquire(periph, DA_REF_TUR) == 0) { | if (da_periph_acquire(periph, DA_REF_TUR) == 0) { | ||||
cam_iosched_set_work_flags(softc->cam_iosched, DA_WORK_TUR); | cam_iosched_set_work_flags(softc->cam_iosched, DA_WORK_TUR); | ||||
daschedule(periph); | daschedule(periph); | ||||
} | } | ||||
} | } | ||||
cam_periph_unlock(periph); | |||||
/* FALLTHROUGH */ | /* FALLTHROUGH */ | ||||
case AC_SENT_BDR: | case AC_SENT_BDR: | ||||
case AC_BUS_RESET: | case AC_BUS_RESET: | ||||
{ | { | ||||
struct ccb_hdr *ccbh; | struct ccb_hdr *ccbh; | ||||
softc = (struct da_softc *)periph->softc; | softc = (struct da_softc *)periph->softc; | ||||
/* | /* | ||||
* Don't fail on the expected unit attention | * Don't fail on the expected unit attention | ||||
* that will occur. | * that will occur. | ||||
*/ | */ | ||||
cam_periph_lock(periph); | |||||
softc->flags |= DA_FLAG_RETRY_UA; | softc->flags |= DA_FLAG_RETRY_UA; | ||||
LIST_FOREACH(ccbh, &softc->pending_ccbs, periph_links.le) | LIST_FOREACH(ccbh, &softc->pending_ccbs, periph_links.le) | ||||
ccbh->ccb_state |= DA_CCB_RETRY_UA; | ccbh->ccb_state |= DA_CCB_RETRY_UA; | ||||
cam_periph_unlock(periph); | |||||
break; | break; | ||||
} | } | ||||
case AC_INQ_CHANGED: | case AC_INQ_CHANGED: | ||||
cam_periph_lock(periph); | |||||
softc = (struct da_softc *)periph->softc; | softc = (struct da_softc *)periph->softc; | ||||
softc->flags &= ~DA_FLAG_PROBED; | softc->flags &= ~DA_FLAG_PROBED; | ||||
dareprobe(periph); | dareprobe(periph); | ||||
cam_periph_unlock(periph); | |||||
break; | break; | ||||
default: | default: | ||||
break; | break; | ||||
} | } | ||||
cam_periph_async(periph, code, path, arg); | cam_periph_async(periph, code, path, arg); | ||||
} | } | ||||
static void | static void | ||||
Show All 13 Lines | if (periph->flags & CAM_PERIPH_INVALID) { | ||||
return; | return; | ||||
} | } | ||||
softc = (struct da_softc *)periph->softc; | softc = (struct da_softc *)periph->softc; | ||||
snprintf(tmpstr, sizeof(tmpstr), "CAM DA unit %d", periph->unit_number); | snprintf(tmpstr, sizeof(tmpstr), "CAM DA unit %d", periph->unit_number); | ||||
snprintf(tmpstr2, sizeof(tmpstr2), "%d", periph->unit_number); | snprintf(tmpstr2, sizeof(tmpstr2), "%d", periph->unit_number); | ||||
sysctl_ctx_init(&softc->sysctl_ctx); | sysctl_ctx_init(&softc->sysctl_ctx); | ||||
cam_periph_lock(periph); | |||||
softc->flags |= DA_FLAG_SCTX_INIT; | softc->flags |= DA_FLAG_SCTX_INIT; | ||||
cam_periph_unlock(periph); | |||||
softc->sysctl_tree = SYSCTL_ADD_NODE_WITH_LABEL(&softc->sysctl_ctx, | softc->sysctl_tree = SYSCTL_ADD_NODE_WITH_LABEL(&softc->sysctl_ctx, | ||||
SYSCTL_STATIC_CHILDREN(_kern_cam_da), OID_AUTO, tmpstr2, | SYSCTL_STATIC_CHILDREN(_kern_cam_da), OID_AUTO, tmpstr2, | ||||
CTLFLAG_RD, 0, tmpstr, "device_index"); | CTLFLAG_RD, 0, tmpstr, "device_index"); | ||||
if (softc->sysctl_tree == NULL) { | if (softc->sysctl_tree == NULL) { | ||||
printf("dasysctlinit: unable to allocate sysctl tree\n"); | printf("dasysctlinit: unable to allocate sysctl tree\n"); | ||||
da_periph_release(periph, DA_REF_SYSCTL); | da_periph_release(periph, DA_REF_SYSCTL); | ||||
return; | return; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 515 Lines • ▼ Show 20 Lines | daregister(struct cam_periph *periph, void *arg) | ||||
/* | /* | ||||
* Schedule a periodic event to occasionally send an | * Schedule a periodic event to occasionally send an | ||||
* ordered tag to a device. | * ordered tag to a device. | ||||
*/ | */ | ||||
callout_init_mtx(&softc->sendordered_c, cam_periph_mtx(periph), 0); | callout_init_mtx(&softc->sendordered_c, cam_periph_mtx(periph), 0); | ||||
callout_reset(&softc->sendordered_c, | callout_reset(&softc->sendordered_c, | ||||
(da_default_timeout * hz) / DA_ORDEREDTAG_INTERVAL, | (da_default_timeout * hz) / DA_ORDEREDTAG_INTERVAL, | ||||
dasendorderedtag, softc); | dasendorderedtag, periph); | ||||
cam_periph_unlock(periph); | cam_periph_unlock(periph); | ||||
/* | /* | ||||
* RBC devices don't have to support READ(6), only READ(10). | * RBC devices don't have to support READ(6), only READ(10). | ||||
*/ | */ | ||||
if (softc->quirks & DA_Q_NO_6_BYTE || SID_TYPE(&cgd->inq_data) == T_RBC) | if (softc->quirks & DA_Q_NO_6_BYTE || SID_TYPE(&cgd->inq_data) == T_RBC) | ||||
softc->minimum_cmd_size = 10; | softc->minimum_cmd_size = 10; | ||||
else | else | ||||
▲ Show 20 Lines • Show All 411 Lines • ▼ Show 20 Lines | bailout: | ||||
return (error); | return (error); | ||||
} | } | ||||
static void | static void | ||||
dastart(struct cam_periph *periph, union ccb *start_ccb) | dastart(struct cam_periph *periph, union ccb *start_ccb) | ||||
{ | { | ||||
struct da_softc *softc; | struct da_softc *softc; | ||||
cam_periph_assert(periph, MA_OWNED); | |||||
softc = (struct da_softc *)periph->softc; | softc = (struct da_softc *)periph->softc; | ||||
CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("dastart\n")); | CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("dastart\n")); | ||||
skipstate: | skipstate: | ||||
switch (softc->state) { | switch (softc->state) { | ||||
case DA_STATE_NORMAL: | case DA_STATE_NORMAL: | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 1,534 Lines • ▼ Show 20 Lines | if ((csio->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) { | ||||
*/ | */ | ||||
if ((state == DA_CCB_PROBE_RC16) && | if ((state == DA_CCB_PROBE_RC16) && | ||||
(softc->flags & DA_FLAG_CAN_RC16) && | (softc->flags & DA_FLAG_CAN_RC16) && | ||||
(((csio->ccb_h.status & CAM_STATUS_MASK) == | (((csio->ccb_h.status & CAM_STATUS_MASK) == | ||||
CAM_REQ_INVALID) || | CAM_REQ_INVALID) || | ||||
((have_sense) && | ((have_sense) && | ||||
(error_code == SSD_CURRENT_ERROR) && | (error_code == SSD_CURRENT_ERROR) && | ||||
(sense_key == SSD_KEY_ILLEGAL_REQUEST)))) { | (sense_key == SSD_KEY_ILLEGAL_REQUEST)))) { | ||||
cam_periph_lock(periph); | |||||
softc->flags &= ~DA_FLAG_CAN_RC16; | softc->flags &= ~DA_FLAG_CAN_RC16; | ||||
cam_periph_unlock(periph); | |||||
free(rdcap, M_SCSIDA); | free(rdcap, M_SCSIDA); | ||||
xpt_release_ccb(done_ccb); | xpt_release_ccb(done_ccb); | ||||
softc->state = DA_STATE_PROBE_RC; | softc->state = DA_STATE_PROBE_RC; | ||||
xpt_schedule(periph, priority); | xpt_schedule(periph, priority); | ||||
return; | return; | ||||
} | } | ||||
/* | /* | ||||
▲ Show 20 Lines • Show All 370 Lines • ▼ Show 20 Lines | if ((csio->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) { | ||||
cam_iosched_set_sort_queue(softc->cam_iosched, 0); | cam_iosched_set_sort_queue(softc->cam_iosched, 0); | ||||
softc->rotating = 0; | softc->rotating = 0; | ||||
} | } | ||||
if (softc->disk->d_rotation_rate != old_rate) { | if (softc->disk->d_rotation_rate != old_rate) { | ||||
disk_attr_changed(softc->disk, | disk_attr_changed(softc->disk, | ||||
"GEOM::rotation_rate", M_NOWAIT); | "GEOM::rotation_rate", M_NOWAIT); | ||||
} | } | ||||
cam_periph_assert(periph, MA_OWNED); | |||||
if (ata_params->capabilities1 & ATA_SUPPORT_DMA) | if (ata_params->capabilities1 & ATA_SUPPORT_DMA) | ||||
softc->flags |= DA_FLAG_CAN_ATA_DMA; | softc->flags |= DA_FLAG_CAN_ATA_DMA; | ||||
if (ata_params->support.extension & | if (ata_params->support.extension & | ||||
ATA_SUPPORT_GENLOG) | ATA_SUPPORT_GENLOG) | ||||
softc->flags |= DA_FLAG_CAN_ATA_LOG; | softc->flags |= DA_FLAG_CAN_ATA_LOG; | ||||
/* | /* | ||||
▲ Show 20 Lines • Show All 82 Lines • ▼ Show 20 Lines | case DA_CCB_PROBE_ATA: | ||||
} else | } else | ||||
daprobedone(periph, done_ccb); | daprobedone(periph, done_ccb); | ||||
return; | return; | ||||
} | } | ||||
case DA_CCB_PROBE_ATA_LOGDIR: | case DA_CCB_PROBE_ATA_LOGDIR: | ||||
{ | { | ||||
int error; | int error; | ||||
cam_periph_lock(periph); | |||||
if ((csio->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) { | if ((csio->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) { | ||||
error = 0; | error = 0; | ||||
softc->valid_logdir_len = 0; | softc->valid_logdir_len = 0; | ||||
bzero(&softc->ata_logdir, sizeof(softc->ata_logdir)); | bzero(&softc->ata_logdir, sizeof(softc->ata_logdir)); | ||||
softc->valid_logdir_len = | softc->valid_logdir_len = | ||||
csio->dxfer_len - csio->resid; | csio->dxfer_len - csio->resid; | ||||
if (softc->valid_logdir_len > 0) | if (softc->valid_logdir_len > 0) | ||||
bcopy(csio->data_ptr, &softc->ata_logdir, | bcopy(csio->data_ptr, &softc->ata_logdir, | ||||
Show All 37 Lines | if ((csio->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) { | ||||
cam_release_devq(done_ccb->ccb_h.path, | cam_release_devq(done_ccb->ccb_h.path, | ||||
/*relsim_flags*/0, | /*relsim_flags*/0, | ||||
/*reduction*/0, | /*reduction*/0, | ||||
/*timeout*/0, | /*timeout*/0, | ||||
/*getcount_only*/0); | /*getcount_only*/0); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
cam_periph_unlock(periph); | |||||
free(csio->data_ptr, M_SCSIDA); | free(csio->data_ptr, M_SCSIDA); | ||||
if ((error == 0) | if ((error == 0) | ||||
&& (softc->flags & DA_FLAG_CAN_ATA_IDLOG)) { | && (softc->flags & DA_FLAG_CAN_ATA_IDLOG)) { | ||||
softc->state = DA_STATE_PROBE_ATA_IDDIR; | softc->state = DA_STATE_PROBE_ATA_IDDIR; | ||||
xpt_release_ccb(done_ccb); | xpt_release_ccb(done_ccb); | ||||
xpt_schedule(periph, priority); | xpt_schedule(periph, priority); | ||||
return; | return; | ||||
} | } | ||||
daprobedone(periph, done_ccb); | daprobedone(periph, done_ccb); | ||||
return; | return; | ||||
} | } | ||||
case DA_CCB_PROBE_ATA_IDDIR: | case DA_CCB_PROBE_ATA_IDDIR: | ||||
{ | { | ||||
int error; | int error; | ||||
cam_periph_lock(periph); | |||||
if ((csio->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) { | if ((csio->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) { | ||||
off_t entries_offset, max_entries; | off_t entries_offset, max_entries; | ||||
error = 0; | error = 0; | ||||
softc->valid_iddir_len = 0; | softc->valid_iddir_len = 0; | ||||
bzero(&softc->ata_iddir, sizeof(softc->ata_iddir)); | bzero(&softc->ata_iddir, sizeof(softc->ata_iddir)); | ||||
softc->flags &= ~(DA_FLAG_CAN_ATA_SUPCAP | | softc->flags &= ~(DA_FLAG_CAN_ATA_SUPCAP | | ||||
DA_FLAG_CAN_ATA_ZONE); | DA_FLAG_CAN_ATA_ZONE); | ||||
▲ Show 20 Lines • Show All 54 Lines • ▼ Show 20 Lines | if ((csio->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) { | ||||
cam_release_devq(done_ccb->ccb_h.path, | cam_release_devq(done_ccb->ccb_h.path, | ||||
/*relsim_flags*/0, | /*relsim_flags*/0, | ||||
/*reduction*/0, | /*reduction*/0, | ||||
/*timeout*/0, | /*timeout*/0, | ||||
/*getcount_only*/0); | /*getcount_only*/0); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
cam_periph_unlock(periph); | |||||
free(csio->data_ptr, M_SCSIDA); | free(csio->data_ptr, M_SCSIDA); | ||||
if ((error == 0) | if ((error == 0) | ||||
&& (softc->flags & DA_FLAG_CAN_ATA_SUPCAP)) { | && (softc->flags & DA_FLAG_CAN_ATA_SUPCAP)) { | ||||
softc->state = DA_STATE_PROBE_ATA_SUP; | softc->state = DA_STATE_PROBE_ATA_SUP; | ||||
xpt_release_ccb(done_ccb); | xpt_release_ccb(done_ccb); | ||||
xpt_schedule(periph, priority); | xpt_schedule(periph, priority); | ||||
▲ Show 20 Lines • Show All 75 Lines • ▼ Show 20 Lines | if ((csio->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) { | ||||
if (error == ERESTART) | if (error == ERESTART) | ||||
return; | return; | ||||
else if (error != 0) { | else if (error != 0) { | ||||
/* | /* | ||||
* If we can't get the ATA Identify Data | * If we can't get the ATA Identify Data | ||||
* Supported Capabilities page, clear the | * Supported Capabilities page, clear the | ||||
* flag... | * flag... | ||||
*/ | */ | ||||
cam_periph_lock(periph); | |||||
softc->flags &= ~DA_FLAG_CAN_ATA_SUPCAP; | softc->flags &= ~DA_FLAG_CAN_ATA_SUPCAP; | ||||
cam_periph_unlock(periph); | |||||
/* | /* | ||||
* And clear zone capabilities. | * And clear zone capabilities. | ||||
*/ | */ | ||||
softc->zone_flags &= ~DA_ZONE_FLAG_SUP_MASK; | softc->zone_flags &= ~DA_ZONE_FLAG_SUP_MASK; | ||||
if ((done_ccb->ccb_h.status & | if ((done_ccb->ccb_h.status & | ||||
CAM_DEV_QFRZN) != 0) { | CAM_DEV_QFRZN) != 0) { | ||||
/* Don't wedge this device's queue */ | /* Don't wedge this device's queue */ | ||||
cam_release_devq(done_ccb->ccb_h.path, | cam_release_devq(done_ccb->ccb_h.path, | ||||
▲ Show 20 Lines • Show All 80 Lines • ▼ Show 20 Lines | if ((csio->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) { | ||||
} | } | ||||
} | } | ||||
} else { | } else { | ||||
error = daerror(done_ccb, CAM_RETRY_SELTO, | error = daerror(done_ccb, CAM_RETRY_SELTO, | ||||
SF_RETRY_UA|SF_NO_PRINT); | SF_RETRY_UA|SF_NO_PRINT); | ||||
if (error == ERESTART) | if (error == ERESTART) | ||||
return; | return; | ||||
else if (error != 0) { | else if (error != 0) { | ||||
cam_periph_lock(periph); | |||||
softc->flags &= ~DA_FLAG_CAN_ATA_ZONE; | softc->flags &= ~DA_FLAG_CAN_ATA_ZONE; | ||||
softc->flags &= ~DA_ZONE_FLAG_SET_MASK; | softc->flags &= ~DA_ZONE_FLAG_SET_MASK; | ||||
cam_periph_unlock(periph); | |||||
if ((done_ccb->ccb_h.status & | if ((done_ccb->ccb_h.status & | ||||
CAM_DEV_QFRZN) != 0) { | CAM_DEV_QFRZN) != 0) { | ||||
/* Don't wedge this device's queue */ | /* Don't wedge this device's queue */ | ||||
cam_release_devq(done_ccb->ccb_h.path, | cam_release_devq(done_ccb->ccb_h.path, | ||||
/*relsim_flags*/0, | /*relsim_flags*/0, | ||||
/*reduction*/0, | /*reduction*/0, | ||||
/*timeout*/0, | /*timeout*/0, | ||||
▲ Show 20 Lines • Show All 132 Lines • ▼ Show 20 Lines | |||||
#if defined(BUF_TRACKING) || defined(FULL_BUF_TRACKING) | #if defined(BUF_TRACKING) || defined(FULL_BUF_TRACKING) | ||||
if (ccb->csio.bio != NULL) | if (ccb->csio.bio != NULL) | ||||
biotrack(ccb->csio.bio, __func__); | biotrack(ccb->csio.bio, __func__); | ||||
#endif | #endif | ||||
periph = xpt_path_periph(ccb->ccb_h.path); | periph = xpt_path_periph(ccb->ccb_h.path); | ||||
softc = (struct da_softc *)periph->softc; | softc = (struct da_softc *)periph->softc; | ||||
cam_periph_assert(periph, MA_OWNED); | |||||
/* | /* | ||||
* Automatically detect devices that do not support | * Automatically detect devices that do not support | ||||
* READ(6)/WRITE(6) and upgrade to using 10 byte cdbs. | * READ(6)/WRITE(6) and upgrade to using 10 byte cdbs. | ||||
*/ | */ | ||||
error = 0; | error = 0; | ||||
if ((ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_INVALID) { | if ((ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_INVALID) { | ||||
error = cmd6workaround(ccb); | error = cmd6workaround(ccb); | ||||
} else if (scsi_extract_sense_ccb(ccb, | } else if (scsi_extract_sense_ccb(ccb, | ||||
▲ Show 20 Lines • Show All 78 Lines • ▼ Show 20 Lines | |||||
static void | static void | ||||
daprevent(struct cam_periph *periph, int action) | daprevent(struct cam_periph *periph, int action) | ||||
{ | { | ||||
struct da_softc *softc; | struct da_softc *softc; | ||||
union ccb *ccb; | union ccb *ccb; | ||||
int error; | int error; | ||||
cam_periph_assert(periph, MA_OWNED); | |||||
softc = (struct da_softc *)periph->softc; | softc = (struct da_softc *)periph->softc; | ||||
if (((action == PR_ALLOW) | if (((action == PR_ALLOW) | ||||
&& (softc->flags & DA_FLAG_PACK_LOCKED) == 0) | && (softc->flags & DA_FLAG_PACK_LOCKED) == 0) | ||||
|| ((action == PR_PREVENT) | || ((action == PR_PREVENT) | ||||
&& (softc->flags & DA_FLAG_PACK_LOCKED) != 0)) { | && (softc->flags & DA_FLAG_PACK_LOCKED) != 0)) { | ||||
return; | return; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 139 Lines • ▼ Show 20 Lines | dasetgeom(struct cam_periph *periph, uint32_t block_len, uint64_t maxsector, | ||||
error = disk_resize(softc->disk, M_NOWAIT); | error = disk_resize(softc->disk, M_NOWAIT); | ||||
if (error != 0) | if (error != 0) | ||||
xpt_print(periph->path, "disk_resize(9) failed, error = %d\n", error); | xpt_print(periph->path, "disk_resize(9) failed, error = %d\n", error); | ||||
} | } | ||||
static void | static void | ||||
dasendorderedtag(void *arg) | dasendorderedtag(void *arg) | ||||
{ | { | ||||
struct da_softc *softc = arg; | struct cam_periph *periph = arg; | ||||
struct da_softc *softc = periph->softc; | |||||
cam_periph_assert(periph, MA_OWNED); | |||||
if (da_send_ordered) { | if (da_send_ordered) { | ||||
if (!LIST_EMPTY(&softc->pending_ccbs)) { | if (!LIST_EMPTY(&softc->pending_ccbs)) { | ||||
if ((softc->flags & DA_FLAG_WAS_OTAG) == 0) | if ((softc->flags & DA_FLAG_WAS_OTAG) == 0) | ||||
softc->flags |= DA_FLAG_NEED_OTAG; | softc->flags |= DA_FLAG_NEED_OTAG; | ||||
softc->flags &= ~DA_FLAG_WAS_OTAG; | softc->flags &= ~DA_FLAG_WAS_OTAG; | ||||
} | } | ||||
} | } | ||||
/* Queue us up again */ | /* Queue us up again */ | ||||
callout_reset(&softc->sendordered_c, | callout_reset(&softc->sendordered_c, | ||||
(da_default_timeout * hz) / DA_ORDEREDTAG_INTERVAL, | (da_default_timeout * hz) / DA_ORDEREDTAG_INTERVAL, | ||||
dasendorderedtag, softc); | dasendorderedtag, periph); | ||||
} | } | ||||
/* | /* | ||||
* Step through all DA peripheral drivers, and if the device is still open, | * Step through all DA peripheral drivers, and if the device is still open, | ||||
* sync the disk cache to physical media. | * sync the disk cache to physical media. | ||||
*/ | */ | ||||
static void | static void | ||||
dashutdown(void * arg, int howto) | dashutdown(void * arg, int howto) | ||||
▲ Show 20 Lines • Show All 413 Lines • Show Last 20 Lines |