xref: /netbsd-src/sys/arch/m68k/include/m68k.h (revision 4a2f42e885910817ccf207053444419f342fba51)
1 /*	$NetBSD: m68k.h,v 1.27 2024/01/13 00:44:42 thorpej 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 struct fpframe;
100 
101 /* copypage.s */
102 void	copypage040(void *fromaddr, void *toaddr);
103 void	copypage(void *fromaddr, void *toaddr);
104 void	zeropage(void *addr);
105 
106 /* switch_subr.s */
107 void	lwp_trampoline(void);
108 void	m68881_save(struct fpframe *);
109 void	m68881_restore(struct fpframe *);
110 void	savectx(struct pcb *);
111 
112 /* w16copy.s */
113 void	w16zero(void *, u_int);
114 void	w16copy(const void *, void *, u_int);
115 
116 /* fpu.c */
117 int	fpu_probe(void);
118 
119 /* regdump.c */
120 void	regdump(struct trapframe *, int);
121 
122 /* sys_machdep.c */
123 int	cachectl1(u_long, vaddr_t, size_t, struct proc *);
124 int	dma_cachectl(void *, int);
125 
126 /* vm_machdep.c */
127 int	kvtop(void *);
128 void	physaccess(void *, void *, int, int);
129 void	physunaccess(void *, int);
130 
131 #endif /* _KERNEL */
132 #endif /* _M68K_M68K_H_ */
133