Commit 30aa80da authored by Yinghai Lu's avatar Yinghai Lu Committed by Bjorn Helgaas

parisc/PCI: register busn_res for root buses

Add the host bridge bus number aperture to the resource list.
Like the MMIO and I/O port apertures, this is used when assigning
resources to hot-added devices or in the case of conflicts.

[bhelgaas: changelog, set flags directly, at LBA bus_num init]
CC: Kyle McMartin <kyle@mcmartin.ca>
CC: Helge Deller <deller@gmx.de>
CC: linux-parisc@vger.kernel.org
Signed-off-by: default avatarYinghai Lu <yinghai@kernel.org>
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
parent be8e60d8
...@@ -898,6 +898,7 @@ static int __init dino_probe(struct parisc_device *dev) ...@@ -898,6 +898,7 @@ static int __init dino_probe(struct parisc_device *dev)
LIST_HEAD(resources); LIST_HEAD(resources);
struct pci_bus *bus; struct pci_bus *bus;
unsigned long hpa = dev->hpa.start; unsigned long hpa = dev->hpa.start;
int max;
name = "Dino"; name = "Dino";
if (is_card_dino(&dev->id)) { if (is_card_dino(&dev->id)) {
...@@ -983,6 +984,10 @@ static int __init dino_probe(struct parisc_device *dev) ...@@ -983,6 +984,10 @@ static int __init dino_probe(struct parisc_device *dev)
if (dino_dev->hba.gmmio_space.flags) if (dino_dev->hba.gmmio_space.flags)
pci_add_resource(&resources, &dino_dev->hba.gmmio_space); pci_add_resource(&resources, &dino_dev->hba.gmmio_space);
dino_dev->hba.bus_num.start = dino_current_bus;
dino_dev->hba.bus_num.end = 255;
dino_dev->hba.bus_num.flags = IORESOURCE_BUS;
pci_add_resource(&resources, &dino_dev->hba.bus_num);
/* /*
** It's not used to avoid chicken/egg problems ** It's not used to avoid chicken/egg problems
** with configuration accessor functions. ** with configuration accessor functions.
...@@ -998,12 +1003,13 @@ static int __init dino_probe(struct parisc_device *dev) ...@@ -998,12 +1003,13 @@ static int __init dino_probe(struct parisc_device *dev)
return 0; return 0;
} }
bus->busn_res.end = pci_scan_child_bus(bus); max = pci_scan_child_bus(bus);
pci_bus_update_busn_res_end(bus, max);
/* This code *depends* on scanning being single threaded /* This code *depends* on scanning being single threaded
* if it isn't, this global bus number count will fail * if it isn't, this global bus number count will fail
*/ */
dino_current_bus = bus->busn_res.end + 1; dino_current_bus = max + 1;
pci_bus_assign_resources(bus); pci_bus_assign_resources(bus);
pci_bus_add_devices(bus); pci_bus_add_devices(bus);
return 0; return 0;
......
...@@ -989,6 +989,7 @@ lba_pat_resources(struct parisc_device *pa_dev, struct lba_device *lba_dev) ...@@ -989,6 +989,7 @@ lba_pat_resources(struct parisc_device *pa_dev, struct lba_device *lba_dev)
case PAT_PBNUM: case PAT_PBNUM:
lba_dev->hba.bus_num.start = p->start; lba_dev->hba.bus_num.start = p->start;
lba_dev->hba.bus_num.end = p->end; lba_dev->hba.bus_num.end = p->end;
lba_dev->hba.bus_num.flags = IORESOURCE_BUS;
break; break;
case PAT_LMMIO: case PAT_LMMIO:
...@@ -1366,6 +1367,7 @@ lba_driver_probe(struct parisc_device *dev) ...@@ -1366,6 +1367,7 @@ lba_driver_probe(struct parisc_device *dev)
void *tmp_obj; void *tmp_obj;
char *version; char *version;
void __iomem *addr = ioremap_nocache(dev->hpa.start, 4096); void __iomem *addr = ioremap_nocache(dev->hpa.start, 4096);
int max;
/* Read HW Rev First */ /* Read HW Rev First */
func_class = READ_REG32(addr + LBA_FCLASS); func_class = READ_REG32(addr + LBA_FCLASS);
...@@ -1502,6 +1504,8 @@ lba_driver_probe(struct parisc_device *dev) ...@@ -1502,6 +1504,8 @@ lba_driver_probe(struct parisc_device *dev)
if (lba_dev->hba.gmmio_space.flags) if (lba_dev->hba.gmmio_space.flags)
pci_add_resource(&resources, &lba_dev->hba.gmmio_space); pci_add_resource(&resources, &lba_dev->hba.gmmio_space);
pci_add_resource(&resources, &lba_dev->hba.bus_num);
dev->dev.platform_data = lba_dev; dev->dev.platform_data = lba_dev;
lba_bus = lba_dev->hba.hba_bus = lba_bus = lba_dev->hba.hba_bus =
pci_create_root_bus(&dev->dev, lba_dev->hba.bus_num.start, pci_create_root_bus(&dev->dev, lba_dev->hba.bus_num.start,
...@@ -1511,7 +1515,7 @@ lba_driver_probe(struct parisc_device *dev) ...@@ -1511,7 +1515,7 @@ lba_driver_probe(struct parisc_device *dev)
return 0; return 0;
} }
lba_bus->busn_res.end = pci_scan_child_bus(lba_bus); max = pci_scan_child_bus(lba_bus);
/* This is in lieu of calling pci_assign_unassigned_resources() */ /* This is in lieu of calling pci_assign_unassigned_resources() */
if (is_pdc_pat()) { if (is_pdc_pat()) {
...@@ -1541,7 +1545,7 @@ lba_driver_probe(struct parisc_device *dev) ...@@ -1541,7 +1545,7 @@ lba_driver_probe(struct parisc_device *dev)
lba_dev->flags |= LBA_FLAG_SKIP_PROBE; lba_dev->flags |= LBA_FLAG_SKIP_PROBE;
} }
lba_next_bus = lba_res->busn_res.end + 1; lba_next_bus = max + 1;
pci_bus_add_devices(lba_bus); pci_bus_add_devices(lba_bus);
/* Whew! Finally done! Tell services we got this one covered. */ /* Whew! Finally done! Tell services we got this one covered. */
......
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