Prev: [PATCH 29/29] x86: make e820 to be __initdata
Next: [PATCH 10/29] lmb: Prepare to include linux/lmb.h in core file
From: Yinghai Lu on 30 Mar 2010 07:30 So we can make e820 to be __initdata Signed-off-by: Yinghai Lu <yinghai(a)kernel.org> --- arch/x86/kernel/tboot.c | 22 +++++++++------------- 1 files changed, 9 insertions(+), 13 deletions(-) diff --git a/arch/x86/kernel/tboot.c b/arch/x86/kernel/tboot.c index cc2c604..cf27d64 100644 --- a/arch/x86/kernel/tboot.c +++ b/arch/x86/kernel/tboot.c @@ -170,34 +170,30 @@ static void tboot_create_trampoline(void) #ifdef CONFIG_ACPI_SLEEP -static void add_mac_region(phys_addr_t start, unsigned long size) +static int +add_mac_region(unsigned long start_pfn, unsigned long nr_pages, void *arg) { + u64 start = start_pfn; + u64 size = nr_pages; struct tboot_mac_region *mr; - phys_addr_t end = start + size; if (tboot->num_mac_regions >= MAX_TB_MAC_REGIONS) panic("tboot: Too many MAC regions\n"); if (start && size) { mr = &tboot->mac_regions[tboot->num_mac_regions++]; - mr->start = round_down(start, PAGE_SIZE); - mr->size = round_up(end, PAGE_SIZE) - mr->start; + mr->start = start << PAGE_SHIFT; + mr->size = (u32) (size << PAGE_SHIFT); } + + return 0; } static int tboot_setup_sleep(void) { - int i; - tboot->num_mac_regions = 0; - for (i = 0; i < e820.nr_map; i++) { - if ((e820.map[i].type != E820_RAM) - && (e820.map[i].type != E820_RESERVED_KERN)) - continue; - - add_mac_region(e820.map[i].addr, e820.map[i].size); - } + walk_system_ram_range(0, max_pfn, NULL, add_mac_region); tboot->acpi_sinfo.kernel_s3_resume_vector = acpi_wakeup_address; -- 1.6.4.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ |