cpu.h revision 1.1
11.1Smatt/* $NetBSD: cpu.h,v 1.1 2013/07/18 22:08:59 matt Exp $ */ 21.1Smatt 31.1Smatt/* 41.1Smatt * Copyright (c) 1988 University of Utah. 51.1Smatt * Copyright (c) 1982, 1990, 1993 61.1Smatt * The Regents of the University of California. All rights reserved. 71.1Smatt * 81.1Smatt * This code is derived from software contributed to Berkeley by 91.1Smatt * the Systems Programming Group of the University of Utah Computer 101.1Smatt * Science Department. 111.1Smatt * 121.1Smatt * Redistribution and use in source and binary forms, with or without 131.1Smatt * modification, are permitted provided that the following conditions 141.1Smatt * are met: 151.1Smatt * 1. Redistributions of source code must retain the above copyright 161.1Smatt * notice, this list of conditions and the following disclaimer. 171.1Smatt * 2. Redistributions in binary form must reproduce the above copyright 181.1Smatt * notice, this list of conditions and the following disclaimer in the 191.1Smatt * documentation and/or other materials provided with the distribution. 201.1Smatt * 3. Neither the name of the University nor the names of its contributors 211.1Smatt * may be used to endorse or promote products derived from this software 221.1Smatt * without specific prior written permission. 231.1Smatt * 241.1Smatt * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 251.1Smatt * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 261.1Smatt * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 271.1Smatt * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 281.1Smatt * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 291.1Smatt * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 301.1Smatt * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 311.1Smatt * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 321.1Smatt * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 331.1Smatt * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 341.1Smatt * SUCH DAMAGE. 351.1Smatt * 361.1Smatt * from: Utah $Hdr: cpu.h 1.16 91/03/25$ 371.1Smatt * 381.1Smatt * @(#)cpu.h 8.4 (Berkeley) 1/5/94 391.1Smatt */ 401.1Smatt 411.1Smatt#ifndef _MACHINE_CPU_H_ 421.1Smatt#define _MACHINE_CPU_H_ 431.1Smatt 441.1Smatt#if defined(_KERNEL_OPT) 451.1Smatt#include "opt_lockdebug.h" 461.1Smatt#include "opt_m68k_arch.h" 471.1Smatt#endif 481.1Smatt 491.1Smatt/* 501.1Smatt * Get common m68k CPU definitions. 511.1Smatt */ 521.1Smatt#include <m68k/cpu.h> 531.1Smatt 541.1Smatt#if defined(_KERNEL) 551.1Smatt/* 561.1Smatt * Exported definitions unique to mvme68k/68k cpu support. 571.1Smatt */ 581.1Smatt#define M68K_MMU_COLDFIRE 591.1Smatt 601.1Smatt/* 611.1Smatt * Arguments to hardclock and gatherstats encapsulate the previous 621.1Smatt * machine state in an opaque clockframe. One the mvme68k, we use 631.1Smatt * what the hardware pushes on an interrupt (frame format 0). 641.1Smatt */ 651.1Smattstruct clockframe { 661.1Smatt u_short sr; /* sr at time of interrupt */ 671.1Smatt u_long pc; /* pc at time of interrupt */ 681.1Smatt u_short fmt:4, 691.1Smatt vec:12; /* vector offset (4-word frame) */ 701.1Smatt} __attribute__((packed)); 711.1Smatt 721.1Smatt#define CLKF_USERMODE(framep) (((framep)->sr & PSL_S) == 0) 731.1Smatt#define CLKF_PC(framep) ((framep)->pc) 741.1Smatt 751.1Smatt/* 761.1Smatt * The clock interrupt handler can determine if it's a nested 771.1Smatt * interrupt by checking for interrupt_depth > 1. 781.1Smatt * (Remember, the clock interrupt handler itself will cause the 791.1Smatt * depth counter to be incremented). 801.1Smatt */ 811.1Smattextern volatile unsigned int interrupt_depth; 821.1Smatt#define CLKF_INTR(framep) (interrupt_depth > 1) 831.1Smatt 841.1Smatt 851.1Smatt/* 861.1Smatt * Preempt the current process if in interrupt from user mode, 871.1Smatt * or after the current trap/syscall if in system mode. 881.1Smatt */ 891.1Smatt#define cpu_need_resched(ci, flags) \ 901.1Smatt do { ci->ci_want_resched++; aston(); } while (/* CONSTCOND */0) 911.1Smatt 921.1Smatt/* 931.1Smatt * Give a profiling tick to the current process when the user profiling 941.1Smatt * buffer pages are invalid. On the hp300, request an ast to send us 951.1Smatt * through trap, marking the proc as needing a profiling tick. 961.1Smatt */ 971.1Smatt#define cpu_need_proftick(l) \ 981.1Smatt do { (l)->l_pflag |= LP_OWEUPC; aston(); } while (/* CONSTCOND */0) 991.1Smatt 1001.1Smatt/* 1011.1Smatt * Notify the current process (p) that it has a signal pending, 1021.1Smatt * process as soon as possible. 1031.1Smatt */ 1041.1Smatt#define cpu_signotify(l) aston() 1051.1Smatt 1061.1Smattextern int astpending; /* need to trap before returning to user mode */ 1071.1Smatt#define aston() (astpending++) 1081.1Smatt 1091.1Smatt#endif /* _KERNEL */ 1101.1Smatt 1111.1Smatt/* 1121.1Smatt * CTL_MACHDEP definitions. 1131.1Smatt */ 1141.1Smatt#define CPU_CONSDEV 1 /* dev_t: console terminal device */ 1151.1Smatt#define CPU_MAXID 2 /* number of valid machdep ids */ 1161.1Smatt 1171.1Smatt#ifdef _KERNEL 1181.1Smatt/* 1191.1Smatt * Associate MVME models with CPU types. 1201.1Smatt */ 1211.1Smatt#define MVME68K 1 1221.1Smatt 1231.1Smatt/* 1241.1Smatt * MVME-147; 68030 CPU 1251.1Smatt */ 1261.1Smatt#if defined(MVME147) && !defined(M68030) 1271.1Smatt#define M68030 1281.1Smatt#endif 1291.1Smatt 1301.1Smatt/* 1311.1Smatt * MVME-162/166/167; 68040 CPU 1321.1Smatt */ 1331.1Smatt#if (defined(MVME162) || defined(MVME167)) && !defined(M68040) 1341.1Smatt#define M68040 1351.1Smatt#endif 1361.1Smatt 1371.1Smatt/* 1381.1Smatt * MVME-172/177; 68060 CPU 1391.1Smatt */ 1401.1Smatt#if (defined(MVME172) || defined(MVME177)) && !defined(M68060) 1411.1Smatt#define M68060 1421.1Smatt#endif 1431.1Smatt#endif /* _KERNEL */ 1441.1Smatt 1451.1Smatt/* 1461.1Smatt * Values for machineid; these match the Bug's values. 1471.1Smatt */ 1481.1Smatt#define MVME_147 0x147 1491.1Smatt#define MVME_162 0x162 1501.1Smatt#define MVME_166 0x166 1511.1Smatt#define MVME_167 0x167 1521.1Smatt#define MVME_172 0x172 1531.1Smatt#define MVME_177 0x177 1541.1Smatt 1551.1Smatt#ifdef _KERNEL 1561.1Smattextern int machineid; 1571.1Smattextern int cpuspeed; 1581.1Smattextern char *intiobase, *intiolimit; 1591.1Smattextern u_int intiobase_phys, intiotop_phys; 1601.1Smattextern u_long ether_data_buff_size; 1611.1Smattextern u_char mvme_ea[6]; 1621.1Smatt 1631.1Smattvoid doboot(int) 1641.1Smatt __attribute__((__noreturn__)); 1651.1Smattint nmihand(void *); 1661.1Smattvoid mvme68k_abort(const char *); 1671.1Smattvoid *iomap(u_long, size_t); 1681.1Smattvoid iounmap(void *, size_t); 1691.1Smattvoid loadustp(paddr_t); 1701.1Smatt 1711.1Smatt/* physical memory addresses where mvme147's onboard devices live */ 1721.1Smatt#define INTIOBASE147 (0xfffe0000u) 1731.1Smatt#define INTIOTOP147 (0xfffe5000u) 1741.1Smatt 1751.1Smatt/* ditto for mvme1[67][27] */ 1761.1Smatt#define INTIOBASE1xx (0xfff40000u) 1771.1Smatt#define INTIOTOP1xx (0xfffd0000u) 1781.1Smatt 1791.1Smatt#endif /* _KERNEL */ 1801.1Smatt 1811.1Smatt#endif /* _MACHINE_CPU_H_ */ 182