Anton Staaf | 49d351b | 2011-10-17 16:46:12 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2011 The Chromium OS Authors. |
Anton Staaf | 49d351b | 2011-10-17 16:46:12 -0700 | [diff] [blame] | 3 | * |
Wolfgang Denk | d79de1d | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 4 | * SPDX-License-Identifier: GPL-2.0+ |
Anton Staaf | 49d351b | 2011-10-17 16:46:12 -0700 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | #ifndef __X86_CACHE_H__ |
| 8 | #define __X86_CACHE_H__ |
| 9 | |
| 10 | /* |
| 11 | * If CONFIG_SYS_CACHELINE_SIZE is defined use it for DMA alignment. Otherwise |
| 12 | * use 64-bytes, a safe default for x86. |
| 13 | */ |
Stefan Roese | 1daf477 | 2016-07-18 12:53:31 +0200 | [diff] [blame] | 14 | #ifndef CONFIG_SYS_CACHELINE_SIZE |
| 15 | #define CONFIG_SYS_CACHELINE_SIZE 64 |
Anton Staaf | 49d351b | 2011-10-17 16:46:12 -0700 | [diff] [blame] | 16 | #endif |
| 17 | |
Stefan Roese | 1daf477 | 2016-07-18 12:53:31 +0200 | [diff] [blame] | 18 | #define ARCH_DMA_MINALIGN CONFIG_SYS_CACHELINE_SIZE |
| 19 | |
Stefan Reinauer | 2acf848 | 2012-12-02 04:49:50 +0000 | [diff] [blame] | 20 | static inline void wbinvd(void) |
| 21 | { |
| 22 | asm volatile ("wbinvd" : : : "memory"); |
| 23 | } |
| 24 | |
| 25 | static inline void invd(void) |
| 26 | { |
| 27 | asm volatile("invd" : : : "memory"); |
| 28 | } |
| 29 | |
| 30 | /* Enable caches and write buffer */ |
| 31 | void enable_caches(void); |
| 32 | |
| 33 | /* Disable caches and write buffer */ |
| 34 | void disable_caches(void); |
| 35 | |
Anton Staaf | 49d351b | 2011-10-17 16:46:12 -0700 | [diff] [blame] | 36 | #endif /* __X86_CACHE_H__ */ |