Commit 99cfd107 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] ia32 limit_regions update

Sync this up with 2.4:

 ChangeSet@1.404.2.2  2002-05-06 21:30:10-03:00  hch@infradead.org
 [PATCH] memsetup fixes (again)

 The mem= fixes from Red Hat's tree had a small bug:
 if mem= was not actually used with the additional features, but
 int plain old way, is used the value as the size of memory it
 wants, not the upper limit.  The problem with this is that there
 is a small difference due to memory holes.

 I had one report of a person using mem= to reduce memory size for
 a broken i386 chipset thaty only supports 64MB cached and the rest
 as mtd/slram device for swap.  I got broken as the boundaries changed.
parent defa3962
......@@ -139,22 +139,23 @@ static void __init probe_roms(void)
probe_extension_roms(roms);
}
static void __init limit_regions (unsigned long long size)
static void __init limit_regions(unsigned long long size)
{
unsigned long long current_addr = 0;
int i;
unsigned long long current_size = 0;
for (i = 0; i < e820.nr_map; i++) {
if (e820.map[i].type == E820_RAM) {
current_size += e820.map[i].size;
if (current_size >= size) {
e820.map[i].size -= current_size-size;
current_addr = e820.map[i].addr + e820.map[i].size;
if (current_addr >= size) {
e820.map[i].size -= current_addr-size;
e820.nr_map = i + 1;
return;
}
}
}
}
static void __init add_memory_region(unsigned long long start,
unsigned long long size, int type)
{
......
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