Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * This is included by init/main.c to check for architecture-dependent bugs.
0004  *
0005  * Copyright (C) 2007  Maciej W. Rozycki
0006  *
0007  * Needs:
0008  *  void check_bugs(void);
0009  */
0010 #ifndef _ASM_BUGS_H
0011 #define _ASM_BUGS_H
0012 
0013 #include <linux/bug.h>
0014 #include <linux/delay.h>
0015 #include <linux/smp.h>
0016 
0017 #include <asm/cpu.h>
0018 #include <asm/cpu-info.h>
0019 
0020 extern int daddiu_bug;
0021 
0022 extern void check_bugs64_early(void);
0023 
0024 extern void check_bugs32(void);
0025 extern void check_bugs64(void);
0026 
0027 static inline void check_bugs_early(void)
0028 {
0029     if (IS_ENABLED(CONFIG_CPU_R4X00_BUGS64))
0030         check_bugs64_early();
0031 }
0032 
0033 static inline void check_bugs(void)
0034 {
0035     unsigned int cpu = smp_processor_id();
0036 
0037     cpu_data[cpu].udelay_val = loops_per_jiffy;
0038     check_bugs32();
0039 
0040     if (IS_ENABLED(CONFIG_CPU_R4X00_BUGS64))
0041         check_bugs64();
0042 }
0043 
0044 static inline int r4k_daddiu_bug(void)
0045 {
0046     if (!IS_ENABLED(CONFIG_CPU_R4X00_BUGS64))
0047         return 0;
0048 
0049     WARN_ON(daddiu_bug < 0);
0050     return daddiu_bug != 0;
0051 }
0052 
0053 #endif /* _ASM_BUGS_H */