Changeset View
Changeset View
Standalone View
Standalone View
sys/cam/nvme/nvme_da.c
Show First 20 Lines • Show All 398 Lines • ▼ Show 20 Lines | ndadump(void *arg, void *virtual, vm_offset_t physical, off_t offset, size_t length) | ||||
} | } | ||||
/* xpt_get_ccb returns a zero'd allocation for the ccb, mimic that here */ | /* xpt_get_ccb returns a zero'd allocation for the ccb, mimic that here */ | ||||
memset(&nvmeio, 0, sizeof(nvmeio)); | memset(&nvmeio, 0, sizeof(nvmeio)); | ||||
if (length > 0) { | if (length > 0) { | ||||
xpt_setup_ccb(&nvmeio.ccb_h, periph->path, CAM_PRIORITY_NORMAL); | xpt_setup_ccb(&nvmeio.ccb_h, periph->path, CAM_PRIORITY_NORMAL); | ||||
nvmeio.ccb_h.ccb_state = NDA_CCB_DUMP; | nvmeio.ccb_h.ccb_state = NDA_CCB_DUMP; | ||||
nda_nvme_write(softc, &nvmeio, virtual, lba, length, count); | nda_nvme_write(softc, &nvmeio, virtual, lba, length, count); | ||||
xpt_polled_action((union ccb *)&nvmeio); | error = cam_periph_runccb((union ccb *)&nvmeio, cam_periph_error, | ||||
0, SF_NO_RECOVERY | SF_NO_RETRY, NULL); | |||||
error = cam_periph_error((union ccb *)&nvmeio, | |||||
0, SF_NO_RECOVERY | SF_NO_RETRY); | |||||
if ((nvmeio.ccb_h.status & CAM_DEV_QFRZN) != 0) | |||||
cam_release_devq(nvmeio.ccb_h.path, /*relsim_flags*/0, | |||||
/*reduction*/0, /*timeout*/0, /*getcount_only*/0); | |||||
if (error != 0) | if (error != 0) | ||||
printf("Aborting dump due to I/O error.\n"); | printf("Aborting dump due to I/O error %d.\n", error); | ||||
cam_periph_unlock(periph); | cam_periph_unlock(periph); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* Flush */ | /* Flush */ | ||||
xpt_setup_ccb(&nvmeio.ccb_h, periph->path, CAM_PRIORITY_NORMAL); | xpt_setup_ccb(&nvmeio.ccb_h, periph->path, CAM_PRIORITY_NORMAL); | ||||
nvmeio.ccb_h.ccb_state = NDA_CCB_DUMP; | nvmeio.ccb_h.ccb_state = NDA_CCB_DUMP; | ||||
nda_nvme_flush(softc, &nvmeio); | nda_nvme_flush(softc, &nvmeio); | ||||
xpt_polled_action((union ccb *)&nvmeio); | error = cam_periph_runccb((union ccb *)&nvmeio, cam_periph_error, | ||||
0, SF_NO_RECOVERY | SF_NO_RETRY, NULL); | |||||
error = cam_periph_error((union ccb *)&nvmeio, | |||||
0, SF_NO_RECOVERY | SF_NO_RETRY); | |||||
if ((nvmeio.ccb_h.status & CAM_DEV_QFRZN) != 0) | |||||
cam_release_devq(nvmeio.ccb_h.path, /*relsim_flags*/0, | |||||
/*reduction*/0, /*timeout*/0, /*getcount_only*/0); | |||||
if (error != 0) | if (error != 0) | ||||
xpt_print(periph->path, "flush cmd failed\n"); | xpt_print(periph->path, "flush cmd failed\n"); | ||||
cam_periph_unlock(periph); | cam_periph_unlock(periph); | ||||
return (error); | return (error); | ||||
} | } | ||||
static void | static void | ||||
ndainit(void) | ndainit(void) | ||||
▲ Show 20 Lines • Show All 709 Lines • Show Last 20 Lines |