locore.h revision 1.9 1 1.9 mhitch /* $NetBSD: locore.h,v 1.9 1997/06/19 06:31:14 mhitch Exp $ */
2 1.1 jonathan
3 1.1 jonathan /*
4 1.1 jonathan * Copyright 1996 The Board of Trustees of The Leland Stanford
5 1.1 jonathan * Junior University. All Rights Reserved.
6 1.1 jonathan *
7 1.1 jonathan * Permission to use, copy, modify, and distribute this
8 1.1 jonathan * software and its documentation for any purpose and without
9 1.1 jonathan * fee is hereby granted, provided that the above copyright
10 1.1 jonathan * notice appear in all copies. Stanford University
11 1.1 jonathan * makes no representations about the suitability of this
12 1.1 jonathan * software for any purpose. It is provided "as is" without
13 1.1 jonathan * express or implied warranty.
14 1.1 jonathan */
15 1.1 jonathan
16 1.1 jonathan /*
17 1.1 jonathan * Jump table for MIPS cpu locore functions that are implemented
18 1.1 jonathan * differently on different generations, or instruction-level
19 1.1 jonathan * archtecture (ISA) level, the Mips family.
20 1.1 jonathan * The following functions must be provided for each mips ISA level:
21 1.1 jonathan *
22 1.1 jonathan *
23 1.1 jonathan * MachConfigCache
24 1.1 jonathan * MachFlushCache
25 1.1 jonathan * MachFlushDCache
26 1.1 jonathan * MachFlushICache
27 1.1 jonathan * MachForceCacheUpdate
28 1.1 jonathan * MachSetPID
29 1.1 jonathan * MachTLBFlush
30 1.1 jonathan * MachTLBFlushAddr __P()
31 1.1 jonathan * MachTLBUpdate (u_int, (pt_entry_t?) u_int);
32 1.1 jonathan * MachTLBWriteIndexed
33 1.5 mhitch * wbflush
34 1.5 mhitch * proc_trampoline()
35 1.9 mhitch * switch_exit()
36 1.9 mhitch * cpu_switch_resume()
37 1.1 jonathan *
38 1.1 jonathan * We currently provide support for:
39 1.1 jonathan *
40 1.1 jonathan * r2000 and r3000 (mips ISA-I)
41 1.1 jonathan * r4000 and r4400 in 32-bit mode (mips ISA-III?)
42 1.1 jonathan */
43 1.1 jonathan
44 1.1 jonathan #ifndef _MIPS_LOCORE_H
45 1.1 jonathan #define _MIPS_LOCORE_H
46 1.2 jonathan
47 1.2 jonathan /*
48 1.2 jonathan * locore service routine for exeception vectors. Used outside locore
49 1.2 jonathan * only to print them by name in stack tracebacks
50 1.2 jonathan */
51 1.2 jonathan
52 1.3 jonathan extern void mips1_ConfigCache __P((void));
53 1.3 jonathan extern void mips1_FlushCache __P((void));
54 1.3 jonathan extern void mips1_FlushDCache __P((vm_offset_t addr, vm_offset_t len));
55 1.3 jonathan extern void mips1_FlushICache __P((vm_offset_t addr, vm_offset_t len));
56 1.3 jonathan extern void mips1_ForceCacheUpdate __P((void));
57 1.3 jonathan extern void mips1_SetPID __P((int pid));
58 1.3 jonathan extern void mips1_TLBFlush __P((void));
59 1.3 jonathan extern void mips1_TLBFlushAddr __P( /* XXX Really pte highpart ? */
60 1.1 jonathan (vm_offset_t addr));
61 1.5 mhitch extern int mips1_TLBUpdate __P((u_int, /*pt_entry_t*/ u_int));
62 1.3 jonathan extern void mips1_TLBWriteIndexed __P((u_int index, u_int high,
63 1.1 jonathan u_int low));
64 1.5 mhitch extern void mips1_wbflush __P((void));
65 1.5 mhitch extern void mips1_proc_trampoline __P((void));
66 1.9 mhitch extern void mips1_switch_exit __P((struct proc *));
67 1.9 mhitch extern void mips1_cpu_switch_resume __P((void));
68 1.1 jonathan
69 1.3 jonathan extern void mips3_ConfigCache __P((void));
70 1.3 jonathan extern void mips3_FlushCache __P((void));
71 1.3 jonathan extern void mips3_FlushDCache __P((vm_offset_t addr, vm_offset_t len));
72 1.3 jonathan extern void mips3_FlushICache __P((vm_offset_t addr, vm_offset_t len));
73 1.3 jonathan extern void mips3_ForceCacheUpdate __P((void));
74 1.7 jonathan extern void mips3_HitFlushDCache __P((vm_offset_t, int));
75 1.3 jonathan extern void mips3_SetPID __P((int pid));
76 1.3 jonathan extern void mips3_TLBFlush __P((void));
77 1.3 jonathan extern void mips3_TLBFlushAddr __P( /* XXX Really pte highpart ? */
78 1.1 jonathan (vm_offset_t addr));
79 1.5 mhitch extern int mips3_TLBUpdate __P((u_int, /*pt_entry_t*/ u_int));
80 1.5 mhitch extern void mips3_TLBWriteIndexedVPS __P((u_int index, void *tlb));
81 1.3 jonathan extern void mips3_TLBWriteIndexed __P((u_int index, u_int high,
82 1.5 mhitch u_int lo0, u_int lo1));
83 1.5 mhitch extern void mips3_wbflush __P((void));
84 1.5 mhitch extern void mips3_proc_trampoline __P((void));
85 1.9 mhitch extern void mips3_switch_exit __P((struct proc *));
86 1.9 mhitch extern void mips3_cpu_switch_resume __P((void));
87 1.1 jonathan
88 1.7 jonathan extern void MachHitFlushDCache __P((caddr_t, int));
89 1.7 jonathan extern void mips3_SetWIRED __P((int));
90 1.7 jonathan
91 1.7 jonathan
92 1.1 jonathan /*
93 1.1 jonathan * A vector with an entry for each mips-ISA-level dependent
94 1.1 jonathan * locore function, and macros which jump through it.
95 1.1 jonathan * XXX the macro names are chosen to be compatible with the old
96 1.1 jonathan * Sprite coding-convention names used in 4.4bsd/pmax.
97 1.1 jonathan */
98 1.1 jonathan typedef struct {
99 1.1 jonathan void (*configCache) __P((void));
100 1.1 jonathan void (*flushCache) __P((void));
101 1.1 jonathan void (*flushDCache) __P((vm_offset_t addr, vm_offset_t len));
102 1.1 jonathan void (*flushICache) __P((vm_offset_t addr, vm_offset_t len));
103 1.1 jonathan void (*forceCacheUpdate) __P((void));
104 1.1 jonathan void (*setTLBpid) __P((int pid));
105 1.1 jonathan void (*tlbFlush) __P((void));
106 1.1 jonathan void (*tlbFlushAddr) __P((vm_offset_t)); /* XXX Really pte highpart ? */
107 1.5 mhitch int (*tlbUpdate) __P((u_int highreg, u_int lowreg));
108 1.5 mhitch #ifdef MIPS3
109 1.5 mhitch void (*tlbWriteIndexed) __P((u_int, u_int, u_int, u_int));
110 1.5 mhitch #else
111 1.1 jonathan void (*tlbWriteIndexed) __P((u_int, u_int, u_int));
112 1.5 mhitch #endif
113 1.5 mhitch void (*wbflush) __P((void));
114 1.5 mhitch void (*proc_trampoline) __P((void));
115 1.9 mhitch void (*mips_switch_exit) __P((struct proc *));
116 1.9 mhitch void (*cpu_switch_resume) __P((void));
117 1.1 jonathan } mips_locore_jumpvec_t;
118 1.1 jonathan
119 1.1 jonathan
120 1.1 jonathan /*
121 1.1 jonathan * The "active" locore-fuction vector, and
122 1.1 jonathan
123 1.1 jonathan */
124 1.1 jonathan extern mips_locore_jumpvec_t mips_locore_jumpvec;
125 1.1 jonathan extern mips_locore_jumpvec_t r2000_locore_vec;
126 1.1 jonathan extern mips_locore_jumpvec_t r4000_locore_vec;
127 1.1 jonathan
128 1.1 jonathan #define MachConfigCache (*(mips_locore_jumpvec.configCache))
129 1.1 jonathan #define MachFlushCache (*(mips_locore_jumpvec.flushCache))
130 1.1 jonathan #define MachFlushDCache (*(mips_locore_jumpvec.flushDCache))
131 1.1 jonathan #define MachFlushICache (*(mips_locore_jumpvec.flushICache))
132 1.1 jonathan #define MachForceCacheUpdate (*(mips_locore_jumpvec.forceCacheUpdate))
133 1.1 jonathan #define MachSetPID (*(mips_locore_jumpvec.setTLBpid))
134 1.1 jonathan #define MachTLBFlush (*(mips_locore_jumpvec.tlbFlush))
135 1.1 jonathan #define MachTLBFlushAddr (*(mips_locore_jumpvec.tlbFlushAddr))
136 1.1 jonathan #define MachTLBUpdate (*(mips_locore_jumpvec.tlbUpdate))
137 1.1 jonathan #define MachTLBWriteIndexed (*(mips_locore_jumpvec.tlbWriteIndexed))
138 1.5 mhitch #define wbflush (*(mips_locore_jumpvec.wbflush))
139 1.5 mhitch #define proc_trampoline (mips_locore_jumpvec.proc_trampoline)
140 1.9 mhitch #define switch_exit (*(mips_locore_jumpvec.mips_switch_exit))
141 1.9 mhitch /* cpu_switch_resume not called directly */
142 1.7 jonathan
143 1.7 jonathan
144 1.7 jonathan /*
145 1.7 jonathan * CPU identification, from PRID register.
146 1.7 jonathan */
147 1.7 jonathan union cpuprid {
148 1.7 jonathan int cpuprid;
149 1.7 jonathan struct {
150 1.7 jonathan #if BYTE_ORDER == BIG_ENDIAN
151 1.7 jonathan u_int pad1:16; /* reserved */
152 1.7 jonathan u_int cp_imp:8; /* implementation identifier */
153 1.7 jonathan u_int cp_majrev:4; /* major revision identifier */
154 1.7 jonathan u_int cp_minrev:4; /* minor revision identifier */
155 1.7 jonathan #else
156 1.7 jonathan u_int cp_minrev:4; /* minor revision identifier */
157 1.7 jonathan u_int cp_majrev:4; /* major revision identifier */
158 1.7 jonathan u_int cp_imp:8; /* implementation identifier */
159 1.7 jonathan u_int pad1:16; /* reserved */
160 1.7 jonathan #endif
161 1.7 jonathan } cpu;
162 1.7 jonathan };
163 1.7 jonathan
164 1.6 jonathan
165 1.6 jonathan #ifdef _KERNEL
166 1.6 jonathan
167 1.6 jonathan /*
168 1.6 jonathan * Global variables used to communicate CPU type, and parameters
169 1.6 jonathan * such as cache size, from locore to higher-level code (e.g., pmap).
170 1.6 jonathan */
171 1.8 jonathan extern union cpuprid cpu_id;
172 1.8 jonathan extern union cpuprid fpu_id;
173 1.8 jonathan extern int cpu_arch;
174 1.9 mhitch extern u_int mips_L1DataCacheSize;
175 1.9 mhitch extern u_int mips_L1InstCacheSize;
176 1.9 mhitch extern u_int mips_L1DataCacheLSize;
177 1.9 mhitch extern u_int mips_L1InstCacheLSize;
178 1.9 mhitch extern u_int mips_L2CacheSize;
179 1.9 mhitch extern u_int mips_L2CacheLSize;
180 1.9 mhitch extern u_int mips_CacheAliasMask;
181 1.6 jonathan extern struct intr_tab intr_tab[];
182 1.6 jonathan #endif
183 1.1 jonathan
184 1.1 jonathan #endif /* _MIPS_LOCORE_H */
185