Commit bf495573 authored by Ingo Molnar's avatar Ingo Molnar

x86/boot/e820: Harmonize the 'struct e820_table' fields

So the e820_table->map and e820_table->nr_map names are a bit
confusing, because it's not clear what a 'map' really means
(it could be a bitmap, or some other data structure), nor is
it clear what nr_map means (is it a current index, or some
other count).

Rename the fields from:

 e820_table->map        =>     e820_table->entries
 e820_table->nr_map     =>     e820_table->nr_entries

which makes it abundantly clear that these are entries
of the table, and that the size of the table is ->nr_entries.

Propagate the changes to all affected files. Where necessary,
adjust local variable names to better reflect the new field names.

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 61a50101
...@@ -69,8 +69,8 @@ ...@@ -69,8 +69,8 @@
* The whole array of E820 entries: * The whole array of E820 entries:
*/ */
struct e820_table { struct e820_table {
__u32 nr_map; __u32 nr_entries;
struct e820_entry map[E820_X_MAX]; struct e820_entry entries[E820_X_MAX];
}; };
/* /*
......
...@@ -60,8 +60,8 @@ e820_any_mapped(u64 start, u64 end, unsigned type) ...@@ -60,8 +60,8 @@ e820_any_mapped(u64 start, u64 end, unsigned type)
{ {
int i; int i;
for (i = 0; i < e820_table->nr_map; i++) { for (i = 0; i < e820_table->nr_entries; i++) {
struct e820_entry *ei = &e820_table->map[i]; struct e820_entry *ei = &e820_table->entries[i];
if (type && ei->type != type) if (type && ei->type != type)
continue; continue;
...@@ -83,8 +83,8 @@ int __init e820_all_mapped(u64 start, u64 end, unsigned type) ...@@ -83,8 +83,8 @@ int __init e820_all_mapped(u64 start, u64 end, unsigned type)
{ {
int i; int i;
for (i = 0; i < e820_table->nr_map; i++) { for (i = 0; i < e820_table->nr_entries; i++) {
struct e820_entry *ei = &e820_table->map[i]; struct e820_entry *ei = &e820_table->entries[i];
if (type && ei->type != type) if (type && ei->type != type)
continue; continue;
...@@ -110,22 +110,21 @@ int __init e820_all_mapped(u64 start, u64 end, unsigned type) ...@@ -110,22 +110,21 @@ int __init e820_all_mapped(u64 start, u64 end, unsigned type)
/* /*
* Add a memory region to the kernel e820 map. * Add a memory region to the kernel e820 map.
*/ */
static void __init __e820_add_region(struct e820_table *e820x, u64 start, u64 size, static void __init __e820_add_region(struct e820_table *table, u64 start, u64 size, int type)
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", printk(KERN_ERR "e820: too many entries; ignoring [mem %#010llx-%#010llx]\n",
(unsigned long long) start, (unsigned long long) start,
(unsigned long long) (start + size - 1)); (unsigned long long) (start + size - 1));
return; return;
} }
e820x->map[x].addr = start; table->entries[x].addr = start;
e820x->map[x].size = size; table->entries[x].size = size;
e820x->map[x].type = type; table->entries[x].type = type;
e820x->nr_map++; table->nr_entries++;
} }
void __init e820_add_region(u64 start, u64 size, int type) void __init e820_add_region(u64 start, u64 size, int type)
...@@ -166,12 +165,12 @@ void __init e820_print_map(char *who) ...@@ -166,12 +165,12 @@ void __init e820_print_map(char *who)
{ {
int i; 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, 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) (unsigned long long)
(e820_table->map[i].addr + e820_table->map[i].size - 1)); (e820_table->entries[i].addr + e820_table->entries[i].size - 1));
e820_print_type(e820_table->map[i].type); e820_print_type(e820_table->entries[i].type);
printk(KERN_CONT "\n"); printk(KERN_CONT "\n");
} }
} }
...@@ -423,7 +422,7 @@ static int __init append_e820_table(struct e820_entry *biosmap, int nr_map) ...@@ -423,7 +422,7 @@ static int __init append_e820_table(struct e820_entry *biosmap, int nr_map)
return __append_e820_table(biosmap, 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, u64 size, unsigned old_type,
unsigned new_type) unsigned new_type)
{ {
...@@ -444,8 +443,8 @@ static u64 __init __e820_update_range(struct e820_table *e820x, u64 start, ...@@ -444,8 +443,8 @@ static u64 __init __e820_update_range(struct e820_table *e820x, u64 start,
e820_print_type(new_type); e820_print_type(new_type);
printk(KERN_CONT "\n"); printk(KERN_CONT "\n");
for (i = 0; i < e820x->nr_map; i++) { for (i = 0; i < table->nr_entries; i++) {
struct e820_entry *ei = &e820x->map[i]; struct e820_entry *ei = &table->entries[i];
u64 final_start, final_end; u64 final_start, final_end;
u64 ei_end; u64 ei_end;
...@@ -462,8 +461,8 @@ static u64 __init __e820_update_range(struct e820_table *e820x, u64 start, ...@@ -462,8 +461,8 @@ static u64 __init __e820_update_range(struct e820_table *e820x, u64 start,
/* new range is totally covered? */ /* new range is totally covered? */
if (ei->addr < start && ei_end > end) { if (ei->addr < start && ei_end > end) {
__e820_add_region(e820x, start, size, new_type); __e820_add_region(table, start, size, new_type);
__e820_add_region(e820x, end, ei_end - end, ei->type); __e820_add_region(table, end, ei_end - end, ei->type);
ei->size = start - ei->addr; ei->size = start - ei->addr;
real_updated_size += size; real_updated_size += size;
continue; continue;
...@@ -475,7 +474,7 @@ static u64 __init __e820_update_range(struct e820_table *e820x, u64 start, ...@@ -475,7 +474,7 @@ static u64 __init __e820_update_range(struct e820_table *e820x, u64 start,
if (final_start >= final_end) if (final_start >= final_end)
continue; continue;
__e820_add_region(e820x, final_start, final_end - final_start, __e820_add_region(table, final_start, final_end - final_start,
new_type); new_type);
real_updated_size += final_end - final_start; real_updated_size += final_end - final_start;
...@@ -523,8 +522,8 @@ u64 __init e820_remove_range(u64 start, u64 size, unsigned old_type, ...@@ -523,8 +522,8 @@ u64 __init e820_remove_range(u64 start, u64 size, unsigned old_type,
e820_print_type(old_type); e820_print_type(old_type);
printk(KERN_CONT "\n"); printk(KERN_CONT "\n");
for (i = 0; i < e820_table->nr_map; i++) { for (i = 0; i < e820_table->nr_entries; i++) {
struct e820_entry *ei = &e820_table->map[i]; struct e820_entry *ei = &e820_table->entries[i];
u64 final_start, final_end; u64 final_start, final_end;
u64 ei_end; u64 ei_end;
...@@ -568,15 +567,14 @@ u64 __init e820_remove_range(u64 start, u64 size, unsigned old_type, ...@@ -568,15 +567,14 @@ u64 __init e820_remove_range(u64 start, u64 size, unsigned old_type,
void __init update_e820(void) 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; return;
printk(KERN_INFO "e820: modified physical RAM map:\n"); printk(KERN_INFO "e820: modified physical RAM map:\n");
e820_print_map("modified"); e820_print_map("modified");
} }
static void __init update_e820_table_saved(void) static void __init update_e820_table_saved(void)
{ {
sanitize_e820_table(e820_table_saved->map, ARRAY_SIZE(e820_table_saved->map), sanitize_e820_table(e820_table_saved->entries, ARRAY_SIZE(e820_table_saved->entries), &e820_table_saved->nr_entries);
&e820_table_saved->nr_map);
} }
#define MAX_GAP_END 0x100000000ull #define MAX_GAP_END 0x100000000ull
/* /*
...@@ -586,12 +584,12 @@ static int __init e820_search_gap(unsigned long *gapstart, ...@@ -586,12 +584,12 @@ static int __init e820_search_gap(unsigned long *gapstart,
unsigned long *gapsize) unsigned long *gapsize)
{ {
unsigned long long last = MAX_GAP_END; unsigned long long last = MAX_GAP_END;
int i = e820_table->nr_map; int i = e820_table->nr_entries;
int found = 0; int found = 0;
while (--i >= 0) { while (--i >= 0) {
unsigned long long start = e820_table->map[i].addr; unsigned long long start = e820_table->entries[i].addr;
unsigned long long end = start + e820_table->map[i].size; unsigned long long end = start + e820_table->entries[i].size;
/* /*
* Since "last" is at most 4GB, we know we'll * Since "last" is at most 4GB, we know we'll
...@@ -661,13 +659,13 @@ __init void e820_reallocate_tables(void) ...@@ -661,13 +659,13 @@ __init void e820_reallocate_tables(void)
struct e820_table *n; struct e820_table *n;
int size; 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); n = kmalloc(size, GFP_KERNEL);
BUG_ON(!n); BUG_ON(!n);
memcpy(n, e820_table, size); memcpy(n, e820_table, size);
e820_table = n; 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); n = kmalloc(size, GFP_KERNEL);
BUG_ON(!n); BUG_ON(!n);
memcpy(n, e820_table_saved, size); memcpy(n, e820_table_saved, size);
...@@ -690,7 +688,7 @@ void __init parse_e820_ext(u64 phys_addr, u32 data_len) ...@@ -690,7 +688,7 @@ void __init parse_e820_ext(u64 phys_addr, u32 data_len)
entries = sdata->len / sizeof(struct e820_entry); entries = sdata->len / sizeof(struct e820_entry);
extmap = (struct e820_entry *)(sdata->data); extmap = (struct e820_entry *)(sdata->data);
__append_e820_table(extmap, entries); __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); early_memunmap(sdata, data_len);
printk(KERN_INFO "e820: extended physical RAM map:\n"); printk(KERN_INFO "e820: extended physical RAM map:\n");
e820_print_map("extended"); e820_print_map("extended");
...@@ -709,8 +707,8 @@ void __init e820_mark_nosave_regions(unsigned long limit_pfn) ...@@ -709,8 +707,8 @@ void __init e820_mark_nosave_regions(unsigned long limit_pfn)
int i; int i;
unsigned long pfn = 0; unsigned long pfn = 0;
for (i = 0; i < e820_table->nr_map; i++) { for (i = 0; i < e820_table->nr_entries; i++) {
struct e820_entry *ei = &e820_table->map[i]; struct e820_entry *ei = &e820_table->entries[i];
if (pfn < PFN_UP(ei->addr)) if (pfn < PFN_UP(ei->addr))
register_nosave_region(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) ...@@ -734,8 +732,8 @@ static int __init e820_mark_nvs_memory(void)
{ {
int i; int i;
for (i = 0; i < e820_table->nr_map; i++) { for (i = 0; i < e820_table->nr_entries; i++) {
struct e820_entry *ei = &e820_table->map[i]; struct e820_entry *ei = &e820_table->entries[i];
if (ei->type == E820_NVS) if (ei->type == E820_NVS)
acpi_nvs_register(ei->addr, ei->size); acpi_nvs_register(ei->addr, ei->size);
...@@ -782,8 +780,8 @@ static unsigned long __init e820_end_pfn(unsigned long limit_pfn, unsigned type) ...@@ -782,8 +780,8 @@ static unsigned long __init e820_end_pfn(unsigned long limit_pfn, unsigned type)
unsigned long last_pfn = 0; unsigned long last_pfn = 0;
unsigned long max_arch_pfn = MAX_ARCH_PFN; unsigned long max_arch_pfn = MAX_ARCH_PFN;
for (i = 0; i < e820_table->nr_map; i++) { for (i = 0; i < e820_table->nr_entries; i++) {
struct e820_entry *ei = &e820_table->map[i]; struct e820_entry *ei = &e820_table->entries[i];
unsigned long start_pfn; unsigned long start_pfn;
unsigned long end_pfn; unsigned long end_pfn;
...@@ -874,7 +872,7 @@ static int __init parse_memmap_one(char *p) ...@@ -874,7 +872,7 @@ static int __init parse_memmap_one(char *p)
*/ */
saved_max_pfn = e820_end_of_ram_pfn(); saved_max_pfn = e820_end_of_ram_pfn();
#endif #endif
e820_table->nr_map = 0; e820_table->nr_entries = 0;
userdef = 1; userdef = 1;
return 0; return 0;
} }
...@@ -921,8 +919,8 @@ early_param("memmap", parse_memmap_opt); ...@@ -921,8 +919,8 @@ early_param("memmap", parse_memmap_opt);
void __init finish_e820_parsing(void) void __init finish_e820_parsing(void)
{ {
if (userdef) { if (userdef) {
if (sanitize_e820_table(e820_table->map, ARRAY_SIZE(e820_table->map), if (sanitize_e820_table(e820_table->entries, ARRAY_SIZE(e820_table->entries),
&e820_table->nr_map) < 0) &e820_table->nr_entries) < 0)
early_panic("Invalid user supplied memory map"); early_panic("Invalid user supplied memory map");
printk(KERN_INFO "e820: user-defined physical RAM map:\n"); printk(KERN_INFO "e820: user-defined physical RAM map:\n");
...@@ -1009,35 +1007,35 @@ void __init e820_reserve_resources(void) ...@@ -1009,35 +1007,35 @@ void __init e820_reserve_resources(void)
struct resource *res; struct resource *res;
u64 end; 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; e820_res = res;
for (i = 0; i < e820_table->nr_map; i++) { for (i = 0; i < e820_table->nr_entries; i++) {
end = e820_table->map[i].addr + e820_table->map[i].size - 1; end = e820_table->entries[i].addr + e820_table->entries[i].size - 1;
if (end != (resource_size_t)end) { if (end != (resource_size_t)end) {
res++; res++;
continue; continue;
} }
res->name = e820_type_to_string(e820_table->map[i].type); res->name = e820_type_to_string(e820_table->entries[i].type);
res->start = e820_table->map[i].addr; res->start = e820_table->entries[i].addr;
res->end = end; res->end = end;
res->flags = e820_type_to_iomem_type(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->map[i].type); res->desc = e820_type_to_iores_desc(e820_table->entries[i].type);
/* /*
* don't register the region that could be conflicted with * don't register the region that could be conflicted with
* pci device BAR resource and insert them later in * pci device BAR resource and insert them later in
* pcibios_resource_survey() * 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; res->flags |= IORESOURCE_BUSY;
insert_resource(&iomem_resource, res); insert_resource(&iomem_resource, res);
} }
res++; res++;
} }
for (i = 0; i < e820_table_saved->nr_map; i++) { for (i = 0; i < e820_table_saved->nr_entries; i++) {
struct e820_entry *entry = &e820_table_saved->map[i]; struct e820_entry *entry = &e820_table_saved->entries[i];
firmware_map_add_early(entry->addr, firmware_map_add_early(entry->addr,
entry->addr + entry->size, entry->addr + entry->size,
e820_type_to_string(entry->type)); e820_type_to_string(entry->type));
...@@ -1069,7 +1067,7 @@ void __init e820_reserve_resources_late(void) ...@@ -1069,7 +1067,7 @@ void __init e820_reserve_resources_late(void)
struct resource *res; struct resource *res;
res = e820_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) if (!res->parent && res->end)
insert_resource_expand_to_fit(&iomem_resource, res); insert_resource_expand_to_fit(&iomem_resource, res);
res++; res++;
...@@ -1079,8 +1077,8 @@ void __init e820_reserve_resources_late(void) ...@@ -1079,8 +1077,8 @@ void __init e820_reserve_resources_late(void)
* Try to bump up RAM regions to reasonable boundaries to * Try to bump up RAM regions to reasonable boundaries to
* avoid stolen RAM: * avoid stolen RAM:
*/ */
for (i = 0; i < e820_table->nr_map; i++) { for (i = 0; i < e820_table->nr_entries; i++) {
struct e820_entry *entry = &e820_table->map[i]; struct e820_entry *entry = &e820_table->entries[i];
u64 start, end; u64 start, end;
if (entry->type != E820_RAM) if (entry->type != E820_RAM)
...@@ -1128,7 +1126,7 @@ char *__init default_machine_specific_memory_setup(void) ...@@ -1128,7 +1126,7 @@ char *__init default_machine_specific_memory_setup(void)
who = "BIOS-e801"; who = "BIOS-e801";
} }
e820_table->nr_map = 0; e820_table->nr_entries = 0;
e820_add_region(0, LOWMEMSIZE(), E820_RAM); e820_add_region(0, LOWMEMSIZE(), E820_RAM);
e820_add_region(HIGH_MEMORY, mem_size << 10, E820_RAM); e820_add_region(HIGH_MEMORY, mem_size << 10, E820_RAM);
} }
...@@ -1159,8 +1157,8 @@ void __init memblock_x86_fill(void) ...@@ -1159,8 +1157,8 @@ void __init memblock_x86_fill(void)
*/ */
memblock_allow_resize(); memblock_allow_resize();
for (i = 0; i < e820_table->nr_map; i++) { for (i = 0; i < e820_table->nr_entries; i++) {
struct e820_entry *ei = &e820_table->map[i]; struct e820_entry *ei = &e820_table->entries[i];
end = ei->addr + ei->size; end = ei->addr + ei->size;
if (end != (resource_size_t)end) if (end != (resource_size_t)end)
......
...@@ -547,7 +547,7 @@ intel_graphics_stolen(int num, int slot, int func, ...@@ -547,7 +547,7 @@ intel_graphics_stolen(int num, int slot, int func,
/* Mark this space as reserved */ /* Mark this space as reserved */
e820_add_region(base, size, E820_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) static void __init intel_graphics_quirks(int num, int slot, int func)
......
...@@ -100,15 +100,14 @@ static int setup_e820_entries(struct boot_params *params) ...@@ -100,15 +100,14 @@ static int setup_e820_entries(struct boot_params *params)
{ {
unsigned int nr_e820_entries; 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 */ /* TODO: Pass entries more than E820MAX in bootparams setup data */
if (nr_e820_entries > E820MAX) if (nr_e820_entries > E820MAX)
nr_e820_entries = E820MAX; nr_e820_entries = E820MAX;
params->e820_entries = nr_e820_entries; params->e820_entries = nr_e820_entries;
memcpy(&params->e820_table, &e820_table_saved->map, memcpy(&params->e820_table, &e820_table_saved->entries, nr_e820_entries*sizeof(struct e820_entry));
nr_e820_entries * sizeof(struct e820_entry));
return 0; return 0;
} }
......
...@@ -27,8 +27,8 @@ static void remove_e820_regions(struct resource *avail) ...@@ -27,8 +27,8 @@ static void remove_e820_regions(struct resource *avail)
int i; int i;
struct e820_entry *entry; struct e820_entry *entry;
for (i = 0; i < e820_table->nr_map; i++) { for (i = 0; i < e820_table->nr_entries; i++) {
entry = &e820_table->map[i]; entry = &e820_table->entries[i];
resource_clip(avail, entry->addr, resource_clip(avail, entry->addr,
entry->addr + entry->size - 1); entry->addr + entry->size - 1);
......
...@@ -458,7 +458,7 @@ static void __init e820_reserve_setup_data(void) ...@@ -458,7 +458,7 @@ static void __init e820_reserve_setup_data(void)
early_memunmap(data, sizeof(*data)); 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)); memcpy(e820_table_saved, e820_table, sizeof(struct e820_table));
printk(KERN_INFO "extended physical RAM map:\n"); printk(KERN_INFO "extended physical RAM map:\n");
e820_print_map("reserve setup_data"); e820_print_map("reserve setup_data");
...@@ -763,7 +763,7 @@ static void __init trim_bios_range(void) ...@@ -763,7 +763,7 @@ static void __init trim_bios_range(void)
*/ */
e820_remove_range(BIOS_BEGIN, BIOS_END - BIOS_BEGIN, E820_RAM, 1); 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 */ /* called before trim_bios_range() to spare extra sanitize */
...@@ -1056,7 +1056,7 @@ void __init setup_arch(char **cmdline_p) ...@@ -1056,7 +1056,7 @@ void __init setup_arch(char **cmdline_p)
if (ppro_with_ram_bug()) { if (ppro_with_ram_bug()) {
e820_update_range(0x70000000ULL, 0x40000ULL, E820_RAM, e820_update_range(0x70000000ULL, 0x40000ULL, E820_RAM,
E820_RESERVED); 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"); printk(KERN_INFO "fixed physical RAM map:\n");
e820_print_map("bad_ppro"); e820_print_map("bad_ppro");
} }
......
...@@ -188,12 +188,12 @@ static int tboot_setup_sleep(void) ...@@ -188,12 +188,12 @@ static int tboot_setup_sleep(void)
tboot->num_mac_regions = 0; tboot->num_mac_regions = 0;
for (i = 0; i < e820_table->nr_map; i++) { for (i = 0; i < e820_table->nr_entries; i++) {
if ((e820_table->map[i].type != E820_RAM) if ((e820_table->entries[i].type != E820_RAM)
&& (e820_table->map[i].type != E820_RESERVED_KERN)) && (e820_table->entries[i].type != E820_RESERVED_KERN))
continue; 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 = tboot->acpi_sinfo.kernel_s3_resume_vector =
......
...@@ -167,7 +167,7 @@ static void __init do_add_efi_memmap(void) ...@@ -167,7 +167,7 @@ static void __init do_add_efi_memmap(void)
} }
e820_add_region(start, size, e820_type); 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) int __init efi_memblock_x86_reserve_range(void)
......
...@@ -196,12 +196,12 @@ struct restore_data_record { ...@@ -196,12 +196,12 @@ struct restore_data_record {
#if IS_BUILTIN(CONFIG_CRYPTO_MD5) #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 * @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 scatterlist sg;
struct crypto_ahash *tfm; struct crypto_ahash *tfm;
...@@ -214,10 +214,9 @@ static int get_e820_md5(struct e820_table *map, void *buf) ...@@ -214,10 +214,9 @@ static int get_e820_md5(struct e820_table *map, void *buf)
{ {
AHASH_REQUEST_ON_STACK(req, tfm); AHASH_REQUEST_ON_STACK(req, tfm);
size = offsetof(struct e820_table, map) size = offsetof(struct e820_table, entries) + sizeof(struct e820_entry) * table->nr_entries;
+ sizeof(struct e820_entry) * map->nr_map;
ahash_request_set_tfm(req, tfm); 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_callback(req, 0, NULL, NULL);
ahash_request_set_crypt(req, &sg, buf, size); ahash_request_set_crypt(req, &sg, buf, size);
......
...@@ -861,7 +861,7 @@ char * __init xen_memory_setup(void) ...@@ -861,7 +861,7 @@ char * __init xen_memory_setup(void)
e820_add_region(ISA_START_ADDRESS, ISA_END_ADDRESS - ISA_START_ADDRESS, e820_add_region(ISA_START_ADDRESS, ISA_END_ADDRESS - ISA_START_ADDRESS,
E820_RESERVED); 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. * Check whether the kernel itself conflicts with the target E820 map.
......
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