Re: git: 84bbfc32a3f4 - main - acpi_powerres: D3cold support
Date: Fri, 08 Aug 2025 13:19:58 UTC
On 8 Aug 2025, at 10:49, Aymeric Wibo <obiwac@freebsd.org> wrote:
>
> The branch main has been updated by obiwac:
>
> URL: https://cgit.FreeBSD.org/src/commit/?id=84bbfc32a3f47bd2e32741247afe516cbeff7789
>
> commit 84bbfc32a3f47bd2e32741247afe516cbeff7789
> Author: Aymeric Wibo <obiwac@FreeBSD.org>
> AuthorDate: 2025-06-14 15:29:25 +0000
> Commit: Aymeric Wibo <obiwac@FreeBSD.org>
> CommitDate: 2025-08-08 09:42:44 +0000
>
> acpi_powerres: D3cold support
>
> Cherry-pick commit 0b76c0a from ACPICA (actypes: Distinguish between
> D3hot/cold, and default `ACPI_STATE_D3` to D3cold).
>
> The same distinction is made between `PCI_POWERSTATE_D3_HOT` and
> `PCI_POWERSTATE_D3_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. Add support for D3cold 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 of just
> "D3".
>
> Reviewed by: markj, ziaee, mckusick (mentor)
> Approved by: markj, mckusick (mentor)
> Sponsored by: The FreeBSD Foundation
> Differential Revision: https://reviews.freebsd.org/D48384
> ---
> share/man/man9/pci.9 | 8 +++-
> sys/compat/linuxkpi/common/include/linux/pci.h | 10 ++---
> sys/contrib/dev/acpica/include/actypes.h | 8 ++--
> sys/dev/acpica/acpi.c | 9 ++--
> sys/dev/acpica/acpi_pci.c | 12 +++---
> sys/dev/acpica/acpi_powerres.c | 58 +++++++++++++++++++-------
> sys/dev/acpica/acpivar.h | 9 ++++
> sys/dev/pci/pci.c | 7 +++-
> sys/dev/pci/pcivar.h | 27 ++++++------
> 9 files changed, 98 insertions(+), 50 deletions(-)
>
> [...]
> diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c
> index f94438cda041..4629165f34b2 100644
> --- a/sys/dev/pci/pci.c
> +++ b/sys/dev/pci/pci.c
> @@ -81,6 +81,9 @@
>
> #include <dev/iommu/iommu.h>
>
> +#include <contrib/dev/acpica/include/acpi.h>
> +#include <dev/acpica/acpivar.h>
> +
This breaks non-ACPI kernel configs. Please revert or fix.
Note this is particularly bad for architectures that don’t use /
support ACPI, i.e. everything except x86 and arm64.
Jessica
> #include "pcib_if.h"
> #include "pci_if.h"
>
> @@ -2896,8 +2899,8 @@ pci_set_powerstate_method(device_t dev, device_t child, int state)
> }
>
> if (bootverbose)
> - pci_printf(cfg, "Transition from D%d to D%d\n", oldstate,
> - state);
> + pci_printf(cfg, "Transition from %s to %s\n",
> + acpi_d_state_to_str(oldstate), acpi_d_state_to_str(state));
>
> PCI_WRITE_CONFIG(dev, child, cfg->pp.pp_location + PCIR_POWER_STATUS,
> status, 2);
> [...]