Commit 09821ff1 authored by Ingo Molnar's avatar Ingo Molnar

x86/boot/e820: Prefix the E820_* type names with "E820_TYPE_"

So there's a number of constants that start with "E820" but which
are not types - these create a confusing mixture when seen together
with 'enum e820_type' values:

	E820MAP
	E820NR
	E820_X_MAX
	E820MAX

To better differentiate the 'enum e820_type' values prefix them
with E820_TYPE_.

No change in functionality.

Cc: Alex Thorlton <athorlton@sgi.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Huang, Ying <ying.huang@intel.com>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Juergen Gross <jgross@suse.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Paul Jackson <pj@sgi.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Rafael J. Wysocki <rjw@sisk.pl>
Cc: Tejun Heo <tj@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Wei Yang <richard.weiyang@gmail.com>
Cc: Yinghai Lu <yinghai@kernel.org>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent 6afc03b8
...@@ -944,15 +944,15 @@ static efi_status_t setup_e820(struct boot_params *params, ...@@ -944,15 +944,15 @@ static efi_status_t setup_e820(struct boot_params *params,
case EFI_MEMORY_MAPPED_IO: case EFI_MEMORY_MAPPED_IO:
case EFI_MEMORY_MAPPED_IO_PORT_SPACE: case EFI_MEMORY_MAPPED_IO_PORT_SPACE:
case EFI_PAL_CODE: case EFI_PAL_CODE:
e820_type = E820_RESERVED; e820_type = E820_TYPE_RESERVED;
break; break;
case EFI_UNUSABLE_MEMORY: case EFI_UNUSABLE_MEMORY:
e820_type = E820_UNUSABLE; e820_type = E820_TYPE_UNUSABLE;
break; break;
case EFI_ACPI_RECLAIM_MEMORY: case EFI_ACPI_RECLAIM_MEMORY:
e820_type = E820_ACPI; e820_type = E820_TYPE_ACPI;
break; break;
case EFI_LOADER_CODE: case EFI_LOADER_CODE:
...@@ -960,15 +960,15 @@ static efi_status_t setup_e820(struct boot_params *params, ...@@ -960,15 +960,15 @@ static efi_status_t setup_e820(struct boot_params *params,
case EFI_BOOT_SERVICES_CODE: case EFI_BOOT_SERVICES_CODE:
case EFI_BOOT_SERVICES_DATA: case EFI_BOOT_SERVICES_DATA:
case EFI_CONVENTIONAL_MEMORY: case EFI_CONVENTIONAL_MEMORY:
e820_type = E820_RAM; e820_type = E820_TYPE_RAM;
break; break;
case EFI_ACPI_MEMORY_NVS: case EFI_ACPI_MEMORY_NVS:
e820_type = E820_NVS; e820_type = E820_TYPE_NVS;
break; break;
case EFI_PERSISTENT_MEMORY: case EFI_PERSISTENT_MEMORY:
e820_type = E820_PMEM; e820_type = E820_TYPE_PMEM;
break; break;
default: default:
......
...@@ -435,7 +435,7 @@ static void process_e820_entry(struct e820_entry *entry, ...@@ -435,7 +435,7 @@ static void process_e820_entry(struct e820_entry *entry,
unsigned long start_orig; unsigned long start_orig;
/* Skip non-RAM entries. */ /* Skip non-RAM entries. */
if (entry->type != E820_RAM) if (entry->type != E820_TYPE_RAM)
return; return;
/* On 32-bit, ignore entries entirely above our maximum. */ /* On 32-bit, ignore entries entirely above our maximum. */
......
...@@ -97,7 +97,7 @@ static inline int aperture_valid(u64 aper_base, u32 aper_size, u32 min_size) ...@@ -97,7 +97,7 @@ static inline int aperture_valid(u64 aper_base, u32 aper_size, u32 min_size)
printk(KERN_INFO "Aperture beyond 4GB. Ignoring.\n"); printk(KERN_INFO "Aperture beyond 4GB. Ignoring.\n");
return 0; return 0;
} }
if (e820__mapped_any(aper_base, aper_base + aper_size, E820_RAM)) { if (e820__mapped_any(aper_base, aper_base + aper_size, E820_TYPE_RAM)) {
printk(KERN_INFO "Aperture pointing to e820 RAM. Ignoring.\n"); printk(KERN_INFO "Aperture pointing to e820 RAM. Ignoring.\n");
return 0; return 0;
} }
......
...@@ -7,12 +7,12 @@ ...@@ -7,12 +7,12 @@
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
enum e820_type { enum e820_type {
E820_RAM = 1, E820_TYPE_RAM = 1,
E820_RESERVED = 2, E820_TYPE_RESERVED = 2,
E820_ACPI = 3, E820_TYPE_ACPI = 3,
E820_NVS = 4, E820_TYPE_NVS = 4,
E820_UNUSABLE = 5, E820_TYPE_UNUSABLE = 5,
E820_PMEM = 7, E820_TYPE_PMEM = 7,
/* /*
* This is a non-standardized way to represent ADR or * This is a non-standardized way to represent ADR or
...@@ -25,7 +25,7 @@ enum e820_type { ...@@ -25,7 +25,7 @@ enum e820_type {
* type of memory, but newer versions switched to 12 as * type of memory, but newer versions switched to 12 as
* 6 was assigned differently. Some time they will learn... ) * 6 was assigned differently. Some time they will learn... )
*/ */
E820_PRAM = 12, E820_TYPE_PRAM = 12,
/* /*
* Reserved RAM used by the kernel itself if * Reserved RAM used by the kernel itself if
...@@ -34,7 +34,7 @@ enum e820_type { ...@@ -34,7 +34,7 @@ enum e820_type {
* and so should not include any memory that the BIOS * and so should not include any memory that the BIOS
* might alter over the S3 transition: * might alter over the S3 transition:
*/ */
E820_RESERVED_KERN = 128, E820_TYPE_RESERVED_KERN = 128,
}; };
/* /*
......
...@@ -1715,6 +1715,6 @@ int __acpi_release_global_lock(unsigned int *lock) ...@@ -1715,6 +1715,6 @@ int __acpi_release_global_lock(unsigned int *lock)
void __init arch_reserve_mem_area(acpi_physical_address addr, size_t size) void __init arch_reserve_mem_area(acpi_physical_address addr, size_t size)
{ {
e820__range_add(addr, size, E820_ACPI); e820__range_add(addr, size, E820_TYPE_ACPI);
e820__update_table_print(); e820__update_table_print();
} }
...@@ -307,11 +307,11 @@ void __init early_gart_iommu_check(void) ...@@ -307,11 +307,11 @@ void __init early_gart_iommu_check(void)
if (gart_fix_e820 && !fix && aper_enabled) { if (gart_fix_e820 && !fix && aper_enabled) {
if (e820__mapped_any(aper_base, aper_base + aper_size, if (e820__mapped_any(aper_base, aper_base + aper_size,
E820_RAM)) { E820_TYPE_RAM)) {
/* reserve it, so we can reuse it in second kernel */ /* reserve it, so we can reuse it in second kernel */
pr_info("e820: reserve [mem %#010Lx-%#010Lx] for GART\n", pr_info("e820: reserve [mem %#010Lx-%#010Lx] for GART\n",
aper_base, aper_base + aper_size - 1); aper_base, aper_base + aper_size - 1);
e820__range_add(aper_base, aper_size, E820_RESERVED); e820__range_add(aper_base, aper_size, E820_TYPE_RESERVED);
e820__update_table_print(); e820__update_table_print();
} }
} }
......
...@@ -860,7 +860,7 @@ real_trim_memory(unsigned long start_pfn, unsigned long limit_pfn) ...@@ -860,7 +860,7 @@ real_trim_memory(unsigned long start_pfn, unsigned long limit_pfn)
trim_size <<= PAGE_SHIFT; trim_size <<= PAGE_SHIFT;
trim_size -= trim_start; trim_size -= trim_start;
return e820__range_update(trim_start, trim_size, E820_RAM, E820_RESERVED); return e820__range_update(trim_start, trim_size, E820_TYPE_RAM, E820_TYPE_RESERVED);
} }
/** /**
......
...@@ -575,17 +575,17 @@ int crash_setup_memmap_entries(struct kimage *image, struct boot_params *params) ...@@ -575,17 +575,17 @@ int crash_setup_memmap_entries(struct kimage *image, struct boot_params *params)
/* Add first 640K segment */ /* Add first 640K segment */
ei.addr = image->arch.backup_src_start; ei.addr = image->arch.backup_src_start;
ei.size = image->arch.backup_src_sz; ei.size = image->arch.backup_src_sz;
ei.type = E820_RAM; ei.type = E820_TYPE_RAM;
add_e820_entry(params, &ei); add_e820_entry(params, &ei);
/* Add ACPI tables */ /* Add ACPI tables */
cmd.type = E820_ACPI; cmd.type = E820_TYPE_ACPI;
flags = IORESOURCE_MEM | IORESOURCE_BUSY; flags = IORESOURCE_MEM | IORESOURCE_BUSY;
walk_iomem_res_desc(IORES_DESC_ACPI_TABLES, flags, 0, -1, &cmd, walk_iomem_res_desc(IORES_DESC_ACPI_TABLES, flags, 0, -1, &cmd,
memmap_entry_callback); memmap_entry_callback);
/* Add ACPI Non-volatile Storage */ /* Add ACPI Non-volatile Storage */
cmd.type = E820_NVS; cmd.type = E820_TYPE_NVS;
walk_iomem_res_desc(IORES_DESC_ACPI_NV_STORAGE, flags, 0, -1, &cmd, walk_iomem_res_desc(IORES_DESC_ACPI_NV_STORAGE, flags, 0, -1, &cmd,
memmap_entry_callback); memmap_entry_callback);
...@@ -593,7 +593,7 @@ int crash_setup_memmap_entries(struct kimage *image, struct boot_params *params) ...@@ -593,7 +593,7 @@ int crash_setup_memmap_entries(struct kimage *image, struct boot_params *params)
if (crashk_low_res.end) { if (crashk_low_res.end) {
ei.addr = crashk_low_res.start; ei.addr = crashk_low_res.start;
ei.size = crashk_low_res.end - crashk_low_res.start + 1; ei.size = crashk_low_res.end - crashk_low_res.start + 1;
ei.type = E820_RAM; ei.type = E820_TYPE_RAM;
add_e820_entry(params, &ei); add_e820_entry(params, &ei);
} }
...@@ -610,7 +610,7 @@ int crash_setup_memmap_entries(struct kimage *image, struct boot_params *params) ...@@ -610,7 +610,7 @@ int crash_setup_memmap_entries(struct kimage *image, struct boot_params *params)
if (ei.size < PAGE_SIZE) if (ei.size < PAGE_SIZE)
continue; continue;
ei.addr = cmem->ranges[i].start; ei.addr = cmem->ranges[i].start;
ei.type = E820_RAM; ei.type = E820_TYPE_RAM;
add_e820_entry(params, &ei); add_e820_entry(params, &ei);
} }
......
...@@ -148,14 +148,14 @@ void __init e820__range_add(u64 start, u64 size, enum e820_type type) ...@@ -148,14 +148,14 @@ void __init e820__range_add(u64 start, u64 size, enum e820_type type)
static void __init e820_print_type(enum e820_type type) static void __init e820_print_type(enum e820_type type)
{ {
switch (type) { switch (type) {
case E820_RAM: /* Fall through: */ case E820_TYPE_RAM: /* Fall through: */
case E820_RESERVED_KERN: pr_cont("usable"); break; case E820_TYPE_RESERVED_KERN: pr_cont("usable"); break;
case E820_RESERVED: pr_cont("reserved"); break; case E820_TYPE_RESERVED: pr_cont("reserved"); break;
case E820_ACPI: pr_cont("ACPI data"); break; case E820_TYPE_ACPI: pr_cont("ACPI data"); break;
case E820_NVS: pr_cont("ACPI NVS"); break; case E820_TYPE_NVS: pr_cont("ACPI NVS"); break;
case E820_UNUSABLE: pr_cont("unusable"); break; case E820_TYPE_UNUSABLE: pr_cont("unusable"); break;
case E820_PMEM: /* Fall through: */ case E820_TYPE_PMEM: /* Fall through: */
case E820_PRAM: pr_cont("persistent (type %u)", type); break; case E820_TYPE_PRAM: pr_cont("persistent (type %u)", type); break;
default: pr_cont("type %u", type); break; default: pr_cont("type %u", type); break;
} }
} }
...@@ -340,7 +340,7 @@ int __init e820__update_table(struct e820_entry *biosmap, int max_nr_map, u32 *p ...@@ -340,7 +340,7 @@ int __init e820__update_table(struct e820_entry *biosmap, int max_nr_map, u32 *p
} }
/* Continue building up new BIOS map based on this information: */ /* Continue building up new BIOS map based on this information: */
if (current_type != last_type || current_type == E820_PRAM) { if (current_type != last_type || current_type == E820_TYPE_PRAM) {
if (last_type != 0) { if (last_type != 0) {
new_bios[new_bios_entry].size = change_point[chgidx]->addr - last_addr; new_bios[new_bios_entry].size = change_point[chgidx]->addr - last_addr;
/* Move forward only if the new size was non-zero: */ /* Move forward only if the new size was non-zero: */
...@@ -704,7 +704,7 @@ void __init e820_mark_nosave_regions(unsigned long limit_pfn) ...@@ -704,7 +704,7 @@ void __init e820_mark_nosave_regions(unsigned long limit_pfn)
pfn = PFN_DOWN(entry->addr + entry->size); pfn = PFN_DOWN(entry->addr + entry->size);
if (entry->type != E820_RAM && entry->type != E820_RESERVED_KERN) if (entry->type != E820_TYPE_RAM && entry->type != E820_TYPE_RESERVED_KERN)
register_nosave_region(PFN_UP(entry->addr), pfn); register_nosave_region(PFN_UP(entry->addr), pfn);
if (pfn >= limit_pfn) if (pfn >= limit_pfn)
...@@ -724,7 +724,7 @@ static int __init e820_mark_nvs_memory(void) ...@@ -724,7 +724,7 @@ static int __init e820_mark_nvs_memory(void)
for (i = 0; i < e820_table->nr_entries; i++) { for (i = 0; i < e820_table->nr_entries; i++) {
struct e820_entry *entry = &e820_table->entries[i]; struct e820_entry *entry = &e820_table->entries[i];
if (entry->type == E820_NVS) if (entry->type == E820_TYPE_NVS)
acpi_nvs_register(entry->addr, entry->size); acpi_nvs_register(entry->addr, entry->size);
} }
...@@ -747,7 +747,7 @@ u64 __init e820__memblock_alloc_reserved(u64 size, u64 align) ...@@ -747,7 +747,7 @@ u64 __init e820__memblock_alloc_reserved(u64 size, u64 align)
addr = __memblock_alloc_base(size, align, MEMBLOCK_ALLOC_ACCESSIBLE); addr = __memblock_alloc_base(size, align, MEMBLOCK_ALLOC_ACCESSIBLE);
if (addr) { if (addr) {
e820__range_update_firmware(addr, size, E820_RAM, E820_RESERVED); e820__range_update_firmware(addr, size, E820_TYPE_RAM, E820_TYPE_RESERVED);
pr_info("e820: update e820_table_firmware for e820__memblock_alloc_reserved()\n"); pr_info("e820: update e820_table_firmware for e820__memblock_alloc_reserved()\n");
e820__update_table_firmware(); e820__update_table_firmware();
} }
...@@ -805,12 +805,12 @@ static unsigned long __init e820_end_pfn(unsigned long limit_pfn, enum e820_type ...@@ -805,12 +805,12 @@ static unsigned long __init e820_end_pfn(unsigned long limit_pfn, enum e820_type
unsigned long __init e820_end_of_ram_pfn(void) unsigned long __init e820_end_of_ram_pfn(void)
{ {
return e820_end_pfn(MAX_ARCH_PFN, E820_RAM); return e820_end_pfn(MAX_ARCH_PFN, E820_TYPE_RAM);
} }
unsigned long __init e820_end_of_low_ram_pfn(void) unsigned long __init e820_end_of_low_ram_pfn(void)
{ {
return e820_end_pfn(1UL << (32 - PAGE_SHIFT), E820_RAM); return e820_end_pfn(1UL << (32 - PAGE_SHIFT), E820_TYPE_RAM);
} }
static void __init early_panic(char *msg) static void __init early_panic(char *msg)
...@@ -846,7 +846,7 @@ static int __init parse_memopt(char *p) ...@@ -846,7 +846,7 @@ static int __init parse_memopt(char *p)
if (mem_size == 0) if (mem_size == 0)
return -EINVAL; return -EINVAL;
e820__range_remove(mem_size, ULLONG_MAX - mem_size, E820_RAM, 1); e820__range_remove(mem_size, ULLONG_MAX - mem_size, E820_TYPE_RAM, 1);
return 0; return 0;
} }
...@@ -882,18 +882,18 @@ static int __init parse_memmap_one(char *p) ...@@ -882,18 +882,18 @@ static int __init parse_memmap_one(char *p)
userdef = 1; userdef = 1;
if (*p == '@') { if (*p == '@') {
start_at = memparse(p+1, &p); start_at = memparse(p+1, &p);
e820__range_add(start_at, mem_size, E820_RAM); e820__range_add(start_at, mem_size, E820_TYPE_RAM);
} else if (*p == '#') { } else if (*p == '#') {
start_at = memparse(p+1, &p); start_at = memparse(p+1, &p);
e820__range_add(start_at, mem_size, E820_ACPI); e820__range_add(start_at, mem_size, E820_TYPE_ACPI);
} else if (*p == '$') { } else if (*p == '$') {
start_at = memparse(p+1, &p); start_at = memparse(p+1, &p);
e820__range_add(start_at, mem_size, E820_RESERVED); e820__range_add(start_at, mem_size, E820_TYPE_RESERVED);
} else if (*p == '!') { } else if (*p == '!') {
start_at = memparse(p+1, &p); start_at = memparse(p+1, &p);
e820__range_add(start_at, mem_size, E820_PRAM); e820__range_add(start_at, mem_size, E820_TYPE_PRAM);
} else { } else {
e820__range_remove(mem_size, ULLONG_MAX - mem_size, E820_RAM, 1); e820__range_remove(mem_size, ULLONG_MAX - mem_size, E820_TYPE_RAM, 1);
} }
return *p == '\0' ? 0 : -EINVAL; return *p == '\0' ? 0 : -EINVAL;
...@@ -926,7 +926,7 @@ void __init e820_reserve_setup_data(void) ...@@ -926,7 +926,7 @@ void __init e820_reserve_setup_data(void)
while (pa_data) { while (pa_data) {
data = early_memremap(pa_data, sizeof(*data)); data = early_memremap(pa_data, sizeof(*data));
e820__range_update(pa_data, sizeof(*data)+data->len, E820_RAM, E820_RESERVED_KERN); e820__range_update(pa_data, sizeof(*data)+data->len, E820_TYPE_RAM, E820_TYPE_RESERVED_KERN);
pa_data = data->next; pa_data = data->next;
early_memunmap(data, sizeof(*data)); early_memunmap(data, sizeof(*data));
} }
...@@ -956,42 +956,42 @@ void __init e820__finish_early_params(void) ...@@ -956,42 +956,42 @@ void __init e820__finish_early_params(void)
static const char *__init e820_type_to_string(struct e820_entry *entry) static const char *__init e820_type_to_string(struct e820_entry *entry)
{ {
switch (entry->type) { switch (entry->type) {
case E820_RESERVED_KERN: /* Fall-through: */ case E820_TYPE_RESERVED_KERN: /* Fall-through: */
case E820_RAM: return "System RAM"; case E820_TYPE_RAM: return "System RAM";
case E820_ACPI: return "ACPI Tables"; case E820_TYPE_ACPI: return "ACPI Tables";
case E820_NVS: return "ACPI Non-volatile Storage"; case E820_TYPE_NVS: return "ACPI Non-volatile Storage";
case E820_UNUSABLE: return "Unusable memory"; case E820_TYPE_UNUSABLE: return "Unusable memory";
case E820_PRAM: return "Persistent Memory (legacy)"; case E820_TYPE_PRAM: return "Persistent Memory (legacy)";
case E820_PMEM: return "Persistent Memory"; case E820_TYPE_PMEM: return "Persistent Memory";
default: return "Reserved"; default: return "Reserved";
} }
} }
static unsigned long __init e820_type_to_iomem_type(struct e820_entry *entry) static unsigned long __init e820_type_to_iomem_type(struct e820_entry *entry)
{ {
switch (entry->type) { switch (entry->type) {
case E820_RESERVED_KERN: /* Fall-through: */ case E820_TYPE_RESERVED_KERN: /* Fall-through: */
case E820_RAM: return IORESOURCE_SYSTEM_RAM; case E820_TYPE_RAM: return IORESOURCE_SYSTEM_RAM;
case E820_ACPI: /* Fall-through: */ case E820_TYPE_ACPI: /* Fall-through: */
case E820_NVS: /* Fall-through: */ case E820_TYPE_NVS: /* Fall-through: */
case E820_UNUSABLE: /* Fall-through: */ case E820_TYPE_UNUSABLE: /* Fall-through: */
case E820_PRAM: /* Fall-through: */ case E820_TYPE_PRAM: /* Fall-through: */
case E820_PMEM: /* Fall-through: */ case E820_TYPE_PMEM: /* Fall-through: */
default: return IORESOURCE_MEM; default: return IORESOURCE_MEM;
} }
} }
static unsigned long __init e820_type_to_iores_desc(struct e820_entry *entry) static unsigned long __init e820_type_to_iores_desc(struct e820_entry *entry)
{ {
switch (entry->type) { switch (entry->type) {
case E820_ACPI: return IORES_DESC_ACPI_TABLES; case E820_TYPE_ACPI: return IORES_DESC_ACPI_TABLES;
case E820_NVS: return IORES_DESC_ACPI_NV_STORAGE; case E820_TYPE_NVS: return IORES_DESC_ACPI_NV_STORAGE;
case E820_PMEM: return IORES_DESC_PERSISTENT_MEMORY; case E820_TYPE_PMEM: return IORES_DESC_PERSISTENT_MEMORY;
case E820_PRAM: return IORES_DESC_PERSISTENT_MEMORY_LEGACY; case E820_TYPE_PRAM: return IORES_DESC_PERSISTENT_MEMORY_LEGACY;
case E820_RESERVED_KERN: /* Fall-through: */ case E820_TYPE_RESERVED_KERN: /* Fall-through: */
case E820_RAM: /* Fall-through: */ case E820_TYPE_RAM: /* Fall-through: */
case E820_UNUSABLE: /* Fall-through: */ case E820_TYPE_UNUSABLE: /* Fall-through: */
default: return IORES_DESC_NONE; default: return IORES_DESC_NONE;
} }
} }
...@@ -1006,9 +1006,9 @@ static bool __init do_mark_busy(u32 type, struct resource *res) ...@@ -1006,9 +1006,9 @@ static bool __init do_mark_busy(u32 type, struct resource *res)
* for exclusive use of a driver * for exclusive use of a driver
*/ */
switch (type) { switch (type) {
case E820_RESERVED: case E820_TYPE_RESERVED:
case E820_PRAM: case E820_TYPE_PRAM:
case E820_PMEM: case E820_TYPE_PMEM:
return false; return false;
default: default:
return true; return true;
...@@ -1102,7 +1102,7 @@ void __init e820_reserve_resources_late(void) ...@@ -1102,7 +1102,7 @@ void __init e820_reserve_resources_late(void)
struct e820_entry *entry = &e820_table->entries[i]; struct e820_entry *entry = &e820_table->entries[i];
u64 start, end; u64 start, end;
if (entry->type != E820_RAM) if (entry->type != E820_TYPE_RAM)
continue; continue;
start = entry->addr + entry->size; start = entry->addr + entry->size;
...@@ -1148,8 +1148,8 @@ char *__init e820__memory_setup_default(void) ...@@ -1148,8 +1148,8 @@ char *__init e820__memory_setup_default(void)
} }
e820_table->nr_entries = 0; e820_table->nr_entries = 0;
e820__range_add(0, LOWMEMSIZE(), E820_RAM); e820__range_add(0, LOWMEMSIZE(), E820_TYPE_RAM);
e820__range_add(HIGH_MEMORY, mem_size << 10, E820_RAM); e820__range_add(HIGH_MEMORY, mem_size << 10, E820_TYPE_RAM);
} }
return who; return who;
...@@ -1198,7 +1198,7 @@ void __init e820__memblock_setup(void) ...@@ -1198,7 +1198,7 @@ void __init e820__memblock_setup(void)
if (end != (resource_size_t)end) if (end != (resource_size_t)end)
continue; continue;
if (entry->type != E820_RAM && entry->type != E820_RESERVED_KERN) if (entry->type != E820_TYPE_RAM && entry->type != E820_TYPE_RESERVED_KERN)
continue; continue;
memblock_add(entry->addr, entry->size); memblock_add(entry->addr, entry->size);
......
...@@ -546,7 +546,7 @@ intel_graphics_stolen(int num, int slot, int func, ...@@ -546,7 +546,7 @@ intel_graphics_stolen(int num, int slot, int func,
&base, &end); &base, &end);
/* Mark this space as reserved */ /* Mark this space as reserved */
e820__range_add(base, size, E820_RESERVED); e820__range_add(base, size, E820_TYPE_RESERVED);
e820__update_table(e820_table->entries, ARRAY_SIZE(e820_table->entries), &e820_table->nr_entries); e820__update_table(e820_table->entries, ARRAY_SIZE(e820_table->entries), &e820_table->nr_entries);
} }
......
...@@ -232,7 +232,7 @@ setup_boot_parameters(struct kimage *image, struct boot_params *params, ...@@ -232,7 +232,7 @@ setup_boot_parameters(struct kimage *image, struct boot_params *params,
nr_e820_entries = params->e820_entries; nr_e820_entries = params->e820_entries;
for (i = 0; i < nr_e820_entries; i++) { for (i = 0; i < nr_e820_entries; i++) {
if (params->e820_table[i].type != E820_RAM) if (params->e820_table[i].type != E820_TYPE_RAM)
continue; continue;
start = params->e820_table[i].addr; start = params->e820_table[i].addr;
end = params->e820_table[i].addr + params->e820_table[i].size - 1; end = params->e820_table[i].addr + params->e820_table[i].size - 1;
......
...@@ -119,7 +119,7 @@ ...@@ -119,7 +119,7 @@
* max_low_pfn_mapped: highest direct mapped pfn under 4GB * max_low_pfn_mapped: highest direct mapped pfn under 4GB
* max_pfn_mapped: highest direct mapped pfn over 4GB * max_pfn_mapped: highest direct mapped pfn over 4GB
* *
* The direct mapping only covers E820_RAM regions, so the ranges and gaps are * The direct mapping only covers E820_TYPE_RAM regions, so the ranges and gaps are
* represented by pfn_mapped * represented by pfn_mapped
*/ */
unsigned long max_low_pfn_mapped; unsigned long max_low_pfn_mapped;
...@@ -731,14 +731,14 @@ static void __init trim_bios_range(void) ...@@ -731,14 +731,14 @@ static void __init trim_bios_range(void)
* since some BIOSes are known to corrupt low memory. See the * since some BIOSes are known to corrupt low memory. See the
* Kconfig help text for X86_RESERVE_LOW. * Kconfig help text for X86_RESERVE_LOW.
*/ */
e820__range_update(0, PAGE_SIZE, E820_RAM, E820_RESERVED); e820__range_update(0, PAGE_SIZE, E820_TYPE_RAM, E820_TYPE_RESERVED);
/* /*
* special case: Some BIOSen report the PC BIOS * special case: Some BIOSen report the PC BIOS
* area (640->1Mb) as ram even though it is not. * area (640->1Mb) as ram even though it is not.
* take them out. * take them out.
*/ */
e820__range_remove(BIOS_BEGIN, BIOS_END - BIOS_BEGIN, E820_RAM, 1); e820__range_remove(BIOS_BEGIN, BIOS_END - BIOS_BEGIN, E820_TYPE_RAM, 1);
e820__update_table(e820_table->entries, ARRAY_SIZE(e820_table->entries), &e820_table->nr_entries); e820__update_table(e820_table->entries, ARRAY_SIZE(e820_table->entries), &e820_table->nr_entries);
} }
...@@ -750,18 +750,18 @@ static void __init e820_add_kernel_range(void) ...@@ -750,18 +750,18 @@ static void __init e820_add_kernel_range(void)
u64 size = __pa_symbol(_end) - start; u64 size = __pa_symbol(_end) - start;
/* /*
* Complain if .text .data and .bss are not marked as E820_RAM and * Complain if .text .data and .bss are not marked as E820_TYPE_RAM and
* attempt to fix it by adding the range. We may have a confused BIOS, * attempt to fix it by adding the range. We may have a confused BIOS,
* or the user may have used memmap=exactmap or memmap=xxM$yyM to * or the user may have used memmap=exactmap or memmap=xxM$yyM to
* exclude kernel range. If we really are running on top non-RAM, * exclude kernel range. If we really are running on top non-RAM,
* we will crash later anyways. * we will crash later anyways.
*/ */
if (e820__mapped_all(start, start + size, E820_RAM)) if (e820__mapped_all(start, start + size, E820_TYPE_RAM))
return; return;
pr_warn(".text .data .bss are not marked as E820_RAM!\n"); pr_warn(".text .data .bss are not marked as E820_TYPE_RAM!\n");
e820__range_remove(start, size, E820_RAM, 0); e820__range_remove(start, size, E820_TYPE_RAM, 0);
e820__range_add(start, size, E820_RAM); e820__range_add(start, size, E820_TYPE_RAM);
} }
static unsigned reserve_low = CONFIG_X86_RESERVE_LOW << 10; static unsigned reserve_low = CONFIG_X86_RESERVE_LOW << 10;
...@@ -1031,8 +1031,8 @@ void __init setup_arch(char **cmdline_p) ...@@ -1031,8 +1031,8 @@ void __init setup_arch(char **cmdline_p)
trim_bios_range(); trim_bios_range();
#ifdef CONFIG_X86_32 #ifdef CONFIG_X86_32
if (ppro_with_ram_bug()) { if (ppro_with_ram_bug()) {
e820__range_update(0x70000000ULL, 0x40000ULL, E820_RAM, e820__range_update(0x70000000ULL, 0x40000ULL, E820_TYPE_RAM,
E820_RESERVED); E820_TYPE_RESERVED);
e820__update_table(e820_table->entries, ARRAY_SIZE(e820_table->entries), &e820_table->nr_entries); e820__update_table(e820_table->entries, ARRAY_SIZE(e820_table->entries), &e820_table->nr_entries);
printk(KERN_INFO "fixed physical RAM map:\n"); printk(KERN_INFO "fixed physical RAM map:\n");
e820__print_table("bad_ppro"); e820__print_table("bad_ppro");
......
...@@ -69,8 +69,8 @@ void __init tboot_probe(void) ...@@ -69,8 +69,8 @@ void __init tboot_probe(void)
* set_fixmap(), to reduce chance of garbage value causing crash * set_fixmap(), to reduce chance of garbage value causing crash
*/ */
if (!e820__mapped_any(boot_params.tboot_addr, if (!e820__mapped_any(boot_params.tboot_addr,
boot_params.tboot_addr, E820_RESERVED)) { boot_params.tboot_addr, E820_TYPE_RESERVED)) {
pr_warning("non-0 tboot_addr but it is not of type E820_RESERVED\n"); pr_warning("non-0 tboot_addr but it is not of type E820_TYPE_RESERVED\n");
return; return;
} }
...@@ -189,8 +189,8 @@ static int tboot_setup_sleep(void) ...@@ -189,8 +189,8 @@ static int tboot_setup_sleep(void)
tboot->num_mac_regions = 0; tboot->num_mac_regions = 0;
for (i = 0; i < e820_table->nr_entries; i++) { for (i = 0; i < e820_table->nr_entries; i++) {
if ((e820_table->entries[i].type != E820_RAM) if ((e820_table->entries[i].type != E820_TYPE_RAM)
&& (e820_table->entries[i].type != E820_RESERVED_KERN)) && (e820_table->entries[i].type != E820_TYPE_RESERVED_KERN))
continue; continue;
add_mac_region(e820_table->entries[i].addr, e820_table->entries[i].size); add_mac_region(e820_table->entries[i].addr, e820_table->entries[i].size);
......
...@@ -430,7 +430,7 @@ unsigned long __ref init_memory_mapping(unsigned long start, ...@@ -430,7 +430,7 @@ unsigned long __ref init_memory_mapping(unsigned long start,
/* /*
* We need to iterate through the E820 memory map and create direct mappings * We need to iterate through the E820 memory map and create direct mappings
* for only E820_RAM and E820_KERN_RESERVED regions. We cannot simply * for only E820_TYPE_RAM and E820_KERN_RESERVED regions. We cannot simply
* create direct mappings for all pfns from [0 to max_low_pfn) and * create direct mappings for all pfns from [0 to max_low_pfn) and
* [4GB to max_pfn) because of possible memory holes in high addresses * [4GB to max_pfn) because of possible memory holes in high addresses
* that cannot be marked as UC by fixed/variable range MTRRs. * that cannot be marked as UC by fixed/variable range MTRRs.
......
...@@ -338,9 +338,9 @@ phys_pte_init(pte_t *pte_page, unsigned long paddr, unsigned long paddr_end, ...@@ -338,9 +338,9 @@ phys_pte_init(pte_t *pte_page, unsigned long paddr, unsigned long paddr_end,
if (paddr >= paddr_end) { if (paddr >= paddr_end) {
if (!after_bootmem && if (!after_bootmem &&
!e820__mapped_any(paddr & PAGE_MASK, paddr_next, !e820__mapped_any(paddr & PAGE_MASK, paddr_next,
E820_RAM) && E820_TYPE_RAM) &&
!e820__mapped_any(paddr & PAGE_MASK, paddr_next, !e820__mapped_any(paddr & PAGE_MASK, paddr_next,
E820_RESERVED_KERN)) E820_TYPE_RESERVED_KERN))
set_pte(pte, __pte(0)); set_pte(pte, __pte(0));
continue; continue;
} }
...@@ -393,9 +393,9 @@ phys_pmd_init(pmd_t *pmd_page, unsigned long paddr, unsigned long paddr_end, ...@@ -393,9 +393,9 @@ phys_pmd_init(pmd_t *pmd_page, unsigned long paddr, unsigned long paddr_end,
if (paddr >= paddr_end) { if (paddr >= paddr_end) {
if (!after_bootmem && if (!after_bootmem &&
!e820__mapped_any(paddr & PMD_MASK, paddr_next, !e820__mapped_any(paddr & PMD_MASK, paddr_next,
E820_RAM) && E820_TYPE_RAM) &&
!e820__mapped_any(paddr & PMD_MASK, paddr_next, !e820__mapped_any(paddr & PMD_MASK, paddr_next,
E820_RESERVED_KERN)) E820_TYPE_RESERVED_KERN))
set_pmd(pmd, __pmd(0)); set_pmd(pmd, __pmd(0));
continue; continue;
} }
...@@ -479,9 +479,9 @@ phys_pud_init(pud_t *pud_page, unsigned long paddr, unsigned long paddr_end, ...@@ -479,9 +479,9 @@ phys_pud_init(pud_t *pud_page, unsigned long paddr, unsigned long paddr_end,
if (paddr >= paddr_end) { if (paddr >= paddr_end) {
if (!after_bootmem && if (!after_bootmem &&
!e820__mapped_any(paddr & PUD_MASK, paddr_next, !e820__mapped_any(paddr & PUD_MASK, paddr_next,
E820_RAM) && E820_TYPE_RAM) &&
!e820__mapped_any(paddr & PUD_MASK, paddr_next, !e820__mapped_any(paddr & PUD_MASK, paddr_next,
E820_RESERVED_KERN)) E820_TYPE_RESERVED_KERN))
set_pud(pud, __pud(0)); set_pud(pud, __pud(0));
continue; continue;
} }
......
...@@ -452,7 +452,7 @@ static int __ref is_mmconf_reserved(check_reserved_t is_reserved, ...@@ -452,7 +452,7 @@ static int __ref is_mmconf_reserved(check_reserved_t is_reserved,
int num_buses; int num_buses;
char *method = with_e820 ? "E820" : "ACPI motherboard resources"; char *method = with_e820 ? "E820" : "ACPI motherboard resources";
while (!is_reserved(addr, addr + size, E820_RESERVED)) { while (!is_reserved(addr, addr + size, E820_TYPE_RESERVED)) {
size >>= 1; size >>= 1;
if (size < (16UL<<20)) if (size < (16UL<<20))
break; break;
......
...@@ -140,21 +140,21 @@ static void __init do_add_efi_memmap(void) ...@@ -140,21 +140,21 @@ static void __init do_add_efi_memmap(void)
case EFI_BOOT_SERVICES_DATA: case EFI_BOOT_SERVICES_DATA:
case EFI_CONVENTIONAL_MEMORY: case EFI_CONVENTIONAL_MEMORY:
if (md->attribute & EFI_MEMORY_WB) if (md->attribute & EFI_MEMORY_WB)
e820_type = E820_RAM; e820_type = E820_TYPE_RAM;
else else
e820_type = E820_RESERVED; e820_type = E820_TYPE_RESERVED;
break; break;
case EFI_ACPI_RECLAIM_MEMORY: case EFI_ACPI_RECLAIM_MEMORY:
e820_type = E820_ACPI; e820_type = E820_TYPE_ACPI;
break; break;
case EFI_ACPI_MEMORY_NVS: case EFI_ACPI_MEMORY_NVS:
e820_type = E820_NVS; e820_type = E820_TYPE_NVS;
break; break;
case EFI_UNUSABLE_MEMORY: case EFI_UNUSABLE_MEMORY:
e820_type = E820_UNUSABLE; e820_type = E820_TYPE_UNUSABLE;
break; break;
case EFI_PERSISTENT_MEMORY: case EFI_PERSISTENT_MEMORY:
e820_type = E820_PMEM; e820_type = E820_TYPE_PMEM;
break; break;
default: default:
/* /*
...@@ -162,7 +162,7 @@ static void __init do_add_efi_memmap(void) ...@@ -162,7 +162,7 @@ static void __init do_add_efi_memmap(void)
* EFI_RUNTIME_SERVICES_DATA EFI_MEMORY_MAPPED_IO * EFI_RUNTIME_SERVICES_DATA EFI_MEMORY_MAPPED_IO
* EFI_MEMORY_MAPPED_IO_PORT_SPACE EFI_PAL_CODE * EFI_MEMORY_MAPPED_IO_PORT_SPACE EFI_PAL_CODE
*/ */
e820_type = E820_RESERVED; e820_type = E820_TYPE_RESERVED;
break; break;
} }
e820__range_add(start, size, e820_type); e820__range_add(start, size, e820_type);
......
...@@ -242,14 +242,14 @@ void __init efi_arch_mem_reserve(phys_addr_t addr, u64 size) ...@@ -242,14 +242,14 @@ void __init efi_arch_mem_reserve(phys_addr_t addr, u64 size)
* else. We must only reserve (and then free) regions: * else. We must only reserve (and then free) regions:
* *
* - Not within any part of the kernel * - Not within any part of the kernel
* - Not the BIOS reserved area (E820_RESERVED, E820_NVS, etc) * - Not the BIOS reserved area (E820_TYPE_RESERVED, E820_TYPE_NVS, etc)
*/ */
static bool can_free_region(u64 start, u64 size) static bool can_free_region(u64 start, u64 size)
{ {
if (start + size > __pa_symbol(_text) && start <= __pa_symbol(_end)) if (start + size > __pa_symbol(_text) && start <= __pa_symbol(_end))
return false; return false;
if (!e820__mapped_all(start, start+size, E820_RAM)) if (!e820__mapped_all(start, start+size, E820_TYPE_RAM))
return false; return false;
return true; return true;
...@@ -282,7 +282,7 @@ void __init efi_reserve_boot_services(void) ...@@ -282,7 +282,7 @@ void __init efi_reserve_boot_services(void)
* A good example of a critical region that must not be * A good example of a critical region that must not be
* freed is page zero (first 4Kb of memory), which may * freed is page zero (first 4Kb of memory), which may
* contain boot services code/data but is marked * contain boot services code/data but is marked
* E820_RESERVED by trim_bios_range(). * E820_TYPE_RESERVED by trim_bios_range().
*/ */
if (!already_reserved) { if (!already_reserved) {
memblock_reserve(start, size); memblock_reserve(start, size);
......
...@@ -206,7 +206,7 @@ static unsigned long __init xen_find_pfn_range(unsigned long *min_pfn) ...@@ -206,7 +206,7 @@ static unsigned long __init xen_find_pfn_range(unsigned long *min_pfn)
unsigned long s_pfn; unsigned long s_pfn;
unsigned long e_pfn; unsigned long e_pfn;
if (entry->type != E820_RAM) if (entry->type != E820_TYPE_RAM)
continue; continue;
e_pfn = PFN_DOWN(entry->addr + entry->size); e_pfn = PFN_DOWN(entry->addr + entry->size);
...@@ -473,11 +473,11 @@ static unsigned long __init xen_foreach_remap_area(unsigned long nr_pages, ...@@ -473,11 +473,11 @@ static unsigned long __init xen_foreach_remap_area(unsigned long nr_pages,
*/ */
for (i = 0; i < xen_e820_table_entries; i++, entry++) { for (i = 0; i < xen_e820_table_entries; i++, entry++) {
phys_addr_t end = entry->addr + entry->size; phys_addr_t end = entry->addr + entry->size;
if (entry->type == E820_RAM || i == xen_e820_table_entries - 1) { if (entry->type == E820_TYPE_RAM || i == xen_e820_table_entries - 1) {
unsigned long start_pfn = PFN_DOWN(start); unsigned long start_pfn = PFN_DOWN(start);
unsigned long end_pfn = PFN_UP(end); unsigned long end_pfn = PFN_UP(end);
if (entry->type == E820_RAM) if (entry->type == E820_TYPE_RAM)
end_pfn = PFN_UP(entry->addr); end_pfn = PFN_UP(entry->addr);
if (start_pfn < end_pfn) if (start_pfn < end_pfn)
...@@ -591,7 +591,7 @@ static void __init xen_align_and_add_e820_region(phys_addr_t start, ...@@ -591,7 +591,7 @@ static void __init xen_align_and_add_e820_region(phys_addr_t start,
phys_addr_t end = start + size; phys_addr_t end = start + size;
/* Align RAM regions to page boundaries. */ /* Align RAM regions to page boundaries. */
if (type == E820_RAM) { if (type == E820_TYPE_RAM) {
start = PAGE_ALIGN(start); start = PAGE_ALIGN(start);
end &= ~((phys_addr_t)PAGE_SIZE - 1); end &= ~((phys_addr_t)PAGE_SIZE - 1);
} }
...@@ -605,8 +605,8 @@ static void __init xen_ignore_unusable(void) ...@@ -605,8 +605,8 @@ static void __init xen_ignore_unusable(void)
unsigned int i; unsigned int i;
for (i = 0; i < xen_e820_table_entries; i++, entry++) { for (i = 0; i < xen_e820_table_entries; i++, entry++) {
if (entry->type == E820_UNUSABLE) if (entry->type == E820_TYPE_UNUSABLE)
entry->type = E820_RAM; entry->type = E820_TYPE_RAM;
} }
} }
...@@ -623,7 +623,7 @@ bool __init xen_is_e820_reserved(phys_addr_t start, phys_addr_t size) ...@@ -623,7 +623,7 @@ bool __init xen_is_e820_reserved(phys_addr_t start, phys_addr_t size)
entry = xen_e820_table; entry = xen_e820_table;
for (mapcnt = 0; mapcnt < xen_e820_table_entries; mapcnt++) { for (mapcnt = 0; mapcnt < xen_e820_table_entries; mapcnt++) {
if (entry->type == E820_RAM && entry->addr <= start && if (entry->type == E820_TYPE_RAM && entry->addr <= start &&
(entry->addr + entry->size) >= end) (entry->addr + entry->size) >= end)
return false; return false;
...@@ -648,7 +648,7 @@ phys_addr_t __init xen_find_free_area(phys_addr_t size) ...@@ -648,7 +648,7 @@ phys_addr_t __init xen_find_free_area(phys_addr_t size)
struct e820_entry *entry = xen_e820_table; struct e820_entry *entry = xen_e820_table;
for (mapcnt = 0; mapcnt < xen_e820_table_entries; mapcnt++, entry++) { for (mapcnt = 0; mapcnt < xen_e820_table_entries; mapcnt++, entry++) {
if (entry->type != E820_RAM || entry->size < size) if (entry->type != E820_TYPE_RAM || entry->size < size)
continue; continue;
start = entry->addr; start = entry->addr;
for (addr = start; addr < start + size; addr += PAGE_SIZE) { for (addr = start; addr < start + size; addr += PAGE_SIZE) {
...@@ -764,7 +764,7 @@ char * __init xen_memory_setup(void) ...@@ -764,7 +764,7 @@ char * __init xen_memory_setup(void)
xen_e820_table[0].size = mem_end; xen_e820_table[0].size = mem_end;
/* 8MB slack (to balance backend allocations). */ /* 8MB slack (to balance backend allocations). */
xen_e820_table[0].size += 8ULL << 20; xen_e820_table[0].size += 8ULL << 20;
xen_e820_table[0].type = E820_RAM; xen_e820_table[0].type = E820_TYPE_RAM;
rc = 0; rc = 0;
} }
BUG_ON(rc); BUG_ON(rc);
...@@ -819,7 +819,7 @@ char * __init xen_memory_setup(void) ...@@ -819,7 +819,7 @@ char * __init xen_memory_setup(void)
chunk_size = size; chunk_size = size;
type = xen_e820_table[i].type; type = xen_e820_table[i].type;
if (type == E820_RAM) { if (type == E820_TYPE_RAM) {
if (addr < mem_end) { if (addr < mem_end) {
chunk_size = min(size, mem_end - addr); chunk_size = min(size, mem_end - addr);
} else if (extra_pages) { } else if (extra_pages) {
...@@ -859,7 +859,7 @@ char * __init xen_memory_setup(void) ...@@ -859,7 +859,7 @@ char * __init xen_memory_setup(void)
* about in there. * about in there.
*/ */
e820__range_add(ISA_START_ADDRESS, ISA_END_ADDRESS - ISA_START_ADDRESS, e820__range_add(ISA_START_ADDRESS, ISA_END_ADDRESS - ISA_START_ADDRESS,
E820_RESERVED); E820_TYPE_RESERVED);
e820__update_table(e820_table->entries, ARRAY_SIZE(e820_table->entries), &e820_table->nr_entries); e820__update_table(e820_table->entries, ARRAY_SIZE(e820_table->entries), &e820_table->nr_entries);
......
...@@ -3339,7 +3339,7 @@ int main(int argc, char *argv[]) ...@@ -3339,7 +3339,7 @@ int main(int argc, char *argv[])
* simple, single region. * simple, single region.
*/ */
boot->e820_entries = 1; boot->e820_entries = 1;
boot->e820_table[0] = ((struct e820_entry) { 0, mem, E820_RAM }); boot->e820_table[0] = ((struct e820_entry) { 0, mem, E820_TYPE_RAM });
/* /*
* The boot header contains a command line pointer: we put the command * The boot header contains a command line pointer: we put the command
* line after the boot header. * line after the boot header.
......
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