Page MenuHomeFreeBSD

acpi: Use sleep types defined in sys/power.h
ClosedPublic

Authored by obiwac on Aug 20 2025, 10:33 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Oct 12, 4:53 PM
Unknown Object (File)
Sun, Oct 12, 3:12 PM
Unknown Object (File)
Sun, Oct 12, 3:57 AM
Unknown Object (File)
Thu, Oct 9, 9:53 PM
Unknown Object (File)
Thu, Oct 9, 9:53 PM
Unknown Object (File)
Thu, Oct 9, 9:53 PM
Unknown Object (File)
Thu, Oct 9, 9:53 PM
Unknown Object (File)
Thu, Oct 9, 9:53 PM
Subscribers

Details

Summary

This is as opposed to using ACPI sleep states (ACPI_STATE_S*). We now use POWER_STYPE_* added in D52036.

This is in preparation for adding support for s2idle, which is not an ACPI sleep state, but needs to be handled specially by acpi_EnterSleepState.

Superseeds D48732.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

obiwac created this revision.
sys/dev/acpica/acpi.c
174

Indentation looks wonky here. I think the prevailing style is to tab until aligned with the function name, then add four spaces, so it'd be nice to match.

600

Aren't you effectively breaking compatibility for these sysctls? After this change they report the generic power_stype names instead of ACPI sleep state names.

obiwac marked an inline comment as done and an inline comment as not done.Sep 5 2025, 3:19 PM
obiwac added inline comments.
sys/dev/acpica/acpi.c
600

Yeah I am. This is sort of the main reason why I'm unsure of these changes. We want to be able to tell OSPM to enter a generic "suspend" sleep type instead of an ACPI S-state upon pressing the power button, because this could mean either entering S3 or S0ix (which is not an ACPI state).

610–612

TODO gotta fix this description

sys/dev/acpica/acpi.c
116

Why are these not both bool or BOOLEAN?

600

I think these sysctls are probably too widely used for such breakage to be a good idea. There are quite a few references to these sysctls on various forums. They're also documented in acpi.4, which needs to be updated here.

Since they're taking a string as input, can we instead have sysctl handlers which still accept the old sleep state names as well as the new ones? And perhaps print a warning to the console if one is using the legacy names.

sys/dev/acpica/acpi.c
116

oops, I'll make both bools

600

Since they're taking a string as input, can we instead have sysctl handlers which still accept the old sleep state names as well as the new ones? And perhaps print a warning to the console if one is using the legacy names.

That sounds like a good solution. It still would be a breaking change if e.g. you were to attempt to set it to S1 and standby_state is set to S2, but that's probably not a big deal.

Use own sysctl handler for ACPI stuff so we can still support old S-states here (even though deprecated).

This looks ok to me. It would be best to land this with a man page update, whether that's here or in a separate commit.

sys/dev/acpica/acpi.c
4388

Do you plan to update acpi.4 in this patch?

This revision is now accepted and ready to land.Sep 12 2025, 12:49 PM
mckusick added a subscriber: mckusick.

Mentor approval.

This revision was automatically updated to reflect the committed changes.