Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F159395537
D57414.id179142.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D57414.id179142.diff
View Options
diff --git a/sys/amd64/acpica/acpi_wakeup.c b/sys/amd64/acpica/acpi_wakeup.c
--- a/sys/amd64/acpica/acpi_wakeup.c
+++ b/sys/amd64/acpica/acpi_wakeup.c
@@ -228,7 +228,7 @@
WAKECODE_FIXUP(wakeup_gdt + 2, uint64_t, pcb->pcb_gdt.rd_base);
/* Call ACPICA to enter the desired sleep state */
- if (state == ACPI_STATE_S4 && acpi_should_do_s4bios(sc))
+ if (state == ACPI_STATE_S4)
status = AcpiEnterSleepStateS4bios();
else
status = AcpiEnterSleepState(state);
diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c
--- a/sys/dev/acpica/acpi.c
+++ b/sys/dev/acpica/acpi.c
@@ -626,8 +626,8 @@
* 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 +646,12 @@
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 +764,6 @@
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).");
@@ -4488,25 +4490,6 @@
return (error);
}
-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)
{
diff --git a/sys/dev/acpica/acpivar.h b/sys/dev/acpica/acpivar.h
--- a/sys/dev/acpica/acpivar.h
+++ b/sys/dev/acpica/acpivar.h
@@ -68,7 +68,6 @@
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 @@
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);
diff --git a/sys/i386/acpica/acpi_wakeup.c b/sys/i386/acpica/acpi_wakeup.c
--- a/sys/i386/acpica/acpi_wakeup.c
+++ b/sys/i386/acpica/acpi_wakeup.c
@@ -240,7 +240,7 @@
pmap_remap_lowptdi(true);
/* Call ACPICA to enter the desired sleep state */
- if (state == ACPI_STATE_S4 && acpi_should_do_s4bios(sc))
+ if (state == ACPI_STATE_S4)
status = AcpiEnterSleepStateS4bios();
else
status = AcpiEnterSleepState(state);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Jun 14, 4:30 PM (8 h, 58 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33956226
Default Alt Text
D57414.id179142.diff (3 KB)
Attached To
Mode
D57414: acpi: Forbid requesting S4 when S4BIOS is not supported
Attached
Detach File
Event Timeline
Log In to Comment