The branch main has been updated by obiwac:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=6882fc4cc43653dd52f6d49e15db9dada423455a

commit 6882fc4cc43653dd52f6d49e15db9dada423455a
Author:     Aymeric Wibo <obi...@freebsd.org>
AuthorDate: 2025-08-08 20:15:58 +0000
Commit:     Aymeric Wibo <obi...@freebsd.org>
CommitDate: 2025-08-08 22:30:06 +0000

    pci: Fix dependency on ACPICA for non-ACPI builds
    
    Commit 84bbfc32a3f4 introduced a dependency on ACPICA for non-ACPI
    builds.  This removes that unintended dependency.
    
    While here, print "D3hot" for D3hot in ACPI code instead of just "D3",
    as it was unclear whether that referred to D3hot or D3cold and was
    inconsistent with the `PCI_POWERSTATE_D3` and `ACPI_D_STATE_D3` defines.
    
    Reported by:    jrtc27, free...@sysctl.cz
    Reviewed by:    jrtc27, des, jrm (mentor)
    Approved by:    jrtc27, jrm (mentor)
    Fixes:          84bbfc32a3f4 ("acpi_powerres: D3cold support")
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D51823
---
 sys/dev/acpica/acpivar.h |  3 ++-
 sys/dev/pci/pci.c        |  6 ++----
 sys/dev/pci/pcivar.h     | 12 ++++++++++++
 3 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/sys/dev/acpica/acpivar.h b/sys/dev/acpica/acpivar.h
index 39432731cbcc..6887f080311d 100644
--- a/sys/dev/acpica/acpivar.h
+++ b/sys/dev/acpica/acpivar.h
@@ -520,7 +520,8 @@ acpi_get_verbose(struct acpi_softc *sc)
 static __inline const char *
 acpi_d_state_to_str(int state)
 {
-    const char *strs[ACPI_D_STATE_COUNT] = {"D0", "D1", "D2", "D3", "D3cold"};
+    const char *strs[ACPI_D_STATE_COUNT] = {"D0", "D1", "D2", "D3hot",
+       "D3cold"};
 
     MPASS(state >= ACPI_STATE_D0 && state <= ACPI_D_STATES_MAX);
     return (strs[state]);
diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c
index 4629165f34b2..9e43a4c1909f 100644
--- a/sys/dev/pci/pci.c
+++ b/sys/dev/pci/pci.c
@@ -81,9 +81,6 @@
 
 #include <dev/iommu/iommu.h>
 
-#include <contrib/dev/acpica/include/acpi.h>
-#include <dev/acpica/acpivar.h>
-
 #include "pcib_if.h"
 #include "pci_if.h"
 
@@ -2900,7 +2897,8 @@ pci_set_powerstate_method(device_t dev, device_t child, 
int state)
 
        if (bootverbose)
                pci_printf(cfg, "Transition from %s to %s\n",
-                   acpi_d_state_to_str(oldstate), acpi_d_state_to_str(state));
+                   pci_powerstate_to_str(oldstate),
+                   pci_powerstate_to_str(state));
 
        PCI_WRITE_CONFIG(dev, child, cfg->pp.pp_location + PCIR_POWER_STATUS,
            status, 2);
diff --git a/sys/dev/pci/pcivar.h b/sys/dev/pci/pcivar.h
index 832305b9adee..4abb5e977346 100644
--- a/sys/dev/pci/pcivar.h
+++ b/sys/dev/pci/pcivar.h
@@ -516,8 +516,20 @@ pci_is_vga_memory_range(rman_res_t start, rman_res_t end)
 #define        PCI_POWERSTATE_D3_HOT   3
 #define        PCI_POWERSTATE_D3_COLD  4
 #define        PCI_POWERSTATE_D3       PCI_POWERSTATE_D3_COLD
+#define        PCI_POWERSTATE_MAX      PCI_POWERSTATE_D3_COLD
+#define        PCI_POWERSTATE_COUNT    5
 #define        PCI_POWERSTATE_UNKNOWN  -1
 
+static __inline const char *
+pci_powerstate_to_str(int state)
+{
+    const char *strs[PCI_POWERSTATE_COUNT] = {"D0", "D1", "D2", "D3hot",
+        "D3cold"};
+
+    MPASS(state >= PCI_POWERSTATE_D0 && state <= PCI_POWERSTATE_MAX);
+    return (strs[state]);
+}
+
 static __inline int
 pci_set_powerstate(device_t dev, int state)
 {

Reply via email to