15 #define KMSG_COMPONENT "setup"
16 #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
18 #include <linux/errno.h>
19 #include <linux/module.h>
20 #include <linux/sched.h>
21 #include <linux/kernel.h>
24 #include <linux/stddef.h>
26 #include <linux/ptrace.h>
28 #include <linux/tty.h>
37 #include <linux/device.h>
40 #include <linux/ctype.h>
41 #include <linux/reboot.h>
44 #include <linux/kexec.h>
50 #include <asm/uaccess.h>
53 #include <asm/mmu_context.h>
58 #include <asm/ptrace.h>
59 #include <asm/sections.h>
123 #include <asm/setup.h>
129 static int __init condev_setup(
char *
str)
134 if (vdev >= 0 && vdev < 65536) {
141 __setup(
"condev=", condev_setup);
143 static void __init set_preferred_console(
void)
158 static int __init conmode_setup(
char *str)
160 #if defined(CONFIG_SCLP_CONSOLE) || defined(CONFIG_SCLP_VT220_CONSOLE)
164 #if defined(CONFIG_TN3215_CONSOLE)
165 if (
strncmp(str,
"3215", 5) == 0)
168 #if defined(CONFIG_TN3270_CONSOLE)
169 if (
strncmp(str,
"3270", 5) == 0)
172 set_preferred_console();
176 __setup(
"conmode=", conmode_setup);
178 static void __init conmode_default(
void)
180 char query_buffer[1024];
184 cpcmd(
"QUERY CONSOLE", query_buffer, 1024,
NULL);
186 ptr =
strstr(query_buffer,
"SUBCHANNEL =");
188 cpcmd(
"QUERY TERM", query_buffer, 1024,
NULL);
189 ptr =
strstr(query_buffer,
"CONMODE");
199 #if defined(CONFIG_SCLP_CONSOLE) || defined(CONFIG_SCLP_VT220_CONSOLE)
204 if (
strncmp(ptr + 8,
"3270", 4) == 0) {
205 #if defined(CONFIG_TN3270_CONSOLE)
207 #elif defined(CONFIG_TN3215_CONSOLE)
209 #elif defined(CONFIG_SCLP_CONSOLE) || defined(CONFIG_SCLP_VT220_CONSOLE)
212 }
else if (
strncmp(ptr + 8,
"3215", 4) == 0) {
213 #if defined(CONFIG_TN3215_CONSOLE)
215 #elif defined(CONFIG_TN3270_CONSOLE)
217 #elif defined(CONFIG_SCLP_CONSOLE) || defined(CONFIG_SCLP_VT220_CONSOLE)
222 #if defined(CONFIG_SCLP_CONSOLE) || defined(CONFIG_SCLP_VT220_CONSOLE)
228 #ifdef CONFIG_ZFCPDUMP
237 if (console_devno != -1)
238 sprintf(str,
" cio_ignore=all,!0.0.%04x,!0.0.%04x",
241 sprintf(str,
" cio_ignore=all,!0.0.%04x",
247 static inline void setup_zfcpdump(
unsigned int console_devno) {}
293 static int __init early_parse_mem(
char *
p)
301 static int __init parse_vmalloc(
char *
arg)
313 static void __init set_user_mode_primary(
void)
324 static int __init early_parse_user_mode(
char *
p)
326 if (p &&
strcmp(p,
"primary") == 0)
328 else if (!p ||
strcmp(p,
"home") == 0)
336 static void __init setup_addressing_mode(
void)
340 set_user_mode_primary();
342 pr_info(
"Address spaces switched, mvcos available\n");
344 pr_info(
"Address spaces switched, mvcos not available\n");
349 static void __init setup_lowcore(
void)
392 lc->extended_save_area_addr = (
__u32)
430 set_prefix((
u32)(
unsigned long) lc);
434 static struct resource code_resource = {
435 .name =
"Kernel code",
439 static struct resource data_resource = {
440 .name =
"Kernel data",
444 static struct resource bss_resource = {
445 .name =
"Kernel bss",
455 static void __init setup_resources(
void)
460 code_resource.
start = (
unsigned long) &_text;
461 code_resource.
end = (
unsigned long) &_etext - 1;
462 data_resource.
start = (
unsigned long) &_etext;
463 data_resource.
end = (
unsigned long) &_edata - 1;
464 bss_resource.
start = (
unsigned long) &__bss_start;
465 bss_resource.
end = (
unsigned long) &__bss_stop - 1;
478 res->
name =
"System RAM";
481 res->
name =
"System ROM";
485 res->
name =
"reserved";
491 for (j = 0; j <
ARRAY_SIZE(standard_resources); j++) {
492 std_res = standard_resources[
j];
496 if (std_res->
end > res->
end) {
512 static void __init setup_memory_end(
void)
514 unsigned long vmax, vmalloc_size,
tmp;
518 #ifdef CONFIG_ZFCPDUMP
524 real_memory_size = 0;
538 start = (chunk->
addr + align - 1) & ~(align - 1);
539 end = (chunk->
addr + chunk->
size) & ~(align - 1);
541 memset(chunk, 0,
sizeof(*chunk));
546 real_memory_size =
max(real_memory_size,
554 tmp = tmp * (
sizeof(
struct page) +
PAGE_SIZE) + vmalloc_size;
555 if (tmp <= (1
UL << 42))
574 tmp &= ~((vmax >> 11) - 1);
576 vmemmap = (
struct page *) tmp;
586 memset(chunk, 0,
sizeof(*chunk));
594 static void __init setup_vmcoreinfo(
void)
599 #ifdef CONFIG_CRASH_DUMP
604 static unsigned long __init find_crash_base(
unsigned long crash_size,
607 unsigned long crash_base;
612 *msg =
"first memory chunk must be at least crashkernel size";
618 for (i = MEMORY_CHUNKS - 1; i >= 0; i--) {
620 if (chunk->
size == 0)
624 if (chunk->
size < crash_size)
626 crash_base = (chunk->
addr + chunk->
size) - crash_size;
627 if (crash_base < crash_size)
635 *msg =
"no suitable area found";
642 static int __init verify_crash_base(
unsigned long crash_base,
643 unsigned long crash_size,
653 if (crash_size > crash_base) {
654 *msg =
"crashkernel offset must be greater than size";
660 *msg =
"first memory chunk must be at least crashkernel size";
666 if (chunk->
size == 0)
668 if (crash_base < chunk->
addr)
670 if (crash_base >= chunk->
addr + chunk->
size)
673 if (crash_base + crash_size > chunk->
addr + chunk->
size) {
674 *msg =
"selected memory chunk is too small for "
675 "crashkernel memory";
680 *msg =
"invalid memory range specified";
687 static void __init reserve_kdump_bootmem(
unsigned long addr,
unsigned long size,
721 static void reserve_oldmem(
void)
723 #ifdef CONFIG_CRASH_DUMP
742 #ifdef CONFIG_CRASH_DUMP
743 unsigned long long crash_base, crash_size;
749 if (rc || crash_size == 0)
756 crash_base = find_crash_base(crash_size, &msg);
758 pr_info(
"crashkernel reservation failed: %s\n", msg);
762 if (verify_crash_base(crash_base, crash_size, &msg)) {
763 pr_info(
"crashkernel reservation failed: %s\n", msg);
772 reserve_kdump_bootmem(crash_base, crash_size,
CHUNK_CRASHK);
773 pr_info(
"Reserving %lluMB of memory at %lluMB "
774 "for crashkernel (System RAM: %luMB)\n",
775 crash_size >> 20, crash_base >> 20,
memory_end >> 20);
780 static void __init init_storage_keys(
unsigned long start,
unsigned long end)
782 unsigned long boundary,
function,
size;
784 while (start < end) {
789 boundary = (start +
size) & ~(size - 1);
790 if (boundary <= end) {
792 start = pfmf(
function, start);
793 }
while (start < boundary);
801 boundary = (start +
size) & ~(size - 1);
802 if (boundary <= end) {
804 start = pfmf(
function, start);
805 }
while (start < boundary);
816 unsigned long bootmap_size;
817 unsigned long start_pfn, end_pfn;
827 #ifdef CONFIG_BLK_DEV_INITRD
834 unsigned long bmap_size;
843 #ifdef CONFIG_CRASH_DUMP
852 pr_err(
"initrd extends beyond end of "
853 "memory (0x%08lx > 0x%08lx) "
854 "disabling initrd\n",
858 pr_info(
"Moving initrd (0x%08lx -> "
859 "0x%08lx, size: %ld)\n",
879 unsigned long start_chunk, end_chunk, pfn;
886 end_chunk =
min(end_chunk, end_pfn);
887 if (start_chunk >= end_chunk)
890 PFN_PHYS(end_chunk - start_chunk), 0);
891 pfn =
max(start_chunk, start_pfn);
897 free_bootmem_with_active_regions(0,
max_pfn);
904 PFN_PHYS(start_pfn) - (
unsigned long)_stext,
915 #ifdef CONFIG_CRASH_DUMP
920 if (is_kdump_kernel())
924 #ifdef CONFIG_BLK_DEV_INITRD
932 pr_err(
"initrd extends beyond end of "
933 "memory (0x%08lx > 0x%08lx) "
934 "disabling initrd\n",
945 static void __init setup_hwcaps(
void)
947 static const int stfl_bits[6] = { 0, 2, 7, 17, 19, 21 };
969 for (i = 0; i < 6; i++)
970 if (test_facility(stfl_bits[i]))
973 if (test_facility(22) && test_facility(30))
989 if ((
elf_hwcap & (1
UL << 2)) && test_facility(42) && test_facility(44))
998 #if defined(CONFIG_64BIT)
1008 if (test_facility(50) && test_facility(73))
1013 switch (
cpu_id.machine) {
1015 #if !defined(CONFIG_64BIT)
1022 #if defined(CONFIG_64BIT)
1056 #ifndef CONFIG_64BIT
1058 pr_info(
"Linux is running as a z/VM "
1059 "guest operating system in 31-bit mode\n");
1061 pr_info(
"Linux is running natively in 31-bit mode\n");
1063 pr_info(
"The hardware system has IEEE compatible "
1064 "floating point units\n");
1066 pr_info(
"The hardware system has no IEEE compatible "
1067 "floating point units\n");
1070 pr_info(
"Linux is running as a z/VM "
1071 "guest operating system in 64-bit mode\n");
1073 pr_info(
"Linux is running under KVM in 64-bit mode\n");
1075 pr_info(
"Linux is running natively in 64-bit mode\n");
1099 setup_addressing_mode();
1122 set_preferred_console();
1125 setup_zfcpdump(console_devno);