git: 14cb4636358f - stable/14 - pcib: Clear any pending slot status events during attach

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Tue, 29 Apr 2025 18:30:54 UTC
The branch stable/14 has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=14cb4636358f1d54c2e0d843164c0dc9afcf012b

commit 14cb4636358f1d54c2e0d843164c0dc9afcf012b
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2025-04-22 02:08:17 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2025-04-29 14:46:40 +0000

    pcib: Clear any pending slot status events during attach
    
    Any events left over from boot firmware, etc. are not meaningful so
    clear pending events during attach.  If they are still pending they
    should remain asserted when the slot status register is re-read.
    
    Reviewed by:    imp
    Differential Revision:  https://reviews.freebsd.org/D49950
    
    (cherry picked from commit ff45e4759a38f44a0199b2948b7b1e987e7c71da)
---
 sys/dev/pci/pci_pci.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sys/dev/pci/pci_pci.c b/sys/dev/pci/pci_pci.c
index 74b830be8a0a..eb48dab1f188 100644
--- a/sys/dev/pci/pci_pci.c
+++ b/sys/dev/pci/pci_pci.c
@@ -1449,6 +1449,7 @@ pcib_setup_hotplug(struct pcib_softc *sc)
 
 	/* Clear any events previously pending. */
 	pcie_write_config(dev, PCIER_SLOT_STA, sc->pcie_slot_sta, 2);
+	sc->pcie_slot_sta = pcie_read_config(dev, PCIER_SLOT_STA, 2);
 
 	/* Enable HotPlug events. */
 	mask = PCIEM_SLOT_CTL_DLLSCE | PCIEM_SLOT_CTL_HPIE |