Page MenuHomeFreeBSD
Paste P231

Masterwork From Distant Lands
ActivePublic

Authored by bwidawsk on Oct 22 2018, 11:40 PM.
Tags
None
Referenced Files
F3897862: Masterwork From Distant Lands
Oct 22 2018, 11:40 PM
Subscribers
None
diff --git a/sys/cam/nvme/nvme_da.c b/sys/cam/nvme/nvme_da.c
index f83a038506a..dfc70a9a9ac 100644
--- a/sys/cam/nvme/nvme_da.c
+++ b/sys/cam/nvme/nvme_da.c
@@ -152,6 +152,7 @@ static int ndaerror(union ccb *ccb, u_int32_t cam_flags,
u_int32_t sense_flags);
static void ndashutdown(void *arg, int howto);
static void ndasuspend(void *arg);
+static void ndaresume(void *arg);
#ifndef NDA_DEFAULT_SEND_ORDERED
#define NDA_DEFAULT_SEND_ORDERED 1
@@ -201,12 +202,12 @@ static MALLOC_DEFINE(M_NVMEDA, "nvme_da", "nvme_da buffers");
*/
static void
-nda_nvme_flush(struct nda_softc *softc, struct ccb_nvmeio *nvmeio)
+nda_nvme_flush(struct nda_softc *softc, struct ccb_nvmeio *nvmeio, uint32_t flags)
{
cam_fill_nvmeio(nvmeio,
0, /* retries */
ndadone, /* cbfcnp */
- CAM_DIR_NONE, /* flags */
+ CAM_DIR_NONE | flags, /* flags */
NULL, /* data_ptr */
0, /* dxfer_len */
nda_default_timeout * 1000); /* timeout 30s */
@@ -320,7 +321,7 @@ ndaclose(struct disk *dp)
cam_periph_hold(periph, PRIBIO) == 0) {
ccb = cam_periph_getccb(periph, CAM_PRIORITY_NORMAL);
- nda_nvme_flush(softc, &ccb->nvmeio);
+ nda_nvme_flush(softc, &ccb->nvmeio, 0);
error = cam_periph_runccb(ccb, ndaerror, /*cam_flags*/0,
/*sense_flags*/0, softc->disk->d_devstat);
@@ -438,7 +439,7 @@ ndadump(void *arg, void *virtual, vm_offset_t physical, off_t offset, size_t len
xpt_setup_ccb(&nvmeio.ccb_h, periph->path, CAM_PRIORITY_NORMAL);
nvmeio.ccb_state = NDA_CCB_DUMP;
- nda_nvme_flush(softc, &nvmeio);
+ nda_nvme_flush(softc, &nvmeio, 0);
error = cam_periph_runccb((union ccb *)&nvmeio, cam_periph_error,
0, SF_NO_RECOVERY | SF_NO_RETRY, NULL);
if (error != 0)
@@ -465,10 +466,13 @@ ndainit(void)
/* Register our event handlers */
if ((EVENTHANDLER_REGISTER(power_suspend, ndasuspend,
NULL, EVENTHANDLER_PRI_LAST)) == NULL)
- printf("ndainit: power event registration failed!\n");
+ printf("ndainit: suspend event registration failed!\n");
if ((EVENTHANDLER_REGISTER(shutdown_post_sync, ndashutdown,
NULL, SHUTDOWN_PRI_DEFAULT)) == NULL)
printf("ndainit: shutdown event registration failed!\n");
+ if ((EVENTHANDLER_REGISTER(power_resume, ndaresume,
+ NULL, EVENTHANDLER_PRI_ANY)) == NULL)
+ printf("%s: resume event registration failed!\n", __func__);
}
}
@@ -980,7 +984,7 @@ ndastart(struct cam_periph *periph, union ccb *start_ccb)
goto out;
}
case BIO_FLUSH:
- nda_nvme_flush(softc, nvmeio);
+ nda_nvme_flush(softc, nvmeio, 0);
break;
}
start_ccb->ccb_state = NDA_CCB_BUFFER_IO;
@@ -1186,7 +1190,8 @@ ndaflush(void)
}
ccb = cam_periph_getccb(periph, CAM_PRIORITY_NORMAL);
- nda_nvme_flush(softc, &ccb->nvmeio);
+ nda_nvme_flush(softc, &ccb->nvmeio, CAM_DEV_QFREEZE);
+ cam_freeze_devq(periph->path);
error = cam_periph_runccb(ccb, ndaerror, /*cam_flags*/0,
/*sense_flags*/ SF_NO_RECOVERY | SF_NO_RETRY,
softc->disk->d_devstat);
@@ -1210,3 +1215,13 @@ ndasuspend(void *arg)
ndaflush();
}
+
+static void
+ndaresume(void *arg)
+{
+ struct cam_periph *periph;
+
+ CAM_PERIPH_FOREACH(periph, &ndadriver) {
+ cam_release_devq(periph->path, 0, 0, 0, FALSE);
+ }
+}
diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c
index 4a1c8c0fc3d..fa8109846cc 100644
--- a/sys/dev/acpica/acpi.c
+++ b/sys/dev/acpica/acpi.c
@@ -2782,9 +2782,11 @@ acpi_sleep_force_task(void *context)
{
struct acpi_softc *sc = (struct acpi_softc *)context;
- if (ACPI_FAILURE(acpi_EnterSleepState(sc, sc->acpi_next_sstate)))
- device_printf(sc->acpi_dev, "force sleep state S%d failed\n",
- sc->acpi_next_sstate);
+ ACPI_STATUS err;
+
+ if ((err = acpi_EnterSleepState(sc, sc->acpi_next_sstate)))
+ device_printf(sc->acpi_dev, "force sleep state S%d failed (%s)\n",
+ sc->acpi_next_sstate, AcpiFormatException(err));
}
static void

Event Timeline

bwidawsk changed the title of this paste from untitled to Masterwork From Distant Lands.