hugetlb: introduce generic version of hugetlb_free_pgd_range
[linux/fpc-iii.git] / arch / s390 / boot / startup.c
blob4d441317cdebd821bbab40cd61021b0000a8b4df
1 // SPDX-License-Identifier: GPL-2.0
2 #include <linux/string.h>
3 #include <asm/setup.h>
4 #include <asm/sclp.h>
5 #include "compressed/decompressor.h"
6 #include "boot.h"
8 extern char __boot_data_start[], __boot_data_end[];
10 void error(char *x)
12 sclp_early_printk("\n\n");
13 sclp_early_printk(x);
14 sclp_early_printk("\n\n -- System halted");
16 disabled_wait(0xdeadbeef);
19 #ifdef CONFIG_KERNEL_UNCOMPRESSED
20 unsigned long mem_safe_offset(void)
22 return vmlinux.default_lma + vmlinux.image_size + vmlinux.bss_size;
24 #endif
26 static void rescue_initrd(void)
28 unsigned long min_initrd_addr;
30 if (!IS_ENABLED(CONFIG_BLK_DEV_INITRD))
31 return;
32 if (!INITRD_START || !INITRD_SIZE)
33 return;
34 min_initrd_addr = mem_safe_offset();
35 if (min_initrd_addr <= INITRD_START)
36 return;
37 memmove((void *)min_initrd_addr, (void *)INITRD_START, INITRD_SIZE);
38 INITRD_START = min_initrd_addr;
41 static void copy_bootdata(void)
43 if (__boot_data_end - __boot_data_start != vmlinux.bootdata_size)
44 error(".boot.data section size mismatch");
45 memcpy((void *)vmlinux.bootdata_off, __boot_data_start, vmlinux.bootdata_size);
48 void startup_kernel(void)
50 void *img;
52 rescue_initrd();
53 sclp_early_read_info();
54 store_ipl_parmblock();
55 setup_boot_command_line();
56 setup_memory_end();
57 detect_memory();
58 if (!IS_ENABLED(CONFIG_KERNEL_UNCOMPRESSED)) {
59 img = decompress_kernel();
60 memmove((void *)vmlinux.default_lma, img, vmlinux.image_size);
62 copy_bootdata();
63 vmlinux.entry();