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