1/* SPDX-License-Identifier: GPL-2.0+ */
2/*
3 *  Thumb-1 drop-in for the linux/include/asm-arm/proc-armv/system.h
4 *
5 *  (C) Copyright 2015
6 *  Albert ARIBAUD <albert.u.boot@aribaud.net>
7 *
8 * The original file does not build in Thumb mode. However, in U-Boot
9 * we don't use interrupt context, so we can redefine these as empty
10 * memory barriers, which makes Thumb-1 compiler happy.
11 */
12
13/*
14 * Use the same macro name as linux/include/asm-arm/proc-armv/system.h
15 * here, so that if the original ever gets included after us, it won't
16 * try to re-redefine anything.
17 */
18
19#ifndef __ASM_PROC_SYSTEM_H
20#define __ASM_PROC_SYSTEM_H
21
22/*
23 * Redefine all original macros with static inline functions containing
24 * a simple memory barrier, so that they produce the same instruction
25 * ordering constraints as their original counterparts.
26 * We use static inline functions rather than macros so that we can tell
27 * the compiler to not complain about unused arguments.
28 */
29
30static inline void local_irq_save(
31	unsigned long flags __attribute__((unused)))
32{
33	__asm__ __volatile__ ("" : : : "memory");
34}
35
36static inline void local_irq_enable(void)
37{
38	__asm__ __volatile__ ("" : : : "memory");
39}
40
41static inline void local_irq_disable(void)
42{
43	__asm__ __volatile__ ("" : : : "memory");
44}
45
46static inline void __stf(void)
47{
48	__asm__ __volatile__ ("" : : : "memory");
49}
50
51static inline void __clf(void)
52{
53	__asm__ __volatile__ ("" : : : "memory");
54}
55
56static inline void local_save_flags(
57	unsigned long flags __attribute__((unused)))
58{
59	__asm__ __volatile__ ("" : : : "memory");
60}
61
62static inline void local_irq_restore(
63	unsigned long flags __attribute__((unused)))
64{
65	__asm__ __volatile__ ("" : : : "memory");
66}
67
68#endif /*  __ASM_PROC_SYSTEM_H */
69