interrupts_64.c 2.8 KB

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