Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 15 Jun 2019 20:25:36 +0000 (UTC)
From:      Colin Percival <cperciva@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r349079 - stable/12/sys/dev/pci
Message-ID:  <201906152025.x5FKPar6036974@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: cperciva
Date: Sat Jun 15 20:25:36 2019
New Revision: 349079
URL: https://svnweb.freebsd.org/changeset/base/349079

Log:
  MFC r348681: Only respond to the PCIe Attention Button if a device is
  already plugged in.
  
  This unbreaks attaching disks to EC2 "bare metal" instances.

Modified:
  stable/12/sys/dev/pci/pci_pci.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/pci/pci_pci.c
==============================================================================
--- stable/12/sys/dev/pci/pci_pci.c	Sat Jun 15 20:24:19 2019	(r349078)
+++ stable/12/sys/dev/pci/pci_pci.c	Sat Jun 15 20:25:36 2019	(r349079)
@@ -1167,9 +1167,11 @@ pcib_pcie_intr_hotplug(void *arg)
 {
 	struct pcib_softc *sc;
 	device_t dev;
+	uint16_t old_slot_sta;
 
 	sc = arg;
 	dev = sc->dev;
+	old_slot_sta = sc->pcie_slot_sta;
 	sc->pcie_slot_sta = pcie_read_config(dev, PCIER_SLOT_STA, 2);
 
 	/* Clear the events just reported. */
@@ -1185,7 +1187,8 @@ pcib_pcie_intr_hotplug(void *arg)
 			    "Attention Button Pressed: Detach Cancelled\n");
 			sc->flags &= ~PCIB_DETACH_PENDING;
 			callout_stop(&sc->pcie_ab_timer);
-		} else {
+		} else if (old_slot_sta & PCIEM_SLOT_STA_PDS) {
+			/* Only initiate detach sequence if device present. */
 			device_printf(dev,
 		    "Attention Button Pressed: Detaching in 5 seconds\n");
 			sc->flags |= PCIB_DETACH_PENDING;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201906152025.x5FKPar6036974>