Skip to content

Commit

Permalink
powerpc: Create pci_controller_ops.reset_secondary_bus and shim
Browse files Browse the repository at this point in the history
Add pci_controller_ops.reset_secondary_bus,
shadowing ppc_md.pcibios_reset_secondary_bus.
Add a shim, and changes the callsites to use the shim.

Use pcibios_reset_secondary_bus_shim, as both
pcibios_reset_secondary_bus and pci_reset_secondary_bus
are already taken.

Signed-off-by: Daniel Axtens <dja@axtens.net>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
  • Loading branch information
Daniel Axtens authored and Michael Ellerman committed Apr 11, 2015
1 parent 542070b commit cd16c7b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
17 changes: 17 additions & 0 deletions arch/powerpc/include/asm/pci-bridge.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ struct pci_controller_ops {

/* Called during PCI resource reassignment */
resource_size_t (*window_alignment)(struct pci_bus *, unsigned long type);
void (*reset_secondary_bus)(struct pci_dev *dev);
};

/*
Expand Down Expand Up @@ -346,5 +347,21 @@ static inline resource_size_t pci_window_alignment(struct pci_bus *bus,
return 1;
}

static inline void pcibios_reset_secondary_bus_shim(struct pci_dev *dev)
{
struct pci_controller *phb = pci_bus_to_host(dev->bus);

if (phb->controller_ops.reset_secondary_bus)
phb->controller_ops.reset_secondary_bus(dev);
else if (ppc_md.pcibios_reset_secondary_bus)
ppc_md.pcibios_reset_secondary_bus(dev);
else
/*
* Fallback to the generic function if no
* platform-specific one is provided
*/
pci_reset_secondary_bus(dev);
}

#endif /* __KERNEL__ */
#endif /* _ASM_POWERPC_PCI_BRIDGE_H */
7 changes: 1 addition & 6 deletions arch/powerpc/kernel/pci-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,7 @@ resource_size_t pcibios_window_alignment(struct pci_bus *bus,

void pcibios_reset_secondary_bus(struct pci_dev *dev)
{
if (ppc_md.pcibios_reset_secondary_bus) {
ppc_md.pcibios_reset_secondary_bus(dev);
return;
}

pci_reset_secondary_bus(dev);
pcibios_reset_secondary_bus_shim(dev);
}

static resource_size_t pcibios_io_size(const struct pci_controller *hose)
Expand Down

0 comments on commit cd16c7b

Please sign in to comment.