cplbhdlr.S 3.0 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. .global __cplb_hdr;
  41. .type __cplb_hdr, STT_FUNC;
  42. ENTRY(__cplb_hdr)
  43. R2 = SEQSTAT;
  44. /* Mask the contents of SEQSTAT and leave only EXCAUSE in R2 */
  45. R2 <<= 26;
  46. R2 >>= 26;
  47. R1 = 0x23; /* Data access CPLB protection violation */
  48. CC = R2 == R1;
  49. IF !CC JUMP .Lnot_data_write;
  50. R0 = 2; /* is a write to data space*/
  51. JUMP .Lis_icplb_miss;
  52. .Lnot_data_write:
  53. R1 = 0x2C; /* CPLB miss on an instruction fetch */
  54. CC = R2 == R1;
  55. R0 = 0; /* is_data_miss == False*/
  56. IF CC JUMP .Lis_icplb_miss;
  57. R1 = 0x26;
  58. CC = R2 == R1;
  59. IF !CC JUMP .Lunknown;
  60. R0 = 1; /* is_data_miss == True*/
  61. .Lis_icplb_miss:
  62. #if defined(CONFIG_BLKFIN_CACHE) || defined(CONFIG_BLKFIN_DCACHE)
  63. # if defined(CONFIG_BLKFIN_CACHE) && !defined(CONFIG_BLKFIN_DCACHE)
  64. R1 = CPLB_ENABLE_ICACHE;
  65. # endif
  66. # if !defined(CONFIG_BLKFIN_CACHE) && defined(CONFIG_BLKFIN_DCACHE)
  67. R1 = CPLB_ENABLE_DCACHE;
  68. # endif
  69. # if defined(CONFIG_BLKFIN_CACHE) && defined(CONFIG_BLKFIN_DCACHE)
  70. R1 = CPLB_ENABLE_DCACHE | CPLB_ENABLE_ICACHE;
  71. # endif
  72. #else
  73. R1 = 0;
  74. #endif
  75. [--SP] = RETS;
  76. CALL _cplb_mgr;
  77. RETS = [SP++];
  78. CC = R0 == 0;
  79. IF !CC JUMP .Lnot_replaced;
  80. RTS;
  81. /*
  82. * Diagnostic exception handlers
  83. */
  84. .Lunknown:
  85. R0 = CPLB_UNKNOWN_ERR;
  86. JUMP .Lcplb_error;
  87. .Lnot_replaced:
  88. CC = R0 == CPLB_NO_UNLOCKED;
  89. IF !CC JUMP .Lnext_check;
  90. R0 = CPLB_NO_UNLOCKED;
  91. JUMP .Lcplb_error;
  92. .Lnext_check:
  93. CC = R0 == CPLB_NO_ADDR_MATCH;
  94. IF !CC JUMP .Lnext_check2;
  95. R0 = CPLB_NO_ADDR_MATCH;
  96. JUMP .Lcplb_error;
  97. .Lnext_check2:
  98. CC = R0 == CPLB_PROT_VIOL;
  99. IF !CC JUMP .Lstrange_return_from_cplb_mgr;
  100. R0 = CPLB_PROT_VIOL;
  101. JUMP .Lcplb_error;
  102. .Lstrange_return_from_cplb_mgr:
  103. IDLE;
  104. CSYNC;
  105. JUMP .Lstrange_return_from_cplb_mgr;
  106. .Lcplb_error:
  107. R1 = sp;
  108. SP += -12;
  109. call _panic_cplb_error;
  110. SP += 12;
  111. JUMP _handle_bad_cplb;