diff options
author | Stefan Sperling <stsp@cvs.openbsd.org> | 2019-04-02 07:08:41 +0000 |
---|---|---|
committer | Stefan Sperling <stsp@cvs.openbsd.org> | 2019-04-02 07:08:41 +0000 |
commit | 3b82f7fa18bfc05690e502b333fe37b8651cd2ca (patch) | |
tree | 694b23754f23d2f6d886463a5a80d48f70aabd24 /sys/dev/sdmmc | |
parent | b197d0bf4d4eceba2c572f503cf66ac260642e7c (diff) |
Don't detach non-removable devices during resume on "sdhc* at acpi?".
Makes hibernate work with rootfs on built-in emmc storage.
Tested on King Jim Portabook.
ok deraadt@ kettenis@
Diffstat (limited to 'sys/dev/sdmmc')
-rw-r--r-- | sys/dev/sdmmc/sdhc.c | 5 | ||||
-rw-r--r-- | sys/dev/sdmmc/sdhcvar.h | 3 | ||||
-rw-r--r-- | sys/dev/sdmmc/sdmmc.c | 5 | ||||
-rw-r--r-- | sys/dev/sdmmc/sdmmcvar.h | 3 |
4 files changed, 11 insertions, 5 deletions
diff --git a/sys/dev/sdmmc/sdhc.c b/sys/dev/sdmmc/sdhc.c index 248878293e3..24f7df07377 100644 --- a/sys/dev/sdmmc/sdhc.c +++ b/sys/dev/sdmmc/sdhc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sdhc.c,v 1.61 2018/09/06 10:15:17 patrick Exp $ */ +/* $OpenBSD: sdhc.c,v 1.62 2019/04/02 07:08:40 stsp Exp $ */ /* * Copyright (c) 2006 Uwe Stuehler <uwe@openbsd.org> @@ -335,6 +335,9 @@ sdhc_host_found(struct sdhc_softc *sc, bus_space_tag_t iot, if (ISSET(sc->sc_flags, SDHC_F_NODDR50)) saa.caps &= ~SMC_CAPS_MMC_DDR52; + if (ISSET(sc->sc_flags, SDHC_F_NONREMOVABLE)) + saa.caps |= SMC_CAPS_NONREMOVABLE; + hp->sdmmc = config_found(&sc->sc_dev, &saa, NULL); if (hp->sdmmc == NULL) { error = 0; diff --git a/sys/dev/sdmmc/sdhcvar.h b/sys/dev/sdmmc/sdhcvar.h index 7775015ac97..efa3f5e0bc8 100644 --- a/sys/dev/sdmmc/sdhcvar.h +++ b/sys/dev/sdmmc/sdhcvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: sdhcvar.h,v 1.11 2018/03/19 21:40:32 kettenis Exp $ */ +/* $OpenBSD: sdhcvar.h,v 1.12 2019/04/02 07:08:40 stsp Exp $ */ /* * Copyright (c) 2006 Uwe Stuehler <uwe@openbsd.org> @@ -48,5 +48,6 @@ void sdhc_needs_discover(struct sdhc_softc *); /* flag values */ #define SDHC_F_NOPWR0 (1 << 0) #define SDHC_F_NODDR50 (1 << 1) +#define SDHC_F_NONREMOVABLE (1 << 2) #endif diff --git a/sys/dev/sdmmc/sdmmc.c b/sys/dev/sdmmc/sdmmc.c index 32285bce1cb..9afb62be82a 100644 --- a/sys/dev/sdmmc/sdmmc.c +++ b/sys/dev/sdmmc/sdmmc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sdmmc.c,v 1.52 2018/12/29 11:37:30 patrick Exp $ */ +/* $OpenBSD: sdmmc.c,v 1.53 2019/04/02 07:08:40 stsp Exp $ */ /* * Copyright (c) 2006 Uwe Stuehler <uwe@openbsd.org> @@ -181,7 +181,8 @@ sdmmc_activate(struct device *self, int act) case DVACT_SUSPEND: rv = config_activate_children(self, act); /* If card in slot, cause a detach/re-attach */ - if (ISSET(sc->sc_flags, SMF_CARD_PRESENT)) + if (ISSET(sc->sc_flags, SMF_CARD_PRESENT) && + !ISSET(sc->sc_caps, SMC_CAPS_NONREMOVABLE)) sc->sc_dying = -1; break; case DVACT_RESUME: diff --git a/sys/dev/sdmmc/sdmmcvar.h b/sys/dev/sdmmc/sdmmcvar.h index 1cc635e3182..e5f4f385cdd 100644 --- a/sys/dev/sdmmc/sdmmcvar.h +++ b/sys/dev/sdmmc/sdmmcvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: sdmmcvar.h,v 1.31 2018/12/29 11:37:30 patrick Exp $ */ +/* $OpenBSD: sdmmcvar.h,v 1.32 2019/04/02 07:08:40 stsp Exp $ */ /* * Copyright (c) 2006 Uwe Stuehler <uwe@openbsd.org> @@ -200,6 +200,7 @@ struct sdmmc_softc { #define SMC_CAPS_MMC_DDR52 0x2000 /* eMMC DDR52 timing */ #define SMC_CAPS_MMC_HS200 0x4000 /* eMMC HS200 timing */ #define SMC_CAPS_MMC_HS400 0x8000 /* eMMC HS400 timing */ +#define SMC_CAPS_NONREMOVABLE 0x10000 /* non-removable devices */ int sc_function_count; /* number of I/O functions (SDIO) */ struct sdmmc_function *sc_card; /* selected card */ |