cplbhdlr.S 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. /*
  2. * File: arch/blackfin/mach-common/cplbhdlr.S
  3. * Based on:
  4. * Author: LG Soft India
  5. *
  6. * Created: ?
  7. * Description: CPLB exception handler
  8. *
  9. * Modified:
  10. * Copyright 2004-2006 Analog Devices Inc.
  11. *
  12. * Bugs: Enter bugs at http://blackfin.uclinux.org/
  13. *
  14. * This program is free software; you can redistribute it and/or modify
  15. * it under the terms of the GNU General Public License as published by
  16. * the Free Software Foundation; either version 2 of the License, or
  17. * (at your option) any later version.
  18. *
  19. * This program is distributed in the hope that it will be useful,
  20. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  21. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  22. * GNU General Public License for more details.
  23. *
  24. * You should have received a copy of the GNU General Public License
  25. * along with this program; if not, see the file COPYING, or write
  26. * to the Free Software Foundation, Inc.,
  27. * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  28. */
  29. #include <linux/linkage.h>
  30. #include <asm/cplb.h>
  31. #include <asm/entry.h>
  32. #ifdef CONFIG_EXCPT_IRQ_SYSC_L1
  33. .section .l1.text
  34. #else
  35. .text
  36. #endif
  37. .type _cplb_mgr, STT_FUNC;
  38. .type _panic_cplb_error, STT_FUNC;
  39. .align 2
  40. ENTRY(__cplb_hdr)
  41. R2 = SEQSTAT;
  42. /* Mask the contents of SEQSTAT and leave only EXCAUSE in R2 */
  43. R2 <<= 26;
  44. R2 >>= 26;
  45. R1 = 0x23; /* Data access CPLB protection violation */
  46. CC = R2 == R1;
  47. IF !CC JUMP .Lnot_data_write;
  48. R0 = 2; /* is a write to data space*/
  49. JUMP .Lis_icplb_miss;
  50. .Lnot_data_write:
  51. R1 = 0x2C; /* CPLB miss on an instruction fetch */
  52. CC = R2 == R1;
  53. R0 = 0; /* is_data_miss == False*/
  54. IF CC JUMP .Lis_icplb_miss;
  55. R1 = 0x26;
  56. CC = R2 == R1;
  57. IF !CC JUMP .Lunknown;
  58. R0 = 1; /* is_data_miss == True*/
  59. .Lis_icplb_miss:
  60. #if defined(CONFIG_BFIN_ICACHE) || defined(CONFIG_BFIN_DCACHE)
  61. # if defined(CONFIG_BFIN_ICACHE) && !defined(CONFIG_BFIN_DCACHE)
  62. R1 = CPLB_ENABLE_ICACHE;
  63. # endif
  64. # if !defined(CONFIG_BFIN_ICACHE) && defined(CONFIG_BFIN_DCACHE)
  65. R1 = CPLB_ENABLE_DCACHE;
  66. # endif
  67. # if defined(CONFIG_BFIN_ICACHE) && defined(CONFIG_BFIN_DCACHE)
  68. R1 = CPLB_ENABLE_DCACHE | CPLB_ENABLE_ICACHE;
  69. # endif
  70. #else
  71. R1 = 0;
  72. #endif
  73. [--SP] = RETS;
  74. CALL _cplb_mgr;
  75. RETS = [SP++];
  76. CC = R0 == 0;
  77. IF !CC JUMP .Lnot_replaced;
  78. RTS;
  79. /*
  80. * Diagnostic exception handlers
  81. */
  82. .Lunknown:
  83. R0 = CPLB_UNKNOWN_ERR;
  84. JUMP .Lcplb_error;
  85. .Lnot_replaced:
  86. CC = R0 == CPLB_NO_UNLOCKED;
  87. IF !CC JUMP .Lnext_check;
  88. R0 = CPLB_NO_UNLOCKED;
  89. JUMP .Lcplb_error;
  90. .Lnext_check:
  91. CC = R0 == CPLB_NO_ADDR_MATCH;
  92. IF !CC JUMP .Lnext_check2;
  93. R0 = CPLB_NO_ADDR_MATCH;
  94. JUMP .Lcplb_error;
  95. .Lnext_check2:
  96. CC = R0 == CPLB_PROT_VIOL;
  97. IF !CC JUMP .Lstrange_return_from_cplb_mgr;
  98. R0 = CPLB_PROT_VIOL;
  99. JUMP .Lcplb_error;
  100. .Lstrange_return_from_cplb_mgr:
  101. IDLE;
  102. CSYNC;
  103. JUMP .Lstrange_return_from_cplb_mgr;
  104. .Lcplb_error:
  105. R1 = sp;
  106. SP += -12;
  107. call _panic_cplb_error;
  108. SP += 12;
  109. JUMP.L _handle_bad_cplb;
  110. ENDPROC(__cplb_hdr)