18c2ecf20Sopenharmony_ci/* 28c2ecf20Sopenharmony_ci * This file is subject to the terms and conditions of the GNU General Public 38c2ecf20Sopenharmony_ci * License. See the file "COPYING" in the main directory of this archive 48c2ecf20Sopenharmony_ci * for more details. 58c2ecf20Sopenharmony_ci * 68c2ecf20Sopenharmony_ci * Copyright (C) 2002, 2004, 2007 by Ralf Baechle 78c2ecf20Sopenharmony_ci * Copyright (C) 2007 Maciej W. Rozycki 88c2ecf20Sopenharmony_ci */ 98c2ecf20Sopenharmony_ci#ifndef _ASM_WAR_H 108c2ecf20Sopenharmony_ci#define _ASM_WAR_H 118c2ecf20Sopenharmony_ci 128c2ecf20Sopenharmony_ci/* 138c2ecf20Sopenharmony_ci * Work around certain R4000 CPU errata (as implemented by GCC): 148c2ecf20Sopenharmony_ci * 158c2ecf20Sopenharmony_ci * - A double-word or a variable shift may give an incorrect result 168c2ecf20Sopenharmony_ci * if executed immediately after starting an integer division: 178c2ecf20Sopenharmony_ci * "MIPS R4000PC/SC Errata, Processor Revision 2.2 and 3.0", 188c2ecf20Sopenharmony_ci * erratum #28 198c2ecf20Sopenharmony_ci * "MIPS R4000MC Errata, Processor Revision 2.2 and 3.0", erratum 208c2ecf20Sopenharmony_ci * #19 218c2ecf20Sopenharmony_ci * 228c2ecf20Sopenharmony_ci * - A double-word or a variable shift may give an incorrect result 238c2ecf20Sopenharmony_ci * if executed while an integer multiplication is in progress: 248c2ecf20Sopenharmony_ci * "MIPS R4000PC/SC Errata, Processor Revision 2.2 and 3.0", 258c2ecf20Sopenharmony_ci * errata #16 & #28 268c2ecf20Sopenharmony_ci * 278c2ecf20Sopenharmony_ci * - An integer division may give an incorrect result if started in 288c2ecf20Sopenharmony_ci * a delay slot of a taken branch or a jump: 298c2ecf20Sopenharmony_ci * "MIPS R4000PC/SC Errata, Processor Revision 2.2 and 3.0", 308c2ecf20Sopenharmony_ci * erratum #52 318c2ecf20Sopenharmony_ci */ 328c2ecf20Sopenharmony_ci#ifdef CONFIG_CPU_R4000_WORKAROUNDS 338c2ecf20Sopenharmony_ci#define R4000_WAR 1 348c2ecf20Sopenharmony_ci#else 358c2ecf20Sopenharmony_ci#define R4000_WAR 0 368c2ecf20Sopenharmony_ci#endif 378c2ecf20Sopenharmony_ci 388c2ecf20Sopenharmony_ci/* 398c2ecf20Sopenharmony_ci * Work around certain R4400 CPU errata (as implemented by GCC): 408c2ecf20Sopenharmony_ci * 418c2ecf20Sopenharmony_ci * - A double-word or a variable shift may give an incorrect result 428c2ecf20Sopenharmony_ci * if executed immediately after starting an integer division: 438c2ecf20Sopenharmony_ci * "MIPS R4400MC Errata, Processor Revision 1.0", erratum #10 448c2ecf20Sopenharmony_ci * "MIPS R4400MC Errata, Processor Revision 2.0 & 3.0", erratum #4 458c2ecf20Sopenharmony_ci */ 468c2ecf20Sopenharmony_ci#ifdef CONFIG_CPU_R4400_WORKAROUNDS 478c2ecf20Sopenharmony_ci#define R4400_WAR 1 488c2ecf20Sopenharmony_ci#else 498c2ecf20Sopenharmony_ci#define R4400_WAR 0 508c2ecf20Sopenharmony_ci#endif 518c2ecf20Sopenharmony_ci 528c2ecf20Sopenharmony_ci/* 538c2ecf20Sopenharmony_ci * Work around the "daddi" and "daddiu" CPU errata: 548c2ecf20Sopenharmony_ci * 558c2ecf20Sopenharmony_ci * - The `daddi' instruction fails to trap on overflow. 568c2ecf20Sopenharmony_ci * "MIPS R4000PC/SC Errata, Processor Revision 2.2 and 3.0", 578c2ecf20Sopenharmony_ci * erratum #23 588c2ecf20Sopenharmony_ci * 598c2ecf20Sopenharmony_ci * - The `daddiu' instruction can produce an incorrect result. 608c2ecf20Sopenharmony_ci * "MIPS R4000PC/SC Errata, Processor Revision 2.2 and 3.0", 618c2ecf20Sopenharmony_ci * erratum #41 628c2ecf20Sopenharmony_ci * "MIPS R4000MC Errata, Processor Revision 2.2 and 3.0", erratum 638c2ecf20Sopenharmony_ci * #15 648c2ecf20Sopenharmony_ci * "MIPS R4400PC/SC Errata, Processor Revision 1.0", erratum #7 658c2ecf20Sopenharmony_ci * "MIPS R4400MC Errata, Processor Revision 1.0", erratum #5 668c2ecf20Sopenharmony_ci */ 678c2ecf20Sopenharmony_ci#ifdef CONFIG_CPU_DADDI_WORKAROUNDS 688c2ecf20Sopenharmony_ci#define DADDI_WAR 1 698c2ecf20Sopenharmony_ci#else 708c2ecf20Sopenharmony_ci#define DADDI_WAR 0 718c2ecf20Sopenharmony_ci#endif 728c2ecf20Sopenharmony_ci 738c2ecf20Sopenharmony_ci#endif /* _ASM_WAR_H */ 74