diff options
Diffstat (limited to 'arch/s390/kernel/setup.c')
| -rw-r--r-- | arch/s390/kernel/setup.c | 66 |
1 files changed, 39 insertions, 27 deletions
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c index 2aa13e8e000a..b928fecdc743 100644 --- a/arch/s390/kernel/setup.c +++ b/arch/s390/kernel/setup.c | |||
| @@ -62,13 +62,9 @@ EXPORT_SYMBOL_GPL(uaccess); | |||
| 62 | unsigned int console_mode = 0; | 62 | unsigned int console_mode = 0; |
| 63 | unsigned int console_devno = -1; | 63 | unsigned int console_devno = -1; |
| 64 | unsigned int console_irq = -1; | 64 | unsigned int console_irq = -1; |
| 65 | unsigned long memory_size = 0; | ||
| 66 | unsigned long machine_flags = 0; | 65 | unsigned long machine_flags = 0; |
| 67 | struct { | 66 | |
| 68 | unsigned long addr, size, type; | 67 | struct mem_chunk memory_chunk[MEMORY_CHUNKS]; |
| 69 | } memory_chunk[MEMORY_CHUNKS] = { { 0 } }; | ||
| 70 | #define CHUNK_READ_WRITE 0 | ||
| 71 | #define CHUNK_READ_ONLY 1 | ||
| 72 | volatile int __cpu_logical_map[NR_CPUS]; /* logical cpu to cpu address */ | 68 | volatile int __cpu_logical_map[NR_CPUS]; /* logical cpu to cpu address */ |
| 73 | unsigned long __initdata zholes_size[MAX_NR_ZONES]; | 69 | unsigned long __initdata zholes_size[MAX_NR_ZONES]; |
| 74 | static unsigned long __initdata memory_end; | 70 | static unsigned long __initdata memory_end; |
| @@ -229,11 +225,11 @@ static void __init conmode_default(void) | |||
| 229 | char *ptr; | 225 | char *ptr; |
| 230 | 226 | ||
| 231 | if (MACHINE_IS_VM) { | 227 | if (MACHINE_IS_VM) { |
| 232 | __cpcmd("QUERY CONSOLE", query_buffer, 1024, NULL); | 228 | cpcmd("QUERY CONSOLE", query_buffer, 1024, NULL); |
| 233 | console_devno = simple_strtoul(query_buffer + 5, NULL, 16); | 229 | console_devno = simple_strtoul(query_buffer + 5, NULL, 16); |
| 234 | ptr = strstr(query_buffer, "SUBCHANNEL ="); | 230 | ptr = strstr(query_buffer, "SUBCHANNEL ="); |
| 235 | console_irq = simple_strtoul(ptr + 13, NULL, 16); | 231 | console_irq = simple_strtoul(ptr + 13, NULL, 16); |
| 236 | __cpcmd("QUERY TERM", query_buffer, 1024, NULL); | 232 | cpcmd("QUERY TERM", query_buffer, 1024, NULL); |
| 237 | ptr = strstr(query_buffer, "CONMODE"); | 233 | ptr = strstr(query_buffer, "CONMODE"); |
| 238 | /* | 234 | /* |
| 239 | * Set the conmode to 3215 so that the device recognition | 235 | * Set the conmode to 3215 so that the device recognition |
| @@ -242,7 +238,7 @@ static void __init conmode_default(void) | |||
| 242 | * 3215 and the 3270 driver will try to access the console | 238 | * 3215 and the 3270 driver will try to access the console |
| 243 | * device (3215 as console and 3270 as normal tty). | 239 | * device (3215 as console and 3270 as normal tty). |
| 244 | */ | 240 | */ |
| 245 | __cpcmd("TERM CONMODE 3215", NULL, 0, NULL); | 241 | cpcmd("TERM CONMODE 3215", NULL, 0, NULL); |
| 246 | if (ptr == NULL) { | 242 | if (ptr == NULL) { |
| 247 | #if defined(CONFIG_SCLP_CONSOLE) | 243 | #if defined(CONFIG_SCLP_CONSOLE) |
| 248 | SET_CONSOLE_SCLP; | 244 | SET_CONSOLE_SCLP; |
| @@ -299,14 +295,14 @@ static void do_machine_restart_nonsmp(char * __unused) | |||
| 299 | static void do_machine_halt_nonsmp(void) | 295 | static void do_machine_halt_nonsmp(void) |
| 300 | { | 296 | { |
| 301 | if (MACHINE_IS_VM && strlen(vmhalt_cmd) > 0) | 297 | if (MACHINE_IS_VM && strlen(vmhalt_cmd) > 0) |
| 302 | cpcmd(vmhalt_cmd, NULL, 0, NULL); | 298 | __cpcmd(vmhalt_cmd, NULL, 0, NULL); |
| 303 | signal_processor(smp_processor_id(), sigp_stop_and_store_status); | 299 | signal_processor(smp_processor_id(), sigp_stop_and_store_status); |
| 304 | } | 300 | } |
| 305 | 301 | ||
| 306 | static void do_machine_power_off_nonsmp(void) | 302 | static void do_machine_power_off_nonsmp(void) |
| 307 | { | 303 | { |
| 308 | if (MACHINE_IS_VM && strlen(vmpoff_cmd) > 0) | 304 | if (MACHINE_IS_VM && strlen(vmpoff_cmd) > 0) |
| 309 | cpcmd(vmpoff_cmd, NULL, 0, NULL); | 305 | __cpcmd(vmpoff_cmd, NULL, 0, NULL); |
| 310 | signal_processor(smp_processor_id(), sigp_stop_and_store_status); | 306 | signal_processor(smp_processor_id(), sigp_stop_and_store_status); |
| 311 | } | 307 | } |
| 312 | 308 | ||
| @@ -489,6 +485,37 @@ setup_resources(void) | |||
| 489 | } | 485 | } |
| 490 | } | 486 | } |
| 491 | 487 | ||
| 488 | static void __init setup_memory_end(void) | ||
| 489 | { | ||
| 490 | unsigned long real_size, memory_size; | ||
| 491 | unsigned long max_mem, max_phys; | ||
| 492 | int i; | ||
| 493 | |||
| 494 | memory_size = real_size = 0; | ||
| 495 | max_phys = VMALLOC_END - VMALLOC_MIN_SIZE; | ||
| 496 | memory_end &= PAGE_MASK; | ||
| 497 | |||
| 498 | max_mem = memory_end ? min(max_phys, memory_end) : max_phys; | ||
| 499 | |||
| 500 | for (i = 0; i < MEMORY_CHUNKS; i++) { | ||
| 501 | struct mem_chunk *chunk = &memory_chunk[i]; | ||
| 502 | |||
| 503 | real_size = max(real_size, chunk->addr + chunk->size); | ||
| 504 | if (chunk->addr >= max_mem) { | ||
| 505 | memset(chunk, 0, sizeof(*chunk)); | ||
| 506 | continue; | ||
| 507 | } | ||
| 508 | if (chunk->addr + chunk->size > max_mem) | ||
| 509 | chunk->size = max_mem - chunk->addr; | ||
| 510 | memory_size = max(memory_size, chunk->addr + chunk->size); | ||
| 511 | } | ||
| 512 | if (!memory_end) | ||
| 513 | memory_end = memory_size; | ||
| 514 | if (real_size > memory_end) | ||
| 515 | printk("More memory detected than supported. Unused: %luk\n", | ||
| 516 | (real_size - memory_end) >> 10); | ||
| 517 | } | ||
| 518 | |||
| 492 | static void __init | 519 | static void __init |
| 493 | setup_memory(void) | 520 | setup_memory(void) |
| 494 | { | 521 | { |
| @@ -645,8 +672,6 @@ setup_arch(char **cmdline_p) | |||
| 645 | init_mm.end_data = (unsigned long) &_edata; | 672 | init_mm.end_data = (unsigned long) &_edata; |
| 646 | init_mm.brk = (unsigned long) &_end; | 673 | init_mm.brk = (unsigned long) &_end; |
| 647 | 674 | ||
| 648 | memory_end = memory_size; | ||
| 649 | |||
| 650 | if (MACHINE_HAS_MVCOS) | 675 | if (MACHINE_HAS_MVCOS) |
| 651 | memcpy(&uaccess, &uaccess_mvcos, sizeof(uaccess)); | 676 | memcpy(&uaccess, &uaccess_mvcos, sizeof(uaccess)); |
| 652 | else | 677 | else |
| @@ -654,20 +679,7 @@ setup_arch(char **cmdline_p) | |||
| 654 | 679 | ||
| 655 | parse_early_param(); | 680 | parse_early_param(); |
| 656 | 681 | ||
| 657 | #ifndef CONFIG_64BIT | 682 | setup_memory_end(); |
| 658 | memory_end &= ~0x400000UL; | ||
| 659 | |||
| 660 | /* | ||
| 661 | * We need some free virtual space to be able to do vmalloc. | ||
| 662 | * On a machine with 2GB memory we make sure that we have at | ||
| 663 | * least 128 MB free space for vmalloc. | ||
| 664 | */ | ||
| 665 | if (memory_end > 1920*1024*1024) | ||
| 666 | memory_end = 1920*1024*1024; | ||
| 667 | #else /* CONFIG_64BIT */ | ||
| 668 | memory_end &= ~0x200000UL; | ||
| 669 | #endif /* CONFIG_64BIT */ | ||
| 670 | |||
| 671 | setup_memory(); | 683 | setup_memory(); |
| 672 | setup_resources(); | 684 | setup_resources(); |
| 673 | setup_lowcore(); | 685 | setup_lowcore(); |
