war.h 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. /*
  2. * This file is subject to the terms and conditions of the GNU General Public
  3. * License. See the file "COPYING" in the main directory of this archive
  4. * for more details.
  5. *
  6. * Copyright (C) 2002, 2004, 2007 by Ralf Baechle
  7. * Copyright (C) 2007 Maciej W. Rozycki
  8. */
  9. #ifndef _ASM_WAR_H
  10. #define _ASM_WAR_H
  11. #include <war.h>
  12. /*
  13. * Work around certain R4000 CPU errata (as implemented by GCC):
  14. *
  15. * - A double-word or a variable shift may give an incorrect result
  16. * if executed immediately after starting an integer division:
  17. * "MIPS R4000PC/SC Errata, Processor Revision 2.2 and 3.0",
  18. * erratum #28
  19. * "MIPS R4000MC Errata, Processor Revision 2.2 and 3.0", erratum
  20. * #19
  21. *
  22. * - A double-word or a variable shift may give an incorrect result
  23. * if executed while an integer multiplication is in progress:
  24. * "MIPS R4000PC/SC Errata, Processor Revision 2.2 and 3.0",
  25. * errata #16 & #28
  26. *
  27. * - An integer division may give an incorrect result if started in
  28. * a delay slot of a taken branch or a jump:
  29. * "MIPS R4000PC/SC Errata, Processor Revision 2.2 and 3.0",
  30. * erratum #52
  31. */
  32. #ifdef CONFIG_CPU_R4000_WORKAROUNDS
  33. #define R4000_WAR 1
  34. #else
  35. #define R4000_WAR 0
  36. #endif
  37. /*
  38. * Work around certain R4400 CPU errata (as implemented by GCC):
  39. *
  40. * - A double-word or a variable shift may give an incorrect result
  41. * if executed immediately after starting an integer division:
  42. * "MIPS R4400MC Errata, Processor Revision 1.0", erratum #10
  43. * "MIPS R4400MC Errata, Processor Revision 2.0 & 3.0", erratum #4
  44. */
  45. #ifdef CONFIG_CPU_R4400_WORKAROUNDS
  46. #define R4400_WAR 1
  47. #else
  48. #define R4400_WAR 0
  49. #endif
  50. /*
  51. * Work around the "daddi" and "daddiu" CPU errata:
  52. *
  53. * - The `daddi' instruction fails to trap on overflow.
  54. * "MIPS R4000PC/SC Errata, Processor Revision 2.2 and 3.0",
  55. * erratum #23
  56. *
  57. * - The `daddiu' instruction can produce an incorrect result.
  58. * "MIPS R4000PC/SC Errata, Processor Revision 2.2 and 3.0",
  59. * erratum #41
  60. * "MIPS R4000MC Errata, Processor Revision 2.2 and 3.0", erratum
  61. * #15
  62. * "MIPS R4400PC/SC Errata, Processor Revision 1.0", erratum #7
  63. * "MIPS R4400MC Errata, Processor Revision 1.0", erratum #5
  64. */
  65. #ifdef CONFIG_CPU_DADDI_WORKAROUNDS
  66. #define DADDI_WAR 1
  67. #else
  68. #define DADDI_WAR 0
  69. #endif
  70. /*
  71. * Another R4600 erratum. Due to the lack of errata information the exact
  72. * technical details aren't known. I've experimentally found that disabling
  73. * interrupts during indexed I-cache flushes seems to be sufficient to deal
  74. * with the issue.
  75. */
  76. #ifndef R4600_V1_INDEX_ICACHEOP_WAR
  77. #error Check setting of R4600_V1_INDEX_ICACHEOP_WAR for your platform
  78. #endif
  79. /*
  80. * Pleasures of the R4600 V1.x. Cite from the IDT R4600 V1.7 errata:
  81. *
  82. * 18. The CACHE instructions Hit_Writeback_Invalidate_D, Hit_Writeback_D,
  83. * Hit_Invalidate_D and Create_Dirty_Excl_D should only be
  84. * executed if there is no other dcache activity. If the dcache is
  85. * accessed for another instruction immeidately preceding when these
  86. * cache instructions are executing, it is possible that the dcache
  87. * tag match outputs used by these cache instructions will be
  88. * incorrect. These cache instructions should be preceded by at least
  89. * four instructions that are not any kind of load or store
  90. * instruction.
  91. *
  92. * This is not allowed: lw
  93. * nop
  94. * nop
  95. * nop
  96. * cache Hit_Writeback_Invalidate_D
  97. *
  98. * This is allowed: lw
  99. * nop
  100. * nop
  101. * nop
  102. * nop
  103. * cache Hit_Writeback_Invalidate_D
  104. */
  105. #ifndef R4600_V1_HIT_CACHEOP_WAR
  106. #error Check setting of R4600_V1_HIT_CACHEOP_WAR for your platform
  107. #endif
  108. /*
  109. * Writeback and invalidate the primary cache dcache before DMA.
  110. *
  111. * R4600 v2.0 bug: "The CACHE instructions Hit_Writeback_Inv_D,
  112. * Hit_Writeback_D, Hit_Invalidate_D and Create_Dirty_Exclusive_D will only
  113. * operate correctly if the internal data cache refill buffer is empty. These
  114. * CACHE instructions should be separated from any potential data cache miss
  115. * by a load instruction to an uncached address to empty the response buffer."
  116. * (Revision 2.0 device errata from IDT available on http://www.idt.com/
  117. * in .pdf format.)
  118. */
  119. #ifndef R4600_V2_HIT_CACHEOP_WAR
  120. #error Check setting of R4600_V2_HIT_CACHEOP_WAR for your platform
  121. #endif
  122. /*
  123. * When an interrupt happens on a CP0 register read instruction, CPU may
  124. * lock up or read corrupted values of CP0 registers after it enters
  125. * the exception handler.
  126. *
  127. * This workaround makes sure that we read a "safe" CP0 register as the
  128. * first thing in the exception handler, which breaks one of the
  129. * pre-conditions for this problem.
  130. */
  131. #ifndef R5432_CP0_INTERRUPT_WAR
  132. #error Check setting of R5432_CP0_INTERRUPT_WAR for your platform
  133. #endif
  134. /*
  135. * Workaround for the Sibyte M3 errata the text of which can be found at
  136. *
  137. * http://sibyte.broadcom.com/hw/bcm1250/docs/pass2errata.txt
  138. *
  139. * This will enable the use of a special TLB refill handler which does a
  140. * consistency check on the information in c0_badvaddr and c0_entryhi and
  141. * will just return and take the exception again if the information was
  142. * found to be inconsistent.
  143. */
  144. #ifndef BCM1250_M3_WAR
  145. #error Check setting of BCM1250_M3_WAR for your platform
  146. #endif
  147. /*
  148. * This is a DUART workaround related to glitches around register accesses
  149. */
  150. #ifndef SIBYTE_1956_WAR
  151. #error Check setting of SIBYTE_1956_WAR for your platform
  152. #endif
  153. /*
  154. * Fill buffers not flushed on CACHE instructions
  155. *
  156. * Hit_Invalidate_I cacheops invalidate an icache line but the refill
  157. * for that line can get stale data from the fill buffer instead of
  158. * accessing memory if the previous icache miss was also to that line.
  159. *
  160. * Workaround: generate an icache refill from a different line
  161. *
  162. * Affects:
  163. * MIPS 4K RTL revision <3.0, PRID revision <4
  164. */
  165. #ifndef MIPS4K_ICACHE_REFILL_WAR
  166. #error Check setting of MIPS4K_ICACHE_REFILL_WAR for your platform
  167. #endif
  168. /*
  169. * Missing implicit forced flush of evictions caused by CACHE
  170. * instruction
  171. *
  172. * Evictions caused by a CACHE instructions are not forced on to the
  173. * bus. The BIU gives higher priority to fetches than to the data from
  174. * the eviction buffer and no collision detection is performed between
  175. * fetches and pending data from the eviction buffer.
  176. *
  177. * Workaround: Execute a SYNC instruction after the cache instruction
  178. *
  179. * Affects:
  180. * MIPS 5Kc,5Kf RTL revision <2.3, PRID revision <8
  181. * MIPS 20Kc RTL revision <4.0, PRID revision <?
  182. */
  183. #ifndef MIPS_CACHE_SYNC_WAR
  184. #error Check setting of MIPS_CACHE_SYNC_WAR for your platform
  185. #endif
  186. /*
  187. * From TX49/H2 manual: "If the instruction (i.e. CACHE) is issued for
  188. * the line which this instruction itself exists, the following
  189. * operation is not guaranteed."
  190. *
  191. * Workaround: do two phase flushing for Index_Invalidate_I
  192. */
  193. #ifndef TX49XX_ICACHE_INDEX_INV_WAR
  194. #error Check setting of TX49XX_ICACHE_INDEX_INV_WAR for your platform
  195. #endif
  196. /*
  197. * The RM7000 processors and the E9000 cores have a bug (though PMC-Sierra
  198. * opposes it being called that) where invalid instructions in the same
  199. * I-cache line worth of instructions being fetched may case spurious
  200. * exceptions.
  201. */
  202. #ifndef ICACHE_REFILLS_WORKAROUND_WAR
  203. #error Check setting of ICACHE_REFILLS_WORKAROUND_WAR for your platform
  204. #endif
  205. /*
  206. * On the R10000 up to version 2.6 (not sure about 2.7) there is a bug that
  207. * may cause ll / sc and lld / scd sequences to execute non-atomically.
  208. */
  209. #ifndef R10000_LLSC_WAR
  210. #error Check setting of R10000_LLSC_WAR for your platform
  211. #endif
  212. /*
  213. * 34K core erratum: "Problems Executing the TLBR Instruction"
  214. */
  215. #ifndef MIPS34K_MISSED_ITLB_WAR
  216. #error Check setting of MIPS34K_MISSED_ITLB_WAR for your platform
  217. #endif
  218. #endif /* _ASM_WAR_H */