This patch separates ACPI_STATE_D3 into ACPI_STATE_D3_HOT and ACPI_STATE_D3_COLD. The previous ACPI_STATE_D3 is now defined as ACPI_STATE_D3_COLD. The same distinction has been made between PCI_POWERSTATE_HOT and PCI_POWERSTATE_COLD, as they're defined by ACPI (and are asserted to be the same). D3cold is essentially the same as D3hot except the power resources are turned off. Support for D3cold has been added to acpi_pwr_switch_consumer.
acpi_d_state_to_str replaces the printf("D%d", d_state) pattern, allowing for "D3hot" and "D3cold" strings to be printed instead.
acpi_pwr_get_state was added as a prerequisite to LPI (low-power idle) states. Since these states define minimum D-state constraints on other devices to be able to enter them, it will be necessary to use this function to check them before attempting to do so. Aside from that, this function is currently only used to get the initial D-state of a power consumer when registering it (previously it would be set to ACPI_STATE_UNKNOWN). It uses the _PSC method if available (older devices), or infers the D-state through the _PRx objects with acpi_pwr_infer_state if not.
acpi_pwr_switch_consumer now uses this to verify that the D-state of a power consumer was switched correctly.
The power resource dependencies for each _PRx object are discovered and cached in ac_prx on the power consumer struct (struct acpi_powerconsumer) when a power consumer is registered. This is done in acpi_pwr_get_power_resources. This discovery process also registers those power resources, which were previously only registered when they were referenced by the relevant _PRx object for the target D-state when switching. This meant that the first D-state switch for a power consumer would not turn off any power resources as they wouldn't have been registered yet. This has been fixed.
Sponsored by: The FreeBSD Fondation