summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/include/asm/e820/types.h4
-rw-r--r--arch/x86/kernel/e820.c114
-rw-r--r--arch/x86/kernel/early-quirks.c2
-rw-r--r--arch/x86/kernel/kexec-bzimage64.c5
-rw-r--r--arch/x86/kernel/resource.c4
-rw-r--r--arch/x86/kernel/setup.c6
-rw-r--r--arch/x86/kernel/tboot.c8
-rw-r--r--arch/x86/platform/efi/efi.c2
-rw-r--r--arch/x86/power/hibernate_64.c11
-rw-r--r--arch/x86/xen/setup.c2
10 files changed, 77 insertions, 81 deletions
diff --git a/arch/x86/include/asm/e820/types.h b/arch/x86/include/asm/e820/types.h
index ae2c4e9db0d4..e9d811afc123 100644
--- a/arch/x86/include/asm/e820/types.h
+++ b/arch/x86/include/asm/e820/types.h
@@ -69,8 +69,8 @@
* The whole array of E820 entries:
*/
struct e820_table {
- __u32 nr_map;
- struct e820_entry map[E820_X_MAX];
+ __u32 nr_entries;
+ struct e820_entry entries[E820_X_MAX];
};
/*
diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c
index ffaf94357d15..6d73ad46ab35 100644
--- a/arch/x86/kernel/e820.c
+++ b/arch/x86/kernel/e820.c
@@ -60,8 +60,8 @@ e820_any_mapped(u64 start, u64 end, unsigned type)
{
int i;
- for (i = 0; i < e820_table->nr_map; i++) {
- struct e820_entry *ei = &e820_table->map[i];
+ for (i = 0; i < e820_table->nr_entries; i++) {
+ struct e820_entry *ei = &e820_table->entries[i];
if (type && ei->type != type)
continue;
@@ -83,8 +83,8 @@ int __init e820_all_mapped(u64 start, u64 end, unsigned type)
{
int i;
- for (i = 0; i < e820_table->nr_map; i++) {
- struct e820_entry *ei = &e820_table->map[i];
+ for (i = 0; i < e820_table->nr_entries; i++) {
+ struct e820_entry *ei = &e820_table->entries[i];
if (type && ei->type != type)
continue;
@@ -110,22 +110,21 @@ int __init e820_all_mapped(u64 start, u64 end, unsigned type)
/*
* Add a memory region to the kernel e820 map.
*/
-static void __init __e820_add_region(struct e820_table *e820x, u64 start, u64 size,
- int type)
+static void __init __e820_add_region(struct e820_table *table, u64 start, u64 size, int type)
{
- int x = e820x->nr_map;
+ int x = table->nr_entries;
- if (x >= ARRAY_SIZE(e820x->map)) {
+ if (x >= ARRAY_SIZE(table->entries)) {
printk(KERN_ERR "e820: too many entries; ignoring [mem %#010llx-%#010llx]\n",
(unsigned long long) start,
(unsigned long long) (start + size - 1));
return;
}
- e820x->map[x].addr = start;
- e820x->map[x].size = size;
- e820x->map[x].type = type;
- e820x->nr_map++;
+ table->entries[x].addr = start;
+ table->entries[x].size = size;
+ table->entries[x].type = type;
+ table->nr_entries++;
}
void __init e820_add_region(u64 start, u64 size, int type)
@@ -166,12 +165,12 @@ void __init e820_print_map(char *who)
{
int i;
- for (i = 0; i < e820_table->nr_map; i++) {
+ for (i = 0; i < e820_table->nr_entries; i++) {
printk(KERN_INFO "%s: [mem %#018Lx-%#018Lx] ", who,
- (unsigned long long) e820_table->map[i].addr,
+ (unsigned long long) e820_table->entries[i].addr,
(unsigned long long)
- (e820_table->map[i].addr + e820_table->map[i].size - 1));
- e820_print_type(e820_table->map[i].type);
+ (e820_table->entries[i].addr + e820_table->entries[i].size - 1));
+ e820_print_type(e820_table->entries[i].type);
printk(KERN_CONT "\n");
}
}
@@ -423,7 +422,7 @@ static int __init append_e820_table(struct e820_entry *biosmap, int nr_map)
return __append_e820_table(biosmap, nr_map);
}
-static u64 __init __e820_update_range(struct e820_table *e820x, u64 start,
+static u64 __init __e820_update_range(struct e820_table *table, u64 start,
u64 size, unsigned old_type,
unsigned new_type)
{
@@ -444,8 +443,8 @@ static u64 __init __e820_update_range(struct e820_table *e820x, u64 start,
e820_print_type(new_type);
printk(KERN_CONT "\n");
- for (i = 0; i < e820x->nr_map; i++) {
- struct e820_entry *ei = &e820x->map[i];
+ for (i = 0; i < table->nr_entries; i++) {
+ struct e820_entry *ei = &table->entries[i];
u64 final_start, final_end;
u64 ei_end;
@@ -462,8 +461,8 @@ static u64 __init __e820_update_range(struct e820_table *e820x, u64 start,
/* new range is totally covered? */
if (ei->addr < start && ei_end > end) {
- __e820_add_region(e820x, start, size, new_type);
- __e820_add_region(e820x, end, ei_end - end, ei->type);
+ __e820_add_region(table, start, size, new_type);
+ __e820_add_region(table, end, ei_end - end, ei->type);
ei->size = start - ei->addr;
real_updated_size += size;
continue;
@@ -475,7 +474,7 @@ static u64 __init __e820_update_range(struct e820_table *e820x, u64 start,
if (final_start >= final_end)
continue;
- __e820_add_region(e820x, final_start, final_end - final_start,
+ __e820_add_region(table, final_start, final_end - final_start,
new_type);
real_updated_size += final_end - final_start;
@@ -523,8 +522,8 @@ u64 __init e820_remove_range(u64 start, u64 size, unsigned old_type,
e820_print_type(old_type);
printk(KERN_CONT "\n");
- for (i = 0; i < e820_table->nr_map; i++) {
- struct e820_entry *ei = &e820_table->map[i];
+ for (i = 0; i < e820_table->nr_entries; i++) {
+ struct e820_entry *ei = &e820_table->entries[i];
u64 final_start, final_end;
u64 ei_end;
@@ -568,15 +567,14 @@ u64 __init e820_remove_range(u64 start, u64 size, unsigned old_type,
void __init update_e820(void)
{
- if (sanitize_e820_table(e820_table->map, ARRAY_SIZE(e820_table->map), &e820_table->nr_map))
+ if (sanitize_e820_table(e820_table->entries, ARRAY_SIZE(e820_table->entries), &e820_table->nr_entries))
return;
printk(KERN_INFO "e820: modified physical RAM map:\n");
e820_print_map("modified");
}
static void __init update_e820_table_saved(void)
{
- sanitize_e820_table(e820_table_saved->map, ARRAY_SIZE(e820_table_saved->map),
- &e820_table_saved->nr_map);
+ sanitize_e820_table(e820_table_saved->entries, ARRAY_SIZE(e820_table_saved->entries), &e820_table_saved->nr_entries);
}
#define MAX_GAP_END 0x100000000ull
/*
@@ -586,12 +584,12 @@ static int __init e820_search_gap(unsigned long *gapstart,
unsigned long *gapsize)
{
unsigned long long last = MAX_GAP_END;
- int i = e820_table->nr_map;
+ int i = e820_table->nr_entries;
int found = 0;
while (--i >= 0) {
- unsigned long long start = e820_table->map[i].addr;
- unsigned long long end = start + e820_table->map[i].size;
+ unsigned long long start = e820_table->entries[i].addr;
+ unsigned long long end = start + e820_table->entries[i].size;
/*
* Since "last" is at most 4GB, we know we'll
@@ -661,13 +659,13 @@ __init void e820_reallocate_tables(void)
struct e820_table *n;
int size;
- size = offsetof(struct e820_table, map) + sizeof(struct e820_entry) * e820_table->nr_map;
+ size = offsetof(struct e820_table, entries) + sizeof(struct e820_entry) * e820_table->nr_entries;
n = kmalloc(size, GFP_KERNEL);
BUG_ON(!n);
memcpy(n, e820_table, size);
e820_table = n;
- size = offsetof(struct e820_table, map) + sizeof(struct e820_entry) * e820_table_saved->nr_map;
+ size = offsetof(struct e820_table, entries) + sizeof(struct e820_entry) * e820_table_saved->nr_entries;
n = kmalloc(size, GFP_KERNEL);
BUG_ON(!n);
memcpy(n, e820_table_saved, size);
@@ -690,7 +688,7 @@ void __init parse_e820_ext(u64 phys_addr, u32 data_len)
entries = sdata->len / sizeof(struct e820_entry);
extmap = (struct e820_entry *)(sdata->data);
__append_e820_table(extmap, entries);
- sanitize_e820_table(e820_table->map, ARRAY_SIZE(e820_table->map), &e820_table->nr_map);
+ sanitize_e820_table(e820_table->entries, ARRAY_SIZE(e820_table->entries), &e820_table->nr_entries);
early_memunmap(sdata, data_len);
printk(KERN_INFO "e820: extended physical RAM map:\n");
e820_print_map("extended");
@@ -709,8 +707,8 @@ void __init e820_mark_nosave_regions(unsigned long limit_pfn)
int i;
unsigned long pfn = 0;
- for (i = 0; i < e820_table->nr_map; i++) {
- struct e820_entry *ei = &e820_table->map[i];
+ for (i = 0; i < e820_table->nr_entries; i++) {
+ struct e820_entry *ei = &e820_table->entries[i];
if (pfn < PFN_UP(ei->addr))
register_nosave_region(pfn, PFN_UP(ei->addr));
@@ -734,8 +732,8 @@ static int __init e820_mark_nvs_memory(void)
{
int i;
- for (i = 0; i < e820_table->nr_map; i++) {
- struct e820_entry *ei = &e820_table->map[i];
+ for (i = 0; i < e820_table->nr_entries; i++) {
+ struct e820_entry *ei = &e820_table->entries[i];
if (ei->type == E820_NVS)
acpi_nvs_register(ei->addr, ei->size);
@@ -782,8 +780,8 @@ static unsigned long __init e820_end_pfn(unsigned long limit_pfn, unsigned type)
unsigned long last_pfn = 0;
unsigned long max_arch_pfn = MAX_ARCH_PFN;
- for (i = 0; i < e820_table->nr_map; i++) {
- struct e820_entry *ei = &e820_table->map[i];
+ for (i = 0; i < e820_table->nr_entries; i++) {
+ struct e820_entry *ei = &e820_table->entries[i];
unsigned long start_pfn;
unsigned long end_pfn;
@@ -874,7 +872,7 @@ static int __init parse_memmap_one(char *p)
*/
saved_max_pfn = e820_end_of_ram_pfn();
#endif
- e820_table->nr_map = 0;
+ e820_table->nr_entries = 0;
userdef = 1;
return 0;
}
@@ -921,8 +919,8 @@ early_param("memmap", parse_memmap_opt);
void __init finish_e820_parsing(void)
{
if (userdef) {
- if (sanitize_e820_table(e820_table->map, ARRAY_SIZE(e820_table->map),
- &e820_table->nr_map) < 0)
+ if (sanitize_e820_table(e820_table->entries, ARRAY_SIZE(e820_table->entries),
+ &e820_table->nr_entries) < 0)
early_panic("Invalid user supplied memory map");
printk(KERN_INFO "e820: user-defined physical RAM map:\n");
@@ -1009,35 +1007,35 @@ void __init e820_reserve_resources(void)
struct resource *res;
u64 end;
- res = alloc_bootmem(sizeof(struct resource) * e820_table->nr_map);
+ res = alloc_bootmem(sizeof(struct resource) * e820_table->nr_entries);
e820_res = res;
- for (i = 0; i < e820_table->nr_map; i++) {
- end = e820_table->map[i].addr + e820_table->map[i].size - 1;
+ for (i = 0; i < e820_table->nr_entries; i++) {
+ end = e820_table->entries[i].addr + e820_table->entries[i].size - 1;
if (end != (resource_size_t)end) {
res++;
continue;
}
- res->name = e820_type_to_string(e820_table->map[i].type);
- res->start = e820_table->map[i].addr;
+ res->name = e820_type_to_string(e820_table->entries[i].type);
+ res->start = e820_table->entries[i].addr;
res->end = end;
- res->flags = e820_type_to_iomem_type(e820_table->map[i].type);
- res->desc = e820_type_to_iores_desc(e820_table->map[i].type);
+ res->flags = e820_type_to_iomem_type(e820_table->entries[i].type);
+ res->desc = e820_type_to_iores_desc(e820_table->entries[i].type);
/*
* don't register the region that could be conflicted with
* pci device BAR resource and insert them later in
* pcibios_resource_survey()
*/
- if (do_mark_busy(e820_table->map[i].type, res)) {
+ if (do_mark_busy(e820_table->entries[i].type, res)) {
res->flags |= IORESOURCE_BUSY;
insert_resource(&iomem_resource, res);
}
res++;
}
- for (i = 0; i < e820_table_saved->nr_map; i++) {
- struct e820_entry *entry = &e820_table_saved->map[i];
+ for (i = 0; i < e820_table_saved->nr_entries; i++) {
+ struct e820_entry *entry = &e820_table_saved->entries[i];
firmware_map_add_early(entry->addr,
entry->addr + entry->size,
e820_type_to_string(entry->type));
@@ -1069,7 +1067,7 @@ void __init e820_reserve_resources_late(void)
struct resource *res;
res = e820_res;
- for (i = 0; i < e820_table->nr_map; i++) {
+ for (i = 0; i < e820_table->nr_entries; i++) {
if (!res->parent && res->end)
insert_resource_expand_to_fit(&iomem_resource, res);
res++;
@@ -1079,8 +1077,8 @@ void __init e820_reserve_resources_late(void)
* Try to bump up RAM regions to reasonable boundaries to
* avoid stolen RAM:
*/
- for (i = 0; i < e820_table->nr_map; i++) {
- struct e820_entry *entry = &e820_table->map[i];
+ for (i = 0; i < e820_table->nr_entries; i++) {
+ struct e820_entry *entry = &e820_table->entries[i];
u64 start, end;
if (entry->type != E820_RAM)
@@ -1128,7 +1126,7 @@ char *__init default_machine_specific_memory_setup(void)
who = "BIOS-e801";
}
- e820_table->nr_map = 0;
+ e820_table->nr_entries = 0;
e820_add_region(0, LOWMEMSIZE(), E820_RAM);
e820_add_region(HIGH_MEMORY, mem_size << 10, E820_RAM);
}
@@ -1159,8 +1157,8 @@ void __init memblock_x86_fill(void)
*/
memblock_allow_resize();
- for (i = 0; i < e820_table->nr_map; i++) {
- struct e820_entry *ei = &e820_table->map[i];
+ for (i = 0; i < e820_table->nr_entries; i++) {
+ struct e820_entry *ei = &e820_table->entries[i];
end = ei->addr + ei->size;
if (end != (resource_size_t)end)
diff --git a/arch/x86/kernel/early-quirks.c b/arch/x86/kernel/early-quirks.c
index a6cdf9b9c7a9..4f52758accbc 100644
--- a/arch/x86/kernel/early-quirks.c
+++ b/arch/x86/kernel/early-quirks.c
@@ -547,7 +547,7 @@ intel_graphics_stolen(int num, int slot, int func,
/* Mark this space as reserved */
e820_add_region(base, size, E820_RESERVED);
- sanitize_e820_table(e820_table->map, ARRAY_SIZE(e820_table->map), &e820_table->nr_map);
+ sanitize_e820_table(e820_table->entries, ARRAY_SIZE(e820_table->entries), &e820_table->nr_entries);
}
static void __init intel_graphics_quirks(int num, int slot, int func)
diff --git a/arch/x86/kernel/kexec-bzimage64.c b/arch/x86/kernel/kexec-bzimage64.c
index 39d340ac50eb..3e5c995e1718 100644
--- a/arch/x86/kernel/kexec-bzimage64.c
+++ b/arch/x86/kernel/kexec-bzimage64.c
@@ -100,15 +100,14 @@ static int setup_e820_entries(struct boot_params *params)
{
unsigned int nr_e820_entries;
- nr_e820_entries = e820_table_saved->nr_map;
+ nr_e820_entries = e820_table_saved->nr_entries;
/* TODO: Pass entries more than E820MAX in bootparams setup data */
if (nr_e820_entries > E820MAX)
nr_e820_entries = E820MAX;
params->e820_entries = nr_e820_entries;
- memcpy(&params->e820_table, &e820_table_saved->map,
- nr_e820_entries * sizeof(struct e820_entry));
+ memcpy(&params->e820_table, &e820_table_saved->entries, nr_e820_entries*sizeof(struct e820_entry));
return 0;
}
diff --git a/arch/x86/kernel/resource.c b/arch/x86/kernel/resource.c
index 17b494d4bb86..5ab3895516ac 100644
--- a/arch/x86/kernel/resource.c
+++ b/arch/x86/kernel/resource.c
@@ -27,8 +27,8 @@ static void remove_e820_regions(struct resource *avail)
int i;
struct e820_entry *entry;
- for (i = 0; i < e820_table->nr_map; i++) {
- entry = &e820_table->map[i];
+ for (i = 0; i < e820_table->nr_entries; i++) {
+ entry = &e820_table->entries[i];
resource_clip(avail, entry->addr,
entry->addr + entry->size - 1);
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index a3c1d39116b7..c2bb2d143d70 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -458,7 +458,7 @@ static void __init e820_reserve_setup_data(void)
early_memunmap(data, sizeof(*data));
}
- sanitize_e820_table(e820_table->map, ARRAY_SIZE(e820_table->map), &e820_table->nr_map);
+ sanitize_e820_table(e820_table->entries, ARRAY_SIZE(e820_table->entries), &e820_table->nr_entries);
memcpy(e820_table_saved, e820_table, sizeof(struct e820_table));
printk(KERN_INFO "extended physical RAM map:\n");
e820_print_map("reserve setup_data");
@@ -763,7 +763,7 @@ static void __init trim_bios_range(void)
*/
e820_remove_range(BIOS_BEGIN, BIOS_END - BIOS_BEGIN, E820_RAM, 1);
- sanitize_e820_table(e820_table->map, ARRAY_SIZE(e820_table->map), &e820_table->nr_map);
+ sanitize_e820_table(e820_table->entries, ARRAY_SIZE(e820_table->entries), &e820_table->nr_entries);
}
/* called before trim_bios_range() to spare extra sanitize */
@@ -1056,7 +1056,7 @@ void __init setup_arch(char **cmdline_p)
if (ppro_with_ram_bug()) {
e820_update_range(0x70000000ULL, 0x40000ULL, E820_RAM,
E820_RESERVED);
- sanitize_e820_table(e820_table->map, ARRAY_SIZE(e820_table->map), &e820_table->nr_map);
+ sanitize_e820_table(e820_table->entries, ARRAY_SIZE(e820_table->entries), &e820_table->nr_entries);
printk(KERN_INFO "fixed physical RAM map:\n");
e820_print_map("bad_ppro");
}
diff --git a/arch/x86/kernel/tboot.c b/arch/x86/kernel/tboot.c
index 825822688aa5..f7cba42d7807 100644
--- a/arch/x86/kernel/tboot.c
+++ b/arch/x86/kernel/tboot.c
@@ -188,12 +188,12 @@ static int tboot_setup_sleep(void)
tboot->num_mac_regions = 0;
- for (i = 0; i < e820_table->nr_map; i++) {
- if ((e820_table->map[i].type != E820_RAM)
- && (e820_table->map[i].type != E820_RESERVED_KERN))
+ for (i = 0; i < e820_table->nr_entries; i++) {
+ if ((e820_table->entries[i].type != E820_RAM)
+ && (e820_table->entries[i].type != E820_RESERVED_KERN))
continue;
- add_mac_region(e820_table->map[i].addr, e820_table->map[i].size);
+ add_mac_region(e820_table->entries[i].addr, e820_table->entries[i].size);
}
tboot->acpi_sinfo.kernel_s3_resume_vector =
diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
index 9e055f6859e5..b69199165610 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -167,7 +167,7 @@ static void __init do_add_efi_memmap(void)
}
e820_add_region(start, size, e820_type);
}
- sanitize_e820_table(e820_table->map, ARRAY_SIZE(e820_table->map), &e820_table->nr_map);
+ sanitize_e820_table(e820_table->entries, ARRAY_SIZE(e820_table->entries), &e820_table->nr_entries);
}
int __init efi_memblock_x86_reserve_range(void)
diff --git a/arch/x86/power/hibernate_64.c b/arch/x86/power/hibernate_64.c
index 8fe5be0e90b2..1bfda425879c 100644
--- a/arch/x86/power/hibernate_64.c
+++ b/arch/x86/power/hibernate_64.c
@@ -196,12 +196,12 @@ struct restore_data_record {
#if IS_BUILTIN(CONFIG_CRYPTO_MD5)
/**
- * get_e820_md5 - calculate md5 according to given e820 map
+ * get_e820_md5 - calculate md5 according to given e820 table
*
- * @map: the e820 map to be calculated
+ * @table: the e820 table to be calculated
* @buf: the md5 result to be stored to
*/
-static int get_e820_md5(struct e820_table *map, void *buf)
+static int get_e820_md5(struct e820_table *table, void *buf)
{
struct scatterlist sg;
struct crypto_ahash *tfm;
@@ -214,10 +214,9 @@ static int get_e820_md5(struct e820_table *map, void *buf)
{
AHASH_REQUEST_ON_STACK(req, tfm);
- size = offsetof(struct e820_table, map)
- + sizeof(struct e820_entry) * map->nr_map;
+ size = offsetof(struct e820_table, entries) + sizeof(struct e820_entry) * table->nr_entries;
ahash_request_set_tfm(req, tfm);
- sg_init_one(&sg, (u8 *)map, size);
+ sg_init_one(&sg, (u8 *)table, size);
ahash_request_set_callback(req, 0, NULL, NULL);
ahash_request_set_crypt(req, &sg, buf, size);
diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
index f98713e5a705..8b26b9282070 100644
--- a/arch/x86/xen/setup.c
+++ b/arch/x86/xen/setup.c
@@ -861,7 +861,7 @@ char * __init xen_memory_setup(void)
e820_add_region(ISA_START_ADDRESS, ISA_END_ADDRESS - ISA_START_ADDRESS,
E820_RESERVED);
- sanitize_e820_table(e820_table->map, ARRAY_SIZE(e820_table->map), &e820_table->nr_map);
+ sanitize_e820_table(e820_table->entries, ARRAY_SIZE(e820_table->entries), &e820_table->nr_entries);
/*
* Check whether the kernel itself conflicts with the target E820 map.