162306a36Sopenharmony_ci/*
262306a36Sopenharmony_ci * This file is subject to the terms and conditions of the GNU General Public
362306a36Sopenharmony_ci * License.  See the file "COPYING" in the main directory of this archive
462306a36Sopenharmony_ci * for more details.
562306a36Sopenharmony_ci *
662306a36Sopenharmony_ci * Copyright (C) 2003 by Ralf Baechle
762306a36Sopenharmony_ci */
862306a36Sopenharmony_ci#ifndef __ASM_PREFETCH_H
962306a36Sopenharmony_ci#define __ASM_PREFETCH_H
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_ci/*
1362306a36Sopenharmony_ci * R5000 and RM5200 implements pref and prefx instructions but they're nops, so
1462306a36Sopenharmony_ci * rather than wasting time we pretend these processors don't support
1562306a36Sopenharmony_ci * prefetching at all.
1662306a36Sopenharmony_ci *
1762306a36Sopenharmony_ci * R5432 implements Load, Store, LoadStreamed, StoreStreamed, LoadRetained,
1862306a36Sopenharmony_ci * StoreRetained and WriteBackInvalidate but not Pref_PrepareForStore.
1962306a36Sopenharmony_ci *
2062306a36Sopenharmony_ci * Hell (and the book on my shelf I can't open ...) know what the R8000 does.
2162306a36Sopenharmony_ci *
2262306a36Sopenharmony_ci * RM7000 version 1.0 interprets all hints as Pref_Load; version 2.0 implements
2362306a36Sopenharmony_ci * Pref_PrepareForStore also.
2462306a36Sopenharmony_ci *
2562306a36Sopenharmony_ci * RM9000 is MIPS IV but implements prefetching like MIPS32/MIPS64; it's
2662306a36Sopenharmony_ci * Pref_WriteBackInvalidate is a nop and Pref_PrepareForStore is broken in
2762306a36Sopenharmony_ci * current versions due to erratum G105.
2862306a36Sopenharmony_ci *
2962306a36Sopenharmony_ci * VR5500 (including VR5701 and VR7701) only implement load prefetch.
3062306a36Sopenharmony_ci *
3162306a36Sopenharmony_ci * Finally MIPS32 and MIPS64 implement all of the following hints.
3262306a36Sopenharmony_ci */
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_ci#define Pref_Load			0
3562306a36Sopenharmony_ci#define Pref_Store			1
3662306a36Sopenharmony_ci						/* 2 and 3 are reserved */
3762306a36Sopenharmony_ci#define Pref_LoadStreamed		4
3862306a36Sopenharmony_ci#define Pref_StoreStreamed		5
3962306a36Sopenharmony_ci#define Pref_LoadRetained		6
4062306a36Sopenharmony_ci#define Pref_StoreRetained		7
4162306a36Sopenharmony_ci						/* 8 ... 24 are reserved */
4262306a36Sopenharmony_ci#define Pref_WriteBackInvalidate	25
4362306a36Sopenharmony_ci#define Pref_PrepareForStore		30
4462306a36Sopenharmony_ci
4562306a36Sopenharmony_ci#ifdef __ASSEMBLY__
4662306a36Sopenharmony_ci
4762306a36Sopenharmony_ci	.macro	__pref hint addr
4862306a36Sopenharmony_ci#ifdef CONFIG_CPU_HAS_PREFETCH
4962306a36Sopenharmony_ci	pref	\hint, \addr
5062306a36Sopenharmony_ci#endif
5162306a36Sopenharmony_ci	.endm
5262306a36Sopenharmony_ci
5362306a36Sopenharmony_ci	.macro	pref_load addr
5462306a36Sopenharmony_ci	__pref	Pref_Load, \addr
5562306a36Sopenharmony_ci	.endm
5662306a36Sopenharmony_ci
5762306a36Sopenharmony_ci	.macro	pref_store addr
5862306a36Sopenharmony_ci	__pref	Pref_Store, \addr
5962306a36Sopenharmony_ci	.endm
6062306a36Sopenharmony_ci
6162306a36Sopenharmony_ci	.macro	pref_load_streamed addr
6262306a36Sopenharmony_ci	__pref	Pref_LoadStreamed, \addr
6362306a36Sopenharmony_ci	.endm
6462306a36Sopenharmony_ci
6562306a36Sopenharmony_ci	.macro	pref_store_streamed addr
6662306a36Sopenharmony_ci	__pref	Pref_StoreStreamed, \addr
6762306a36Sopenharmony_ci	.endm
6862306a36Sopenharmony_ci
6962306a36Sopenharmony_ci	.macro	pref_load_retained addr
7062306a36Sopenharmony_ci	__pref	Pref_LoadRetained, \addr
7162306a36Sopenharmony_ci	.endm
7262306a36Sopenharmony_ci
7362306a36Sopenharmony_ci	.macro	pref_store_retained addr
7462306a36Sopenharmony_ci	__pref	Pref_StoreRetained, \addr
7562306a36Sopenharmony_ci	.endm
7662306a36Sopenharmony_ci
7762306a36Sopenharmony_ci	.macro	pref_wback_inv addr
7862306a36Sopenharmony_ci	__pref	Pref_WriteBackInvalidate, \addr
7962306a36Sopenharmony_ci	.endm
8062306a36Sopenharmony_ci
8162306a36Sopenharmony_ci	.macro	pref_prepare_for_store addr
8262306a36Sopenharmony_ci	__pref	Pref_PrepareForStore, \addr
8362306a36Sopenharmony_ci	.endm
8462306a36Sopenharmony_ci
8562306a36Sopenharmony_ci#endif
8662306a36Sopenharmony_ci
8762306a36Sopenharmony_ci#endif /* __ASM_PREFETCH_H */
88