git: 3e271569ab62 - stable/14 - pci: Adapt PME capability queries to stable/14

From: Kevin Bowling <kbowling_at_FreeBSD.org>
Date: Sun, 13 Sep 2026 01:53:14 UTC
The branch stable/14 has been updated by kbowling:

URL: https://cgit.FreeBSD.org/src/commit/?id=3e271569ab62ab38cf42d4cd2e88c75ddacc5e59

commit 3e271569ab62ab38cf42d4cd2e88c75ddacc5e59
Author:     Kevin Bowling <kbowling@FreeBSD.org>
AuthorDate: 2026-09-13 01:47:39 +0000
Commit:     Kevin Bowling <kbowling@FreeBSD.org>
CommitDate: 2026-09-13 01:50:42 +0000

    pci: Adapt PME capability queries to stable/14
    
    Add explicit D3hot and D3cold names and the bounds needed by
    pci_has_pme(), while retaining PCI_POWERSTATE_D3 == 3.  D3cold is a
    capability-query state here, not a newly supported power transition.
    This avoids importing the ACPI D3cold changes for the PME and igc
    Wake-on-LAN backports.
    
    Use pci_has_pm() to check capability presence instead of pp_location,
    which is not present in stable/14.  Keep the PCI configuration structure
    layout unchanged.
    
    Fixes: d831cb2ad3d8 ("pci: Expose PME support by power state")
    Fixes: 443dc80b712c ("igc: Correct Wake-on-LAN filter programming")
---
 sys/dev/pci/pci.c    | 2 +-
 sys/dev/pci/pcivar.h | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c
index a6df0ff2ebc7..38d80a87b48e 100644
--- a/sys/dev/pci/pci.c
+++ b/sys/dev/pci/pci.c
@@ -3017,7 +3017,7 @@ pci_has_pme(device_t dev, int state)
 
 	if (state < PCI_POWERSTATE_D0 || state > PCI_POWERSTATE_MAX)
 		return (false);
-	return (cfg->pp.pp_location != 0 &&
+	return (pci_has_pm(dev) &&
 	    (cfg->pp.pp_cap & pme_mask[state]) != 0);
 }
 
diff --git a/sys/dev/pci/pcivar.h b/sys/dev/pci/pcivar.h
index b71814f79aed..592e926d0d0d 100644
--- a/sys/dev/pci/pcivar.h
+++ b/sys/dev/pci/pcivar.h
@@ -517,6 +517,11 @@ pci_is_vga_memory_range(rman_res_t start, rman_res_t end)
 #define	PCI_POWERSTATE_D1	1
 #define	PCI_POWERSTATE_D2	2
 #define	PCI_POWERSTATE_D3	3
+#define	PCI_POWERSTATE_D3_HOT	PCI_POWERSTATE_D3
+/* D3cold is a PME query state, not a supported power-state transition. */
+#define	PCI_POWERSTATE_D3_COLD	4
+#define	PCI_POWERSTATE_MAX	PCI_POWERSTATE_D3_COLD
+#define	PCI_POWERSTATE_COUNT	5
 #define	PCI_POWERSTATE_UNKNOWN	-1
 
 static __inline int