interrupts_64.c 2.7 KB

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