diff mbox

[Xenial,SRU] Revert "UBUNTU: SAUCE: (noup) powerpc/pci: Assign fixed PHB number based on device-tree properties"

Message ID 1460128695-13918-1-git-send-email-tim.gardner@canonical.com
State New
Headers show

Commit Message

Tim Gardner April 8, 2016, 3:18 p.m. UTC
From: Tim Gardner <tim.gardner@canonical.com>

BugLink: http://bugs.launchpad.net/bugs/1567581

This reverts commit ebfd4a071e73632b9b533453e3d4a3e0967552c4.

Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
---
 arch/powerpc/kernel/pci-common.c | 40 +++-------------------------------------
 1 file changed, 3 insertions(+), 37 deletions(-)

Comments

Seth Forshee April 11, 2016, 2:22 p.m. UTC | #1

Stefan Bader April 11, 2016, 2:24 p.m. UTC | #2
Hope the next thing won't be complaining about whatever this originally was
supposed to fix.
Tim Gardner April 11, 2016, 6:48 p.m. UTC | #3

diff mbox

Patch

diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index d6fc895..6fd99ac 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -44,11 +44,8 @@ 
 static DEFINE_SPINLOCK(hose_spinlock);
 LIST_HEAD(hose_list);
 
-/* For dynamic PHB numbering on get_phb_number(): max number of PHBs. */
-#define	MAX_PHBS	8192
-
-/* For dynamic PHB numbering: used/free PHBs tracking bitmap. */
-static DECLARE_BITMAP(phb_bitmap, MAX_PHBS);
+/* XXX kill that some day ... */
+static int global_phb_number;		/* Global phb counter */
 
 /* ISA Memory physical address */
 resource_size_t isa_mem_base;
@@ -67,32 +64,6 @@  struct dma_map_ops *get_pci_dma_ops(void)
 }
 EXPORT_SYMBOL(get_pci_dma_ops);
 
-static int get_phb_number(struct device_node *dn)
-{
-	const __be64 *prop64;
-	const __be32 *regs;
-	int phb_id = 0;
-
-	/* try fixed PHB numbering first, by checking archs and reading
-	 * the respective device-tree property. */
-	if (machine_is(pseries)) {
-		regs = of_get_property(dn, "reg", NULL);
-		if (regs)
-			return (int)(be32_to_cpu(regs[1]) & 0xFFFF);
-	} else if (machine_is(powernv)) {
-		prop64 = of_get_property(dn, "ibm,opal-phbid", NULL);
-		if (prop64)
-			return (int)(be64_to_cpup(prop64) & 0xFFFF);
-	}
-
-	/* if not pSeries nor PowerNV, fallback to dynamic PHB numbering */
-	phb_id = find_first_zero_bit(phb_bitmap, MAX_PHBS);
-	BUG_ON(phb_id >= MAX_PHBS); /* reached maximum number of PHBs */
-	set_bit(phb_id, phb_bitmap);
-
-	return phb_id;
-}
-
 struct pci_controller *pcibios_alloc_controller(struct device_node *dev)
 {
 	struct pci_controller *phb;
@@ -101,7 +72,7 @@  struct pci_controller *pcibios_alloc_controller(struct device_node *dev)
 	if (phb == NULL)
 		return NULL;
 	spin_lock(&hose_spinlock);
-	phb->global_number = get_phb_number(dev);
+	phb->global_number = global_phb_number++;
 	list_add_tail(&phb->list_node, &hose_list);
 	spin_unlock(&hose_spinlock);
 	phb->dn = dev;
@@ -123,11 +94,6 @@  EXPORT_SYMBOL_GPL(pcibios_alloc_controller);
 void pcibios_free_controller(struct pci_controller *phb)
 {
 	spin_lock(&hose_spinlock);
-
-	/* clear bit of phb_bitmap to allow reuse of this phb number */
-	if (phb->global_number < MAX_PHBS)
-		clear_bit(phb->global_number, phb_bitmap);
-
 	list_del(&phb->list_node);
 	spin_unlock(&hose_spinlock);