setup.c (822bbba0cabb50825a0ce22707dc45eb82d02853) | setup.c (268a2d60013049cfd9a0aada77284aa6ea8ad26a) |
---|---|
1/* 2 * This file is subject to the terms and conditions of the GNU General Public 3 * License. See the file "COPYING" in the main directory of this archive 4 * for more details. 5 * 6 * Copyright (C) 1995 Linus Torvalds 7 * Copyright (C) 1995 Waldorf Electronics 8 * Copyright (C) 1994, 95, 96, 97, 98, 99, 2000, 01, 02, 03 Ralf Baechle --- 53 unchanged lines hidden (view full) --- 62unsigned long mips_machtype __read_mostly = MACH_UNKNOWN; 63 64EXPORT_SYMBOL(mips_machtype); 65 66static char __initdata command_line[COMMAND_LINE_SIZE]; 67char __initdata arcs_cmdline[COMMAND_LINE_SIZE]; 68 69#ifdef CONFIG_CMDLINE_BOOL | 1/* 2 * This file is subject to the terms and conditions of the GNU General Public 3 * License. See the file "COPYING" in the main directory of this archive 4 * for more details. 5 * 6 * Copyright (C) 1995 Linus Torvalds 7 * Copyright (C) 1995 Waldorf Electronics 8 * Copyright (C) 1994, 95, 96, 97, 98, 99, 2000, 01, 02, 03 Ralf Baechle --- 53 unchanged lines hidden (view full) --- 62unsigned long mips_machtype __read_mostly = MACH_UNKNOWN; 63 64EXPORT_SYMBOL(mips_machtype); 65 66static char __initdata command_line[COMMAND_LINE_SIZE]; 67char __initdata arcs_cmdline[COMMAND_LINE_SIZE]; 68 69#ifdef CONFIG_CMDLINE_BOOL |
70static char __initdata builtin_cmdline[COMMAND_LINE_SIZE] = CONFIG_CMDLINE; | 70static const char builtin_cmdline[] __initconst = CONFIG_CMDLINE; 71#else 72static const char builtin_cmdline[] __initconst = ""; |
71#endif 72 73/* 74 * mips_io_port_base is the begin of the address space to which x86 style 75 * I/O ports are mapped. 76 */ 77unsigned long mips_io_port_base = -1; 78EXPORT_SYMBOL(mips_io_port_base); --- 201 unchanged lines hidden (view full) --- 280#define finalize_initrd() do {} while (0) 281 282#endif 283 284/* 285 * Initialize the bootmem allocator. It also setup initrd related data 286 * if needed. 287 */ | 73#endif 74 75/* 76 * mips_io_port_base is the begin of the address space to which x86 style 77 * I/O ports are mapped. 78 */ 79unsigned long mips_io_port_base = -1; 80EXPORT_SYMBOL(mips_io_port_base); --- 201 unchanged lines hidden (view full) --- 282#define finalize_initrd() do {} while (0) 283 284#endif 285 286/* 287 * Initialize the bootmem allocator. It also setup initrd related data 288 * if needed. 289 */ |
288#if defined(CONFIG_SGI_IP27) || (defined(CONFIG_CPU_LOONGSON3) && defined(CONFIG_NUMA)) | 290#if defined(CONFIG_SGI_IP27) || (defined(CONFIG_CPU_LOONGSON64) && defined(CONFIG_NUMA)) |
289 290static void __init bootmem_init(void) 291{ 292 init_initrd(); 293 finalize_initrd(); 294} 295 296#else /* !CONFIG_SGI_IP27 */ --- 236 unchanged lines hidden (view full) --- 533 phys_addr_t size = PFN_PHYS(PFN_UP(__pa_symbol(&_end))) - start; 534 535 if (!memblock_is_region_memory(start, size)) { 536 pr_info("Kernel sections are not in the memory maps\n"); 537 memblock_add(start, size); 538 } 539} 540 | 291 292static void __init bootmem_init(void) 293{ 294 init_initrd(); 295 finalize_initrd(); 296} 297 298#else /* !CONFIG_SGI_IP27 */ --- 236 unchanged lines hidden (view full) --- 535 phys_addr_t size = PFN_PHYS(PFN_UP(__pa_symbol(&_end))) - start; 536 537 if (!memblock_is_region_memory(start, size)) { 538 pr_info("Kernel sections are not in the memory maps\n"); 539 memblock_add(start, size); 540 } 541} 542 |
541#define USE_PROM_CMDLINE IS_ENABLED(CONFIG_MIPS_CMDLINE_FROM_BOOTLOADER) 542#define USE_DTB_CMDLINE IS_ENABLED(CONFIG_MIPS_CMDLINE_FROM_DTB) 543#define EXTEND_WITH_PROM IS_ENABLED(CONFIG_MIPS_CMDLINE_DTB_EXTEND) 544#define BUILTIN_EXTEND_WITH_PROM \ 545 IS_ENABLED(CONFIG_MIPS_CMDLINE_BUILTIN_EXTEND) | 543static void __init bootcmdline_append(const char *s, size_t max) 544{ 545 if (!s[0] || !max) 546 return; |
546 | 547 |
548 if (boot_command_line[0]) 549 strlcat(boot_command_line, " ", COMMAND_LINE_SIZE); 550 551 strlcat(boot_command_line, s, max); 552} 553 554#ifdef CONFIG_OF_EARLY_FLATTREE 555 556static int __init bootcmdline_scan_chosen(unsigned long node, const char *uname, 557 int depth, void *data) 558{ 559 bool *dt_bootargs = data; 560 const char *p; 561 int l; 562 563 if (depth != 1 || !data || 564 (strcmp(uname, "chosen") != 0 && strcmp(uname, "chosen@0") != 0)) 565 return 0; 566 567 p = of_get_flat_dt_prop(node, "bootargs", &l); 568 if (p != NULL && l > 0) { 569 bootcmdline_append(p, min(l, COMMAND_LINE_SIZE)); 570 *dt_bootargs = true; 571 } 572 573 return 1; 574} 575 576#endif /* CONFIG_OF_EARLY_FLATTREE */ 577 578static void __init bootcmdline_init(char **cmdline_p) 579{ 580 bool dt_bootargs = false; 581 582 /* 583 * If CMDLINE_OVERRIDE is enabled then initializing the command line is 584 * trivial - we simply use the built-in command line unconditionally & 585 * unmodified. 586 */ 587 if (IS_ENABLED(CONFIG_CMDLINE_OVERRIDE)) { 588 strlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE); 589 return; 590 } 591 592 /* 593 * If the user specified a built-in command line & 594 * MIPS_CMDLINE_BUILTIN_EXTEND, then the built-in command line is 595 * prepended to arguments from the bootloader or DT so we'll copy them 596 * to the start of boot_command_line here. Otherwise, empty 597 * boot_command_line to undo anything early_init_dt_scan_chosen() did. 598 */ 599 if (IS_ENABLED(CONFIG_MIPS_CMDLINE_BUILTIN_EXTEND)) 600 strlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE); 601 else 602 boot_command_line[0] = 0; 603 604#ifdef CONFIG_OF_EARLY_FLATTREE 605 /* 606 * If we're configured to take boot arguments from DT, look for those 607 * now. 608 */ 609 if (IS_ENABLED(CONFIG_MIPS_CMDLINE_FROM_DTB)) 610 of_scan_flat_dt(bootcmdline_scan_chosen, &dt_bootargs); 611#endif 612 613 /* 614 * If we didn't get any arguments from DT (regardless of whether that's 615 * because we weren't configured to look for them, or because we looked 616 * & found none) then we'll take arguments from the bootloader. 617 * plat_mem_setup() should have filled arcs_cmdline with arguments from 618 * the bootloader. 619 */ 620 if (IS_ENABLED(CONFIG_MIPS_CMDLINE_DTB_EXTEND) || !dt_bootargs) 621 bootcmdline_append(arcs_cmdline, COMMAND_LINE_SIZE); 622 623 /* 624 * If the user specified a built-in command line & we didn't already 625 * prepend it, we append it to boot_command_line here. 626 */ 627 if (IS_ENABLED(CONFIG_CMDLINE_BOOL) && 628 !IS_ENABLED(CONFIG_MIPS_CMDLINE_BUILTIN_EXTEND)) 629 bootcmdline_append(builtin_cmdline, COMMAND_LINE_SIZE); 630} 631 |
|
547/* 548 * arch_mem_init - initialize memory management subsystem 549 * 550 * o plat_mem_setup() detects the memory configuration and will record detected 551 * memory areas using add_memory_region. 552 * 553 * At this stage the memory configuration of the system is known to the 554 * kernel but generic memory management system is still entirely uninitialized. --- 10 unchanged lines hidden (view full) --- 565 * get away without any kind of memory allocator. To keep old code from 566 * breaking plat_setup was just renamed to plat_mem_setup and a second platform 567 * initialization hook for anything else was introduced. 568 */ 569static void __init arch_mem_init(char **cmdline_p) 570{ 571 extern void plat_mem_setup(void); 572 | 632/* 633 * arch_mem_init - initialize memory management subsystem 634 * 635 * o plat_mem_setup() detects the memory configuration and will record detected 636 * memory areas using add_memory_region. 637 * 638 * At this stage the memory configuration of the system is known to the 639 * kernel but generic memory management system is still entirely uninitialized. --- 10 unchanged lines hidden (view full) --- 650 * get away without any kind of memory allocator. To keep old code from 651 * breaking plat_setup was just renamed to plat_mem_setup and a second platform 652 * initialization hook for anything else was introduced. 653 */ 654static void __init arch_mem_init(char **cmdline_p) 655{ 656 extern void plat_mem_setup(void); 657 |
573 /* 574 * Initialize boot_command_line to an innocuous but non-empty string in 575 * order to prevent early_init_dt_scan_chosen() from copying 576 * CONFIG_CMDLINE into it without our knowledge. We handle 577 * CONFIG_CMDLINE ourselves below & don't want to duplicate its 578 * content because repeating arguments can be problematic. 579 */ 580 strlcpy(boot_command_line, " ", COMMAND_LINE_SIZE); 581 | |
582 /* call board setup routine */ 583 plat_mem_setup(); 584 memblock_set_bottom_up(true); 585 | 658 /* call board setup routine */ 659 plat_mem_setup(); 660 memblock_set_bottom_up(true); 661 |
586#if defined(CONFIG_CMDLINE_BOOL) && defined(CONFIG_CMDLINE_OVERRIDE) 587 strlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE); 588#else 589 if ((USE_PROM_CMDLINE && arcs_cmdline[0]) || 590 (USE_DTB_CMDLINE && !boot_command_line[0])) 591 strlcpy(boot_command_line, arcs_cmdline, COMMAND_LINE_SIZE); 592 593 if (EXTEND_WITH_PROM && arcs_cmdline[0]) { 594 if (boot_command_line[0]) 595 strlcat(boot_command_line, " ", COMMAND_LINE_SIZE); 596 strlcat(boot_command_line, arcs_cmdline, COMMAND_LINE_SIZE); 597 } 598 599#if defined(CONFIG_CMDLINE_BOOL) 600 if (builtin_cmdline[0]) { 601 if (boot_command_line[0]) 602 strlcat(boot_command_line, " ", COMMAND_LINE_SIZE); 603 strlcat(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE); 604 } 605 606 if (BUILTIN_EXTEND_WITH_PROM && arcs_cmdline[0]) { 607 if (boot_command_line[0]) 608 strlcat(boot_command_line, " ", COMMAND_LINE_SIZE); 609 strlcat(boot_command_line, arcs_cmdline, COMMAND_LINE_SIZE); 610 } 611#endif 612#endif | 662 bootcmdline_init(cmdline_p); |
613 strlcpy(command_line, boot_command_line, COMMAND_LINE_SIZE); | 663 strlcpy(command_line, boot_command_line, COMMAND_LINE_SIZE); |
614 | |
615 *cmdline_p = command_line; 616 617 parse_early_param(); 618 619 if (usermem) 620 pr_info("User-defined physical RAM map overwrite\n"); 621 622 check_kernel_sections_mem(); --- 181 unchanged lines hidden --- | 664 *cmdline_p = command_line; 665 666 parse_early_param(); 667 668 if (usermem) 669 pr_info("User-defined physical RAM map overwrite\n"); 670 671 check_kernel_sections_mem(); --- 181 unchanged lines hidden --- |