This revision is sort of a draft :) Want to get feedback on this design.
The idea behind this is to pull out the sleep types (stype) from ACPI, as was previously being done in D48732, and to pass this sleep type to power_pm_fn instead of passing the existing sleep state. This is a little awkward because we already kinda have generic sleep states (POWER_SLEEP_STATE_*), but these are not precise enough to build upon.
I think "stype" is a poor name. Ideally we should permute the POWER_SLEEP_STATE_* and STYPE names, though idk if we can/wanna change that. Better ideas welcome. Maybe we should just replace POWER_SLEEP_STATE_* entirely if allowed.
This revision also adds generic equivalents to hw.acpi.suspend_state etc sysctls, e.g. kern.power.suspend.
I intend to have the PM backend (e.g. ACPI) report supported stypes when registering in power_pm_register in a subsequent revision, and to have a kern.power.supported_stype sysctl similar to hw.acpi.supported_sleep_state. The default values to kern.power.suspend etc will depend on the reported supported sleep states.
S1 and S2 are rolled into POWER_STYPE_STANDBY, and the hw.acpi.suspend_sx sysctl chooses which underlying ACPI state to enter
when standbying (see acpi_stype_to_sstate).
This is sort of out of scope for this revision, but currently in acpi_pm_func I'm converting the stype straight to an ACPI sleep state. The next revision will make acpi_EnterSleepState itself accept an stype. This isn't ideal but we kinda need to do this to support s2idle (which is not an ACPI S-state) in future revisions. A "proper" solution would involve pulling out a lot of the logic in acpi_EnterSleepState, maybe into sys/kern/subr_power.c, but that requires a lot of
reworking.