blob: 9dc10df32078e10475dd49c60248c06d31461139 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * This is included by init/main.c to check for architecture-dependent bugs.
3 *
Maciej W. Rozycki20d60d92007-10-23 12:43:11 +01004 * Copyright (C) 2007 Maciej W. Rozycki
5 *
Linus Torvalds1da177e2005-04-16 15:20:36 -07006 * Needs:
7 * void check_bugs(void);
8 */
9#ifndef _ASM_BUGS_H
10#define _ASM_BUGS_H
11
Maciej W. Rozycki20d60d92007-10-23 12:43:11 +010012#include <linux/bug.h>
Ralf Baechle38551572005-04-13 17:36:49 +000013#include <linux/delay.h>
Maciej W. Rozycki20d60d92007-10-23 12:43:11 +010014
Ralf Baechlef03da6e2005-04-13 13:37:32 +000015#include <asm/cpu.h>
16#include <asm/cpu-info.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070017
Maciej W. Rozycki20d60d92007-10-23 12:43:11 +010018extern int daddiu_bug;
19
20extern void check_bugs64_early(void);
21
Linus Torvalds1da177e2005-04-16 15:20:36 -070022extern void check_bugs32(void);
23extern void check_bugs64(void);
24
Maciej W. Rozycki20d60d92007-10-23 12:43:11 +010025static inline void check_bugs_early(void)
26{
27#ifdef CONFIG_64BIT
28 check_bugs64_early();
29#endif
30}
31
Linus Torvalds1da177e2005-04-16 15:20:36 -070032static inline void check_bugs(void)
33{
Ralf Baechlef03da6e2005-04-13 13:37:32 +000034 unsigned int cpu = smp_processor_id();
35
36 cpu_data[cpu].udelay_val = loops_per_jiffy;
Linus Torvalds1da177e2005-04-16 15:20:36 -070037 check_bugs32();
Ralf Baechle875d43e2005-09-03 15:56:16 -070038#ifdef CONFIG_64BIT
Linus Torvalds1da177e2005-04-16 15:20:36 -070039 check_bugs64();
40#endif
41}
42
Maciej W. Rozycki20d60d92007-10-23 12:43:11 +010043static inline int r4k_daddiu_bug(void)
44{
45#ifdef CONFIG_64BIT
46 WARN_ON(daddiu_bug < 0);
47 return daddiu_bug != 0;
48#else
49 return 0;
50#endif
51}
52
Linus Torvalds1da177e2005-04-16 15:20:36 -070053#endif /* _ASM_BUGS_H */