diff options
author | Michael Neuling <mikey@neuling.org> | 2018-02-22 11:26:51 +1100 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2018-02-28 20:28:28 -0600 |
commit | fa03921a9aa6296b6019c79127db7d009705be2d (patch) | |
tree | 738019874f6bebbb2860eb9ee66ba7f5abc0947e | |
parent | 682e196627a062731dc2596276013f2e9fa9f6db (diff) | |
download | skiboot-fa03921a9aa6296b6019c79127db7d009705be2d.zip skiboot-fa03921a9aa6296b6019c79127db7d009705be2d.tar.gz skiboot-fa03921a9aa6296b6019c79127db7d009705be2d.tar.bz2 |
pci: Move code around
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@neuling.org>
Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
-rw-r--r-- | core/pci.c | 126 |
1 files changed, 63 insertions, 63 deletions
@@ -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 |