blob: 4ff63c33317f8bfbd75a8d3729ddb9ef7158c434 [file] [log] [blame]
Anton Staaf3620f862011-10-17 16:46:12 -07001/*
2 * Copyright (c) 2011 The Chromium OS Authors.
Anton Staaf3620f862011-10-17 16:46:12 -07003 *
Wolfgang Denk1a459662013-07-08 09:37:19 +02004 * SPDX-License-Identifier: GPL-2.0+
Anton Staaf3620f862011-10-17 16:46:12 -07005 */
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 Roesebf4ea7e2016-07-18 12:53:31 +020014#ifndef CONFIG_SYS_CACHELINE_SIZE
15#define CONFIG_SYS_CACHELINE_SIZE 64
Anton Staaf3620f862011-10-17 16:46:12 -070016#endif
17
Stefan Roesebf4ea7e2016-07-18 12:53:31 +020018#define ARCH_DMA_MINALIGN CONFIG_SYS_CACHELINE_SIZE
19
Stefan Reinauer095593c2012-12-02 04:49:50 +000020static inline void wbinvd(void)
21{
22 asm volatile ("wbinvd" : : : "memory");
23}
24
25static inline void invd(void)
26{
27 asm volatile("invd" : : : "memory");
28}
29
30/* Enable caches and write buffer */
31void enable_caches(void);
32
33/* Disable caches and write buffer */
34void disable_caches(void);
35
Anton Staaf3620f862011-10-17 16:46:12 -070036#endif /* __X86_CACHE_H__ */