18c2ecf20Sopenharmony_ci/* 28c2ecf20Sopenharmony_ci * This file is subject to the terms and conditions of the GNU General Public 38c2ecf20Sopenharmony_ci * License. See the file "COPYING" in the main directory of this archive 48c2ecf20Sopenharmony_ci * for more details. 58c2ecf20Sopenharmony_ci * 68c2ecf20Sopenharmony_ci * Copyright (c) 1997, 1999 by Ralf Baechle 78c2ecf20Sopenharmony_ci * Copyright (c) 1999 Silicon Graphics, Inc. 88c2ecf20Sopenharmony_ci */ 98c2ecf20Sopenharmony_ci#ifndef _ASM_BCACHE_H 108c2ecf20Sopenharmony_ci#define _ASM_BCACHE_H 118c2ecf20Sopenharmony_ci 128c2ecf20Sopenharmony_ci#include <linux/types.h> 138c2ecf20Sopenharmony_ci 148c2ecf20Sopenharmony_ci/* Some R4000 / R4400 / R4600 / R5000 machines may have a non-dma-coherent, 158c2ecf20Sopenharmony_ci chipset implemented caches. On machines with other CPUs the CPU does the 168c2ecf20Sopenharmony_ci cache thing itself. */ 178c2ecf20Sopenharmony_cistruct bcache_ops { 188c2ecf20Sopenharmony_ci void (*bc_enable)(void); 198c2ecf20Sopenharmony_ci void (*bc_disable)(void); 208c2ecf20Sopenharmony_ci void (*bc_wback_inv)(unsigned long page, unsigned long size); 218c2ecf20Sopenharmony_ci void (*bc_inv)(unsigned long page, unsigned long size); 228c2ecf20Sopenharmony_ci void (*bc_prefetch_enable)(void); 238c2ecf20Sopenharmony_ci void (*bc_prefetch_disable)(void); 248c2ecf20Sopenharmony_ci bool (*bc_prefetch_is_enabled)(void); 258c2ecf20Sopenharmony_ci}; 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_ciextern void indy_sc_init(void); 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_ci#ifdef CONFIG_BOARD_SCACHE 308c2ecf20Sopenharmony_ci 318c2ecf20Sopenharmony_ciextern struct bcache_ops *bcops; 328c2ecf20Sopenharmony_ci 338c2ecf20Sopenharmony_cistatic inline void bc_enable(void) 348c2ecf20Sopenharmony_ci{ 358c2ecf20Sopenharmony_ci bcops->bc_enable(); 368c2ecf20Sopenharmony_ci} 378c2ecf20Sopenharmony_ci 388c2ecf20Sopenharmony_cistatic inline void bc_disable(void) 398c2ecf20Sopenharmony_ci{ 408c2ecf20Sopenharmony_ci bcops->bc_disable(); 418c2ecf20Sopenharmony_ci} 428c2ecf20Sopenharmony_ci 438c2ecf20Sopenharmony_cistatic inline void bc_wback_inv(unsigned long page, unsigned long size) 448c2ecf20Sopenharmony_ci{ 458c2ecf20Sopenharmony_ci bcops->bc_wback_inv(page, size); 468c2ecf20Sopenharmony_ci} 478c2ecf20Sopenharmony_ci 488c2ecf20Sopenharmony_cistatic inline void bc_inv(unsigned long page, unsigned long size) 498c2ecf20Sopenharmony_ci{ 508c2ecf20Sopenharmony_ci bcops->bc_inv(page, size); 518c2ecf20Sopenharmony_ci} 528c2ecf20Sopenharmony_ci 538c2ecf20Sopenharmony_cistatic inline void bc_prefetch_enable(void) 548c2ecf20Sopenharmony_ci{ 558c2ecf20Sopenharmony_ci if (bcops->bc_prefetch_enable) 568c2ecf20Sopenharmony_ci bcops->bc_prefetch_enable(); 578c2ecf20Sopenharmony_ci} 588c2ecf20Sopenharmony_ci 598c2ecf20Sopenharmony_cistatic inline void bc_prefetch_disable(void) 608c2ecf20Sopenharmony_ci{ 618c2ecf20Sopenharmony_ci if (bcops->bc_prefetch_disable) 628c2ecf20Sopenharmony_ci bcops->bc_prefetch_disable(); 638c2ecf20Sopenharmony_ci} 648c2ecf20Sopenharmony_ci 658c2ecf20Sopenharmony_cistatic inline bool bc_prefetch_is_enabled(void) 668c2ecf20Sopenharmony_ci{ 678c2ecf20Sopenharmony_ci if (bcops->bc_prefetch_is_enabled) 688c2ecf20Sopenharmony_ci return bcops->bc_prefetch_is_enabled(); 698c2ecf20Sopenharmony_ci 708c2ecf20Sopenharmony_ci return false; 718c2ecf20Sopenharmony_ci} 728c2ecf20Sopenharmony_ci 738c2ecf20Sopenharmony_ci#else /* !defined(CONFIG_BOARD_SCACHE) */ 748c2ecf20Sopenharmony_ci 758c2ecf20Sopenharmony_ci/* Not R4000 / R4400 / R4600 / R5000. */ 768c2ecf20Sopenharmony_ci 778c2ecf20Sopenharmony_ci#define bc_enable() do { } while (0) 788c2ecf20Sopenharmony_ci#define bc_disable() do { } while (0) 798c2ecf20Sopenharmony_ci#define bc_wback_inv(page, size) do { } while (0) 808c2ecf20Sopenharmony_ci#define bc_inv(page, size) do { } while (0) 818c2ecf20Sopenharmony_ci#define bc_prefetch_enable() do { } while (0) 828c2ecf20Sopenharmony_ci#define bc_prefetch_disable() do { } while (0) 838c2ecf20Sopenharmony_ci#define bc_prefetch_is_enabled() 0 848c2ecf20Sopenharmony_ci 858c2ecf20Sopenharmony_ci#endif /* !defined(CONFIG_BOARD_SCACHE) */ 868c2ecf20Sopenharmony_ci 878c2ecf20Sopenharmony_ci#endif /* _ASM_BCACHE_H */ 88