13620f860SAnton Staaf /* 23620f860SAnton Staaf * Copyright (c) 2011 The Chromium OS Authors. 33620f860SAnton Staaf * See file CREDITS for list of people who contributed to this 43620f860SAnton Staaf * project. 53620f860SAnton Staaf * 63620f860SAnton Staaf * This program is free software; you can redistribute it and/or 73620f860SAnton Staaf * modify it under the terms of the GNU General Public License as 83620f860SAnton Staaf * published by the Free Software Foundation; either version 2 of 93620f860SAnton Staaf * the License, or (at your option) any later version. 103620f860SAnton Staaf * 113620f860SAnton Staaf * This program is distributed in the hope that it will be useful, 123620f860SAnton Staaf * but WITHOUT ANY WARRANTY; without even the implied warranty of 133620f860SAnton Staaf * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 143620f860SAnton Staaf * GNU General Public License for more details. 153620f860SAnton Staaf * 163620f860SAnton Staaf * You should have received a copy of the GNU General Public License 173620f860SAnton Staaf * along with this program; if not, write to the Free Software 183620f860SAnton Staaf * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 193620f860SAnton Staaf * MA 02111-1307 USA 203620f860SAnton Staaf */ 213620f860SAnton Staaf 223620f860SAnton Staaf #ifndef __X86_CACHE_H__ 233620f860SAnton Staaf #define __X86_CACHE_H__ 243620f860SAnton Staaf 253620f860SAnton Staaf /* 263620f860SAnton Staaf * If CONFIG_SYS_CACHELINE_SIZE is defined use it for DMA alignment. Otherwise 273620f860SAnton Staaf * use 64-bytes, a safe default for x86. 283620f860SAnton Staaf */ 293620f860SAnton Staaf #ifdef CONFIG_SYS_CACHELINE_SIZE 303620f860SAnton Staaf #define ARCH_DMA_MINALIGN CONFIG_SYS_CACHELINE_SIZE 313620f860SAnton Staaf #else 323620f860SAnton Staaf #define ARCH_DMA_MINALIGN 64 333620f860SAnton Staaf #endif 343620f860SAnton Staaf 35*095593c0SStefan Reinauer static inline void wbinvd(void) 36*095593c0SStefan Reinauer { 37*095593c0SStefan Reinauer asm volatile ("wbinvd" : : : "memory"); 38*095593c0SStefan Reinauer } 39*095593c0SStefan Reinauer 40*095593c0SStefan Reinauer static inline void invd(void) 41*095593c0SStefan Reinauer { 42*095593c0SStefan Reinauer asm volatile("invd" : : : "memory"); 43*095593c0SStefan Reinauer } 44*095593c0SStefan Reinauer 45*095593c0SStefan Reinauer /* Enable caches and write buffer */ 46*095593c0SStefan Reinauer void enable_caches(void); 47*095593c0SStefan Reinauer 48*095593c0SStefan Reinauer /* Disable caches and write buffer */ 49*095593c0SStefan Reinauer void disable_caches(void); 50*095593c0SStefan Reinauer 513620f860SAnton Staaf #endif /* __X86_CACHE_H__ */ 52