aboutsummaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorOlivier Certner <olce@FreeBSD.org>2026-06-02 16:04:55 +0000
committerOlivier Certner <olce@FreeBSD.org>2026-06-22 13:50:03 +0000
commitfc6d7a7520d00943ab167544b145f404c10b406a (patch)
tree9b0ba9dbc51a320794b2c9bf684a0bbf7e30314c /sys/dev
parentd928113eaadaeb9ab821a2a5b6f08159f1ce8d76 (diff)
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/acpica/acpi.c34
-rw-r--r--sys/dev/acpica/acpivar.h8
2 files changed, 8 insertions, 34 deletions
diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c
index 9a85a0844de6..7103eea16053 100644
--- a/sys/dev/acpica/acpi.c
+++ b/sys/dev/acpica/acpi.c
@@ -189,7 +189,6 @@ static void acpi_system_eventhandler_sleep(void *arg,
enum power_stype stype);
static void acpi_system_eventhandler_wakeup(void *arg,
enum power_stype stype);
-static int acpi_s4bios_sysctl(SYSCTL_HANDLER_ARGS);
static enum power_stype acpi_sstate_to_stype(int sstate);
static int acpi_sname_to_sstate(const char *sname);
static const char *acpi_sstate_to_sname(int sstate);
@@ -626,8 +625,8 @@ acpi_attach(device_t dev)
* Mark whether S4BIOS is available according to the FACS, and if it is,
* enable it by default.
*/
- if (AcpiGbl_FACS != NULL && AcpiGbl_FACS->Flags & ACPI_FACS_S4_BIOS_PRESENT)
- sc->acpi_s4bios = sc->acpi_s4bios_supported = true;
+ sc->acpi_s4bios_supported = AcpiGbl_FACS != NULL &&
+ (AcpiGbl_FACS->Flags & ACPI_FACS_S4_BIOS_PRESENT) != 0;
/*
* Probe all supported ACPI sleep states. Awake (S0) is always supported,
@@ -646,6 +645,12 @@ acpi_attach(device_t dev)
sc->acpi_supported_stypes[acpi_sstate_to_stype(state)] = true;
}
}
+ /*
+ * Prevent users from requesting firmware-supported image saving if firmware
+ * does not indicate it as supported.
+ */
+ if (!sc->acpi_s4bios_supported)
+ sc->acpi_supported_stypes[POWER_STYPE_FW_HIBERNATE] = false;
/*
* Dispatch the default sleep type to devices. The lid switch is set
@@ -758,10 +763,6 @@ acpi_attach(device_t dev)
SYSCTL_ADD_INT(&sc->acpi_sysctl_ctx, SYSCTL_CHILDREN(sc->acpi_sysctl_tree),
OID_AUTO, "sleep_delay", CTLFLAG_RW, &sc->acpi_sleep_delay, 0,
"sleep delay in seconds");
- SYSCTL_ADD_PROC(&sc->acpi_sysctl_ctx, SYSCTL_CHILDREN(sc->acpi_sysctl_tree),
- OID_AUTO, "s4bios", CTLTYPE_U8 | CTLFLAG_RW | CTLFLAG_MPSAFE,
- sc, 0, acpi_s4bios_sysctl, "CU",
- "On hibernate, have the firmware save/restore the machine state (S4BIOS).");
SYSCTL_ADD_BOOL(&sc->acpi_sysctl_ctx, SYSCTL_CHILDREN(sc->acpi_sysctl_tree),
OID_AUTO, "s4bios_supported", CTLFLAG_RD, &sc->acpi_s4bios_supported, 0,
"Whether firmware supports saving/restoring the machine state (S4BIOS).");
@@ -4489,25 +4490,6 @@ acpiioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread *t
}
static int
-acpi_s4bios_sysctl(SYSCTL_HANDLER_ARGS)
-{
- struct acpi_softc *const sc = arg1;
- bool val;
- int error;
-
- val = sc->acpi_s4bios;
- error = sysctl_handle_bool(oidp, &val, 0, req);
- if (error != 0 || req->newptr == NULL)
- return (error);
-
- if (val && !sc->acpi_s4bios_supported)
- return (EOPNOTSUPP);
- sc->acpi_s4bios = val;
-
- return (0);
-}
-
-static int
acpi_sname_to_sstate(const char *sname)
{
int sstate;
diff --git a/sys/dev/acpica/acpivar.h b/sys/dev/acpica/acpivar.h
index 476170f5743b..01e7ddcd74cd 100644
--- a/sys/dev/acpica/acpivar.h
+++ b/sys/dev/acpica/acpivar.h
@@ -68,7 +68,6 @@ struct acpi_softc {
enum power_stype acpi_lid_switch_stype;
int acpi_standby_sx;
- bool acpi_s4bios;
bool acpi_s4bios_supported;
int acpi_sleep_delay;
@@ -517,13 +516,6 @@ acpi_d_state_to_str(int state)
return (strs[state]);
}
-static __inline bool
-acpi_should_do_s4bios(struct acpi_softc *sc)
-{
- MPASS(!sc->acpi_s4bios || sc->acpi_s4bios_supported);
- return (sc->acpi_s4bios);
-}
-
char *acpi_name(ACPI_HANDLE handle);
int acpi_avoid(ACPI_HANDLE handle);
int acpi_disabled(char *subsys);