Changeset View
Changeset View
Standalone View
Standalone View
sys/cam/nvme/nvme_da.c
Show First 20 Lines • Show All 517 Lines • ▼ Show 20 Lines | ndadump(void *arg, void *virtual, vm_offset_t physical, off_t offset, size_t length) | ||||
secsize = softc->disk->d_sectorsize; | secsize = softc->disk->d_sectorsize; | ||||
lba = offset / secsize; | lba = offset / secsize; | ||||
count = length / secsize; | count = length / secsize; | ||||
if ((periph->flags & CAM_PERIPH_INVALID) != 0) | if ((periph->flags & CAM_PERIPH_INVALID) != 0) | ||||
return (ENXIO); | return (ENXIO); | ||||
/* 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)); | xpt_setup_stack_ccb(&nvmeio.ccb_h, sizeof(nvmeio), periph->path, | ||||
CAM_PRIORITY_NORMAL); | |||||
if (length > 0) { | if (length > 0) { | ||||
xpt_setup_ccb(&nvmeio.ccb_h, periph->path, CAM_PRIORITY_NORMAL); | |||||
nvmeio.ccb_state = NDA_CCB_DUMP; | nvmeio.ccb_state = NDA_CCB_DUMP; | ||||
nda_nvme_write(softc, &nvmeio, virtual, lba, length, count); | nda_nvme_write(softc, &nvmeio, virtual, lba, length, count); | ||||
error = cam_periph_runccb((union ccb *)&nvmeio, cam_periph_error, | error = cam_periph_runccb((union ccb *)&nvmeio, cam_periph_error, | ||||
0, SF_NO_RECOVERY | SF_NO_RETRY, NULL); | 0, SF_NO_RECOVERY | SF_NO_RETRY, NULL); | ||||
if (error != 0) | if (error != 0) | ||||
printf("Aborting dump due to I/O error %d.\n", error); | printf("Aborting dump due to I/O error %d.\n", error); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* Flush */ | |||||
xpt_setup_ccb(&nvmeio.ccb_h, periph->path, CAM_PRIORITY_NORMAL); | |||||
nvmeio.ccb_state = NDA_CCB_DUMP; | nvmeio.ccb_state = NDA_CCB_DUMP; | ||||
nda_nvme_flush(softc, &nvmeio); | nda_nvme_flush(softc, &nvmeio); | ||||
error = cam_periph_runccb((union ccb *)&nvmeio, cam_periph_error, | error = cam_periph_runccb((union ccb *)&nvmeio, cam_periph_error, | ||||
0, SF_NO_RECOVERY | SF_NO_RETRY, NULL); | 0, SF_NO_RECOVERY | SF_NO_RETRY, NULL); | ||||
if (error != 0) | if (error != 0) | ||||
xpt_print(periph->path, "flush cmd failed\n"); | xpt_print(periph->path, "flush cmd failed\n"); | ||||
return (error); | return (error); | ||||
▲ Show 20 Lines • Show All 815 Lines • Show Last 20 Lines |