diff options
author | Heiko Carstens <heiko.carstens@de.ibm.com> | 2007-02-05 23:18:37 +0300 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2007-02-05 23:18:37 +0300 |
commit | ab14de6c37fae22911ba99f4171613e6d758050b (patch) | |
tree | 7545169fe9d64a82616ae37f2b6c1a420c77f30f /arch/s390/kernel/setup.c | |
parent | 31ee4b2f40994e8b21691f85cdd4052551a789b7 (diff) | |
download | linux-ab14de6c37fae22911ba99f4171613e6d758050b.tar.xz |
[S390] Convert memory detection into C code.
Hopefully this will make it more maintainable and less error prone.
Code makes use of search_exception_tables(). Since it calls this
function before the kernel exeception table is sorted, there is an
early call to sort_main_extable().
This way it's easy to use the already present infrastructure of fixup
sections. Also this would allows to easily convert the rest of
head[31|64].S into C code.
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390/kernel/setup.c')
-rw-r--r-- | arch/s390/kernel/setup.c | 134 |
1 files changed, 0 insertions, 134 deletions
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c index 2fa866f6f711..f73a11528217 100644 --- a/arch/s390/kernel/setup.c +++ b/arch/s390/kernel/setup.c @@ -284,140 +284,6 @@ static void __init conmode_default(void) } } -/* - * Create a Kernel NSS if the SAVESYS= parameter is defined -*/ -#define DEFSYS_CMD_SIZE 96 -#define SAVESYS_CMD_SIZE 32 - -extern int _eshared; -char kernel_nss_name[NSS_NAME_SIZE + 1]; - -#ifdef CONFIG_SHARED_KERNEL -static __init void create_kernel_nss(void) -{ - unsigned int i, stext_pfn, eshared_pfn, end_pfn, min_size; -#ifdef CONFIG_BLK_DEV_INITRD - unsigned int sinitrd_pfn, einitrd_pfn; -#endif - int response; - char *savesys_ptr; - char upper_command_line[COMMAND_LINE_SIZE]; - char defsys_cmd[DEFSYS_CMD_SIZE]; - char savesys_cmd[SAVESYS_CMD_SIZE]; - - /* Do nothing if we are not running under VM */ - if (!MACHINE_IS_VM) - return; - - /* Convert COMMAND_LINE to upper case */ - for (i = 0; i < strlen(COMMAND_LINE); i++) - upper_command_line[i] = toupper(COMMAND_LINE[i]); - - savesys_ptr = strstr(upper_command_line, "SAVESYS="); - - if (!savesys_ptr) - return; - - savesys_ptr += 8; /* Point to the beginning of the NSS name */ - for (i = 0; i < NSS_NAME_SIZE; i++) { - if (savesys_ptr[i] == ' ' || savesys_ptr[i] == '\0') - break; - kernel_nss_name[i] = savesys_ptr[i]; - } - - stext_pfn = PFN_DOWN(__pa(&_stext)); - eshared_pfn = PFN_DOWN(__pa(&_eshared)); - end_pfn = PFN_UP(__pa(&_end)); - min_size = end_pfn << 2; - - sprintf(defsys_cmd, "DEFSYS %s 00000-%.5X EW %.5X-%.5X SR %.5X-%.5X", - kernel_nss_name, stext_pfn - 1, stext_pfn, eshared_pfn - 1, - eshared_pfn, end_pfn); - -#ifdef CONFIG_BLK_DEV_INITRD - if (INITRD_START && INITRD_SIZE) { - sinitrd_pfn = PFN_DOWN(__pa(INITRD_START)); - einitrd_pfn = PFN_UP(__pa(INITRD_START + INITRD_SIZE)); - min_size = einitrd_pfn << 2; - sprintf(defsys_cmd, "%s EW %.5X-%.5X", defsys_cmd, - sinitrd_pfn, einitrd_pfn); - } -#endif - - sprintf(defsys_cmd, "%s EW MINSIZE=%.7iK", defsys_cmd, min_size); - sprintf(savesys_cmd, "SAVESYS %s \n IPL %s", - kernel_nss_name, kernel_nss_name); - - __cpcmd(defsys_cmd, NULL, 0, &response); - - if (response != 0) - return; - - __cpcmd(savesys_cmd, NULL, 0, &response); - - if (response != strlen(savesys_cmd)) - return; - - ipl_flags = IPL_NSS_VALID; -} - -#else /* CONFIG_SHARED_KERNEL */ - -static inline void create_kernel_nss(void) { } - -#endif /* CONFIG_SHARED_KERNEL */ - -/* - * Clear bss memory - */ -static __init void clear_bss_section(void) -{ - memset(__bss_start, 0, _end - __bss_start); -} - -/* - * Initialize storage key for kernel pages - */ -static __init void init_kernel_storage_key(void) -{ - unsigned long end_pfn, init_pfn; - - end_pfn = PFN_UP(__pa(&_end)); - - for (init_pfn = 0 ; init_pfn < end_pfn; init_pfn++) - page_set_storage_key(init_pfn << PAGE_SHIFT, PAGE_DEFAULT_KEY); -} - -static __init void detect_machine_type(void) -{ - struct cpuinfo_S390 *cpuinfo = &S390_lowcore.cpu_data; - - asm volatile("stidp %0" : "=m" (S390_lowcore.cpu_data.cpu_id)); - - /* Running under z/VM ? */ - if (cpuinfo->cpu_id.version == 0xff) - machine_flags |= 1; - - /* Running on a P/390 ? */ - if (cpuinfo->cpu_id.machine == 0x7490) - machine_flags |= 4; -} - -/* - * Save ipl parameters, clear bss memory, initialize storage keys - * and create a kernel NSS at startup if the SAVESYS= parm is defined - */ -void __init startup_init(void) -{ - ipl_save_parameters(); - clear_bss_section(); - init_kernel_storage_key(); - lockdep_init(); - detect_machine_type(); - create_kernel_nss(); -} - #ifdef CONFIG_SMP void (*_machine_restart)(char *command) = machine_restart_smp; void (*_machine_halt)(void) = machine_halt_smp; |