blob: 145b8784de1eb50ca3bd0527725bda275ad79343 [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Anton Staaf3620f862011-10-17 16:46:12 -07002/*
3 * Copyright (c) 2011 The Chromium OS Authors.
Anton Staaf3620f862011-10-17 16:46:12 -07004 */
5
6#ifndef __X86_CACHE_H__
7#define __X86_CACHE_H__
8
9/*
10 * If CONFIG_SYS_CACHELINE_SIZE is defined use it for DMA alignment. Otherwise
11 * use 64-bytes, a safe default for x86.
12 */
Stefan Roesebf4ea7e2016-07-18 12:53:31 +020013#ifndef CONFIG_SYS_CACHELINE_SIZE
14#define CONFIG_SYS_CACHELINE_SIZE 64
Anton Staaf3620f862011-10-17 16:46:12 -070015#endif
16
Stefan Roesebf4ea7e2016-07-18 12:53:31 +020017#define ARCH_DMA_MINALIGN CONFIG_SYS_CACHELINE_SIZE
18
Stefan Reinauer095593c2012-12-02 04:49:50 +000019static inline void wbinvd(void)
20{
21 asm volatile ("wbinvd" : : : "memory");
22}
23
24static inline void invd(void)
25{
26 asm volatile("invd" : : : "memory");
27}
28
29/* Enable caches and write buffer */
30void enable_caches(void);
31
32/* Disable caches and write buffer */
33void disable_caches(void);
34
Anton Staaf3620f862011-10-17 16:46:12 -070035#endif /* __X86_CACHE_H__ */