Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c61cf4cf authored by Yinghai Lu's avatar Yinghai Lu Committed by Ingo Molnar
Browse files

x86: print out more info in e820_update_range()



Impact: help debug e820 bugs

Try to print out more info, to catch wrong call parameters.

Signed-off-by: default avatarYinghai Lu <yinghai@kernel.org>
LKML-Reference: <49BCB557.3030000@kernel.org>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 6d7942dc
Loading
Loading
Loading
Loading
+35 −21
Original line number Diff line number Diff line
@@ -131,37 +131,43 @@ void __init e820_add_region(u64 start, u64 size, int type)
	__e820_add_region(&e820, start, size, type);
}

void __init e820_print_map(char *who)
static void __init e820_print_type(u32 type)
{
	int i;

	for (i = 0; i < e820.nr_map; i++) {
		printk(KERN_INFO " %s: %016Lx - %016Lx ", who,
		       (unsigned long long) e820.map[i].addr,
		       (unsigned long long)
		       (e820.map[i].addr + e820.map[i].size));
		switch (e820.map[i].type) {
	switch (type) {
	case E820_RAM:
	case E820_RESERVED_KERN:
			printk(KERN_CONT "(usable)\n");
		printk(KERN_CONT "(usable)");
		break;
	case E820_RESERVED:
			printk(KERN_CONT "(reserved)\n");
		printk(KERN_CONT "(reserved)");
		break;
	case E820_ACPI:
			printk(KERN_CONT "(ACPI data)\n");
		printk(KERN_CONT "(ACPI data)");
		break;
	case E820_NVS:
			printk(KERN_CONT "(ACPI NVS)\n");
		printk(KERN_CONT "(ACPI NVS)");
		break;
	case E820_UNUSABLE:
			printk("(unusable)\n");
		printk(KERN_CONT "(unusable)");
		break;
	default:
			printk(KERN_CONT "type %u\n", e820.map[i].type);
		printk(KERN_CONT "type %u", type);
		break;
	}
}

void __init e820_print_map(char *who)
{
	int i;

	for (i = 0; i < e820.nr_map; i++) {
		printk(KERN_INFO " %s: %016Lx - %016Lx ", who,
		       (unsigned long long) e820.map[i].addr,
		       (unsigned long long)
		       (e820.map[i].addr + e820.map[i].size));
		e820_print_type(e820.map[i].type);
		printk(KERN_CONT "\n");
	}
}

/*
@@ -437,6 +443,14 @@ static u64 __init __e820_update_range(struct e820map *e820x, u64 start,
		size = ULLONG_MAX - start;

	end = start + size;
	printk(KERN_DEBUG "e820 update range: %016Lx - %016Lx ",
		       (unsigned long long) start,
		       (unsigned long long) end);
	e820_print_type(old_type);
	printk(KERN_CONT " ==> ");
	e820_print_type(new_type);
	printk(KERN_CONT "\n");

	for (i = 0; i < e820x->nr_map; i++) {
		struct e820entry *ei = &e820x->map[i];
		u64 final_start, final_end;