x86/PCI: get root CRS before scanning children
This allows us to remove adjust_transparent_bridge_resources and give x86_pci_root_bus_res_quirks a chance when _CRS is not used or not there. Acked-by: Gary Hade <garyhade@us.ibm.com> Tested-by: Gary Hade <garyhade@us.ibm.com> Signed-off-by: Yinghai Lu <yinghai@kernel.org> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
This commit is contained in:
@@ -117,23 +117,6 @@ setup_resource(struct acpi_resource *acpi_res, void *data)
|
|||||||
return AE_OK;
|
return AE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
adjust_transparent_bridge_resources(struct pci_bus *bus)
|
|
||||||
{
|
|
||||||
struct pci_dev *dev;
|
|
||||||
|
|
||||||
list_for_each_entry(dev, &bus->devices, bus_list) {
|
|
||||||
int i;
|
|
||||||
u16 class = dev->class >> 8;
|
|
||||||
|
|
||||||
if (class == PCI_CLASS_BRIDGE_PCI && dev->transparent) {
|
|
||||||
for(i = 3; i < PCI_BUS_NUM_RESOURCES; i++)
|
|
||||||
dev->subordinate->resource[i] =
|
|
||||||
dev->bus->resource[i - 3];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
get_current_resources(struct acpi_device *device, int busnum,
|
get_current_resources(struct acpi_device *device, int busnum,
|
||||||
int domain, struct pci_bus *bus)
|
int domain, struct pci_bus *bus)
|
||||||
@@ -161,8 +144,6 @@ get_current_resources(struct acpi_device *device, int busnum,
|
|||||||
info.res_num = 0;
|
info.res_num = 0;
|
||||||
acpi_walk_resources(device->handle, METHOD_NAME__CRS, setup_resource,
|
acpi_walk_resources(device->handle, METHOD_NAME__CRS, setup_resource,
|
||||||
&info);
|
&info);
|
||||||
if (info.res_num)
|
|
||||||
adjust_transparent_bridge_resources(bus);
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -225,8 +206,15 @@ struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_device *device, int do
|
|||||||
*/
|
*/
|
||||||
memcpy(bus->sysdata, sd, sizeof(*sd));
|
memcpy(bus->sysdata, sd, sizeof(*sd));
|
||||||
kfree(sd);
|
kfree(sd);
|
||||||
} else
|
} else {
|
||||||
bus = pci_scan_bus_parented(NULL, busnum, &pci_root_ops, sd);
|
bus = pci_create_bus(NULL, busnum, &pci_root_ops, sd);
|
||||||
|
if (bus) {
|
||||||
|
if (pci_probe & PCI_USE__CRS)
|
||||||
|
get_current_resources(device, busnum, domain,
|
||||||
|
bus);
|
||||||
|
bus->subordinate = pci_scan_child_bus(bus);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!bus)
|
if (!bus)
|
||||||
kfree(sd);
|
kfree(sd);
|
||||||
@@ -241,8 +229,6 @@ struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_device *device, int do
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bus && (pci_probe & PCI_USE__CRS))
|
|
||||||
get_current_resources(device, busnum, domain, bus);
|
|
||||||
return bus;
|
return bus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -100,8 +100,9 @@ void x86_pci_root_bus_res_quirks(struct pci_bus *b)
|
|||||||
int j;
|
int j;
|
||||||
struct pci_root_info *info;
|
struct pci_root_info *info;
|
||||||
|
|
||||||
/* don't go for it if _CRS is used */
|
/* don't go for it if _CRS is used already */
|
||||||
if (pci_probe & PCI_USE__CRS)
|
if (b->resource[0] != &ioport_resource ||
|
||||||
|
b->resource[1] != &iomem_resource)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* if only one root bus, don't need to anything */
|
/* if only one root bus, don't need to anything */
|
||||||
@@ -116,6 +117,9 @@ void x86_pci_root_bus_res_quirks(struct pci_bus *b)
|
|||||||
if (i == pci_root_num)
|
if (i == pci_root_num)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
printk(KERN_DEBUG "PCI: peer root bus %02x res updated from pci conf\n",
|
||||||
|
b->number);
|
||||||
|
|
||||||
info = &pci_root_info[i];
|
info = &pci_root_info[i];
|
||||||
for (j = 0; j < info->res_num; j++) {
|
for (j = 0; j < info->res_num; j++) {
|
||||||
struct resource *res;
|
struct resource *res;
|
||||||
|
Reference in New Issue
Block a user