Commit 27abfe5c authored by Tim Gardner's avatar Tim Gardner

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

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

This reverts commit ebfd4a07.

Acked-by: seth.forshee@canonical.com
Acked-by: stefan.bader@canonical.com
Signed-off-by: default avatarTim Gardner <tim.gardner@canonical.com>
parent 85b9da23
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment