Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * This is included by init/main.c to check for architecture-dependent bugs. |
| 3 | * |
Maciej W. Rozycki | 20d60d9 | 2007-10-23 12:43:11 +0100 | [diff] [blame] | 4 | * Copyright (C) 2007 Maciej W. Rozycki |
| 5 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6 | * Needs: |
| 7 | * void check_bugs(void); |
| 8 | */ |
| 9 | #ifndef _ASM_BUGS_H |
| 10 | #define _ASM_BUGS_H |
| 11 | |
Maciej W. Rozycki | 20d60d9 | 2007-10-23 12:43:11 +0100 | [diff] [blame] | 12 | #include <linux/bug.h> |
Ralf Baechle | 3855157 | 2005-04-13 17:36:49 +0000 | [diff] [blame] | 13 | #include <linux/delay.h> |
Ralf Baechle | 631330f | 2009-06-19 14:05:26 +0100 | [diff] [blame] | 14 | #include <linux/smp.h> |
Maciej W. Rozycki | 20d60d9 | 2007-10-23 12:43:11 +0100 | [diff] [blame] | 15 | |
Ralf Baechle | f03da6e | 2005-04-13 13:37:32 +0000 | [diff] [blame] | 16 | #include <asm/cpu.h> |
| 17 | #include <asm/cpu-info.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18 | |
Maciej W. Rozycki | 20d60d9 | 2007-10-23 12:43:11 +0100 | [diff] [blame] | 19 | extern int daddiu_bug; |
| 20 | |
| 21 | extern void check_bugs64_early(void); |
| 22 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 23 | extern void check_bugs32(void); |
| 24 | extern void check_bugs64(void); |
| 25 | |
Maciej W. Rozycki | 20d60d9 | 2007-10-23 12:43:11 +0100 | [diff] [blame] | 26 | static inline void check_bugs_early(void) |
| 27 | { |
| 28 | #ifdef CONFIG_64BIT |
| 29 | check_bugs64_early(); |
| 30 | #endif |
| 31 | } |
| 32 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 33 | static inline void check_bugs(void) |
| 34 | { |
Ralf Baechle | f03da6e | 2005-04-13 13:37:32 +0000 | [diff] [blame] | 35 | unsigned int cpu = smp_processor_id(); |
| 36 | |
| 37 | cpu_data[cpu].udelay_val = loops_per_jiffy; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 38 | check_bugs32(); |
Ralf Baechle | 875d43e | 2005-09-03 15:56:16 -0700 | [diff] [blame] | 39 | #ifdef CONFIG_64BIT |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 40 | check_bugs64(); |
| 41 | #endif |
| 42 | } |
| 43 | |
Maciej W. Rozycki | 20d60d9 | 2007-10-23 12:43:11 +0100 | [diff] [blame] | 44 | static inline int r4k_daddiu_bug(void) |
| 45 | { |
| 46 | #ifdef CONFIG_64BIT |
| 47 | WARN_ON(daddiu_bug < 0); |
| 48 | return daddiu_bug != 0; |
| 49 | #else |
| 50 | return 0; |
| 51 | #endif |
| 52 | } |
| 53 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 54 | #endif /* _ASM_BUGS_H */ |