blob: b160a706795dcf17d3b0ea4c8d0278748cd1a458 [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>
Ralf Baechle631330f2009-06-19 14:05:26 +010014#include <linux/smp.h>
Maciej W. Rozycki20d60d92007-10-23 12:43:11 +010015
Ralf Baechlef03da6e2005-04-13 13:37:32 +000016#include <asm/cpu.h>
17#include <asm/cpu-info.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070018
Maciej W. Rozycki20d60d92007-10-23 12:43:11 +010019extern int daddiu_bug;
20
21extern void check_bugs64_early(void);
22
Linus Torvalds1da177e2005-04-16 15:20:36 -070023extern void check_bugs32(void);
24extern void check_bugs64(void);
25
Maciej W. Rozycki20d60d92007-10-23 12:43:11 +010026static inline void check_bugs_early(void)
27{
28#ifdef CONFIG_64BIT
29 check_bugs64_early();
30#endif
31}
32
Linus Torvalds1da177e2005-04-16 15:20:36 -070033static inline void check_bugs(void)
34{
Ralf Baechlef03da6e2005-04-13 13:37:32 +000035 unsigned int cpu = smp_processor_id();
36
37 cpu_data[cpu].udelay_val = loops_per_jiffy;
Linus Torvalds1da177e2005-04-16 15:20:36 -070038 check_bugs32();
Ralf Baechle875d43e2005-09-03 15:56:16 -070039#ifdef CONFIG_64BIT
Linus Torvalds1da177e2005-04-16 15:20:36 -070040 check_bugs64();
41#endif
42}
43
Maciej W. Rozycki20d60d92007-10-23 12:43:11 +010044static 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 Torvalds1da177e2005-04-16 15:20:36 -070054#endif /* _ASM_BUGS_H */