aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/kernel
diff options
context:
space:
mode:
authorGrant Likely <grant.likely@secretlab.ca>2011-04-28 16:27:21 -0400
committerGrant Likely <grant.likely@secretlab.ca>2011-05-23 11:30:20 -0400
commit6291319d4864848efc7b5d81389e2404fb478cb9 (patch)
tree10f53e79940139a60a3d96f3b013ed849f4a176c /arch/arm/kernel
parent9eb8f6743b076b67f00776cda4330c802e157b41 (diff)
arm/dt: consolidate atags setup into setup_machine_atags
In preparation for adding device tree support, this patch consolidates all of the atag-specific setup into a single function. v5: - drop double printk("Machine; %s\n", ...); call. - leave copying boot_command_line in setup_arch() since it isn't atags specific. v4: - adapt to the removal of lookup_machine_type() - break out dump of machine_desc table into dump_machine_table() because the device tree probe code will use it. - Add for_each_machine_desc() macro Tested-by: Tony Lindgren <tony@atomide.com> Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org> Acked-by: Russell King <rmk+kernel@arm.linux.org.uk> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Diffstat (limited to 'arch/arm/kernel')
-rw-r--r--arch/arm/kernel/setup.c69
1 files changed, 40 insertions, 29 deletions
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index 109997e3fe4a..42c2f0cedf1b 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -439,25 +439,12 @@ void cpu_init(void)
439 : "r14"); 439 : "r14");
440} 440}
441 441
442static struct machine_desc * __init setup_machine(unsigned int nr) 442static void __init dump_machine_table(void)
443{ 443{
444 extern struct machine_desc __arch_info_begin[], __arch_info_end[];
445 struct machine_desc *p; 444 struct machine_desc *p;
446 445
447 /* 446 early_print("Available machine support:\n\nID (hex)\tNAME\n");
448 * locate machine in the list of supported machines. 447 for_each_machine_desc(p)
449 */
450 for (p = __arch_info_begin; p < __arch_info_end; p++)
451 if (nr == p->nr) {
452 printk("Machine: %s\n", p->name);
453 return p;
454 }
455
456 early_print("\n"
457 "Error: unrecognized/unsupported machine ID (r1 = 0x%08x).\n\n"
458 "Available machine support:\n\nID (hex)\tNAME\n", nr);
459
460 for (p = __arch_info_begin; p < __arch_info_end; p++)
461 early_print("%08x\t%s\n", p->nr, p->name); 448 early_print("%08x\t%s\n", p->nr, p->name);
462 449
463 early_print("\nPlease check your kernel config and/or bootloader.\n"); 450 early_print("\nPlease check your kernel config and/or bootloader.\n");
@@ -796,23 +783,29 @@ static void __init squash_mem_tags(struct tag *tag)
796 tag->hdr.tag = ATAG_NONE; 783 tag->hdr.tag = ATAG_NONE;
797} 784}
798 785
799void __init setup_arch(char **cmdline_p) 786static struct machine_desc * __init setup_machine_tags(unsigned int nr)
800{ 787{
801 struct tag *tags = (struct tag *)&init_tags; 788 struct tag *tags = (struct tag *)&init_tags;
802 struct machine_desc *mdesc; 789 struct machine_desc *mdesc = NULL, *p;
803 char *from = default_command_line; 790 char *from = default_command_line;
804 791
805 init_tags.mem.start = PHYS_OFFSET; 792 init_tags.mem.start = PHYS_OFFSET;
806 793
807 unwind_init(); 794 /*
808 795 * locate machine in the list of supported machines.
809 setup_processor(); 796 */
810 mdesc = setup_machine(machine_arch_type); 797 for_each_machine_desc(p)
811 machine_desc = mdesc; 798 if (nr == p->nr) {
812 machine_name = mdesc->name; 799 printk("Machine: %s\n", p->name);
800 mdesc = p;
801 break;
802 }
813 803
814 if (mdesc->soft_reboot) 804 if (!mdesc) {
815 reboot_setup("s"); 805 early_print("\nError: unrecognized/unsupported machine ID"
806 " (r1 = 0x%08x).\n\n", nr);
807 dump_machine_table(); /* does not return */
808 }
816 809
817 if (__atags_pointer) 810 if (__atags_pointer)
818 tags = phys_to_virt(__atags_pointer); 811 tags = phys_to_virt(__atags_pointer);
@@ -857,14 +850,32 @@ void __init setup_arch(char **cmdline_p)
857 parse_tags(tags); 850 parse_tags(tags);
858 } 851 }
859 852
853 /* parse_early_param needs a boot_command_line */
854 strlcpy(boot_command_line, from, COMMAND_LINE_SIZE);
855
856 return mdesc;
857}
858
859
860void __init setup_arch(char **cmdline_p)
861{
862 struct machine_desc *mdesc;
863
864 unwind_init();
865
866 setup_processor();
867 mdesc = setup_machine_tags(machine_arch_type);
868 machine_desc = mdesc;
869 machine_name = mdesc->name;
870
871 if (mdesc->soft_reboot)
872 reboot_setup("s");
873
860 init_mm.start_code = (unsigned long) _text; 874 init_mm.start_code = (unsigned long) _text;
861 init_mm.end_code = (unsigned long) _etext; 875 init_mm.end_code = (unsigned long) _etext;
862 init_mm.end_data = (unsigned long) _edata; 876 init_mm.end_data = (unsigned long) _edata;
863 init_mm.brk = (unsigned long) _end; 877 init_mm.brk = (unsigned long) _end;
864 878
865 /* parse_early_param needs a boot_command_line */
866 strlcpy(boot_command_line, from, COMMAND_LINE_SIZE);
867
868 /* populate cmd_line too for later use, preserving boot_command_line */ 879 /* populate cmd_line too for later use, preserving boot_command_line */
869 strlcpy(cmd_line, boot_command_line, COMMAND_LINE_SIZE); 880 strlcpy(cmd_line, boot_command_line, COMMAND_LINE_SIZE);
870 *cmdline_p = cmd_line; 881 *cmdline_p = cmd_line;