1/* $NetBSD: m68k.h,v 1.20 2011/11/15 12:23:22 tsutsui 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 */ 60extern int cputype; /* CPU on this host */ 61extern int ectype; /* external cache on this host */ 62extern int fputype; /* FPU on this host */ 63extern 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 97struct pcb; 98struct trapframe; 99struct fpframe; 100 101/* copypage.s */ 102void copypage040(void *fromaddr, void *toaddr); 103void copypage(void *fromaddr, void *toaddr); 104void zeropage(void *addr); 105 106/* support.s */ 107int getdfc(void); 108int getsfc(void); 109 110/* switch_subr.s */ 111void lwp_trampoline(void); 112void m68881_save(struct fpframe *); 113void m68881_restore(struct fpframe *); 114void savectx(struct pcb *); 115void setfunc_trampoline(void); 116 117/* w16copy.s */ 118void w16zero(void *, u_int); 119void w16copy(const void *, void *, u_int); 120 121/* fpu.c */ 122int fpu_probe(void); 123 124#ifdef MAPPEDCOPY 125/* mappedcopy.c */ 126int mappedcopyin(void *fromp, void *top, size_t count); 127int mappedcopyout(void *fromp, void *top, size_t count); 128extern u_int mappedcopysize; 129#endif /* MAPPEDCOPY */ 130 131/* regdump.c */ 132void regdump(struct trapframe *, int); 133 134/* sys_machdep.c */ 135int cachectl1(u_long, vaddr_t, size_t, struct proc *); 136int dma_cachectl(void *, int); 137 138/* vm_machdep.c */ 139int kvtop(void *); 140void physaccess(void *, void *, int, int); 141void physunaccess(void *, int); 142 143/* m68k_machdep.c */ 144bool ucas_ras_check(struct trapframe *); 145 146#endif /* _KERNEL */ 147#endif /* _M68K_M68K_H_ */ 148