From owner-svn-src-all@freebsd.org Fri Aug 5 23:23:49 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A262FBB0AFC; Fri, 5 Aug 2016 23:23:49 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 616BA1EDC; Fri, 5 Aug 2016 23:23:49 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u75NNmhb099625; Fri, 5 Aug 2016 23:23:48 GMT (envelope-from vangyzen@FreeBSD.org) Received: (from vangyzen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u75NNmD2099623; Fri, 5 Aug 2016 23:23:48 GMT (envelope-from vangyzen@FreeBSD.org) Message-Id: <201608052323.u75NNmD2099623@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vangyzen set sender to vangyzen@FreeBSD.org using -f From: Eric van Gyzen Date: Fri, 5 Aug 2016 23:23:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303788 - in head: sys/dev/pci usr.sbin/pciconf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Aug 2016 23:23:49 -0000 Author: vangyzen Date: Fri Aug 5 23:23:48 2016 New Revision: 303788 URL: https://svnweb.freebsd.org/changeset/base/303788 Log: 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) Reviewed by: jhb MFC after: 3 days Sponsored by: Dell Inc. Differential Revision: https://reviews.freebsd.org/D7426 Modified: head/sys/dev/pci/pci_pci.c head/usr.sbin/pciconf/cap.c Modified: head/sys/dev/pci/pci_pci.c ============================================================================== --- head/sys/dev/pci/pci_pci.c Fri Aug 5 22:23:04 2016 (r303787) +++ head/sys/dev/pci/pci_pci.c Fri Aug 5 23:23:48 2016 (r303788) @@ -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: head/usr.sbin/pciconf/cap.c ============================================================================== --- head/usr.sbin/pciconf/cap.c Fri Aug 5 22:23:04 2016 (r303787) +++ head/usr.sbin/pciconf/cap.c Fri Aug 5 23:23:48 2016 (r303788) @@ -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