Vineet Gupta | c121c50 | 2013-01-18 15:12:20 +0530 | [diff] [blame^] | 1 | /* |
| 2 | * ARC CPU startup Code |
| 3 | * |
| 4 | * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com) |
| 5 | * |
| 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. |
| 9 | * |
| 10 | * Vineetg: Dec 2007 |
| 11 | * -Check if we are running on Simulator or on real hardware |
| 12 | * to skip certain things during boot on simulator |
| 13 | */ |
| 14 | |
| 15 | #include <asm/asm-offsets.h> |
| 16 | #include <asm/entry.h> |
| 17 | #include <linux/linkage.h> |
| 18 | #include <asm/arcregs.h> |
| 19 | |
| 20 | .cpu A7 |
| 21 | |
| 22 | .section .init.text, "ax",@progbits |
| 23 | .type stext, @function |
| 24 | .globl stext |
| 25 | stext: |
| 26 | ;------------------------------------------------------------------- |
| 27 | ; Don't clobber r0-r4 yet. It might have bootloader provided info |
| 28 | ;------------------------------------------------------------------- |
| 29 | |
| 30 | ; Clear BSS before updating any globals |
| 31 | ; XXX: use ZOL here |
| 32 | mov r5, __bss_start |
| 33 | mov r6, __bss_stop |
| 34 | 1: |
| 35 | st.ab 0, [r5,4] |
| 36 | brlt r5, r6, 1b |
| 37 | |
| 38 | #ifdef CONFIG_CMDLINE_UBOOT |
| 39 | ; support for bootloader provided cmdline |
| 40 | ; If cmdline passed by u-boot, then |
| 41 | ; r0 = 1 (because ATAGS parsing, now retired, used to use 0) |
| 42 | ; r1 = magic number (board identity) |
| 43 | ; r2 = addr of cmdline string (somewhere in memory/flash) |
| 44 | |
| 45 | brne r0, 1, .Lother_bootup_chores ; u-boot didn't pass cmdline |
| 46 | breq r2, 0, .Lother_bootup_chores ; or cmdline is NULL |
| 47 | |
| 48 | mov r5, @command_line |
| 49 | 1: |
| 50 | ldb.ab r6, [r2, 1] |
| 51 | breq r6, 0, .Lother_bootup_chores |
| 52 | b.d 1b |
| 53 | stb.ab r6, [r5, 1] |
| 54 | #endif |
| 55 | |
| 56 | .Lother_bootup_chores: |
| 57 | |
| 58 | ; Identify if running on ISS vs Silicon |
| 59 | ; IDENTITY Reg [ 3 2 1 0 ] |
| 60 | ; (chip-id) ^^^^^ ==> 0xffff for ISS |
| 61 | lr r0, [identity] |
| 62 | lsr r3, r0, 16 |
| 63 | cmp r3, 0xffff |
| 64 | mov.z r4, 0 |
| 65 | mov.nz r4, 1 |
| 66 | st r4, [@running_on_hw] |
| 67 | |
| 68 | ; setup "current" tsk and optionally cache it in dedicated r25 |
| 69 | mov r9, @init_task |
| 70 | SET_CURR_TASK_ON_CPU r9, r0 ; r9 = tsk, r0 = scratch |
| 71 | |
| 72 | ; setup stack (fp, sp) |
| 73 | mov fp, 0 |
| 74 | |
| 75 | ; tsk->thread_info is really a PAGE, whose bottom hoists stack |
| 76 | GET_TSK_STACK_BASE r9, sp ; r9 = tsk, sp = stack base(output) |
| 77 | |
| 78 | j start_kernel ; "C" entry point |