cache.h 715 B

1234567891011121314151617181920212223242526272829303132333435
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * Copyright (c) 2011 The Chromium OS Authors.
  4. */
  5. #ifndef __X86_CACHE_H__
  6. #define __X86_CACHE_H__
  7. /*
  8. * If CONFIG_SYS_CACHELINE_SIZE is defined use it for DMA alignment. Otherwise
  9. * use 64-bytes, a safe default for x86.
  10. */
  11. #ifndef CONFIG_SYS_CACHELINE_SIZE
  12. #define CONFIG_SYS_CACHELINE_SIZE 64
  13. #endif
  14. #define ARCH_DMA_MINALIGN CONFIG_SYS_CACHELINE_SIZE
  15. static inline void wbinvd(void)
  16. {
  17. asm volatile ("wbinvd" : : : "memory");
  18. }
  19. static inline void invd(void)
  20. {
  21. asm volatile("invd" : : : "memory");
  22. }
  23. /* Enable caches and write buffer */
  24. void enable_caches(void);
  25. /* Disable caches and write buffer */
  26. void disable_caches(void);
  27. #endif /* __X86_CACHE_H__ */