1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0 */
2*4882a593Smuzhiyun /*
3*4882a593Smuzhiyun * include/asm-parisc/prefetch.h
4*4882a593Smuzhiyun *
5*4882a593Smuzhiyun * PA 2.0 defines data prefetch instructions on page 6-11 of the Kane book.
6*4882a593Smuzhiyun * In addition, many implementations do hardware prefetching of both
7*4882a593Smuzhiyun * instructions and data.
8*4882a593Smuzhiyun *
9*4882a593Smuzhiyun * PA7300LC (page 14-4 of the ERS) also implements prefetching by a load
10*4882a593Smuzhiyun * to gr0 but not in a way that Linux can use. If the load would cause an
11*4882a593Smuzhiyun * interruption (eg due to prefetching 0), it is suppressed on PA2.0
12*4882a593Smuzhiyun * processors, but not on 7300LC.
13*4882a593Smuzhiyun *
14*4882a593Smuzhiyun */
15*4882a593Smuzhiyun
16*4882a593Smuzhiyun #ifndef __ASM_PARISC_PREFETCH_H
17*4882a593Smuzhiyun #define __ASM_PARISC_PREFETCH_H
18*4882a593Smuzhiyun
19*4882a593Smuzhiyun #ifndef __ASSEMBLY__
20*4882a593Smuzhiyun #ifdef CONFIG_PREFETCH
21*4882a593Smuzhiyun
22*4882a593Smuzhiyun #define ARCH_HAS_PREFETCH
prefetch(const void * addr)23*4882a593Smuzhiyun static inline void prefetch(const void *addr)
24*4882a593Smuzhiyun {
25*4882a593Smuzhiyun __asm__(
26*4882a593Smuzhiyun #ifndef CONFIG_PA20
27*4882a593Smuzhiyun /* Need to avoid prefetch of NULL on PA7300LC */
28*4882a593Smuzhiyun " extrw,u,= %0,31,32,%%r0\n"
29*4882a593Smuzhiyun #endif
30*4882a593Smuzhiyun " ldw 0(%0), %%r0" : : "r" (addr));
31*4882a593Smuzhiyun }
32*4882a593Smuzhiyun
33*4882a593Smuzhiyun /* LDD is a PA2.0 addition. */
34*4882a593Smuzhiyun #ifdef CONFIG_PA20
35*4882a593Smuzhiyun #define ARCH_HAS_PREFETCHW
prefetchw(const void * addr)36*4882a593Smuzhiyun static inline void prefetchw(const void *addr)
37*4882a593Smuzhiyun {
38*4882a593Smuzhiyun __asm__("ldd 0(%0), %%r0" : : "r" (addr));
39*4882a593Smuzhiyun }
40*4882a593Smuzhiyun #endif /* CONFIG_PA20 */
41*4882a593Smuzhiyun
42*4882a593Smuzhiyun #endif /* CONFIG_PREFETCH */
43*4882a593Smuzhiyun #endif /* __ASSEMBLY__ */
44*4882a593Smuzhiyun
45*4882a593Smuzhiyun #endif /* __ASM_PARISC_PROCESSOR_H */
46