system.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. * Use the same macro name as linux/include/asm-arm/proc-armv/system.h
  14. * here, so that if the original ever gets included after us, it won't
  15. * try to re-redefine anything.
  16. */
  17. #ifndef __ASM_PROC_SYSTEM_H
  18. #define __ASM_PROC_SYSTEM_H
  19. /*
  20. * Redefine all original macros with static inline functions containing
  21. * a simple memory barrier, so that they produce the same instruction
  22. * ordering constraints as their original counterparts.
  23. * We use static inline functions rather than macros so that we can tell
  24. * the compiler to not complain about unused arguments.
  25. */
  26. static inline void local_irq_save(
  27. unsigned long flags __attribute__((unused)))
  28. {
  29. __asm__ __volatile__ ("" : : : "memory");
  30. }
  31. static inline void local_irq_enable(void)
  32. {
  33. __asm__ __volatile__ ("" : : : "memory");
  34. }
  35. static inline void local_irq_disable(void)
  36. {
  37. __asm__ __volatile__ ("" : : : "memory");
  38. }
  39. static inline void __stf(void)
  40. {
  41. __asm__ __volatile__ ("" : : : "memory");
  42. }
  43. static inline void __clf(void)
  44. {
  45. __asm__ __volatile__ ("" : : : "memory");
  46. }
  47. static inline void local_save_flags(
  48. unsigned long flags __attribute__((unused)))
  49. {
  50. __asm__ __volatile__ ("" : : : "memory");
  51. }
  52. static inline void local_irq_restore(
  53. unsigned long flags __attribute__((unused)))
  54. {
  55. __asm__ __volatile__ ("" : : : "memory");
  56. }
  57. #endif /* __ASM_PROC_SYSTEM_H */