18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci/* $Id: cache.h,v 1.6 2004/03/11 18:08:05 lethal Exp $ 38c2ecf20Sopenharmony_ci * 48c2ecf20Sopenharmony_ci * include/asm-sh/cache.h 58c2ecf20Sopenharmony_ci * 68c2ecf20Sopenharmony_ci * Copyright 1999 (C) Niibe Yutaka 78c2ecf20Sopenharmony_ci * Copyright 2002, 2003 (C) Paul Mundt 88c2ecf20Sopenharmony_ci */ 98c2ecf20Sopenharmony_ci#ifndef __ASM_SH_CACHE_H 108c2ecf20Sopenharmony_ci#define __ASM_SH_CACHE_H 118c2ecf20Sopenharmony_ci 128c2ecf20Sopenharmony_ci#include <linux/init.h> 138c2ecf20Sopenharmony_ci#include <cpu/cache.h> 148c2ecf20Sopenharmony_ci 158c2ecf20Sopenharmony_ci#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT) 168c2ecf20Sopenharmony_ci 178c2ecf20Sopenharmony_ci#define __read_mostly __section(".data..read_mostly") 188c2ecf20Sopenharmony_ci 198c2ecf20Sopenharmony_ci#ifndef __ASSEMBLY__ 208c2ecf20Sopenharmony_cistruct cache_info { 218c2ecf20Sopenharmony_ci unsigned int ways; /* Number of cache ways */ 228c2ecf20Sopenharmony_ci unsigned int sets; /* Number of cache sets */ 238c2ecf20Sopenharmony_ci unsigned int linesz; /* Cache line size (bytes) */ 248c2ecf20Sopenharmony_ci 258c2ecf20Sopenharmony_ci unsigned int way_size; /* sets * line size */ 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_ci /* 288c2ecf20Sopenharmony_ci * way_incr is the address offset for accessing the next way 298c2ecf20Sopenharmony_ci * in memory mapped cache array ops. 308c2ecf20Sopenharmony_ci */ 318c2ecf20Sopenharmony_ci unsigned int way_incr; 328c2ecf20Sopenharmony_ci unsigned int entry_shift; 338c2ecf20Sopenharmony_ci unsigned int entry_mask; 348c2ecf20Sopenharmony_ci 358c2ecf20Sopenharmony_ci /* 368c2ecf20Sopenharmony_ci * Compute a mask which selects the address bits which overlap between 378c2ecf20Sopenharmony_ci * 1. those used to select the cache set during indexing 388c2ecf20Sopenharmony_ci * 2. those in the physical page number. 398c2ecf20Sopenharmony_ci */ 408c2ecf20Sopenharmony_ci unsigned int alias_mask; 418c2ecf20Sopenharmony_ci unsigned int n_aliases; /* Number of aliases */ 428c2ecf20Sopenharmony_ci 438c2ecf20Sopenharmony_ci unsigned long flags; 448c2ecf20Sopenharmony_ci}; 458c2ecf20Sopenharmony_ci#endif /* __ASSEMBLY__ */ 468c2ecf20Sopenharmony_ci#endif /* __ASM_SH_CACHE_H */ 47