Lines 152-157
static int ndaerror(union ccb *ccb, u_int32_t cam_flags,
Link Here
|
152 |
u_int32_t sense_flags); |
152 |
u_int32_t sense_flags); |
153 |
static void ndashutdown(void *arg, int howto); |
153 |
static void ndashutdown(void *arg, int howto); |
154 |
static void ndasuspend(void *arg); |
154 |
static void ndasuspend(void *arg); |
|
|
155 |
static void ndaresume(void *arg); |
155 |
|
156 |
|
156 |
#ifndef NDA_DEFAULT_SEND_ORDERED |
157 |
#ifndef NDA_DEFAULT_SEND_ORDERED |
157 |
#define NDA_DEFAULT_SEND_ORDERED 1 |
158 |
#define NDA_DEFAULT_SEND_ORDERED 1 |
Lines 201-212
static MALLOC_DEFINE(M_NVMEDA, "nvme_da", "nvme_da buffers");
Link Here
|
201 |
*/ |
202 |
*/ |
202 |
|
203 |
|
203 |
static void |
204 |
static void |
204 |
nda_nvme_flush(struct nda_softc *softc, struct ccb_nvmeio *nvmeio) |
205 |
nda_nvme_flush(struct nda_softc *softc, struct ccb_nvmeio *nvmeio, uint32_t flags) |
205 |
{ |
206 |
{ |
206 |
cam_fill_nvmeio(nvmeio, |
207 |
cam_fill_nvmeio(nvmeio, |
207 |
0, /* retries */ |
208 |
0, /* retries */ |
208 |
ndadone, /* cbfcnp */ |
209 |
ndadone, /* cbfcnp */ |
209 |
CAM_DIR_NONE, /* flags */ |
210 |
CAM_DIR_NONE | flags, /* flags */ |
210 |
NULL, /* data_ptr */ |
211 |
NULL, /* data_ptr */ |
211 |
0, /* dxfer_len */ |
212 |
0, /* dxfer_len */ |
212 |
nda_default_timeout * 1000); /* timeout 30s */ |
213 |
nda_default_timeout * 1000); /* timeout 30s */ |
Lines 320-326
ndaclose(struct disk *dp)
Link Here
|
320 |
cam_periph_hold(periph, PRIBIO) == 0) { |
321 |
cam_periph_hold(periph, PRIBIO) == 0) { |
321 |
|
322 |
|
322 |
ccb = cam_periph_getccb(periph, CAM_PRIORITY_NORMAL); |
323 |
ccb = cam_periph_getccb(periph, CAM_PRIORITY_NORMAL); |
323 |
nda_nvme_flush(softc, &ccb->nvmeio); |
324 |
nda_nvme_flush(softc, &ccb->nvmeio, 0); |
324 |
error = cam_periph_runccb(ccb, ndaerror, /*cam_flags*/0, |
325 |
error = cam_periph_runccb(ccb, ndaerror, /*cam_flags*/0, |
325 |
/*sense_flags*/0, softc->disk->d_devstat); |
326 |
/*sense_flags*/0, softc->disk->d_devstat); |
326 |
|
327 |
|
Lines 438-444
ndadump(void *arg, void *virtual, vm_offset_t physical, off_t offset, size_t len
Link Here
|
438 |
xpt_setup_ccb(&nvmeio.ccb_h, periph->path, CAM_PRIORITY_NORMAL); |
439 |
xpt_setup_ccb(&nvmeio.ccb_h, periph->path, CAM_PRIORITY_NORMAL); |
439 |
|
440 |
|
440 |
nvmeio.ccb_state = NDA_CCB_DUMP; |
441 |
nvmeio.ccb_state = NDA_CCB_DUMP; |
441 |
nda_nvme_flush(softc, &nvmeio); |
442 |
nda_nvme_flush(softc, &nvmeio, 0); |
442 |
error = cam_periph_runccb((union ccb *)&nvmeio, cam_periph_error, |
443 |
error = cam_periph_runccb((union ccb *)&nvmeio, cam_periph_error, |
443 |
0, SF_NO_RECOVERY | SF_NO_RETRY, NULL); |
444 |
0, SF_NO_RECOVERY | SF_NO_RETRY, NULL); |
444 |
if (error != 0) |
445 |
if (error != 0) |
Lines 465-474
ndainit(void)
Link Here
|
465 |
/* Register our event handlers */ |
466 |
/* Register our event handlers */ |
466 |
if ((EVENTHANDLER_REGISTER(power_suspend, ndasuspend, |
467 |
if ((EVENTHANDLER_REGISTER(power_suspend, ndasuspend, |
467 |
NULL, EVENTHANDLER_PRI_LAST)) == NULL) |
468 |
NULL, EVENTHANDLER_PRI_LAST)) == NULL) |
468 |
printf("ndainit: power event registration failed!\n"); |
469 |
printf("ndainit: suspend event registration failed!\n"); |
469 |
if ((EVENTHANDLER_REGISTER(shutdown_post_sync, ndashutdown, |
470 |
if ((EVENTHANDLER_REGISTER(shutdown_post_sync, ndashutdown, |
470 |
NULL, SHUTDOWN_PRI_DEFAULT)) == NULL) |
471 |
NULL, SHUTDOWN_PRI_DEFAULT)) == NULL) |
471 |
printf("ndainit: shutdown event registration failed!\n"); |
472 |
printf("ndainit: shutdown event registration failed!\n"); |
|
|
473 |
if ((EVENTHANDLER_REGISTER(power_resume, ndaresume, |
474 |
NULL, EVENTHANDLER_PRI_ANY)) == NULL) |
475 |
printf("%s: resume event registration failed!\n", __func__); |
472 |
} |
476 |
} |
473 |
} |
477 |
} |
474 |
|
478 |
|
Lines 980-986
ndastart(struct cam_periph *periph, union ccb *start_ccb)
Link Here
|
980 |
goto out; |
984 |
goto out; |
981 |
} |
985 |
} |
982 |
case BIO_FLUSH: |
986 |
case BIO_FLUSH: |
983 |
nda_nvme_flush(softc, nvmeio); |
987 |
nda_nvme_flush(softc, nvmeio, 0); |
984 |
break; |
988 |
break; |
985 |
} |
989 |
} |
986 |
start_ccb->ccb_state = NDA_CCB_BUFFER_IO; |
990 |
start_ccb->ccb_state = NDA_CCB_BUFFER_IO; |
Lines 1186-1192
ndaflush(void)
Link Here
|
1186 |
} |
1190 |
} |
1187 |
|
1191 |
|
1188 |
ccb = cam_periph_getccb(periph, CAM_PRIORITY_NORMAL); |
1192 |
ccb = cam_periph_getccb(periph, CAM_PRIORITY_NORMAL); |
1189 |
nda_nvme_flush(softc, &ccb->nvmeio); |
1193 |
nda_nvme_flush(softc, &ccb->nvmeio, CAM_DEV_QFREEZE); |
1190 |
error = cam_periph_runccb(ccb, ndaerror, /*cam_flags*/0, |
1194 |
error = cam_periph_runccb(ccb, ndaerror, /*cam_flags*/0, |
1191 |
/*sense_flags*/ SF_NO_RECOVERY | SF_NO_RETRY, |
1195 |
/*sense_flags*/ SF_NO_RECOVERY | SF_NO_RETRY, |
1192 |
softc->disk->d_devstat); |
1196 |
softc->disk->d_devstat); |
Lines 1210-1212
ndasuspend(void *arg)
Link Here
|
1210 |
|
1214 |
|
1211 |
ndaflush(); |
1215 |
ndaflush(); |
1212 |
} |
1216 |
} |
1213 |
- |
1217 |
|
|
|
1218 |
static void |
1219 |
ndaresume(void *arg) |
1220 |
{ |
1221 |
struct cam_periph *periph; |
1222 |
|
1223 |
CAM_PERIPH_FOREACH(periph, &ndadriver) { |
1224 |
cam_release_devq(periph->path, 0, 0, 0, FALSE); |
1225 |
} |
1226 |
} |