Skip to content

Commit

Permalink
PCI: build a bus number resource tree for every domain
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Bjorn Helgaas <[email protected]>
  • Loading branch information
Yinghai Lu authored and bjorn-helgaas committed Jun 13, 2012
1 parent 3527ed8 commit 5cc62c2
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions drivers/pci/probe.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,36 @@
LIST_HEAD(pci_root_buses);
EXPORT_SYMBOL(pci_root_buses);

static LIST_HEAD(pci_domain_busn_res_list);

struct pci_domain_busn_res {
struct list_head list;
struct resource res;
int domain_nr;
};

static struct resource *get_pci_domain_busn_res(int domain_nr)
{
struct pci_domain_busn_res *r;

list_for_each_entry(r, &pci_domain_busn_res_list, list)
if (r->domain_nr == domain_nr)
return &r->res;

r = kzalloc(sizeof(*r), GFP_KERNEL);
if (!r)
return NULL;

r->domain_nr = domain_nr;
r->res.start = 0;
r->res.end = 0xff;
r->res.flags = IORESOURCE_BUS | IORESOURCE_PCI_FIXED;

list_add_tail(&r->list, &pci_domain_busn_res_list);

return &r->res;
}

static int find_anything(struct device *dev, void *data)
{
return 1;
Expand Down

0 comments on commit 5cc62c2

Please sign in to comment.