diff options
author | Jiang Liu <jiang.liu@huawei.com> | 2012-06-22 02:55:11 -0400 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2012-06-22 17:16:14 -0400 |
commit | 846e402300ffa2131239dcf82265b5366cd755f4 (patch) | |
tree | 75647c417de63d4e5f9f4a712ea2387ff910d3a6 /arch/x86/pci | |
parent | 2a76c450bd0377f715caf313ded530290d7dc7d7 (diff) |
x86/PCI: split out pci_mmconfig_alloc() for code reuse
Split out pci_mmconfig_alloc() for code reuse, which will be used
when supporting PCI root bridge hotplug.
Reviewed-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Jiang Liu <liuj97@gmail.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'arch/x86/pci')
-rw-r--r-- | arch/x86/pci/mmconfig-shared.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/arch/x86/pci/mmconfig-shared.c b/arch/x86/pci/mmconfig-shared.c index f799949a08a5..5e2cd2aa2889 100644 --- a/arch/x86/pci/mmconfig-shared.c +++ b/arch/x86/pci/mmconfig-shared.c | |||
@@ -61,8 +61,9 @@ static __init void list_add_sorted(struct pci_mmcfg_region *new) | |||
61 | list_add_tail(&new->list, &pci_mmcfg_list); | 61 | list_add_tail(&new->list, &pci_mmcfg_list); |
62 | } | 62 | } |
63 | 63 | ||
64 | static __init struct pci_mmcfg_region *pci_mmconfig_add(int segment, int start, | 64 | static __devinit struct pci_mmcfg_region *pci_mmconfig_alloc(int segment, |
65 | int end, u64 addr) | 65 | int start, |
66 | int end, u64 addr) | ||
66 | { | 67 | { |
67 | struct pci_mmcfg_region *new; | 68 | struct pci_mmcfg_region *new; |
68 | struct resource *res; | 69 | struct resource *res; |
@@ -79,8 +80,6 @@ static __init struct pci_mmcfg_region *pci_mmconfig_add(int segment, int start, | |||
79 | new->start_bus = start; | 80 | new->start_bus = start; |
80 | new->end_bus = end; | 81 | new->end_bus = end; |
81 | 82 | ||
82 | list_add_sorted(new); | ||
83 | |||
84 | res = &new->res; | 83 | res = &new->res; |
85 | res->start = addr + PCI_MMCFG_BUS_OFFSET(start); | 84 | res->start = addr + PCI_MMCFG_BUS_OFFSET(start); |
86 | res->end = addr + PCI_MMCFG_BUS_OFFSET(end + 1) - 1; | 85 | res->end = addr + PCI_MMCFG_BUS_OFFSET(end + 1) - 1; |
@@ -96,6 +95,18 @@ static __init struct pci_mmcfg_region *pci_mmconfig_add(int segment, int start, | |||
96 | return new; | 95 | return new; |
97 | } | 96 | } |
98 | 97 | ||
98 | static __init struct pci_mmcfg_region *pci_mmconfig_add(int segment, int start, | ||
99 | int end, u64 addr) | ||
100 | { | ||
101 | struct pci_mmcfg_region *new; | ||
102 | |||
103 | new = pci_mmconfig_alloc(segment, start, end, addr); | ||
104 | if (new) | ||
105 | list_add_sorted(new); | ||
106 | |||
107 | return new; | ||
108 | } | ||
109 | |||
99 | struct pci_mmcfg_region *pci_mmconfig_lookup(int segment, int bus) | 110 | struct pci_mmcfg_region *pci_mmconfig_lookup(int segment, int bus) |
100 | { | 111 | { |
101 | struct pci_mmcfg_region *cfg; | 112 | struct pci_mmcfg_region *cfg; |