Commit 517daede authored by Linus Torvalds's avatar Linus Torvalds

Use e820 memory map to determine PCI allocation area.

Don't use the VM numbers (max_low_pfn and friends), since they depend
on the partial kernel linear mapping and only partially on the actual
physical memory layout.
parent fca717c5
...@@ -1166,9 +1166,10 @@ legacy_init_iomem_resources(struct resource *code_resource, struct resource *dat ...@@ -1166,9 +1166,10 @@ legacy_init_iomem_resources(struct resource *code_resource, struct resource *dat
/* /*
* Request address space for all standard resources * Request address space for all standard resources
*/ */
static void __init register_memory(unsigned long max_low_pfn) static void __init register_memory(void)
{ {
unsigned long low_mem_size; long long gapsize;
unsigned long long last;
int i; int i;
if (efi_enabled) if (efi_enabled)
...@@ -1184,9 +1185,21 @@ static void __init register_memory(unsigned long max_low_pfn) ...@@ -1184,9 +1185,21 @@ static void __init register_memory(unsigned long max_low_pfn)
request_resource(&ioport_resource, &standard_io_resources[i]); request_resource(&ioport_resource, &standard_io_resources[i]);
/* Tell the PCI layer not to allocate too close to the RAM area.. */ /* Tell the PCI layer not to allocate too close to the RAM area.. */
low_mem_size = ((max_low_pfn << PAGE_SHIFT) + 0xfffff) & ~0xfffff; last = 0x100000000ull;
if (low_mem_size > pci_mem_start) gapsize = 0x400000;
pci_mem_start = low_mem_size; i = e820.nr_map;
while (--i >= 0) {
unsigned long long start = e820.map[i].addr;
unsigned long long end = start + e820.map[i].size;
long long gap = last - end;
if (gap > gapsize) {
gapsize = gap;
pci_mem_start = ((unsigned long) end + 0xfffff) & ~0xfffff;
}
last = start;
}
printk("Allocating PCI resources starting at %08lx\n", pci_mem_start);
} }
/* Use inline assembly to define this because the nops are defined /* Use inline assembly to define this because the nops are defined
...@@ -1432,7 +1445,7 @@ void __init setup_arch(char **cmdline_p) ...@@ -1432,7 +1445,7 @@ void __init setup_arch(char **cmdline_p)
get_smp_config(); get_smp_config();
#endif #endif
register_memory(max_low_pfn); register_memory();
#ifdef CONFIG_VT #ifdef CONFIG_VT
#if defined(CONFIG_VGA_CONSOLE) #if defined(CONFIG_VGA_CONSOLE)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment