Annotation of sys/arch/mvme68k/include/cpu.h, Revision 1.1
1.1 ! nbrk 1: /* $OpenBSD: cpu.h,v 1.27 2007/05/30 17:10:44 miod Exp $ */
! 2:
! 3: /*
! 4: * Copyright (c) 1995 Theo de Raadt
! 5: *
! 6: * Redistribution and use in source and binary forms, with or without
! 7: * modification, are permitted provided that the following conditions
! 8: * are met:
! 9: * 1. Redistributions of source code must retain the above copyright
! 10: * notice, this list of conditions and the following disclaimer.
! 11: * 2. Redistributions in binary form must reproduce the above copyright
! 12: * notice, this list of conditions and the following disclaimer in the
! 13: * documentation and/or other materials provided with the distribution.
! 14: *
! 15: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
! 16: * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
! 17: * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
! 18: * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
! 19: * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
! 20: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
! 21: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
! 22: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
! 23: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
! 24: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
! 25: * SUCH DAMAGE.
! 26: *
! 27: * Copyright (c) 1988 University of Utah.
! 28: * Copyright (c) 1982, 1990, 1993
! 29: * The Regents of the University of California. All rights reserved.
! 30: *
! 31: * This code is derived from software contributed to Berkeley by
! 32: * the Systems Programming Group of the University of Utah Computer
! 33: * Science Department.
! 34: *
! 35: * Redistribution and use in source and binary forms, with or without
! 36: * modification, are permitted provided that the following conditions
! 37: * are met:
! 38: * 1. Redistributions of source code must retain the above copyright
! 39: * notice, this list of conditions and the following disclaimer.
! 40: * 2. Redistributions in binary form must reproduce the above copyright
! 41: * notice, this list of conditions and the following disclaimer in the
! 42: * documentation and/or other materials provided with the distribution.
! 43: * 3. Neither the name of the University nor the names of its contributors
! 44: * may be used to endorse or promote products derived from this software
! 45: * without specific prior written permission.
! 46: *
! 47: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
! 48: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
! 49: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
! 50: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
! 51: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
! 52: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
! 53: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
! 54: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
! 55: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
! 56: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
! 57: * SUCH DAMAGE.
! 58: *
! 59: * from: Utah $Hdr: cpu.h 1.16 91/03/25$
! 60: *
! 61: * @(#)cpu.h 8.4 (Berkeley) 1/5/94
! 62: */
! 63:
! 64: #ifndef _MVME68K_CPU_H_
! 65: #define _MVME68K_CPU_H_
! 66:
! 67: /*
! 68: * Exported definitions unique to mvme68k cpu support.
! 69: */
! 70:
! 71: /*
! 72: * Get common m68k CPU definiti÷ns.
! 73: */
! 74: #define M68K_MMU_MOTOROLA
! 75: #include <m68k/cpu.h>
! 76:
! 77: #ifdef _KERNEL
! 78:
! 79: /*
! 80: * Get interrupt glue.
! 81: */
! 82: #include <machine/intr.h>
! 83:
! 84: /*
! 85: * definitions of cpu-dependent requirements
! 86: * referenced in generic code
! 87: */
! 88: #define cpu_wait(p) /* nothing */
! 89:
! 90: /*
! 91: * Arguments to hardclock and gatherstats encapsulate the previous
! 92: * machine state in an opaque clockframe. One the m68k, we use
! 93: * what the hardware pushes on an interrupt (frame format 0).
! 94: */
! 95: struct clockframe {
! 96: u_short sr; /* sr at time of interrupt */
! 97: u_long pc; /* pc at time of interrupt */
! 98: u_short vo; /* vector offset (4-word frame) */
! 99: };
! 100:
! 101: #define CLKF_USERMODE(framep) (((framep)->sr & PSL_S) == 0)
! 102: #define CLKF_PC(framep) ((framep)->pc)
! 103: #if 0
! 104: /* We would like to do it this way... */
! 105: #define CLKF_INTR(framep) (((framep)->sr & PSL_M) == 0)
! 106: #else
! 107: /* but until we start using PSL_M, we have to do this instead */
! 108: #define CLKF_INTR(framep) (0) /* XXX */
! 109: #endif
! 110:
! 111:
! 112: /*
! 113: * Preempt the current process if in interrupt from user mode,
! 114: * or after the current trap/syscall if in system mode.
! 115: */
! 116: extern int want_resched;
! 117: #define need_resched(ci) { want_resched = 1; aston(); }
! 118:
! 119: /*
! 120: * Give a profiling tick to the current process when the user profiling
! 121: * buffer pages are invalid. On the m68k, request an ast to send us
! 122: * through trap, marking the proc as needing a profiling tick.
! 123: */
! 124: #define need_proftick(p) aston()
! 125:
! 126: /*
! 127: * Notify the current process (p) that it has a signal pending,
! 128: * process as soon as possible.
! 129: */
! 130: #define signotify(p) aston()
! 131:
! 132: extern int astpending;
! 133: #define aston() (astpending = 1)
! 134:
! 135: #endif /* _KERNEL */
! 136:
! 137: /*
! 138: * CTL_MACHDEP definitions.
! 139: */
! 140: #define CPU_CONSDEV 1 /* dev_t: console terminal device */
! 141: #define CPU_MAXID 2 /* number of valid machdep ids */
! 142:
! 143: #define CTL_MACHDEP_NAMES { \
! 144: { 0, 0 }, \
! 145: { "console_device", CTLTYPE_STRUCT }, \
! 146: }
! 147:
! 148: #ifdef _KERNEL
! 149:
! 150: extern vaddr_t intiobase, intiolimit;
! 151: extern vaddr_t iiomapbase;
! 152: extern int iiomapsize;
! 153:
! 154: /* physical memory sections for mvme147 */
! 155: #define INTIOBASE_147 (0xfffe0000)
! 156: #define INTIOTOP_147 (0xfffe5000)
! 157: #define INTIOSIZE_147 ((INTIOTOP_147-INTIOBASE_147)/NBPG)
! 158:
! 159: /* physical memory sections for mvme16x */
! 160: #define INTIOBASE_162 (0xfff00000)
! 161: #define INTIOTOP_162 (0xfffd0000) /* was 0xfff50000 */
! 162: #define INTIOSIZE_162 ((INTIOTOP_162-INTIOBASE_162)/NBPG)
! 163:
! 164: /*
! 165: * Internal IO space (iiomapsize).
! 166: *
! 167: * Internal IO space is mapped in the kernel from ``intiobase'' to
! 168: * ``intiolimit'' (defined in locore.s). Since it is always mapped,
! 169: * conversion between physical and kernel virtual addresses is easy.
! 170: */
! 171: #define ISIIOVA(va) \
! 172: ((va) >= intiobase && (va) < intiolimit)
! 173: #define IIOV(pa) ((pa) - iiomapbase + intiobase)
! 174: #define IIOP(va) ((va) - intiobase + iiomapbase)
! 175: #define IIOPOFF(pa) ((pa) - iiomapbase)
! 176:
! 177: extern int cputyp;
! 178: #define CPU_147 0x147
! 179: #define CPU_162 0x162
! 180: #define CPU_165 0x165
! 181: #define CPU_166 0x166
! 182: #define CPU_167 0x167
! 183: #define CPU_172 0x172
! 184: #define CPU_177 0x177
! 185:
! 186: #include <sys/evcount.h>
! 187:
! 188: struct intrhand {
! 189: SLIST_ENTRY(intrhand) ih_link;
! 190: int (*ih_fn)(void *);
! 191: void *ih_arg;
! 192: int ih_ipl;
! 193: int ih_wantframe;
! 194: struct evcount ih_count;
! 195: };
! 196:
! 197: int intr_establish(int, struct intrhand *, const char *);
! 198:
! 199: #define NVMEINTR 256
! 200:
! 201: /* locore.s */
! 202: __dead void doboot(void);
! 203:
! 204: int badpaddr(paddr_t, int);
! 205: int badvaddr(vaddr_t, int);
! 206: void nmihand(void *);
! 207: int intr_findvec(int, int);
! 208:
! 209: void dma_cachectl(caddr_t, int);
! 210: paddr_t kvtop(vaddr_t);
! 211:
! 212: #endif /* _KERNEL */
! 213: #endif /* _MVME68K_CPU_H_ */
CVSweb