aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390
diff options
context:
space:
mode:
authorHeiko Carstens <heiko.carstens@de.ibm.com>2013-04-27 07:43:34 -0400
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2013-05-02 09:50:23 -0400
commit7b1e427d685e2aee91f9a622f9c2691130f8e57d (patch)
treec13639a468c0b290e3e1fae7c358149c5c5978a1 /drivers/s390
parent0a694067111e8fcd3eda430f8fa2d0277edd231f (diff)
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: Michael Holzheu <holzheu@linux.vnet.ibm.com> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'drivers/s390')
-rw-r--r--drivers/s390/char/zcore.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/drivers/s390/char/zcore.c b/drivers/s390/char/zcore.c
index 22820610022c..d415ba7f26a6 100644
--- a/drivers/s390/char/zcore.c
+++ b/drivers/s390/char/zcore.c
@@ -557,7 +557,7 @@ static void __init set_lc_mask(struct save_area *map)
557/* 557/*
558 * Initialize dump globals for a given architecture 558 * Initialize dump globals for a given architecture
559 */ 559 */
560static int __init sys_info_init(enum arch_id arch) 560static int __init sys_info_init(enum arch_id arch, unsigned long mem_end)
561{ 561{
562 int rc; 562 int rc;
563 563
@@ -579,7 +579,7 @@ static int __init sys_info_init(enum arch_id arch)
579 rc = init_cpu_info(arch); 579 rc = init_cpu_info(arch);
580 if (rc) 580 if (rc)
581 return rc; 581 return rc;
582 sys_info.mem_size = real_memory_size; 582 sys_info.mem_size = mem_end;
583 583
584 return 0; 584 return 0;
585} 585}
@@ -601,7 +601,7 @@ static int __init check_sdias(void)
601 return 0; 601 return 0;
602} 602}
603 603
604static int __init get_mem_size(unsigned long *mem) 604static int __init get_mem_info(unsigned long *mem, unsigned long *end)
605{ 605{
606 int i; 606 int i;
607 struct mem_chunk *chunk_array; 607 struct mem_chunk *chunk_array;
@@ -615,28 +615,26 @@ static int __init get_mem_size(unsigned long *mem)
615 if (chunk_array[i].size == 0) 615 if (chunk_array[i].size == 0)
616 break; 616 break;
617 *mem += chunk_array[i].size; 617 *mem += chunk_array[i].size;
618 *end = max(*end, chunk_array[i].addr + chunk_array[i].size);
618 } 619 }
619 kfree(chunk_array); 620 kfree(chunk_array);
620 return 0; 621 return 0;
621} 622}
622 623
623static int __init zcore_header_init(int arch, struct zcore_header *hdr) 624static void __init zcore_header_init(int arch, struct zcore_header *hdr,
625 unsigned long mem_size)
624{ 626{
625 int rc, i;
626 unsigned long memory = 0;
627 u32 prefix; 627 u32 prefix;
628 int i;
628 629
629 if (arch == ARCH_S390X) 630 if (arch == ARCH_S390X)
630 hdr->arch_id = DUMP_ARCH_S390X; 631 hdr->arch_id = DUMP_ARCH_S390X;
631 else 632 else
632 hdr->arch_id = DUMP_ARCH_S390; 633 hdr->arch_id = DUMP_ARCH_S390;
633 rc = get_mem_size(&memory); 634 hdr->mem_size = mem_size;
634 if (rc) 635 hdr->rmem_size = mem_size;
635 return rc;
636 hdr->mem_size = memory;
637 hdr->rmem_size = memory;
638 hdr->mem_end = sys_info.mem_size; 636 hdr->mem_end = sys_info.mem_size;
639 hdr->num_pages = memory / PAGE_SIZE; 637 hdr->num_pages = mem_size / PAGE_SIZE;
640 hdr->tod = get_tod_clock(); 638 hdr->tod = get_tod_clock();
641 get_cpu_id(&hdr->cpu_id); 639 get_cpu_id(&hdr->cpu_id);
642 for (i = 0; zfcpdump_save_areas[i]; i++) { 640 for (i = 0; zfcpdump_save_areas[i]; i++) {
@@ -647,7 +645,6 @@ static int __init zcore_header_init(int arch, struct zcore_header *hdr)
647 hdr->lc_vec[hdr->cpu_cnt] = prefix; 645 hdr->lc_vec[hdr->cpu_cnt] = prefix;
648 hdr->cpu_cnt++; 646 hdr->cpu_cnt++;
649 } 647 }
650 return 0;
651} 648}
652 649
653/* 650/*
@@ -682,9 +679,11 @@ static int __init zcore_reipl_init(void)
682 679
683static int __init zcore_init(void) 680static int __init zcore_init(void)
684{ 681{
682 unsigned long mem_size, mem_end;
685 unsigned char arch; 683 unsigned char arch;
686 int rc; 684 int rc;
687 685
686 mem_size = mem_end = 0;
688 if (ipl_info.type != IPL_TYPE_FCP_DUMP) 687 if (ipl_info.type != IPL_TYPE_FCP_DUMP)
689 return -ENODATA; 688 return -ENODATA;
690 if (OLDMEM_BASE) 689 if (OLDMEM_BASE)
@@ -727,13 +726,14 @@ static int __init zcore_init(void)
727 } 726 }
728#endif /* CONFIG_64BIT */ 727#endif /* CONFIG_64BIT */
729 728
730 rc = sys_info_init(arch); 729 rc = get_mem_info(&mem_size, &mem_end);
731 if (rc) 730 if (rc)
732 goto fail; 731 goto fail;
733 732
734 rc = zcore_header_init(arch, &zcore_header); 733 rc = sys_info_init(arch, mem_end);
735 if (rc) 734 if (rc)
736 goto fail; 735 goto fail;
736 zcore_header_init(arch, &zcore_header, mem_size);
737 737
738 rc = zcore_reipl_init(); 738 rc = zcore_reipl_init();
739 if (rc) 739 if (rc)