cache.h 710 B

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