18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Copyright (C) 2007  Maciej W. Rozycki
48c2ecf20Sopenharmony_ci */
58c2ecf20Sopenharmony_ci#ifndef _ASM_BUGS_H
68c2ecf20Sopenharmony_ci#define _ASM_BUGS_H
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci#include <linux/bug.h>
98c2ecf20Sopenharmony_ci#include <linux/smp.h>
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#include <asm/cpu.h>
128c2ecf20Sopenharmony_ci#include <asm/cpu-info.h>
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ciextern int daddiu_bug;
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ciextern void check_bugs64_early(void);
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ciextern void check_bugs32(void);
198c2ecf20Sopenharmony_ciextern void check_bugs64(void);
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_cistatic inline void check_bugs_early(void)
228c2ecf20Sopenharmony_ci{
238c2ecf20Sopenharmony_ci	if (IS_ENABLED(CONFIG_CPU_R4X00_BUGS64))
248c2ecf20Sopenharmony_ci		check_bugs64_early();
258c2ecf20Sopenharmony_ci}
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_cistatic inline int r4k_daddiu_bug(void)
288c2ecf20Sopenharmony_ci{
298c2ecf20Sopenharmony_ci	if (!IS_ENABLED(CONFIG_CPU_R4X00_BUGS64))
308c2ecf20Sopenharmony_ci		return 0;
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci	WARN_ON(daddiu_bug < 0);
338c2ecf20Sopenharmony_ci	return daddiu_bug != 0;
348c2ecf20Sopenharmony_ci}
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ci#endif /* _ASM_BUGS_H */
37