David Feng | 0ae7653 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 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 | |
| 11 | |
| 12 | int interrupt_init(void) |
| 13 | { |
| 14 | return 0; |
| 15 | } |
| 16 | |
| 17 | void enable_interrupts(void) |
| 18 | { |
| 19 | return; |
| 20 | } |
| 21 | |
| 22 | int disable_interrupts(void) |
| 23 | { |
| 24 | return 0; |
| 25 | } |
| 26 | |
| 27 | void show_regs(struct pt_regs *regs) |
| 28 | { |
| 29 | int i; |
| 30 | |
| 31 | printf("ELR: %lx\n", regs->elr); |
| 32 | printf("LR: %lx\n", regs->regs[30]); |
| 33 | for (i = 0; i < 29; i += 2) |
| 34 | printf("x%-2d: %016lx x%-2d: %016lx\n", |
| 35 | i, regs->regs[i], i+1, regs->regs[i+1]); |
| 36 | printf("\n"); |
| 37 | } |
| 38 | |
| 39 | /* |
| 40 | * do_bad_sync handles the impossible case in the Synchronous Abort vector. |
| 41 | */ |
| 42 | void do_bad_sync(struct pt_regs *pt_regs, unsigned int esr) |
| 43 | { |
| 44 | printf("Bad mode in \"Synchronous Abort\" handler, esr 0x%08x\n", esr); |
| 45 | show_regs(pt_regs); |
| 46 | panic("Resetting CPU ...\n"); |
| 47 | } |
| 48 | |
| 49 | /* |
| 50 | * do_bad_irq handles the impossible case in the Irq vector. |
| 51 | */ |
| 52 | void do_bad_irq(struct pt_regs *pt_regs, unsigned int esr) |
| 53 | { |
| 54 | printf("Bad mode in \"Irq\" handler, esr 0x%08x\n", esr); |
| 55 | show_regs(pt_regs); |
| 56 | panic("Resetting CPU ...\n"); |
| 57 | } |
| 58 | |
| 59 | /* |
| 60 | * do_bad_fiq handles the impossible case in the Fiq vector. |
| 61 | */ |
| 62 | void do_bad_fiq(struct pt_regs *pt_regs, unsigned int esr) |
| 63 | { |
| 64 | printf("Bad mode in \"Fiq\" handler, esr 0x%08x\n", esr); |
| 65 | show_regs(pt_regs); |
| 66 | panic("Resetting CPU ...\n"); |
| 67 | } |
| 68 | |
| 69 | /* |
| 70 | * do_bad_error handles the impossible case in the Error vector. |
| 71 | */ |
| 72 | void do_bad_error(struct pt_regs *pt_regs, unsigned int esr) |
| 73 | { |
| 74 | printf("Bad mode in \"Error\" handler, esr 0x%08x\n", esr); |
| 75 | show_regs(pt_regs); |
| 76 | panic("Resetting CPU ...\n"); |
| 77 | } |
| 78 | |
| 79 | /* |
| 80 | * do_sync handles the Synchronous Abort exception. |
| 81 | */ |
| 82 | void do_sync(struct pt_regs *pt_regs, unsigned int esr) |
| 83 | { |
| 84 | printf("\"Synchronous Abort\" handler, esr 0x%08x\n", esr); |
| 85 | show_regs(pt_regs); |
| 86 | panic("Resetting CPU ...\n"); |
| 87 | } |
| 88 | |
| 89 | /* |
| 90 | * do_irq handles the Irq exception. |
| 91 | */ |
| 92 | void do_irq(struct pt_regs *pt_regs, unsigned int esr) |
| 93 | { |
| 94 | printf("\"Irq\" handler, esr 0x%08x\n", esr); |
| 95 | show_regs(pt_regs); |
| 96 | panic("Resetting CPU ...\n"); |
| 97 | } |
| 98 | |
| 99 | /* |
| 100 | * do_fiq handles the Fiq exception. |
| 101 | */ |
| 102 | void do_fiq(struct pt_regs *pt_regs, unsigned int esr) |
| 103 | { |
| 104 | printf("\"Fiq\" handler, esr 0x%08x\n", esr); |
| 105 | show_regs(pt_regs); |
| 106 | panic("Resetting CPU ...\n"); |
| 107 | } |
| 108 | |
| 109 | /* |
| 110 | * do_error handles the Error exception. |
| 111 | * Errors are more likely to be processor specific, |
| 112 | * it is defined with weak attribute and can be redefined |
| 113 | * in processor specific code. |
| 114 | */ |
| 115 | void __weak do_error(struct pt_regs *pt_regs, unsigned int esr) |
| 116 | { |
| 117 | printf("\"Error\" handler, esr 0x%08x\n", esr); |
| 118 | show_regs(pt_regs); |
| 119 | panic("Resetting CPU ...\n"); |
| 120 | } |