]> git.karo-electronics.de Git - karo-tx-uboot.git/blob - arch/arm/lib/interrupts_64.c
arm64: print pre-relocation addresses in register dump
[karo-tx-uboot.git] / arch / arm / lib / interrupts_64.c
1 /*
2  * (C) Copyright 2013
3  * David Feng <fenghua@phytium.com.cn>
4  *
5  * SPDX-License-Identifier:     GPL-2.0+
6  */
7
8 #include <common.h>
9 #include <linux/compiler.h>
10 #include <efi_loader.h>
11
12 DECLARE_GLOBAL_DATA_PTR;
13
14 int interrupt_init(void)
15 {
16         return 0;
17 }
18
19 void enable_interrupts(void)
20 {
21         return;
22 }
23
24 int disable_interrupts(void)
25 {
26         return 0;
27 }
28
29 void show_regs(struct pt_regs *regs)
30 {
31         int i;
32
33         if (gd->flags & GD_FLG_RELOC) {
34                 printf("ELR:     %08lx (pre-reloc: %08lx)\n",
35                         regs->elr, regs->elr - gd->reloc_off);
36                 printf("LR:      %08lx (pre-reloc: %08lx)\n",
37                         regs->regs[30], regs->regs[30] - gd->reloc_off);
38         } else {
39                 printf("ELR:     %08lx\n", regs->elr);
40                 printf("LR:      %08lx\n", regs->regs[30]);
41         }
42         for (i = 0; i < 29; i += 2)
43                 printf("x%-2d: %016lx x%-2d: %016lx\n",
44                        i, regs->regs[i], i+1, regs->regs[i+1]);
45         printf("\n");
46 }
47
48 /*
49  * do_bad_sync handles the impossible case in the Synchronous Abort vector.
50  */
51 void do_bad_sync(struct pt_regs *pt_regs, unsigned int esr)
52 {
53         efi_restore_gd();
54         printf("Bad mode in \"Synchronous Abort\" handler, esr 0x%08x\n", esr);
55         show_regs(pt_regs);
56         panic("Resetting CPU ...\n");
57 }
58
59 /*
60  * do_bad_irq handles the impossible case in the Irq vector.
61  */
62 void do_bad_irq(struct pt_regs *pt_regs, unsigned int esr)
63 {
64         efi_restore_gd();
65         printf("Bad mode in \"Irq\" handler, esr 0x%08x\n", esr);
66         show_regs(pt_regs);
67         panic("Resetting CPU ...\n");
68 }
69
70 /*
71  * do_bad_fiq handles the impossible case in the Fiq vector.
72  */
73 void do_bad_fiq(struct pt_regs *pt_regs, unsigned int esr)
74 {
75         efi_restore_gd();
76         printf("Bad mode in \"Fiq\" handler, esr 0x%08x\n", esr);
77         show_regs(pt_regs);
78         panic("Resetting CPU ...\n");
79 }
80
81 /*
82  * do_bad_error handles the impossible case in the Error vector.
83  */
84 void do_bad_error(struct pt_regs *pt_regs, unsigned int esr)
85 {
86         efi_restore_gd();
87         printf("Bad mode in \"Error\" handler, esr 0x%08x\n", esr);
88         show_regs(pt_regs);
89         panic("Resetting CPU ...\n");
90 }
91
92 /*
93  * do_sync handles the Synchronous Abort exception.
94  */
95 void do_sync(struct pt_regs *pt_regs, unsigned int esr)
96 {
97         efi_restore_gd();
98         printf("\"Synchronous Abort\" handler, esr 0x%08x\n", esr);
99         show_regs(pt_regs);
100         panic("Resetting CPU ...\n");
101 }
102
103 /*
104  * do_irq handles the Irq exception.
105  */
106 void do_irq(struct pt_regs *pt_regs, unsigned int esr)
107 {
108         efi_restore_gd();
109         printf("\"Irq\" handler, esr 0x%08x\n", esr);
110         show_regs(pt_regs);
111         panic("Resetting CPU ...\n");
112 }
113
114 /*
115  * do_fiq handles the Fiq exception.
116  */
117 void do_fiq(struct pt_regs *pt_regs, unsigned int esr)
118 {
119         efi_restore_gd();
120         printf("\"Fiq\" handler, esr 0x%08x\n", esr);
121         show_regs(pt_regs);
122         panic("Resetting CPU ...\n");
123 }
124
125 /*
126  * do_error handles the Error exception.
127  * Errors are more likely to be processor specific,
128  * it is defined with weak attribute and can be redefined
129  * in processor specific code.
130  */
131 void __weak do_error(struct pt_regs *pt_regs, unsigned int esr)
132 {
133         efi_restore_gd();
134         printf("\"Error\" handler, esr 0x%08x\n", esr);
135         show_regs(pt_regs);
136         panic("Resetting CPU ...\n");
137 }