m68k.h revision 1.18 1 /* $NetBSD: m68k.h,v 1.18 2011/02/08 20:20:16 rmind Exp $ */
2
3 /*
4 * Copyright (c) 1988 University of Utah.
5 * Copyright (c) 1982, 1990, 1993
6 * The Regents of the University of California. All rights reserved.
7 *
8 * This code is derived from software contributed to Berkeley by
9 * the Systems Programming Group of the University of Utah Computer
10 * Science Department.
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in the
19 * documentation and/or other materials provided with the distribution.
20 * 3. Neither the name of the University nor the names of its contributors
21 * may be used to endorse or promote products derived from this software
22 * without specific prior written permission.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE.
35 *
36 * from: Utah $Hdr: cpu.h 1.16 91/03/25$
37 * from: @(#)cpu.h 8.4 (Berkeley) 1/5/94
38 */
39
40 #ifndef _M68K_M68K_H_
41 #define _M68K_M68K_H_
42
43 /*
44 * Declarations for things exported by sources in this directory,
45 * or required by sources in here and not declared elsewhere.
46 *
47 * These declarations generally do NOT belong in <machine/cpu.h>,
48 * because that defines the interface between the common code and
49 * the machine-dependent code, whereas this defines the interface
50 * between the shared m68k code and the machine-dependent code.
51 *
52 * The MMU stuff is exported separately so it can be used just
53 * where it is really needed. Same for function codes, etc.
54 */
55
56 #ifdef _KERNEL
57 /*
58 * All m68k ports must provide these globals.
59 */
60 extern int cputype; /* CPU on this host */
61 extern int ectype; /* external cache on this host */
62 extern int fputype; /* FPU on this host */
63 extern int mmutype; /* MMU on this host */
64 #endif /* _KERNEL */
65
66 /* values for cputype */
67 #define CPU_68010 -1 /* 68010 */
68 #define CPU_68020 0 /* 68020 */
69 #define CPU_68030 1 /* 68030 */
70 #define CPU_68040 2 /* 68040 */
71 #define CPU_68060 3 /* 68060 */
72
73 /* values for ectype */
74 #define EC_PHYS -1 /* external physical address cache */
75 #define EC_NONE 0 /* no external cache */
76 #define EC_VIRT 1 /* external virtual address cache */
77
78 /* values for fputype */
79 #define FPU_NONE 0 /* no FPU */
80 #define FPU_68881 1 /* 68881 FPU */
81 #define FPU_68882 2 /* 68882 FPU */
82 #define FPU_68040 3 /* 68040 on-chip FPU */
83 #define FPU_68060 4 /* 68060 on-chip FPU */
84 #define FPU_UNKNOWN 5 /* placeholder; unknown FPU */
85
86 /* values for mmutype (assigned for quick testing) */
87 #define MMU_68060 -3 /* 68060 on-chip MMU */
88 #define MMU_68040 -2 /* 68040 on-chip MMU */
89 #define MMU_68030 -1 /* 68030 on-chip subset of 68851 */
90 #define MMU_HP 0 /* HP proprietary */
91 #define MMU_68851 1 /* Motorola 68851 */
92 #define MMU_SUN 2 /* Sun MMU */
93
94
95 #ifdef _KERNEL
96
97 struct pcb;
98 struct trapframe;
99
100 /* copypage.s */
101 void copypage040(void *fromaddr, void *toaddr);
102 void copypage(void *fromaddr, void *toaddr);
103 void zeropage(void *addr);
104
105 /* locore.s (XXX: move to support.s?) */
106 int getdfc(void);
107 int getsfc(void);
108
109 /* switch_subr.s */
110 void lwp_trampoline(void);
111 void savectx(struct pcb *);
112 void setfunc_trampoline(void);
113
114 /* w16copy.s */
115 void w16zero(void *, u_int);
116 void w16copy(const void *, void *, u_int);
117
118 #ifdef MAPPEDCOPY
119 /* mappedcopy.c */
120 int mappedcopyin(void *fromp, void *top, size_t count);
121 int mappedcopyout(void *fromp, void *top, size_t count);
122 extern u_int mappedcopysize;
123 #endif /* MAPPEDCOPY */
124
125 /* regdump.c */
126 void regdump(struct trapframe *, int);
127
128 /* sys_machdep.c */
129 int cachectl1(u_long, vaddr_t, size_t, struct proc *);
130 int dma_cachectl(void *, int);
131
132 /* vm_machdep.c */
133 int kvtop(void *);
134 void physaccess(void *, void *, int, int);
135 void physunaccess(void *, int);
136
137 /* m68k_machdep.c */
138 bool ucas_ras_check(struct trapframe *);
139
140 #endif /* _KERNEL */
141 #endif /* _M68K_M68K_H_ */
142