Author: vangyzen
Date: Mon Aug  8 15:07:38 2016
New Revision: 303835
URL: https://svnweb.freebsd.org/changeset/base/303835

Log:
  MFC r303788
  
  Fix some logic in PCIe HotPlug; display EI status
  
  The interpretation of the Electromechanical Interlock Status was
  inverted, so we disengaged the EI if a card was inserted.
  Fix it to engage the EI if a card is inserted.
  
  When displaying the slot capabilites/status with pciconf:
  
  - We inverted the sense of the Power Controller Control bit,
    saying the power was off when it was really on (according to
    this bit).  Fix that.
  
  - Display the status of the Electromechanical Interlock:
        EI(engaged)
        EI(disengaged)
  
  Approved by:  re (gjb)
  Sponsored by: Dell Inc.

Modified:
  stable/11/sys/dev/pci/pci_pci.c
  stable/11/usr.sbin/pciconf/cap.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/pci/pci_pci.c
==============================================================================
--- stable/11/sys/dev/pci/pci_pci.c     Mon Aug  8 13:52:18 2016        
(r303834)
+++ stable/11/sys/dev/pci/pci_pci.c     Mon Aug  8 15:07:38 2016        
(r303835)
@@ -1057,7 +1057,7 @@ static void
 pcib_pcie_hotplug_update(struct pcib_softc *sc, uint16_t val, uint16_t mask,
     bool schedule_task)
 {
-       bool card_inserted;
+       bool card_inserted, ei_engaged;
 
        /* Clear DETACHING if Present Detect has cleared. */
        if ((sc->pcie_slot_sta & (PCIEM_SLOT_STA_PDC | PCIEM_SLOT_STA_PDS)) ==
@@ -1094,8 +1094,8 @@ pcib_pcie_hotplug_update(struct pcib_sof
         */
        if (sc->pcie_slot_cap & PCIEM_SLOT_CAP_EIP) {
                mask |= PCIEM_SLOT_CTL_EIC;
-               if (card_inserted !=
-                   !(sc->pcie_slot_sta & PCIEM_SLOT_STA_EIS))
+               ei_engaged = (sc->pcie_slot_sta & PCIEM_SLOT_STA_EIS) != 0;
+               if (card_inserted != ei_engaged)
                        val |= PCIEM_SLOT_CTL_EIC;
        }
 
@@ -1122,7 +1122,7 @@ pcib_pcie_hotplug_update(struct pcib_sof
        pcib_pcie_hotplug_command(sc, val, mask);
 
        /*
-        * During attach the child "pci" device is added sychronously;
+        * During attach the child "pci" device is added synchronously;
         * otherwise, the task is scheduled to manage the child
         * device.
         */

Modified: stable/11/usr.sbin/pciconf/cap.c
==============================================================================
--- stable/11/usr.sbin/pciconf/cap.c    Mon Aug  8 13:52:18 2016        
(r303834)
+++ stable/11/usr.sbin/pciconf/cap.c    Mon Aug  8 15:07:38 2016        
(r303835)
@@ -529,10 +529,13 @@ cap_express(int fd, struct pci_conf *p, 
        if (cap & PCIEM_SLOT_CAP_APB)
                printf(" Attn Button");
        if (cap & PCIEM_SLOT_CAP_PCP)
-               printf(" PC(%s)", ctl & PCIEM_SLOT_CTL_PCC ? "on" : "off");
+               printf(" PC(%s)", ctl & PCIEM_SLOT_CTL_PCC ? "off" : "on");
        if (cap & PCIEM_SLOT_CAP_MRLSP)
                printf(" MRL(%s)", sta & PCIEM_SLOT_STA_MRLSS ? "open" :
                    "closed");
+       if (cap & PCIEM_SLOT_CAP_EIP)
+               printf(" EI(%s)", sta & PCIEM_SLOT_STA_EIS ? "engaged" :
+                   "disengaged");
 }
 
 static void
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to