1 /* SPDX-License-Identifier: GPL-2.0 */
3 * ross.h: Ross module specific definitions and defines.
5 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
14 /* Ross made Hypersparcs have a %psr 'impl' field of '0001'. The 'vers'
18 /* The MMU control register fields on the HyperSparc.
20 * -----------------------------------------------------------------
21 * |implvers| RSV |CWR|SE|WBE| MID |BM| C|CS|MR|CM|RSV|CE|RSV|NF|ME|
22 * -----------------------------------------------------------------
23 * 31 24 23-22 21 20 19 18-15 14 13 12 11 10 9 8 7-2 1 0
25 * Phew, lots of fields there ;-)
27 * CWR: Cache Wrapping Enabled, if one cache wrapping is on.
28 * SE: Snoop Enable, turns on bus snooping for cache activity if one.
29 * WBE: Write Buffer Enable, one turns it on.
30 * MID: The ModuleID of the chip for MBus transactions.
31 * BM: Boot-Mode. One indicates the MMU is in boot mode.
32 * C: Indicates whether accesses are cachable while the MMU is
34 * CS: Cache Size -- 0 = 128k, 1 = 256k
35 * MR: Memory Reflection, one indicates that the memory bus connected
36 * to the MBus supports memory reflection.
37 * CM: Cache Mode -- 0 = write-through, 1 = copy-back
38 * CE: Cache Enable -- 0 = no caching, 1 = cache is on
39 * NF: No Fault -- 0 = faults trap the CPU from supervisor mode
40 * 1 = faults from supervisor mode do not generate traps
41 * ME: MMU Enable -- 0 = MMU is off, 1 = MMU is on
44 #define HYPERSPARC_CWENABLE 0x00200000
45 #define HYPERSPARC_SBENABLE 0x00100000
46 #define HYPERSPARC_WBENABLE 0x00080000
47 #define HYPERSPARC_MIDMASK 0x00078000
48 #define HYPERSPARC_BMODE 0x00004000
49 #define HYPERSPARC_ACENABLE 0x00002000
50 #define HYPERSPARC_CSIZE 0x00001000
51 #define HYPERSPARC_MRFLCT 0x00000800
52 #define HYPERSPARC_CMODE 0x00000400
53 #define HYPERSPARC_CENABLE 0x00000100
54 #define HYPERSPARC_NFAULT 0x00000002
55 #define HYPERSPARC_MENABLE 0x00000001
58 /* The ICCR instruction cache register on the HyperSparc.
60 * -----------------------------------------------
62 * -----------------------------------------------
65 * This register is accessed using the V8 'wrasr' and 'rdasr'
66 * opcodes, since not all assemblers understand them and those
67 * that do use different semantics I will just hard code the
68 * instruction with a '.word' statement.
70 * FTD: If set to one flush instructions executed during an
71 * instruction cache hit occurs, the corresponding line
72 * for said cache-hit is invalidated. If FTD is zero,
73 * an unimplemented 'flush' trap will occur when any
74 * flush is executed by the processor.
76 * ICE: If set to one, the instruction cache is enabled. If
77 * zero, the cache will not be used for instruction fetches.
79 * All other bits are read as zeros, and writes to them have no
82 * Wheee, not many assemblers understand the %iccr register nor
83 * the generic asr r/w instructions.
85 * 1000 0011 0100 0111 1100 0000 0000 0000 ! rd %iccr, %g1
87 * 0x 8 3 4 7 c 0 0 0 ! 0x8347c000
89 * 1011 1111 1000 0000 0110 0000 0000 0000 ! wr %g1, 0x0, %iccr
91 * 0x b f 8 0 6 0 0 0 ! 0xbf806000
95 #define HYPERSPARC_ICCR_FTD 0x00000002
96 #define HYPERSPARC_ICCR_ICE 0x00000001
100 static inline unsigned int get_ross_icr(void)
104 __asm__
__volatile__(".word 0x8347c000\n\t" /* rd %iccr, %g1 */
113 static inline void put_ross_icr(unsigned int icreg
)
115 __asm__
__volatile__("or %%g0, %0, %%g1\n\t"
116 ".word 0xbf806000\n\t" /* wr %g1, 0x0, %iccr */
127 /* HyperSparc specific cache flushing. */
129 /* This is for the on-chip instruction cache. */
130 static inline void hyper_flush_whole_icache(void)
132 __asm__
__volatile__("sta %%g0, [%%g0] %0\n\t"
134 : "i" (ASI_M_FLUSH_IWHOLE
)
139 extern int vac_cache_size
;
140 extern int vac_line_size
;
142 static inline void hyper_clear_all_tags(void)
146 for(addr
= 0; addr
< vac_cache_size
; addr
+= vac_line_size
)
147 __asm__
__volatile__("sta %%g0, [%0] %1\n\t"
149 : "r" (addr
), "i" (ASI_M_DATAC_TAG
)
153 static inline void hyper_flush_unconditional_combined(void)
157 for (addr
= 0; addr
< vac_cache_size
; addr
+= vac_line_size
)
158 __asm__
__volatile__("sta %%g0, [%0] %1\n\t"
160 : "r" (addr
), "i" (ASI_M_FLUSH_CTX
)
164 static inline void hyper_flush_cache_user(void)
168 for (addr
= 0; addr
< vac_cache_size
; addr
+= vac_line_size
)
169 __asm__
__volatile__("sta %%g0, [%0] %1\n\t"
171 : "r" (addr
), "i" (ASI_M_FLUSH_USER
)
175 static inline void hyper_flush_cache_page(unsigned long page
)
180 end
= page
+ PAGE_SIZE
;
182 __asm__
__volatile__("sta %%g0, [%0] %1\n\t"
184 : "r" (page
), "i" (ASI_M_FLUSH_PAGE
)
186 page
+= vac_line_size
;
190 #endif /* !(__ASSEMBLY__) */
192 #endif /* !(_SPARC_ROSS_H) */