interrupts_64.c 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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. DECLARE_GLOBAL_DATA_PTR;
  11. int interrupt_init(void)
  12. {
  13. return 0;
  14. }
  15. void enable_interrupts(void)
  16. {
  17. return;
  18. }
  19. int disable_interrupts(void)
  20. {
  21. return 0;
  22. }
  23. void show_regs(struct pt_regs *regs)
  24. {
  25. int i;
  26. if (gd->flags & GD_FLG_RELOC) {
  27. printf("ELR: %lx\n", regs->elr - gd->reloc_off);
  28. printf("LR: %lx\n", regs->regs[30] - gd->reloc_off);
  29. } else {
  30. printf("ELR: %lx\n", regs->elr);
  31. printf("LR: %lx\n", regs->regs[30]);
  32. }
  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. * do_bad_sync handles the impossible case in the Synchronous Abort vector.
  40. */
  41. void do_bad_sync(struct pt_regs *pt_regs, unsigned int esr)
  42. {
  43. efi_restore_gd();
  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. * do_bad_irq handles the impossible case in the Irq vector.
  50. */
  51. void do_bad_irq(struct pt_regs *pt_regs, unsigned int esr)
  52. {
  53. efi_restore_gd();
  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. * do_bad_fiq handles the impossible case in the Fiq vector.
  60. */
  61. void do_bad_fiq(struct pt_regs *pt_regs, unsigned int esr)
  62. {
  63. efi_restore_gd();
  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. * do_bad_error handles the impossible case in the Error vector.
  70. */
  71. void do_bad_error(struct pt_regs *pt_regs, unsigned int esr)
  72. {
  73. efi_restore_gd();
  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. * do_sync handles the Synchronous Abort exception.
  80. */
  81. void do_sync(struct pt_regs *pt_regs, unsigned int esr)
  82. {
  83. efi_restore_gd();
  84. printf("\"Synchronous Abort\" handler, esr 0x%08x\n", esr);
  85. show_regs(pt_regs);
  86. panic("Resetting CPU ...\n");
  87. }
  88. /*
  89. * do_irq handles the Irq exception.
  90. */
  91. void do_irq(struct pt_regs *pt_regs, unsigned int esr)
  92. {
  93. efi_restore_gd();
  94. printf("\"Irq\" handler, esr 0x%08x\n", esr);
  95. show_regs(pt_regs);
  96. panic("Resetting CPU ...\n");
  97. }
  98. /*
  99. * do_fiq handles the Fiq exception.
  100. */
  101. void do_fiq(struct pt_regs *pt_regs, unsigned int esr)
  102. {
  103. efi_restore_gd();
  104. printf("\"Fiq\" handler, esr 0x%08x\n", esr);
  105. show_regs(pt_regs);
  106. panic("Resetting CPU ...\n");
  107. }
  108. /*
  109. * do_error handles the Error exception.
  110. * Errors are more likely to be processor specific,
  111. * it is defined with weak attribute and can be redefined
  112. * in processor specific code.
  113. */
  114. void __weak do_error(struct pt_regs *pt_regs, unsigned int esr)
  115. {
  116. efi_restore_gd();
  117. printf("\"Error\" handler, esr 0x%08x\n", esr);
  118. show_regs(pt_regs);
  119. panic("Resetting CPU ...\n");
  120. }