diff options
Diffstat (limited to 'arch/i386/pci/mmconfig-shared.c')
-rw-r--r-- | arch/i386/pci/mmconfig-shared.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/arch/i386/pci/mmconfig-shared.c b/arch/i386/pci/mmconfig-shared.c index d72f0439147c..4757554b08cf 100644 --- a/arch/i386/pci/mmconfig-shared.c +++ b/arch/i386/pci/mmconfig-shared.c | |||
@@ -166,6 +166,37 @@ static int __init pci_mmcfg_check_hostbridge(void) | |||
166 | return name != NULL; | 166 | return name != NULL; |
167 | } | 167 | } |
168 | 168 | ||
169 | static __init void pci_mmcfg_insert_resources(void) | ||
170 | { | ||
171 | #define PCI_MMCFG_RESOURCE_NAME_LEN 19 | ||
172 | int i; | ||
173 | struct resource *res; | ||
174 | char *names; | ||
175 | unsigned num_buses; | ||
176 | |||
177 | res = kcalloc(PCI_MMCFG_RESOURCE_NAME_LEN + sizeof(*res), | ||
178 | pci_mmcfg_config_num, GFP_KERNEL); | ||
179 | |||
180 | if (!res) { | ||
181 | printk(KERN_ERR "PCI: Unable to allocate MMCONFIG resources\n"); | ||
182 | return; | ||
183 | } | ||
184 | |||
185 | names = (void *)&res[pci_mmcfg_config_num]; | ||
186 | for (i = 0; i < pci_mmcfg_config_num; i++, res++) { | ||
187 | num_buses = pci_mmcfg_config[i].end_bus_number - | ||
188 | pci_mmcfg_config[i].start_bus_number + 1; | ||
189 | res->name = names; | ||
190 | snprintf(names, PCI_MMCFG_RESOURCE_NAME_LEN, "PCI MMCONFIG %u", | ||
191 | pci_mmcfg_config[i].pci_segment); | ||
192 | res->start = pci_mmcfg_config[i].address; | ||
193 | res->end = res->start + (num_buses << 20) - 1; | ||
194 | res->flags = IORESOURCE_MEM | IORESOURCE_BUSY; | ||
195 | insert_resource(&iomem_resource, res); | ||
196 | names += PCI_MMCFG_RESOURCE_NAME_LEN; | ||
197 | } | ||
198 | } | ||
199 | |||
169 | void __init pci_mmcfg_init(int type) | 200 | void __init pci_mmcfg_init(int type) |
170 | { | 201 | { |
171 | int known_bridge = 0; | 202 | int known_bridge = 0; |
@@ -199,6 +230,8 @@ void __init pci_mmcfg_init(int type) | |||
199 | if (pci_mmcfg_arch_init()) { | 230 | if (pci_mmcfg_arch_init()) { |
200 | if (type == 1) | 231 | if (type == 1) |
201 | unreachable_devices(); | 232 | unreachable_devices(); |
233 | if (known_bridge) | ||
234 | pci_mmcfg_insert_resources(); | ||
202 | pci_probe = (pci_probe & ~PCI_PROBE_MASK) | PCI_PROBE_MMCONF; | 235 | pci_probe = (pci_probe & ~PCI_PROBE_MASK) | PCI_PROBE_MMCONF; |
203 | } | 236 | } |
204 | } | 237 | } |