Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame^] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
David Feng | 85fd5f1 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 2 | /* |
| 3 | * (C) Copyright 2013 |
| 4 | * David Feng <fenghua@phytium.com.cn> |
David Feng | 85fd5f1 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | #include <common.h> |
| 8 | #include <linux/compiler.h> |
Alexander Graf | 5817786 | 2016-03-04 01:10:06 +0100 | [diff] [blame] | 9 | #include <efi_loader.h> |
David Feng | 85fd5f1 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 10 | |
Peng Fan | c3c9b33 | 2017-11-28 10:08:08 +0800 | [diff] [blame] | 11 | DECLARE_GLOBAL_DATA_PTR; |
David Feng | 85fd5f1 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 12 | |
| 13 | int interrupt_init(void) |
| 14 | { |
| 15 | return 0; |
| 16 | } |
| 17 | |
| 18 | void enable_interrupts(void) |
| 19 | { |
| 20 | return; |
| 21 | } |
| 22 | |
| 23 | int disable_interrupts(void) |
| 24 | { |
| 25 | return 0; |
| 26 | } |
| 27 | |
| 28 | void show_regs(struct pt_regs *regs) |
| 29 | { |
| 30 | int i; |
| 31 | |
Karl Beldan | b33ccd1 | 2018-02-20 23:30:08 +0000 | [diff] [blame] | 32 | 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 Feng | 85fd5f1 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 38 | 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 | */ |
| 47 | void do_bad_sync(struct pt_regs *pt_regs, unsigned int esr) |
| 48 | { |
Alexander Graf | 5817786 | 2016-03-04 01:10:06 +0100 | [diff] [blame] | 49 | efi_restore_gd(); |
David Feng | 85fd5f1 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 50 | 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 | */ |
| 58 | void do_bad_irq(struct pt_regs *pt_regs, unsigned int esr) |
| 59 | { |
Alexander Graf | 5817786 | 2016-03-04 01:10:06 +0100 | [diff] [blame] | 60 | efi_restore_gd(); |
David Feng | 85fd5f1 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 61 | 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 | */ |
| 69 | void do_bad_fiq(struct pt_regs *pt_regs, unsigned int esr) |
| 70 | { |
Alexander Graf | 5817786 | 2016-03-04 01:10:06 +0100 | [diff] [blame] | 71 | efi_restore_gd(); |
David Feng | 85fd5f1 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 72 | 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 | */ |
| 80 | void do_bad_error(struct pt_regs *pt_regs, unsigned int esr) |
| 81 | { |
Alexander Graf | 5817786 | 2016-03-04 01:10:06 +0100 | [diff] [blame] | 82 | efi_restore_gd(); |
David Feng | 85fd5f1 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 83 | 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 | */ |
| 91 | void do_sync(struct pt_regs *pt_regs, unsigned int esr) |
| 92 | { |
Alexander Graf | 5817786 | 2016-03-04 01:10:06 +0100 | [diff] [blame] | 93 | efi_restore_gd(); |
David Feng | 85fd5f1 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 94 | 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 | */ |
| 102 | void do_irq(struct pt_regs *pt_regs, unsigned int esr) |
| 103 | { |
Alexander Graf | 5817786 | 2016-03-04 01:10:06 +0100 | [diff] [blame] | 104 | efi_restore_gd(); |
David Feng | 85fd5f1 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 105 | 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 | */ |
| 113 | void do_fiq(struct pt_regs *pt_regs, unsigned int esr) |
| 114 | { |
Alexander Graf | 5817786 | 2016-03-04 01:10:06 +0100 | [diff] [blame] | 115 | efi_restore_gd(); |
David Feng | 85fd5f1 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 116 | 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 | */ |
| 127 | void __weak do_error(struct pt_regs *pt_regs, unsigned int esr) |
| 128 | { |
Alexander Graf | 5817786 | 2016-03-04 01:10:06 +0100 | [diff] [blame] | 129 | efi_restore_gd(); |
David Feng | 85fd5f1 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 130 | printf("\"Error\" handler, esr 0x%08x\n", esr); |
| 131 | show_regs(pt_regs); |
| 132 | panic("Resetting CPU ...\n"); |
| 133 | } |