18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Copyright (C) 2020 Loongson Technology Corporation Limited
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Cache operations for the cache instruction.
68c2ecf20Sopenharmony_ci */
78c2ecf20Sopenharmony_ci#ifndef __ASM_CACHEOPS_H
88c2ecf20Sopenharmony_ci#define __ASM_CACHEOPS_H
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci/*
118c2ecf20Sopenharmony_ci * Most cache ops are split into a 3 bit field identifying the cache, and a 2
128c2ecf20Sopenharmony_ci * bit field identifying the cache operation.
138c2ecf20Sopenharmony_ci */
148c2ecf20Sopenharmony_ci#define CacheOp_Cache			0x07
158c2ecf20Sopenharmony_ci#define CacheOp_Op			0x18
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci#define Cache_LEAF0			0x00
188c2ecf20Sopenharmony_ci#define Cache_LEAF1			0x01
198c2ecf20Sopenharmony_ci#define Cache_LEAF2			0x02
208c2ecf20Sopenharmony_ci#define Cache_LEAF3			0x03
218c2ecf20Sopenharmony_ci#define Cache_LEAF4			0x04
228c2ecf20Sopenharmony_ci#define Cache_LEAF5			0x05
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ci#define Index_Invalidate		0x08
258c2ecf20Sopenharmony_ci#define Index_Writeback_Inv		0x08
268c2ecf20Sopenharmony_ci#define Hit_Invalidate			0x10
278c2ecf20Sopenharmony_ci#define Hit_Writeback_Inv		0x10
288c2ecf20Sopenharmony_ci#define CacheOp_User_Defined		0x18
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ci#define Index_Writeback_Inv_LEAF0	(Cache_LEAF0 | Index_Writeback_Inv)
318c2ecf20Sopenharmony_ci#define Index_Writeback_Inv_LEAF1	(Cache_LEAF1 | Index_Writeback_Inv)
328c2ecf20Sopenharmony_ci#define Index_Writeback_Inv_LEAF2	(Cache_LEAF2 | Index_Writeback_Inv)
338c2ecf20Sopenharmony_ci#define Index_Writeback_Inv_LEAF3	(Cache_LEAF3 | Index_Writeback_Inv)
348c2ecf20Sopenharmony_ci#define Index_Writeback_Inv_LEAF4	(Cache_LEAF4 | Index_Writeback_Inv)
358c2ecf20Sopenharmony_ci#define Index_Writeback_Inv_LEAF5	(Cache_LEAF5 | Index_Writeback_Inv)
368c2ecf20Sopenharmony_ci#define Hit_Writeback_Inv_LEAF0		(Cache_LEAF0 | Hit_Writeback_Inv)
378c2ecf20Sopenharmony_ci#define Hit_Writeback_Inv_LEAF1		(Cache_LEAF1 | Hit_Writeback_Inv)
388c2ecf20Sopenharmony_ci#define Hit_Writeback_Inv_LEAF2		(Cache_LEAF2 | Hit_Writeback_Inv)
398c2ecf20Sopenharmony_ci#define Hit_Writeback_Inv_LEAF3		(Cache_LEAF3 | Hit_Writeback_Inv)
408c2ecf20Sopenharmony_ci#define Hit_Writeback_Inv_LEAF4		(Cache_LEAF4 | Hit_Writeback_Inv)
418c2ecf20Sopenharmony_ci#define Hit_Writeback_Inv_LEAF5		(Cache_LEAF5 | Hit_Writeback_Inv)
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ci#endif	/* __ASM_CACHEOPS_H */
44