blob: 7c9cfce69fafe7f1ef4055e2af69a1d67ca3c7ca [file] [log] [blame]
David Feng85fd5f12013-12-14 11:47:35 +08001/*
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>
Alexander Graf58177862016-03-04 01:10:06 +010010#include <efi_loader.h>
David Feng85fd5f12013-12-14 11:47:35 +080011
12
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
32 printf("ELR: %lx\n", regs->elr);
33 printf("LR: %lx\n", regs->regs[30]);
34 for (i = 0; i < 29; i += 2)
35 printf("x%-2d: %016lx x%-2d: %016lx\n",
36 i, regs->regs[i], i+1, regs->regs[i+1]);
37 printf("\n");
38}
39
40/*
41 * do_bad_sync handles the impossible case in the Synchronous Abort vector.
42 */
43void do_bad_sync(struct pt_regs *pt_regs, unsigned int esr)
44{
Alexander Graf58177862016-03-04 01:10:06 +010045 efi_restore_gd();
David Feng85fd5f12013-12-14 11:47:35 +080046 printf("Bad mode in \"Synchronous Abort\" handler, esr 0x%08x\n", esr);
47 show_regs(pt_regs);
48 panic("Resetting CPU ...\n");
49}
50
51/*
52 * do_bad_irq handles the impossible case in the Irq vector.
53 */
54void do_bad_irq(struct pt_regs *pt_regs, unsigned int esr)
55{
Alexander Graf58177862016-03-04 01:10:06 +010056 efi_restore_gd();
David Feng85fd5f12013-12-14 11:47:35 +080057 printf("Bad mode in \"Irq\" handler, esr 0x%08x\n", esr);
58 show_regs(pt_regs);
59 panic("Resetting CPU ...\n");
60}
61
62/*
63 * do_bad_fiq handles the impossible case in the Fiq vector.
64 */
65void do_bad_fiq(struct pt_regs *pt_regs, unsigned int esr)
66{
Alexander Graf58177862016-03-04 01:10:06 +010067 efi_restore_gd();
David Feng85fd5f12013-12-14 11:47:35 +080068 printf("Bad mode in \"Fiq\" handler, esr 0x%08x\n", esr);
69 show_regs(pt_regs);
70 panic("Resetting CPU ...\n");
71}
72
73/*
74 * do_bad_error handles the impossible case in the Error vector.
75 */
76void do_bad_error(struct pt_regs *pt_regs, unsigned int esr)
77{
Alexander Graf58177862016-03-04 01:10:06 +010078 efi_restore_gd();
David Feng85fd5f12013-12-14 11:47:35 +080079 printf("Bad mode in \"Error\" handler, esr 0x%08x\n", esr);
80 show_regs(pt_regs);
81 panic("Resetting CPU ...\n");
82}
83
84/*
85 * do_sync handles the Synchronous Abort exception.
86 */
87void do_sync(struct pt_regs *pt_regs, unsigned int esr)
88{
Alexander Graf58177862016-03-04 01:10:06 +010089 efi_restore_gd();
David Feng85fd5f12013-12-14 11:47:35 +080090 printf("\"Synchronous Abort\" handler, esr 0x%08x\n", esr);
91 show_regs(pt_regs);
92 panic("Resetting CPU ...\n");
93}
94
95/*
96 * do_irq handles the Irq exception.
97 */
98void do_irq(struct pt_regs *pt_regs, unsigned int esr)
99{
Alexander Graf58177862016-03-04 01:10:06 +0100100 efi_restore_gd();
David Feng85fd5f12013-12-14 11:47:35 +0800101 printf("\"Irq\" handler, esr 0x%08x\n", esr);
102 show_regs(pt_regs);
103 panic("Resetting CPU ...\n");
104}
105
106/*
107 * do_fiq handles the Fiq exception.
108 */
109void do_fiq(struct pt_regs *pt_regs, unsigned int esr)
110{
Alexander Graf58177862016-03-04 01:10:06 +0100111 efi_restore_gd();
David Feng85fd5f12013-12-14 11:47:35 +0800112 printf("\"Fiq\" handler, esr 0x%08x\n", esr);
113 show_regs(pt_regs);
114 panic("Resetting CPU ...\n");
115}
116
117/*
118 * do_error handles the Error exception.
119 * Errors are more likely to be processor specific,
120 * it is defined with weak attribute and can be redefined
121 * in processor specific code.
122 */
123void __weak do_error(struct pt_regs *pt_regs, unsigned int esr)
124{
Alexander Graf58177862016-03-04 01:10:06 +0100125 efi_restore_gd();
David Feng85fd5f12013-12-14 11:47:35 +0800126 printf("\"Error\" handler, esr 0x%08x\n", esr);
127 show_regs(pt_regs);
128 panic("Resetting CPU ...\n");
129}