1;
2;  Port on Texas Instruments TMS320C6x architecture
3;
4;  Copyright (C) 2004, 2009, 2010, 2011 Texas Instruments Incorporated
5;  Author: Aurelien Jacquiot (aurelien.jacquiot@jaluna.com)
6;
7;  This program is free software; you can redistribute it and/or modify
8;  it under the terms of the GNU General Public License version 2 as
9;  published by the Free Software Foundation.
10;
11#include <linux/linkage.h>
12#include <linux/of_fdt.h>
13#include <asm/asm-offsets.h>
14
15	__HEAD
16ENTRY(_c_int00)
17	;; Save magic and pointer
18	MV	.S1	A4,A10
19	MV	.S2	B4,B10
20	MVKL	.S2	__bss_start,B5
21	MVKH	.S2	__bss_start,B5
22	MVKL	.S2	__bss_stop,B6
23	MVKH	.S2	__bss_stop,B6
24	SUB	.L2	B6,B5,B6 ; bss size
25
26	;; Set the stack pointer
27	MVKL	.S2	current_ksp,B0
28	MVKH	.S2	current_ksp,B0
29	LDW	.D2T2	*B0,B15
30
31	;; clear bss
32	SHR	.S2	B6,3,B0	  ; number of dwords to clear
33	ZERO	.L2	B13
34	ZERO	.L2	B12
35bss_loop:
36	BDEC	.S2	bss_loop,B0
37	NOP	3
38	CMPLT	.L2	B0,0,B1
39 [!B1]	STDW	.D2T2	B13:B12,*B5++[1]
40
41	NOP	4
42	AND	.D2	~7,B15,B15
43
44	;; Clear GIE and PGIE
45	MVC	.S2	CSR,B2
46	CLR	.S2	B2,0,1,B2
47	MVC	.S2	B2,CSR
48	MVC	.S2	TSR,B2
49	CLR	.S2	B2,0,1,B2
50	MVC	.S2	B2,TSR
51	MVC	.S2	ITSR,B2
52	CLR	.S2	B2,0,1,B2
53	MVC	.S2	B2,ITSR
54	MVC	.S2	NTSR,B2
55	CLR	.S2	B2,0,1,B2
56	MVC	.S2	B2,NTSR
57
58	;; pass DTB pointer to machine_init (or zero if none)
59	MVKL	.S1	OF_DT_HEADER,A0
60	MVKH	.S1	OF_DT_HEADER,A0
61	CMPEQ	.L1	A10,A0,A0
62  [A0]	MV	.S1X	B10,A4
63  [!A0] MVK	.S1	0,A4
64
65#ifdef CONFIG_C6X_BIG_KERNEL
66	MVKL	.S1	machine_init,A0
67	MVKH	.S1	machine_init,A0
68	B	.S2X	A0
69	ADDKPC  .S2     0f,B3,4
700:
71#else
72	CALLP	.S2	machine_init,B3
73#endif
74
75	;; Jump to Linux init
76#ifdef CONFIG_C6X_BIG_KERNEL
77	MVKL	.S1	start_kernel,A0
78	MVKH	.S1	start_kernel,A0
79	B	.S2X	A0
80#else
81	B	.S2	start_kernel
82#endif
83	NOP	5
84L1:	BNOP	.S2	L1,5
85