[Skiboot] [RFC PATCH 12/23] platform/firenze-pci: Use inband perst when possible

Oliver O'Halloran oohall at gmail.com
Wed Apr 3 20:09:09 AEDT 2019


Signed-off-by: Oliver O'Halloran <oohall at gmail.com>
---
 platforms/ibm-fsp/firenze-pci.c | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/platforms/ibm-fsp/firenze-pci.c b/platforms/ibm-fsp/firenze-pci.c
index 3221ba92a83d..fa808244c2bd 100644
--- a/platforms/ibm-fsp/firenze-pci.c
+++ b/platforms/ibm-fsp/firenze-pci.c
@@ -669,20 +669,26 @@ static void firenze_pci_slot_init(struct pci_slot *slot)
 		      slot->id);
 	} else if (info->inband_perst) {
 		/*
-		 * For PLX downstream ports, PCI config register can be
-		 * leveraged to do PERST. If the slot doesn't have external
-		 * power management stuff, lets try to stick to the PERST
-		 * logic if applicable
+		 * For PLX downstream ports the slot doesn't have actual power
+		 * control, but the switch will still assert PERST when "power"
+		 * is disabled via the slot power control bit. We can make use
+		 * of that to PERST cards under the switch.
 		 */
 		if (slot->pd->dev_type == PCIE_TYPE_SWITCH_DNPORT) {
+			uint32_t ecap = pci_cap(slot->pd, PCI_CFG_CAP_ID_EXP,
+						false);
+
 			pci_cfg_read32(slot->phb, slot->pd->bdfn,
 				       PCI_CFG_VENDOR_ID, &vdid);
 			switch (vdid) {
 			case 0x873210b5:        /* PLX8732 */
 			case 0x874810b5:        /* PLX8748 */
-				plat_slot->perst_reg = 0x80;
-				plat_slot->perst_bit = 0x0400;
-				/* placeholder */
+				plat_slot->perst_reg =
+					ecap + PCICAP_EXP_SLOTCTL;
+				plat_slot->perst_bit =
+					PCICAP_EXP_SLOTCTL_PWRCTLR;
+				slot->ops.assert_perst =
+					firenze_pci_inband_perst;
 				break;
 			}
 		}
-- 
2.20.1



More information about the Skiboot mailing list