Merge tag 'spdx_identifiers-4.14-rc8' of git://git.kernel.org/pub/scm/linux/kernel...
[sfrench/cifs-2.6.git] / arch / metag / kernel / head.S
1 /* SPDX-License-Identifier: GPL-2.0 */
2         ! Copyright 2005,2006,2007,2009 Imagination Technologies
3
4 #include <linux/init.h>
5 #include <asm/metag_mem.h>
6 #include <generated/asm-offsets.h>
7 #undef __exit
8
9         __HEAD
10         ! Setup the stack and get going into _metag_start_kernel
11         .global __start
12         .type   __start,function
13 __start:
14         ! D1Ar1 contains pTBI (ISTAT)
15         ! D0Ar2 contains pTBI
16         ! D1Ar3 contains __pTBISegs
17         ! D0Ar4 contains kernel arglist pointer
18
19         MOVT    D0Re0,#HI(___pTBIs)
20         ADD     D0Re0,D0Re0,#LO(___pTBIs)
21         SETL    [D0Re0],D0Ar2,D1Ar1
22         MOVT    D0Re0,#HI(___pTBISegs)
23         ADD     D0Re0,D0Re0,#LO(___pTBISegs)
24         SETD    [D0Re0],D1Ar3
25         MOV     A0FrP,#0
26         MOV     D0Re0,#0
27         MOV     D1Re0,#0
28         MOV     D1Ar3,#0
29         MOV     D1Ar1,D0Ar4                     !Store kernel boot params
30         MOV     D1Ar5,#0
31         MOV     D0Ar6,#0
32 #ifdef CONFIG_METAG_DSP
33         MOV     D0.8,#0
34 #endif
35         MOVT    A0StP,#HI(_init_thread_union)
36         ADD     A0StP,A0StP,#LO(_init_thread_union)
37         ADD     A0StP,A0StP,#THREAD_INFO_SIZE
38         MOVT    D1RtP,#HI(_metag_start_kernel)
39         CALL    D1RtP,#LO(_metag_start_kernel)
40         .size   __start,.-__start
41
42         !! Needed by TBX
43         .global __exit
44         .type   __exit,function
45 __exit:
46         XOR     TXENABLE,D0Re0,D0Re0
47         .size   __exit,.-__exit
48
49 #ifdef CONFIG_SMP
50         .global _secondary_startup
51         .type _secondary_startup,function
52 _secondary_startup:
53 #if CONFIG_PAGE_OFFSET < LINGLOBAL_BASE
54         ! In case GCOn has just been turned on we need to fence any writes that
55         ! the boot thread might have performed prior to coherency taking effect.
56         MOVT    D0Re0,#HI(LINSYSEVENT_WR_ATOMIC_UNLOCK)
57         MOV     D1Re0,#0
58         SETD    [D0Re0], D1Re0
59 #endif
60         MOVT    A0StP,#HI(_secondary_data_stack)
61         ADD     A0StP,A0StP,#LO(_secondary_data_stack)
62         GETD    A0StP,[A0StP]
63         ADD     A0StP,A0StP,#THREAD_INFO_SIZE
64         B       _secondary_start_kernel
65         .size   _secondary_startup,.-_secondary_startup
66 #endif