Annotation of sys/arch/hp300/include/cpu.h, Revision 1.1
1.1 ! nbrk 1: /* $OpenBSD: cpu.h,v 1.34 2007/05/30 17:10:42 miod Exp $ */
! 2: /* $NetBSD: cpu.h,v 1.28 1998/02/13 07:41:51 scottr Exp $ */
! 3:
! 4: /*
! 5: * Copyright (c) 1988 University of Utah.
! 6: * Copyright (c) 1982, 1990, 1993
! 7: * The Regents of the University of California. All rights reserved.
! 8: *
! 9: * This code is derived from software contributed to Berkeley by
! 10: * the Systems Programming Group of the University of Utah Computer
! 11: * Science Department.
! 12: *
! 13: * Redistribution and use in source and binary forms, with or without
! 14: * modification, are permitted provided that the following conditions
! 15: * are met:
! 16: * 1. Redistributions of source code must retain the above copyright
! 17: * notice, this list of conditions and the following disclaimer.
! 18: * 2. Redistributions in binary form must reproduce the above copyright
! 19: * notice, this list of conditions and the following disclaimer in the
! 20: * documentation and/or other materials provided with the distribution.
! 21: * 3. Neither the name of the University nor the names of its contributors
! 22: * may be used to endorse or promote products derived from this software
! 23: * without specific prior written permission.
! 24: *
! 25: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
! 26: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
! 27: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
! 28: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
! 29: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
! 30: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
! 31: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
! 32: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
! 33: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
! 34: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
! 35: * SUCH DAMAGE.
! 36: *
! 37: * from: Utah $Hdr: cpu.h 1.16 91/03/25$
! 38: *
! 39: * @(#)cpu.h 8.4 (Berkeley) 1/5/94
! 40: */
! 41:
! 42: #ifndef _HP300_CPU_H_
! 43: #define _HP300_CPU_H_
! 44:
! 45: /*
! 46: * Exported definitions unique to hp300/68k cpu support.
! 47: */
! 48:
! 49: /*
! 50: * Get common m68k CPU definitions.
! 51: */
! 52: #include <m68k/cpu.h>
! 53:
! 54: #ifdef _KERNEL
! 55:
! 56: /*
! 57: * Get interrupt glue.
! 58: */
! 59: #include <machine/intr.h>
! 60:
! 61: /*
! 62: * definitions of cpu-dependent requirements
! 63: * referenced in generic code
! 64: */
! 65: #define cpu_wait(p) /* nothing */
! 66:
! 67: /*
! 68: * Arguments to hardclock and gatherstats encapsulate the previous
! 69: * machine state in an opaque clockframe. One the hp300, we use
! 70: * what the hardware pushes on an interrupt (frame format 0).
! 71: */
! 72: struct clockframe {
! 73: u_short sr; /* sr at time of interrupt */
! 74: u_long pc; /* pc at time of interrupt */
! 75: u_short vo; /* vector offset (4-word frame) */
! 76: };
! 77:
! 78: #define CLKF_USERMODE(framep) (((framep)->sr & PSL_S) == 0)
! 79: #define CLKF_PC(framep) ((framep)->pc)
! 80: #if 0
! 81: /* We would like to do it this way... */
! 82: #define CLKF_INTR(framep) (((framep)->sr & PSL_M) == 0)
! 83: #else
! 84: /* but until we start using PSL_M, we have to do this instead */
! 85: #define CLKF_INTR(framep) (0) /* XXX */
! 86: #endif
! 87:
! 88:
! 89: /*
! 90: * Preempt the current process if in interrupt from user mode,
! 91: * or after the current trap/syscall if in system mode.
! 92: */
! 93: extern int want_resched; /* resched() was called */
! 94: #define need_resched(ci) { want_resched = 1; aston(); }
! 95:
! 96: /*
! 97: * Give a profiling tick to the current process when the user profiling
! 98: * buffer pages are invalid. On the hp300, request an ast to send us
! 99: * through trap, marking the proc as needing a profiling tick.
! 100: */
! 101: #define need_proftick(p) aston()
! 102:
! 103: /*
! 104: * Notify the current process (p) that it has a signal pending,
! 105: * process as soon as possible.
! 106: */
! 107: #define signotify(p) aston()
! 108:
! 109: extern int astpending; /* need to trap before returning to user mode */
! 110: #define aston() (astpending = 1)
! 111:
! 112: #endif /* _KERNEL */
! 113:
! 114: /*
! 115: * CTL_MACHDEP definitions.
! 116: */
! 117: #define CPU_CONSDEV 1 /* dev_t: console terminal device */
! 118: #define CPU_CPUSPEED 2 /* CPU speed in MHz */
! 119: #define CPU_MACHINEID 3 /* machine id (HP_XXX) */
! 120: #define CPU_MMUID 4 /* mmu id (MMUID_*) */
! 121: #define CPU_MAXID 5 /* number of valid machdep ids */
! 122:
! 123: #define CTL_MACHDEP_NAMES { \
! 124: { 0, 0 }, \
! 125: { "console_device", CTLTYPE_STRUCT }, \
! 126: { "cpuspeed", CTLTYPE_INT }, \
! 127: { "machineid", CTLTYPE_INT }, \
! 128: { "mmuid", CTLTYPE_INT }, \
! 129: }
! 130:
! 131: /*
! 132: * The rest of this should probably be moved to <machine/hp300spu.h>,
! 133: * although some of it could probably be put into generic 68k headers.
! 134: */
! 135:
! 136: #ifdef _KERNEL
! 137: extern char *intiobase, *intiolimit;
! 138: extern void (*vectab[])(void);
! 139:
! 140: struct frame;
! 141: struct fpframe;
! 142: struct pcb;
! 143:
! 144: /* locore.s functions */
! 145: void PCIA(void);
! 146: __dead void doboot(void);
! 147: void ecacheon(void);
! 148: void ecacheoff(void);
! 149:
! 150: /* clock.c functions */
! 151: void hp300_calibrate_delay(void);
! 152:
! 153: /* machdep.c functions */
! 154: int badaddr(caddr_t);
! 155: int badbaddr(caddr_t);
! 156: void dumpconf(void);
! 157:
! 158: #endif /* _KERNEL */
! 159:
! 160: /* physical memory sections */
! 161: #define ROMBASE (0x00000000)
! 162: #define INTIOBASE (0x00400000)
! 163: #define INTIOTOP (0x00600000)
! 164: #define MAXADDR (0xFFFFF000)
! 165:
! 166: /*
! 167: * Internal IO space:
! 168: *
! 169: * Ranges from 0x400000 to 0x600000 (IIOMAPSIZE).
! 170: *
! 171: * Internal IO space is mapped in the kernel from ``intiobase'' to
! 172: * ``intiolimit'' (defined in locore.s). Since it is always mapped,
! 173: * conversion between physical and kernel virtual addresses is easy.
! 174: */
! 175: #define ISIIOVA(va) \
! 176: ((char *)(va) >= intiobase && (char *)(va) < intiolimit)
! 177: #define IIOV(pa) ((int)(pa)-INTIOBASE+(int)intiobase)
! 178: #define IIOP(va) ((int)(va)-(int)intiobase+INTIOBASE)
! 179: #define IIOPOFF(pa) ((int)(pa)-INTIOBASE)
! 180: #define IIOMAPSIZE btoc(INTIOTOP-INTIOBASE) /* 2mb */
! 181:
! 182: /*
! 183: * HP MMU
! 184: */
! 185: #define MMUBASE IIOPOFF(0x5F4000)
! 186: #define MMUSSTP 0x0
! 187: #define MMUUSTP 0x4
! 188: #define MMUTBINVAL 0x8
! 189: #define MMUSTAT 0xC
! 190: #define MMUCMD MMUSTAT
! 191:
! 192: #define MMU_UMEN 0x0001 /* enable user mapping */
! 193: #define MMU_SMEN 0x0002 /* enable supervisor mapping */
! 194: #define MMU_CEN 0x0004 /* enable data cache */
! 195: #define MMU_BERR 0x0008 /* bus error */
! 196: #define MMU_IEN 0x0020 /* enable instruction cache */
! 197: #define MMU_FPE 0x0040 /* enable 68881 FP coprocessor */
! 198: #define MMU_WPF 0x2000 /* write protect fault */
! 199: #define MMU_PF 0x4000 /* page fault */
! 200: #define MMU_PTF 0x8000 /* page table fault */
! 201:
! 202: #define MMU_FAULT (MMU_PTF|MMU_PF|MMU_WPF|MMU_BERR)
! 203: #define MMU_ENAB (MMU_UMEN|MMU_SMEN|MMU_IEN|MMU_FPE)
! 204:
! 205: #endif /* _HP300_CPU_H_ */
CVSweb