diff options
author | Sebastian Andrzej Siewior <bigeasy@linutronix.de> | 2011-02-22 15:07:36 -0500 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2011-02-23 16:27:52 -0500 |
commit | f1c2b357148ec27fcc6ce0992211209a0ea20d8f (patch) | |
tree | 04cde54cdda61caee0c6115469b9ae3a5088e8f1 /arch/x86/kernel | |
parent | cb4cfd568c1181501419b89d916e8523107c0106 (diff) |
x86: e820: Remove conditional early mapping in parse_e820_ext
This patch ensures that the memory passed from parse_setup_data() is
large enough to cover the complete data structure. That means that the
conditional mapping in parse_e820_ext() can go.
While here, I also attempt not to map two pages if the address is not
aligned to a page boundary.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Dirk Brandewie <dirk.brandewie@gmail.com>
Cc: sodaville@linutronix.de
Cc: devicetree-discuss@lists.ozlabs.org
LKML-Reference: <1298405266-1624-2-git-send-email-bigeasy@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/x86/kernel')
-rw-r--r-- | arch/x86/kernel/e820.c | 8 | ||||
-rw-r--r-- | arch/x86/kernel/setup.c | 17 |
2 files changed, 15 insertions, 10 deletions
diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c index 294f26da0c0c..5fad62684651 100644 --- a/arch/x86/kernel/e820.c +++ b/arch/x86/kernel/e820.c | |||
@@ -667,21 +667,15 @@ __init void e820_setup_gap(void) | |||
667 | * boot_params.e820_map, others are passed via SETUP_E820_EXT node of | 667 | * boot_params.e820_map, others are passed via SETUP_E820_EXT node of |
668 | * linked list of struct setup_data, which is parsed here. | 668 | * linked list of struct setup_data, which is parsed here. |
669 | */ | 669 | */ |
670 | void __init parse_e820_ext(struct setup_data *sdata, unsigned long pa_data) | 670 | void __init parse_e820_ext(struct setup_data *sdata) |
671 | { | 671 | { |
672 | u32 map_len; | ||
673 | int entries; | 672 | int entries; |
674 | struct e820entry *extmap; | 673 | struct e820entry *extmap; |
675 | 674 | ||
676 | entries = sdata->len / sizeof(struct e820entry); | 675 | entries = sdata->len / sizeof(struct e820entry); |
677 | map_len = sdata->len + sizeof(struct setup_data); | ||
678 | if (map_len > PAGE_SIZE) | ||
679 | sdata = early_ioremap(pa_data, map_len); | ||
680 | extmap = (struct e820entry *)(sdata->data); | 676 | extmap = (struct e820entry *)(sdata->data); |
681 | __append_e820_map(extmap, entries); | 677 | __append_e820_map(extmap, entries); |
682 | sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map); | 678 | sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map); |
683 | if (map_len > PAGE_SIZE) | ||
684 | early_iounmap(sdata, map_len); | ||
685 | printk(KERN_INFO "extended physical RAM map:\n"); | 679 | printk(KERN_INFO "extended physical RAM map:\n"); |
686 | e820_print_map("extended"); | 680 | e820_print_map("extended"); |
687 | } | 681 | } |
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index ca2f10622a79..9521483ce58c 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c | |||
@@ -429,16 +429,27 @@ static void __init parse_setup_data(void) | |||
429 | return; | 429 | return; |
430 | pa_data = boot_params.hdr.setup_data; | 430 | pa_data = boot_params.hdr.setup_data; |
431 | while (pa_data) { | 431 | while (pa_data) { |
432 | data = early_memremap(pa_data, PAGE_SIZE); | 432 | u32 data_len, map_len; |
433 | |||
434 | map_len = max(PAGE_SIZE - (pa_data & ~PAGE_MASK), | ||
435 | (u64)sizeof(struct setup_data)); | ||
436 | data = early_memremap(pa_data, map_len); | ||
437 | data_len = data->len + sizeof(struct setup_data); | ||
438 | if (data_len > map_len) { | ||
439 | early_iounmap(data, map_len); | ||
440 | data = early_memremap(pa_data, data_len); | ||
441 | map_len = data_len; | ||
442 | } | ||
443 | |||
433 | switch (data->type) { | 444 | switch (data->type) { |
434 | case SETUP_E820_EXT: | 445 | case SETUP_E820_EXT: |
435 | parse_e820_ext(data, pa_data); | 446 | parse_e820_ext(data); |
436 | break; | 447 | break; |
437 | default: | 448 | default: |
438 | break; | 449 | break; |
439 | } | 450 | } |
440 | pa_data = data->next; | 451 | pa_data = data->next; |
441 | early_iounmap(data, PAGE_SIZE); | 452 | early_iounmap(data, map_len); |
442 | } | 453 | } |
443 | } | 454 | } |
444 | 455 | ||