blob: 8a5d82468b3f72cb8765442b1f58126f409507bd [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
Peng Fanc3c9b332017-11-28 10:08:08 +080012DECLARE_GLOBAL_DATA_PTR;
David Feng85fd5f12013-12-14 11:47:35 +080013
14int interrupt_init(void)
15{
16 return 0;
17}
18
19void enable_interrupts(void)
20{
21 return;
22}
23
24int disable_interrupts(void)
25{
26 return 0;
27}
28
29void show_regs(struct pt_regs *regs)
30{
31 int i;
32
Karl Beldanb33ccd12018-02-20 23:30:08 +000033 if (gd->flags & GD_FLG_RELOC)
34 printf("elr: %016lx lr : %016lx (reloc)\n",
35 regs->elr - gd->reloc_off,
36 regs->regs[30] - gd->reloc_off);
37 printf("elr: %016lx lr : %016lx\n", regs->elr, regs->regs[30]);
38
David Feng85fd5f12013-12-14 11:47:35 +080039 for (i = 0; i < 29; i += 2)
40 printf("x%-2d: %016lx x%-2d: %016lx\n",
41 i, regs->regs[i], i+1, regs->regs[i+1]);
42 printf("\n");
43}
44
45/*
46 * do_bad_sync handles the impossible case in the Synchronous Abort vector.
47 */
48void do_bad_sync(struct pt_regs *pt_regs, unsigned int esr)
49{
Alexander Graf58177862016-03-04 01:10:06 +010050 efi_restore_gd();
David Feng85fd5f12013-12-14 11:47:35 +080051 printf("Bad mode in \"Synchronous Abort\" handler, esr 0x%08x\n", esr);
52 show_regs(pt_regs);
53 panic("Resetting CPU ...\n");
54}
55
56/*
57 * do_bad_irq handles the impossible case in the Irq vector.
58 */
59void do_bad_irq(struct pt_regs *pt_regs, unsigned int esr)
60{
Alexander Graf58177862016-03-04 01:10:06 +010061 efi_restore_gd();
David Feng85fd5f12013-12-14 11:47:35 +080062 printf("Bad mode in \"Irq\" handler, esr 0x%08x\n", esr);
63 show_regs(pt_regs);
64 panic("Resetting CPU ...\n");
65}
66
67/*
68 * do_bad_fiq handles the impossible case in the Fiq vector.
69 */
70void do_bad_fiq(struct pt_regs *pt_regs, unsigned int esr)
71{
Alexander Graf58177862016-03-04 01:10:06 +010072 efi_restore_gd();
David Feng85fd5f12013-12-14 11:47:35 +080073 printf("Bad mode in \"Fiq\" handler, esr 0x%08x\n", esr);
74 show_regs(pt_regs);
75 panic("Resetting CPU ...\n");
76}
77
78/*
79 * do_bad_error handles the impossible case in the Error vector.
80 */
81void do_bad_error(struct pt_regs *pt_regs, unsigned int esr)
82{
Alexander Graf58177862016-03-04 01:10:06 +010083 efi_restore_gd();
David Feng85fd5f12013-12-14 11:47:35 +080084 printf("Bad mode in \"Error\" handler, esr 0x%08x\n", esr);
85 show_regs(pt_regs);
86 panic("Resetting CPU ...\n");
87}
88
89/*
90 * do_sync handles the Synchronous Abort exception.
91 */
92void do_sync(struct pt_regs *pt_regs, unsigned int esr)
93{
Alexander Graf58177862016-03-04 01:10:06 +010094 efi_restore_gd();
David Feng85fd5f12013-12-14 11:47:35 +080095 printf("\"Synchronous Abort\" handler, esr 0x%08x\n", esr);
96 show_regs(pt_regs);
97 panic("Resetting CPU ...\n");
98}
99
100/*
101 * do_irq handles the Irq exception.
102 */
103void do_irq(struct pt_regs *pt_regs, unsigned int esr)
104{
Alexander Graf58177862016-03-04 01:10:06 +0100105 efi_restore_gd();
David Feng85fd5f12013-12-14 11:47:35 +0800106 printf("\"Irq\" handler, esr 0x%08x\n", esr);
107 show_regs(pt_regs);
108 panic("Resetting CPU ...\n");
109}
110
111/*
112 * do_fiq handles the Fiq exception.
113 */
114void do_fiq(struct pt_regs *pt_regs, unsigned int esr)
115{
Alexander Graf58177862016-03-04 01:10:06 +0100116 efi_restore_gd();
David Feng85fd5f12013-12-14 11:47:35 +0800117 printf("\"Fiq\" handler, esr 0x%08x\n", esr);
118 show_regs(pt_regs);
119 panic("Resetting CPU ...\n");
120}
121
122/*
123 * do_error handles the Error exception.
124 * Errors are more likely to be processor specific,
125 * it is defined with weak attribute and can be redefined
126 * in processor specific code.
127 */
128void __weak do_error(struct pt_regs *pt_regs, unsigned int esr)
129{
Alexander Graf58177862016-03-04 01:10:06 +0100130 efi_restore_gd();
David Feng85fd5f12013-12-14 11:47:35 +0800131 printf("\"Error\" handler, esr 0x%08x\n", esr);
132 show_regs(pt_regs);
133 panic("Resetting CPU ...\n");
134}