MIPS: Convert R4600_V1_HIT_CACHEOP into a config option
[linux-2.6-microblaze.git] / arch / mips / include / asm / war.h
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
12 #include <war.h>
13
14 /*
15  * Work around certain R4000 CPU errata (as implemented by GCC):
16  *
17  * - A double-word or a variable shift may give an incorrect result
18  *   if executed immediately after starting an integer division:
19  *   "MIPS R4000PC/SC Errata, Processor Revision 2.2 and 3.0",
20  *   erratum #28
21  *   "MIPS R4000MC Errata, Processor Revision 2.2 and 3.0", erratum
22  *   #19
23  *
24  * - A double-word or a variable shift may give an incorrect result
25  *   if executed while an integer multiplication is in progress:
26  *   "MIPS R4000PC/SC Errata, Processor Revision 2.2 and 3.0",
27  *   errata #16 & #28
28  *
29  * - An integer division may give an incorrect result if started in
30  *   a delay slot of a taken branch or a jump:
31  *   "MIPS R4000PC/SC Errata, Processor Revision 2.2 and 3.0",
32  *   erratum #52
33  */
34 #ifdef CONFIG_CPU_R4000_WORKAROUNDS
35 #define R4000_WAR 1
36 #else
37 #define R4000_WAR 0
38 #endif
39
40 /*
41  * Work around certain R4400 CPU errata (as implemented by GCC):
42  *
43  * - A double-word or a variable shift may give an incorrect result
44  *   if executed immediately after starting an integer division:
45  *   "MIPS R4400MC Errata, Processor Revision 1.0", erratum #10
46  *   "MIPS R4400MC Errata, Processor Revision 2.0 & 3.0", erratum #4
47  */
48 #ifdef CONFIG_CPU_R4400_WORKAROUNDS
49 #define R4400_WAR 1
50 #else
51 #define R4400_WAR 0
52 #endif
53
54 /*
55  * Work around the "daddi" and "daddiu" CPU errata:
56  *
57  * - The `daddi' instruction fails to trap on overflow.
58  *   "MIPS R4000PC/SC Errata, Processor Revision 2.2 and 3.0",
59  *   erratum #23
60  *
61  * - The `daddiu' instruction can produce an incorrect result.
62  *   "MIPS R4000PC/SC Errata, Processor Revision 2.2 and 3.0",
63  *   erratum #41
64  *   "MIPS R4000MC Errata, Processor Revision 2.2 and 3.0", erratum
65  *   #15
66  *   "MIPS R4400PC/SC Errata, Processor Revision 1.0", erratum #7
67  *   "MIPS R4400MC Errata, Processor Revision 1.0", erratum #5
68  */
69 #ifdef CONFIG_CPU_DADDI_WORKAROUNDS
70 #define DADDI_WAR 1
71 #else
72 #define DADDI_WAR 0
73 #endif
74
75 /*
76  * Writeback and invalidate the primary cache dcache before DMA.
77  *
78  * R4600 v2.0 bug: "The CACHE instructions Hit_Writeback_Inv_D,
79  * Hit_Writeback_D, Hit_Invalidate_D and Create_Dirty_Exclusive_D will only
80  * operate correctly if the internal data cache refill buffer is empty.  These
81  * CACHE instructions should be separated from any potential data cache miss
82  * by a load instruction to an uncached address to empty the response buffer."
83  * (Revision 2.0 device errata from IDT available on https://www.idt.com/
84  * in .pdf format.)
85  */
86 #ifndef R4600_V2_HIT_CACHEOP_WAR
87 #error Check setting of R4600_V2_HIT_CACHEOP_WAR for your platform
88 #endif
89
90 /*
91  * Workaround for the Sibyte M3 errata the text of which can be found at
92  *
93  *   http://sibyte.broadcom.com/hw/bcm1250/docs/pass2errata.txt
94  *
95  * This will enable the use of a special TLB refill handler which does a
96  * consistency check on the information in c0_badvaddr and c0_entryhi and
97  * will just return and take the exception again if the information was
98  * found to be inconsistent.
99  */
100 #ifndef BCM1250_M3_WAR
101 #error Check setting of BCM1250_M3_WAR for your platform
102 #endif
103
104 /*
105  * This is a DUART workaround related to glitches around register accesses
106  */
107 #ifndef SIBYTE_1956_WAR
108 #error Check setting of SIBYTE_1956_WAR for your platform
109 #endif
110
111 /*
112  * Fill buffers not flushed on CACHE instructions
113  *
114  * Hit_Invalidate_I cacheops invalidate an icache line but the refill
115  * for that line can get stale data from the fill buffer instead of
116  * accessing memory if the previous icache miss was also to that line.
117  *
118  * Workaround: generate an icache refill from a different line
119  *
120  * Affects:
121  *  MIPS 4K             RTL revision <3.0, PRID revision <4
122  */
123 #ifndef MIPS4K_ICACHE_REFILL_WAR
124 #error Check setting of MIPS4K_ICACHE_REFILL_WAR for your platform
125 #endif
126
127 /*
128  * Missing implicit forced flush of evictions caused by CACHE
129  * instruction
130  *
131  * Evictions caused by a CACHE instructions are not forced on to the
132  * bus. The BIU gives higher priority to fetches than to the data from
133  * the eviction buffer and no collision detection is performed between
134  * fetches and pending data from the eviction buffer.
135  *
136  * Workaround: Execute a SYNC instruction after the cache instruction
137  *
138  * Affects:
139  *   MIPS 5Kc,5Kf       RTL revision <2.3, PRID revision <8
140  *   MIPS 20Kc          RTL revision <4.0, PRID revision <?
141  */
142 #ifndef MIPS_CACHE_SYNC_WAR
143 #error Check setting of MIPS_CACHE_SYNC_WAR for your platform
144 #endif
145
146 /*
147  * From TX49/H2 manual: "If the instruction (i.e. CACHE) is issued for
148  * the line which this instruction itself exists, the following
149  * operation is not guaranteed."
150  *
151  * Workaround: do two phase flushing for Index_Invalidate_I
152  */
153 #ifndef TX49XX_ICACHE_INDEX_INV_WAR
154 #error Check setting of TX49XX_ICACHE_INDEX_INV_WAR for your platform
155 #endif
156
157 /*
158  * The RM7000 processors and the E9000 cores have a bug (though PMC-Sierra
159  * opposes it being called that) where invalid instructions in the same
160  * I-cache line worth of instructions being fetched may case spurious
161  * exceptions.
162  */
163 #ifndef ICACHE_REFILLS_WORKAROUND_WAR
164 #error Check setting of ICACHE_REFILLS_WORKAROUND_WAR for your platform
165 #endif
166
167 /*
168  * On the R10000 up to version 2.6 (not sure about 2.7) there is a bug that
169  * may cause ll / sc and lld / scd sequences to execute non-atomically.
170  */
171 #ifndef R10000_LLSC_WAR
172 #error Check setting of R10000_LLSC_WAR for your platform
173 #endif
174
175 /*
176  * 34K core erratum: "Problems Executing the TLBR Instruction"
177  */
178 #ifndef MIPS34K_MISSED_ITLB_WAR
179 #error Check setting of MIPS34K_MISSED_ITLB_WAR for your platform
180 #endif
181
182 #endif /* _ASM_WAR_H */