Commit 585c3653 authored by Andrew Morton's avatar Andrew Morton Committed by Dave Jones

[PATCH] Fix mem= options

Patch from "Randy.Dunlap" <rddunlap@osdl.org>

Reverts the recent alteration of the format of the `mem=' option.  This is
because `mem=' is interpreted by bootloaders and may not be freely changed.

Instead, the new functionality to set specific memory region usages is
provided via the new "memmap=" option.

The documentation for memmap= is added, and the documentation for mem= is
updated.
parent 538316d2
...@@ -71,6 +71,8 @@ In addition, the following text indicates that the option: ...@@ -71,6 +71,8 @@ In addition, the following text indicates that the option:
Parameters denoted with BOOT are actually interpreted by the boot Parameters denoted with BOOT are actually interpreted by the boot
loader, and have no meaning to the kernel directly. loader, and have no meaning to the kernel directly.
Do not modify the syntax of boot loader parameters without extreme
need or coordination with <Documentation/i386/boot.txt>.
Note that ALL kernel parameters listed below are CASE SENSITIVE, and that Note that ALL kernel parameters listed below are CASE SENSITIVE, and that
a trailing = on the name of any parameter states that that parameter will a trailing = on the name of any parameter states that that parameter will
...@@ -502,30 +504,30 @@ running once the system is up. ...@@ -502,30 +504,30 @@ running once the system is up.
Format: <first>,<last> Format: <first>,<last>
Specifies range of consoles to be captured by the MDA. Specifies range of consoles to be captured by the MDA.
mem=exactmap [KNL,BOOT,IA-32] Enable setting of an exact
E820 memory map, as specified by the user.
Such mem=exactmap lines can be constructed based on
BIOS output or other requirements. See the mem=nn@ss
option description.
mem=nn[KMG] [KNL,BOOT] Force usage of a specific amount of memory mem=nn[KMG] [KNL,BOOT] Force usage of a specific amount of memory
Amount of memory to be used when the kernel is not able Amount of memory to be used when the kernel is not able
to see the whole system memory or for test. to see the whole system memory or for test.
mem=nn[KMG]@ss[KMG] mem=nopentium [BUGS=IA-32] Disable usage of 4MB pages for kernel
[KNL,BOOT] Force usage of a specific region of memory memory.
Region of memory to be used, from ss to ss+nn.
mem=nn[KMG]#ss[KMG] memmap=exactmap [KNL,IA-32] Enable setting of an exact
[KNL,BOOT,ACPI] Mark specific memory as ACPI data. E820 memory map, as specified by the user.
Such memmap=exactmap lines can be constructed based on
BIOS output or other requirements. See the memmap=nn@ss
option description.
memmap=nn[KMG]@ss[KMG]
[KNL] Force usage of a specific region of memory
Region of memory to be used, from ss to ss+nn. Region of memory to be used, from ss to ss+nn.
mem=nn[KMG]$ss[KMG] memmap=nn[KMG]#ss[KMG]
[KNL,BOOT,ACPI] Mark specific memory as reserved. [KNL,ACPI] Mark specific memory as ACPI data.
Region of memory to be used, from ss to ss+nn. Region of memory to be used, from ss to ss+nn.
mem=nopentium [BUGS=IA-32] Disable usage of 4MB pages for kernel memmap=nn[KMG]$ss[KMG]
memory. [KNL,ACPI] Mark specific memory as reserved.
Region of memory to be used, from ss to ss+nn.
memfrac= [KNL] memfrac= [KNL]
......
...@@ -525,8 +525,11 @@ static void __init parse_cmdline_early (char ** cmdline_p) ...@@ -525,8 +525,11 @@ static void __init parse_cmdline_early (char ** cmdline_p)
* "mem=nopentium" disables the 4MB page tables. * "mem=nopentium" disables the 4MB page tables.
* "mem=XXX[kKmM]" defines a memory region from HIGH_MEM * "mem=XXX[kKmM]" defines a memory region from HIGH_MEM
* to <mem>, overriding the bios size. * to <mem>, overriding the bios size.
* "mem=XXX[KkmM]@XXX[KkmM]" defines a memory region from * "memmap=XXX[KkmM]@XXX[KkmM]" defines a memory region from
* <start> to <start>+<mem>, overriding the bios size. * <start> to <start>+<mem>, overriding the bios size.
*
* HPA tells me bootloaders need to parse mem=, so no new
* option should be mem= [also see Documentation/i386/boot.txt]
*/ */
if (c == ' ' && !memcmp(from, "mem=", 4)) { if (c == ' ' && !memcmp(from, "mem=", 4)) {
if (to != command_line) if (to != command_line)
...@@ -535,8 +538,26 @@ static void __init parse_cmdline_early (char ** cmdline_p) ...@@ -535,8 +538,26 @@ static void __init parse_cmdline_early (char ** cmdline_p)
from += 9+4; from += 9+4;
clear_bit(X86_FEATURE_PSE, boot_cpu_data.x86_capability); clear_bit(X86_FEATURE_PSE, boot_cpu_data.x86_capability);
disable_pse = 1; disable_pse = 1;
} else if (!memcmp(from+4, "exactmap", 8)) { } else {
from += 8+4; /* If the user specifies memory size, we
* limit the BIOS-provided memory map to
* that size. exactmap can be used to specify
* the exact map. mem=number can be used to
* trim the existing memory map.
*/
unsigned long long mem_size;
mem_size = memparse(from+4, &from);
limit_regions(mem_size);
userdef=1;
}
}
if (c == ' ' && !memcmp(from, "memmap=", 7)) {
if (to != command_line)
to--;
if (!memcmp(from+7, "exactmap", 8)) {
from += 8+7;
e820.nr_map = 0; e820.nr_map = 0;
userdef = 1; userdef = 1;
} else { } else {
...@@ -548,7 +569,7 @@ static void __init parse_cmdline_early (char ** cmdline_p) ...@@ -548,7 +569,7 @@ static void __init parse_cmdline_early (char ** cmdline_p)
*/ */
unsigned long long start_at, mem_size; unsigned long long start_at, mem_size;
mem_size = memparse(from+4, &from); mem_size = memparse(from+7, &from);
if (*from == '@') { if (*from == '@') {
start_at = memparse(from+1, &from); start_at = memparse(from+1, &from);
add_memory_region(start_at, mem_size, E820_RAM); add_memory_region(start_at, mem_size, E820_RAM);
......
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