4 * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com)
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
11 * -Check if we are running on Simulator or on real hardware
12 * to skip certain things during boot on simulator
15 #include <asm/asm-offsets.h>
16 #include <asm/entry.h>
17 #include <linux/linkage.h>
18 #include <asm/arcregs.h>
22 .section .init.text, "ax",@progbits
23 .type stext, @function
26 ;-------------------------------------------------------------------
27 ; Don't clobber r0-r4 yet. It might have bootloader provided info
28 ;-------------------------------------------------------------------
31 ; Only Boot (Master) proceeds. Others wait in platform dependent way
32 ; IDENTITY Reg [ 3 2 1 0 ]
33 ; (cpu-id) ^^^ => Zero for UP ARC700
34 ; => #Core-ID if SMP (Master 0)
37 jnz arc_platform_smp_wait_to_boot
39 ; Clear BSS before updating any globals
47 #ifdef CONFIG_CMDLINE_UBOOT
48 ; support for bootloader provided cmdline
49 ; If cmdline passed by u-boot, then
50 ; r0 = 1 (because ATAGS parsing, now retired, used to use 0)
51 ; r1 = magic number (board identity)
52 ; r2 = addr of cmdline string (somewhere in memory/flash)
54 brne r0, 1, .Lother_bootup_chores ; u-boot didn't pass cmdline
55 breq r2, 0, .Lother_bootup_chores ; or cmdline is NULL
60 breq r6, 0, .Lother_bootup_chores
65 .Lother_bootup_chores:
67 ; Identify if running on ISS vs Silicon
68 ; IDENTITY Reg [ 3 2 1 0 ]
69 ; (chip-id) ^^^^^ ==> 0xffff for ISS
75 st r4, [@running_on_hw]
77 ; setup "current" tsk and optionally cache it in dedicated r25
79 SET_CURR_TASK_ON_CPU r9, r0 ; r9 = tsk, r0 = scratch
81 ; setup stack (fp, sp)
84 ; tsk->thread_info is really a PAGE, whose bottom hoists stack
85 GET_TSK_STACK_BASE r9, sp ; r9 = tsk, sp = stack base(output)
87 j start_kernel ; "C" entry point
90 ;----------------------------------------------------------------
91 ; First lines of code run by secondary before jumping to 'C'
92 ;----------------------------------------------------------------
93 .section .init.text, "ax",@progbits
94 .type first_lines_of_secondary, @function
95 .globl first_lines_of_secondary
97 first_lines_of_secondary:
99 ; setup per-cpu idle task as "current" on this CPU
100 ld r0, [@secondary_idle_tsk]
101 SET_CURR_TASK_ON_CPU r0, r1
103 ; setup stack (fp, sp)
106 ; set it's stack base to tsk->thread_info bottom
107 GET_TSK_STACK_BASE r0, sp
109 j start_kernel_secondary