blob: ea6cc383540b196ac74c7988fa7c30ee084a2bb1 [file] [log] [blame]
Duy Truong790f06d2013-02-13 16:38:12 -08001/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
Rohit Vaswaniead426f2012-01-05 20:24:52 -08002 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 */
13
14#include <linux/linkage.h>
15#include <asm/assembler.h>
16
17#define VERSION_ID 0x1
18#define MAGIC 0xDEAD0000 | VERSION_ID
19
20 .text
21
22 .align 3
23
24ENTRY(msm_wdog_fiq_start)
25 mov sp, r8 @get stack
26 ldr r8, Ldump_cpu_ctx
27 @ store magic to indicate a valid dump
28 ldr r9, Lmagic
29 str r9, [r8], #4
30 @ get the current cpsr
31 mrs r9, cpsr
32 str r9, [r8],#4
33 @ get the USR r0-r7
34 stmia r8!, {r0-r7}
35 mov r4, r8
36 mov r5, #PSR_I_BIT | PSR_F_BIT | SYSTEM_MODE
37 msr cpsr_c, r5 @ select SYSTEM mode
38 stmia r4!, {r8-r14}
39 mov r5, #PSR_I_BIT | PSR_F_BIT | IRQ_MODE
40 msr cpsr_c, r5 @ select IRQ mode
41 mrs r5, spsr
42 str r5, [r4], #4
43 stmia r4!, {r13-r14}
44 mov r5, #PSR_I_BIT | PSR_F_BIT | SVC_MODE
45 msr cpsr_c, r5 @ select SVC mode
46 mrs r5, spsr
47 str r5, [r4], #4
48 stmia r4!, {r13-r14}
49 mov r5, #PSR_I_BIT | PSR_F_BIT | ABT_MODE
50 msr cpsr_c, r5 @ select ABT mode
51 mrs r5, spsr
52 str r5, [r4], #4
53 stmia r4!, {r13-r14}
54 mov r5, #PSR_I_BIT | PSR_F_BIT | UND_MODE
55 msr cpsr_c, r5 @ select UND mode
56 mrs r5, spsr
57 str r5, [r4], #4
58 stmia r4!, {r13-r14}
59 mov r5, #PSR_I_BIT | PSR_F_BIT | FIQ_MODE
60 msr cpsr_c, r5 @ select FIQ mode
61 mrs r5, spsr
62 str r5, [r4], #4
63 stmia r4!, {r8-r14}
64 dsb
65 mov r5, #PSR_F_BIT | SVC_MODE
66 msr cpsr_c, r5 @ select SVC mode
67 ldr r2, Lwatchdog_bark_fin
68 blx r2
69Ldump_cpu_ctx:
70 .word msm_dump_cpu_ctx
71Lmagic:
72 .word MAGIC
73Lwatchdog_bark_fin:
74 .word msm_wdog_bark_fin
75ENTRY(msm_wdog_fiq_length)
76 .word . - msm_wdog_fiq_start
77
78/* setup the stack */
79ENTRY(msm_wdog_fiq_setup)
80 mrs r3, cpsr
81 msr cpsr_c, #(FIQ_MODE | PSR_I_BIT | PSR_F_BIT)
82 mov r8, r0
83 msr cpsr_c, r3
84 bx lr