git: ff45e4759a38 - main - pcib: Clear any pending slot status events during attach

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Tue, 22 Apr 2025 02:58:24 UTC
The branch main has been updated by jhb:

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

commit ff45e4759a38f44a0199b2948b7b1e987e7c71da
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2025-04-22 02:08:17 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2025-04-22 02:08:17 +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
---
 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 cdd717266026..40ed5db4480e 100644
--- a/sys/dev/pci/pci_pci.c
+++ b/sys/dev/pci/pci_pci.c
@@ -1298,6 +1298,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 |