Commit 7b1e427d authored by Heiko Carstens's avatar Heiko Carstens Committed by Martin Schwidefsky

s390/zcore: calculate real memory size using own get_mem_size function

The zcore device driver makes use of the global visible real_memory_size
variable with its odd semantics.
Since the zcore device driver already has code in place which calculates
the memory size at module load time, use that code to calculate the current
memory end value.

One user less of the odd real_memory_size variable.
Reviewed-by: default avatarMichael Holzheu <holzheu@linux.vnet.ibm.com>
Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent 0a694067
......@@ -557,7 +557,7 @@ static void __init set_lc_mask(struct save_area *map)
/*
* Initialize dump globals for a given architecture
*/
static int __init sys_info_init(enum arch_id arch)
static int __init sys_info_init(enum arch_id arch, unsigned long mem_end)
{
int rc;
......@@ -579,7 +579,7 @@ static int __init sys_info_init(enum arch_id arch)
rc = init_cpu_info(arch);
if (rc)
return rc;
sys_info.mem_size = real_memory_size;
sys_info.mem_size = mem_end;
return 0;
}
......@@ -601,7 +601,7 @@ static int __init check_sdias(void)
return 0;
}
static int __init get_mem_size(unsigned long *mem)
static int __init get_mem_info(unsigned long *mem, unsigned long *end)
{
int i;
struct mem_chunk *chunk_array;
......@@ -615,28 +615,26 @@ static int __init get_mem_size(unsigned long *mem)
if (chunk_array[i].size == 0)
break;
*mem += chunk_array[i].size;
*end = max(*end, chunk_array[i].addr + chunk_array[i].size);
}
kfree(chunk_array);
return 0;
}
static int __init zcore_header_init(int arch, struct zcore_header *hdr)
static void __init zcore_header_init(int arch, struct zcore_header *hdr,
unsigned long mem_size)
{
int rc, i;
unsigned long memory = 0;
u32 prefix;
int i;
if (arch == ARCH_S390X)
hdr->arch_id = DUMP_ARCH_S390X;
else
hdr->arch_id = DUMP_ARCH_S390;
rc = get_mem_size(&memory);
if (rc)
return rc;
hdr->mem_size = memory;
hdr->rmem_size = memory;
hdr->mem_size = mem_size;
hdr->rmem_size = mem_size;
hdr->mem_end = sys_info.mem_size;
hdr->num_pages = memory / PAGE_SIZE;
hdr->num_pages = mem_size / PAGE_SIZE;
hdr->tod = get_tod_clock();
get_cpu_id(&hdr->cpu_id);
for (i = 0; zfcpdump_save_areas[i]; i++) {
......@@ -647,7 +645,6 @@ static int __init zcore_header_init(int arch, struct zcore_header *hdr)
hdr->lc_vec[hdr->cpu_cnt] = prefix;
hdr->cpu_cnt++;
}
return 0;
}
/*
......@@ -682,9 +679,11 @@ static int __init zcore_reipl_init(void)
static int __init zcore_init(void)
{
unsigned long mem_size, mem_end;
unsigned char arch;
int rc;
mem_size = mem_end = 0;
if (ipl_info.type != IPL_TYPE_FCP_DUMP)
return -ENODATA;
if (OLDMEM_BASE)
......@@ -727,13 +726,14 @@ static int __init zcore_init(void)
}
#endif /* CONFIG_64BIT */
rc = sys_info_init(arch);
rc = get_mem_info(&mem_size, &mem_end);
if (rc)
goto fail;
rc = zcore_header_init(arch, &zcore_header);
rc = sys_info_init(arch, mem_end);
if (rc)
goto fail;
zcore_header_init(arch, &zcore_header, mem_size);
rc = zcore_reipl_init();
if (rc)
......
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