blob: 458319ab4878865dec7f8f0f1e5324e2a28968ff [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
David Feng85fd5f12013-12-14 11:47:35 +08002/*
3 * (C) Copyright 2013
4 * David Feng <fenghua@phytium.com.cn>
David Feng85fd5f12013-12-14 11:47:35 +08005 */
6
7#include <common.h>
8#include <linux/compiler.h>
Alexander Graf58177862016-03-04 01:10:06 +01009#include <efi_loader.h>
David Feng85fd5f12013-12-14 11:47:35 +080010
Peng Fanc3c9b332017-11-28 10:08:08 +080011DECLARE_GLOBAL_DATA_PTR;
David Feng85fd5f12013-12-14 11:47:35 +080012
13int interrupt_init(void)
14{
15 return 0;
16}
17
18void enable_interrupts(void)
19{
20 return;
21}
22
23int disable_interrupts(void)
24{
25 return 0;
26}
27
28void show_regs(struct pt_regs *regs)
29{
30 int i;
31
Karl Beldanb33ccd12018-02-20 23:30:08 +000032 if (gd->flags & GD_FLG_RELOC)
33 printf("elr: %016lx lr : %016lx (reloc)\n",
34 regs->elr - gd->reloc_off,
35 regs->regs[30] - gd->reloc_off);
36 printf("elr: %016lx lr : %016lx\n", regs->elr, regs->regs[30]);
37
David Feng85fd5f12013-12-14 11:47:35 +080038 for (i = 0; i < 29; i += 2)
39 printf("x%-2d: %016lx x%-2d: %016lx\n",
40 i, regs->regs[i], i+1, regs->regs[i+1]);
41 printf("\n");
42}
43
44/*
45 * do_bad_sync handles the impossible case in the Synchronous Abort vector.
46 */
47void do_bad_sync(struct pt_regs *pt_regs, unsigned int esr)
48{
Alexander Graf58177862016-03-04 01:10:06 +010049 efi_restore_gd();
David Feng85fd5f12013-12-14 11:47:35 +080050 printf("Bad mode in \"Synchronous Abort\" handler, esr 0x%08x\n", esr);
51 show_regs(pt_regs);
52 panic("Resetting CPU ...\n");
53}
54
55/*
56 * do_bad_irq handles the impossible case in the Irq vector.
57 */
58void do_bad_irq(struct pt_regs *pt_regs, unsigned int esr)
59{
Alexander Graf58177862016-03-04 01:10:06 +010060 efi_restore_gd();
David Feng85fd5f12013-12-14 11:47:35 +080061 printf("Bad mode in \"Irq\" handler, esr 0x%08x\n", esr);
62 show_regs(pt_regs);
63 panic("Resetting CPU ...\n");
64}
65
66/*
67 * do_bad_fiq handles the impossible case in the Fiq vector.
68 */
69void do_bad_fiq(struct pt_regs *pt_regs, unsigned int esr)
70{
Alexander Graf58177862016-03-04 01:10:06 +010071 efi_restore_gd();
David Feng85fd5f12013-12-14 11:47:35 +080072 printf("Bad mode in \"Fiq\" handler, esr 0x%08x\n", esr);
73 show_regs(pt_regs);
74 panic("Resetting CPU ...\n");
75}
76
77/*
78 * do_bad_error handles the impossible case in the Error vector.
79 */
80void do_bad_error(struct pt_regs *pt_regs, unsigned int esr)
81{
Alexander Graf58177862016-03-04 01:10:06 +010082 efi_restore_gd();
David Feng85fd5f12013-12-14 11:47:35 +080083 printf("Bad mode in \"Error\" handler, esr 0x%08x\n", esr);
84 show_regs(pt_regs);
85 panic("Resetting CPU ...\n");
86}
87
88/*
89 * do_sync handles the Synchronous Abort exception.
90 */
91void do_sync(struct pt_regs *pt_regs, unsigned int esr)
92{
Alexander Graf58177862016-03-04 01:10:06 +010093 efi_restore_gd();
David Feng85fd5f12013-12-14 11:47:35 +080094 printf("\"Synchronous Abort\" handler, esr 0x%08x\n", esr);
95 show_regs(pt_regs);
96 panic("Resetting CPU ...\n");
97}
98
99/*
100 * do_irq handles the Irq exception.
101 */
102void do_irq(struct pt_regs *pt_regs, unsigned int esr)
103{
Alexander Graf58177862016-03-04 01:10:06 +0100104 efi_restore_gd();
David Feng85fd5f12013-12-14 11:47:35 +0800105 printf("\"Irq\" handler, esr 0x%08x\n", esr);
106 show_regs(pt_regs);
107 panic("Resetting CPU ...\n");
108}
109
110/*
111 * do_fiq handles the Fiq exception.
112 */
113void do_fiq(struct pt_regs *pt_regs, unsigned int esr)
114{
Alexander Graf58177862016-03-04 01:10:06 +0100115 efi_restore_gd();
David Feng85fd5f12013-12-14 11:47:35 +0800116 printf("\"Fiq\" handler, esr 0x%08x\n", esr);
117 show_regs(pt_regs);
118 panic("Resetting CPU ...\n");
119}
120
121/*
122 * do_error handles the Error exception.
123 * Errors are more likely to be processor specific,
124 * it is defined with weak attribute and can be redefined
125 * in processor specific code.
126 */
127void __weak do_error(struct pt_regs *pt_regs, unsigned int esr)
128{
Alexander Graf58177862016-03-04 01:10:06 +0100129 efi_restore_gd();
David Feng85fd5f12013-12-14 11:47:35 +0800130 printf("\"Error\" handler, esr 0x%08x\n", esr);
131 show_regs(pt_regs);
132 panic("Resetting CPU ...\n");
133}