[Skiboot] [RFC PATCH 08/23] core/pcie-slot: Use pci_slot_generic_freset()

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


Switch to the generic method and remove the pcie slot specific one.

Signed-off-by: Oliver O'Halloran <oohall at gmail.com>
---
 core/pcie-slot.c | 50 +-----------------------------------------------
 1 file changed, 1 insertion(+), 49 deletions(-)

diff --git a/core/pcie-slot.c b/core/pcie-slot.c
index 0ed903501178..213740a683c7 100644
--- a/core/pcie-slot.c
+++ b/core/pcie-slot.c
@@ -411,54 +411,6 @@ static int64_t pcie_slot_sm_hreset(struct pci_slot *slot)
 	return OPAL_HARDWARE;
 }
 
-/*
- * Usually, individual platforms need to override the power
- * management methods for fundamental reset, but the hot
- * reset method is commonly shared.
- */
-static int64_t pcie_slot_sm_freset(struct pci_slot *slot)
-{
-	uint8_t power_state = PCI_SLOT_POWER_ON;
-
-	switch (slot->state) {
-	case PCI_SLOT_STATE_NORMAL:
-		PCIE_SLOT_DBG(slot, "FRESET: Starts\n");
-		if (slot->ops.prepare_link_change)
-			slot->ops.prepare_link_change(slot, false);
-
-		/* Retrieve power state */
-		if (slot->ops.get_power_state) {
-			PCIE_SLOT_DBG(slot, "FRESET: Retrieve power state\n");
-			slot->ops.get_power_state(slot, &power_state);
-		}
-
-		/* In power on state, power it off */
-		if (power_state == PCI_SLOT_POWER_ON) {
-			PCIE_SLOT_DBG(slot, "FRESET: Power is on, turn off\n");
-			pcie_slot_set_power_state_ext(slot,
-				PCI_SLOT_POWER_OFF, false);
-			pci_slot_set_state(slot,
-				PCI_SLOT_STATE_FRESET_POWER_OFF);
-			return pci_slot_set_sm_timeout(slot, msecs_to_tb(50));
-		}
-		/* No power state change, */
-		/* fallthrough */
-	case PCI_SLOT_STATE_FRESET_POWER_OFF:
-		PCIE_SLOT_DBG(slot, "FRESET: Power is off, turn on\n");
-		pcie_slot_set_power_state_ext(slot, PCI_SLOT_POWER_ON, false);
-
-		pci_slot_set_state(slot, PCI_SLOT_STATE_LINK_START_POLL);
-		return pci_slot_set_sm_timeout(slot, msecs_to_tb(50));
-	default:
-		prlog(PR_ERR, PCIE_SLOT_PREFIX
-		      "FRESET: Unexpected slot state %08x\n",
-		      slot->id, slot->state);
-	}
-
-	pci_slot_set_state(slot, PCI_SLOT_STATE_NORMAL);
-	return OPAL_HARDWARE;
-}
-
 struct pci_slot *pcie_slot_create(struct phb *phb, struct pci_device *pd)
 {
 	struct pci_slot *slot;
@@ -540,7 +492,7 @@ struct pci_slot *pcie_slot_create(struct phb *phb, struct pci_device *pd)
 	 */
 	slot->ops.poll_link             = pcie_slot_sm_poll_link;
 	slot->ops.hreset                = pcie_slot_sm_hreset;
-	slot->ops.freset                = pcie_slot_sm_freset;
+	slot->ops.freset                = pci_slot_generic_freset;
 
 	slot->wired_lanes    = PCI_SLOT_WIRED_LANES_UNKNOWN;
 	slot->connector_type = PCI_SLOT_CONNECTOR_PCIE_NS;
-- 
2.20.1



More information about the Skiboot mailing list