aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/pci/mmconfig_64.c
diff options
context:
space:
mode:
authorBjorn Helgaas <bjorn.helgaas@hp.com>2009-11-13 19:34:49 -0500
committerJesse Barnes <jbarnes@virtuousgeek.org>2009-11-24 18:30:14 -0500
commitff097ddd4aeac790fd51d013c79c2f18ec9a7117 (patch)
tree4a77f081e4ac7e93aa74a102bf372419699468b9 /arch/x86/pci/mmconfig_64.c
parent987c367b4e93be6826394e7c9cc14d28bb5c8810 (diff)
x86/PCI: MMCONFIG: manage pci_mmcfg_region as a list, not a table
This changes pci_mmcfg_region from a table to a list, to make it easier to add and remove MMCONFIG regions for PCI host bridge hotplug. Reviewed-by: Yinghai Lu <yinghai@kernel.org> Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'arch/x86/pci/mmconfig_64.c')
-rw-r--r--arch/x86/pci/mmconfig_64.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/arch/x86/pci/mmconfig_64.c b/arch/x86/pci/mmconfig_64.c
index 78fa05c6c04d..ed1f479b4d0e 100644
--- a/arch/x86/pci/mmconfig_64.c
+++ b/arch/x86/pci/mmconfig_64.c
@@ -14,16 +14,13 @@
14 14
15static char __iomem *get_virt(unsigned int seg, unsigned bus) 15static char __iomem *get_virt(unsigned int seg, unsigned bus)
16{ 16{
17 int i;
18 struct pci_mmcfg_region *cfg; 17 struct pci_mmcfg_region *cfg;
19 18
20 for (i = 0; i < pci_mmcfg_config_num; ++i) { 19 list_for_each_entry(cfg, &pci_mmcfg_list, list)
21 cfg = &pci_mmcfg_config[i];
22 if (cfg->segment == seg && 20 if (cfg->segment == seg &&
23 (cfg->start_bus <= bus) && 21 (cfg->start_bus <= bus) &&
24 (cfg->end_bus >= bus)) 22 (cfg->end_bus >= bus))
25 return cfg->virt; 23 return cfg->virt;
26 }
27 24
28 /* Fall back to type 0 */ 25 /* Fall back to type 0 */
29 return NULL; 26 return NULL;
@@ -122,11 +119,9 @@ static void __iomem * __init mcfg_ioremap(struct pci_mmcfg_region *cfg)
122 119
123int __init pci_mmcfg_arch_init(void) 120int __init pci_mmcfg_arch_init(void)
124{ 121{
125 int i;
126 struct pci_mmcfg_region *cfg; 122 struct pci_mmcfg_region *cfg;
127 123
128 for (i = 0; i < pci_mmcfg_config_num; ++i) { 124 list_for_each_entry(cfg, &pci_mmcfg_list, list) {
129 cfg = &pci_mmcfg_config[i];
130 cfg->virt = mcfg_ioremap(cfg); 125 cfg->virt = mcfg_ioremap(cfg);
131 if (!cfg->virt) { 126 if (!cfg->virt) {
132 printk(KERN_ERR "PCI: Cannot map mmconfig aperture for " 127 printk(KERN_ERR "PCI: Cannot map mmconfig aperture for "
@@ -142,11 +137,9 @@ int __init pci_mmcfg_arch_init(void)
142 137
143void __init pci_mmcfg_arch_free(void) 138void __init pci_mmcfg_arch_free(void)
144{ 139{
145 int i;
146 struct pci_mmcfg_region *cfg; 140 struct pci_mmcfg_region *cfg;
147 141
148 for (i = 0; i < pci_mmcfg_config_num; ++i) { 142 list_for_each_entry(cfg, &pci_mmcfg_list, list) {
149 cfg = &pci_mmcfg_config[i];
150 if (cfg->virt) { 143 if (cfg->virt) {
151 iounmap(cfg->virt + PCI_MMCFG_BUS_OFFSET(cfg->start_bus)); 144 iounmap(cfg->virt + PCI_MMCFG_BUS_OFFSET(cfg->start_bus));
152 cfg->virt = NULL; 145 cfg->virt = NULL;