Commit a10bb128 authored by Yinghai Lu's avatar Yinghai Lu Committed by Bjorn Helgaas

x86/PCI: put busn resource in pci_root_info for native host bridge drivers

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

[bhelgaas: changelog, tidy printk]
Signed-off-by: default avatarYinghai Lu <yinghai@kernel.org>
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
parent 5c1d81d1
...@@ -121,7 +121,6 @@ static int __init early_fill_mp_bus_info(void) ...@@ -121,7 +121,6 @@ static int __init early_fill_mp_bus_info(void)
link = (reg >> 8) & 0x03; link = (reg >> 8) & 0x03;
info = alloc_pci_root_info(min_bus, max_bus, node, link); info = alloc_pci_root_info(min_bus, max_bus, node, link);
sprintf(info->name, "PCI Bus #%02x", min_bus);
} }
/* get the default node and link for left over res */ /* get the default node and link for left over res */
...@@ -300,9 +299,9 @@ static int __init early_fill_mp_bus_info(void) ...@@ -300,9 +299,9 @@ static int __init early_fill_mp_bus_info(void)
int busnum; int busnum;
struct pci_root_res *root_res; struct pci_root_res *root_res;
busnum = info->bus_min; busnum = info->busn.start;
printk(KERN_DEBUG "bus: [%02x, %02x] on node %x link %x\n", printk(KERN_DEBUG "bus: %pR on node %x link %x\n",
info->bus_min, info->bus_max, info->node, info->link); &info->busn, info->node, info->link);
list_for_each_entry(root_res, &info->resources, list) list_for_each_entry(root_res, &info->resources, list)
printk(KERN_DEBUG "bus: %02x %pR\n", printk(KERN_DEBUG "bus: %02x %pR\n",
busnum, &root_res->res); busnum, &root_res->res);
......
...@@ -14,7 +14,7 @@ static struct pci_root_info *x86_find_pci_root_info(int bus) ...@@ -14,7 +14,7 @@ static struct pci_root_info *x86_find_pci_root_info(int bus)
return NULL; return NULL;
list_for_each_entry(info, &pci_root_infos, list) list_for_each_entry(info, &pci_root_infos, list)
if (info->bus_min == bus) if (info->busn.start == bus)
return info; return info;
return NULL; return NULL;
...@@ -24,6 +24,8 @@ void x86_pci_root_bus_resources(int bus, struct list_head *resources) ...@@ -24,6 +24,8 @@ void x86_pci_root_bus_resources(int bus, struct list_head *resources)
{ {
struct pci_root_info *info = x86_find_pci_root_info(bus); struct pci_root_info *info = x86_find_pci_root_info(bus);
struct pci_root_res *root_res; struct pci_root_res *root_res;
struct pci_host_bridge_window *window;
bool found = false;
if (!info) if (!info)
goto default_resources; goto default_resources;
...@@ -31,6 +33,16 @@ void x86_pci_root_bus_resources(int bus, struct list_head *resources) ...@@ -31,6 +33,16 @@ void x86_pci_root_bus_resources(int bus, struct list_head *resources)
printk(KERN_DEBUG "PCI: root bus %02x: hardware-probed resources\n", printk(KERN_DEBUG "PCI: root bus %02x: hardware-probed resources\n",
bus); bus);
/* already added by acpi ? */
list_for_each_entry(window, resources, list)
if (window->res->flags & IORESOURCE_BUS) {
found = true;
break;
}
if (!found)
pci_add_resource(resources, &info->busn);
list_for_each_entry(root_res, &info->resources, list) { list_for_each_entry(root_res, &info->resources, list) {
struct resource *res; struct resource *res;
struct resource *root; struct resource *root;
...@@ -66,9 +78,13 @@ struct pci_root_info __init *alloc_pci_root_info(int bus_min, int bus_max, ...@@ -66,9 +78,13 @@ struct pci_root_info __init *alloc_pci_root_info(int bus_min, int bus_max,
if (!info) if (!info)
return info; return info;
sprintf(info->name, "PCI Bus #%02x", bus_min);
INIT_LIST_HEAD(&info->resources); INIT_LIST_HEAD(&info->resources);
info->bus_min = bus_min; info->busn.name = info->name;
info->bus_max = bus_max; info->busn.start = bus_min;
info->busn.end = bus_max;
info->busn.flags = IORESOURCE_BUS;
info->node = node; info->node = node;
info->link = link; info->link = link;
......
...@@ -13,8 +13,7 @@ struct pci_root_info { ...@@ -13,8 +13,7 @@ struct pci_root_info {
struct list_head list; struct list_head list;
char name[12]; char name[12];
struct list_head resources; struct list_head resources;
int bus_min; struct resource busn;
int bus_max;
int node; int node;
int link; int link;
}; };
......
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