aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/probe.c
diff options
context:
space:
mode:
authorYinghai Lu <yinghai@kernel.org>2012-05-17 21:51:11 -0400
committerBjorn Helgaas <bhelgaas@google.com>2012-06-13 17:42:22 -0400
commit5cc62c202211096ec26309722ec27455d52c8726 (patch)
tree10813ef6be2b7bbb176cc37d3127704586e448f6 /drivers/pci/probe.c
parent3527ed81ca01bbaf09df952e68528377a9cd092f (diff)
PCI: build a bus number resource tree for every domain
This adds get_pci_domain_busn_res(), which returns the root of the bus number resource tree for a domain, creating it if necessary. We will later populate the tree with the bus numbers used by host bridges and P2P bridges in the domain. [bhelgaas: changelog] Signed-off-by: Yinghai Lu <yinghai@kernel.org> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'drivers/pci/probe.c')
-rw-r--r--drivers/pci/probe.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 651b096134dc..674a477a6486 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -20,6 +20,36 @@
20LIST_HEAD(pci_root_buses); 20LIST_HEAD(pci_root_buses);
21EXPORT_SYMBOL(pci_root_buses); 21EXPORT_SYMBOL(pci_root_buses);
22 22
23static LIST_HEAD(pci_domain_busn_res_list);
24
25struct pci_domain_busn_res {
26 struct list_head list;
27 struct resource res;
28 int domain_nr;
29};
30
31static struct resource *get_pci_domain_busn_res(int domain_nr)
32{
33 struct pci_domain_busn_res *r;
34
35 list_for_each_entry(r, &pci_domain_busn_res_list, list)
36 if (r->domain_nr == domain_nr)
37 return &r->res;
38
39 r = kzalloc(sizeof(*r), GFP_KERNEL);
40 if (!r)
41 return NULL;
42
43 r->domain_nr = domain_nr;
44 r->res.start = 0;
45 r->res.end = 0xff;
46 r->res.flags = IORESOURCE_BUS | IORESOURCE_PCI_FIXED;
47
48 list_add_tail(&r->list, &pci_domain_busn_res_list);
49
50 return &r->res;
51}
52
23static int find_anything(struct device *dev, void *data) 53static int find_anything(struct device *dev, void *data)
24{ 54{
25 return 1; 55 return 1;