[Skiboot] [PATCH 1/2] pci: Move code around

Michael Neuling mikey at neuling.org
Thu Feb 22 11:26:51 AEDT 2018


This just moves some functions around. A future patch will reuse some
of these in different locations, so the order needs to change.

No code or functional changes

Signed-off-by: Michael Neuling <mikey at neuling.org>
---
 core/pci.c | 126 ++++++++++++++++++++++++++++++-------------------------------
 1 file changed, 63 insertions(+), 63 deletions(-)

diff --git a/core/pci.c b/core/pci.c
index 494a33a454..2ed3e05d15 100644
--- a/core/pci.c
+++ b/core/pci.c
@@ -1648,69 +1648,6 @@ void pci_add_device_nodes(struct phb *phb,
 	}
 }
 
-static void __pci_reset(struct list_head *list)
-{
-	struct pci_device *pd;
-	struct pci_cfg_reg_filter *pcrf;
-	int i;
-
-	while ((pd = list_pop(list, struct pci_device, link)) != NULL) {
-		__pci_reset(&pd->children);
-		dt_free(pd->dn);
-		free(pd->slot);
-		while((pcrf = list_pop(&pd->pcrf, struct pci_cfg_reg_filter, link)) != NULL) {
-			free(pcrf);
-		}
-		for(i=0; i < 64; i++)
-			if (pd->cap[i].free_func)
-				pd->cap[i].free_func(pd->cap[i].data);
-		free(pd);
-	}
-}
-
-int64_t pci_reset(void)
-{
-	unsigned int i;
-	struct pci_slot *slot;
-	int64_t rc;
-
-	prlog(PR_NOTICE, "PCI: Clearing all devices...\n");
-
-	/* XXX Do those in parallel (at least the power up
-	 * state machine could be done in parallel)
-	 */
-	for (i = 0; i < ARRAY_SIZE(phbs); i++) {
-		struct phb *phb = phbs[i];
-		if (!phb)
-			continue;
-		__pci_reset(&phb->devices);
-
-		slot = phb->slot;
-		if (!slot || !slot->ops.creset) {
-			PCINOTICE(phb, 0, "Can't do complete reset\n");
-		} else {
-			rc = slot->ops.creset(slot);
-			while (rc > 0) {
-				time_wait(rc);
-				rc = slot->ops.run_sm(slot);
-			}
-			if (rc < 0) {
-				PCIERR(phb, 0, "Complete reset failed "
-				               "(rc=%lld)\n", rc);
-				return rc;
-			}
-		}
-
-		if (phb->ops->ioda_reset)
-			phb->ops->ioda_reset(phb, true);
-	}
-
-	/* Re-Initialize all discovered PCI slots */
-	pci_init_slots();
-
-	return 0;
-}
-
 static void pci_do_jobs(void (*fn)(void *))
 {
 	struct cpu_job **jobs;
@@ -1788,6 +1725,69 @@ void pci_init_slots(void)
 	}
 }
 
+static void __pci_reset(struct list_head *list)
+{
+	struct pci_device *pd;
+	struct pci_cfg_reg_filter *pcrf;
+	int i;
+
+	while ((pd = list_pop(list, struct pci_device, link)) != NULL) {
+		__pci_reset(&pd->children);
+		dt_free(pd->dn);
+		free(pd->slot);
+		while((pcrf = list_pop(&pd->pcrf, struct pci_cfg_reg_filter, link)) != NULL) {
+			free(pcrf);
+		}
+		for(i=0; i < 64; i++)
+			if (pd->cap[i].free_func)
+				pd->cap[i].free_func(pd->cap[i].data);
+		free(pd);
+	}
+}
+
+int64_t pci_reset(void)
+{
+	unsigned int i;
+	struct pci_slot *slot;
+	int64_t rc;
+
+	prlog(PR_NOTICE, "PCI: Clearing all devices...\n");
+
+	/* XXX Do those in parallel (at least the power up
+	 * state machine could be done in parallel)
+	 */
+	for (i = 0; i < ARRAY_SIZE(phbs); i++) {
+		struct phb *phb = phbs[i];
+		if (!phb)
+			continue;
+		__pci_reset(&phb->devices);
+
+		slot = phb->slot;
+		if (!slot || !slot->ops.creset) {
+			PCINOTICE(phb, 0, "Can't do complete reset\n");
+		} else {
+			rc = slot->ops.creset(slot);
+			while (rc > 0) {
+				time_wait(rc);
+				rc = slot->ops.run_sm(slot);
+			}
+			if (rc < 0) {
+				PCIERR(phb, 0, "Complete reset failed "
+				               "(rc=%lld)\n", rc);
+				return rc;
+			}
+		}
+
+		if (phb->ops->ioda_reset)
+			phb->ops->ioda_reset(phb, true);
+	}
+
+	/* Re-Initialize all discovered PCI slots */
+	pci_init_slots();
+
+	return 0;
+}
+
 /*
  * Complete iteration on current level before switching to
  * child level, which is the proper order for restoring
-- 
2.14.1



More information about the Skiboot mailing list