1 /* $NetBSD: alpha.h,v 1.24 2009/06/01 20:58:16 martin Exp $ */ 2 3 /* 4 * Copyright (c) 1982, 1990, 1993 5 * The Regents of the University of California. All rights reserved. 6 * 7 * This code is derived from software contributed to Berkeley by 8 * the Systems Programming Group of the University of Utah Computer 9 * Science Department. 10 * 11 * Redistribution and use in source and binary forms, with or without 12 * modification, are permitted provided that the following conditions 13 * are met: 14 * 1. Redistributions of source code must retain the above copyright 15 * notice, this list of conditions and the following disclaimer. 16 * 2. Redistributions in binary form must reproduce the above copyright 17 * notice, this list of conditions and the following disclaimer in the 18 * documentation and/or other materials provided with the distribution. 19 * 3. Neither the name of the University nor the names of its contributors 20 * may be used to endorse or promote products derived from this software 21 * without specific prior written permission. 22 * 23 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33 * SUCH DAMAGE. 34 * 35 * from: Utah $Hdr: cpu.h 1.16 91/03/25$ 36 * 37 * @(#)cpu.h 8.4 (Berkeley) 1/5/94 38 */ 39 /* 40 * Copyright (c) 1988 University of Utah. 41 * 42 * This code is derived from software contributed to Berkeley by 43 * the Systems Programming Group of the University of Utah Computer 44 * Science Department. 45 * 46 * Redistribution and use in source and binary forms, with or without 47 * modification, are permitted provided that the following conditions 48 * are met: 49 * 1. Redistributions of source code must retain the above copyright 50 * notice, this list of conditions and the following disclaimer. 51 * 2. Redistributions in binary form must reproduce the above copyright 52 * notice, this list of conditions and the following disclaimer in the 53 * documentation and/or other materials provided with the distribution. 54 * 3. All advertising materials mentioning features or use of this software 55 * must display the following acknowledgement: 56 * This product includes software developed by the University of 57 * California, Berkeley and its contributors. 58 * 4. Neither the name of the University nor the names of its contributors 59 * may be used to endorse or promote products derived from this software 60 * without specific prior written permission. 61 * 62 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 63 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 64 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 65 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 66 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 67 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 68 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 69 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 70 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 71 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 72 * SUCH DAMAGE. 73 * 74 * from: Utah $Hdr: cpu.h 1.16 91/03/25$ 75 * 76 * @(#)cpu.h 8.4 (Berkeley) 1/5/94 77 */ 78 79 #ifndef _ALPHA_H_ 80 #define _ALPHA_H_ 81 82 typedef union alpha_s_float { 83 u_int32_t i; 84 u_int32_t frac: 23, 85 exp: 8, 86 sign: 1; 87 } s_float; 88 89 typedef union alpha_t_float { 90 u_int64_t i; 91 u_int64_t frac: 52, 92 exp: 11, 93 sign: 1; 94 } t_float; 95 96 #ifdef _KERNEL 97 98 #include <machine/bus.h> 99 #include <machine/stdarg.h> 100 101 struct pcb; 102 struct lwp; 103 struct reg; 104 struct rpb; 105 struct trapframe; 106 107 extern u_long cpu_implver; /* from IMPLVER instruction */ 108 extern u_long cpu_amask; /* from AMASK instruction */ 109 extern int bootdev_debug; 110 extern int alpha_fp_sync_complete; 111 extern int alpha_unaligned_print, alpha_unaligned_fix, alpha_unaligned_sigbus; 112 113 void XentArith(u_int64_t, u_int64_t, u_int64_t); /* MAGIC */ 114 void XentIF(u_int64_t, u_int64_t, u_int64_t); /* MAGIC */ 115 void XentInt(u_int64_t, u_int64_t, u_int64_t); /* MAGIC */ 116 void XentMM(u_int64_t, u_int64_t, u_int64_t); /* MAGIC */ 117 void XentRestart(void); /* MAGIC */ 118 void XentSys(u_int64_t, u_int64_t, u_int64_t); /* MAGIC */ 119 void XentUna(u_int64_t, u_int64_t, u_int64_t); /* MAGIC */ 120 void alpha_init(u_long, u_long, u_long, u_long, u_long); 121 int alpha_pa_access(u_long); 122 void ast(struct trapframe *); 123 int badaddr(void *, size_t); 124 int badaddr_read(void *, size_t, void *); 125 u_int64_t console_restart(struct trapframe *); 126 void do_sir(void); 127 void dumpconf(void); 128 void exception_return(void); /* MAGIC */ 129 void frametoreg(const struct trapframe *, struct reg *); 130 long fswintrberr(void); /* MAGIC */ 131 void init_bootstrap_console(void); 132 void init_prom_interface(struct rpb *); 133 void interrupt(unsigned long, unsigned long, unsigned long, 134 struct trapframe *); 135 void machine_check(unsigned long, struct trapframe *, unsigned long, 136 unsigned long); 137 u_int64_t hwrpb_checksum(void); 138 void hwrpb_restart_setup(void); 139 void regdump(struct trapframe *); 140 void regtoframe(const struct reg *, struct trapframe *); 141 void savectx(struct pcb *); 142 void trap(unsigned long, unsigned long, unsigned long, unsigned long, 143 struct trapframe *); 144 void trap_init(void); 145 void enable_nsio_ide(bus_space_tag_t); 146 char * dot_conv(unsigned long); 147 148 void fpusave_cpu(struct cpu_info *, int); 149 void fpusave_proc(struct lwp *, int); 150 151 void alpha_patch(bool); 152 153 /* Multiprocessor glue; cpu.c */ 154 155 struct cpu_info; 156 int cpu_iccb_send(long, const char *); 157 void cpu_iccb_receive(void); 158 void cpu_hatch(struct cpu_info *); 159 void cpu_halt(void) __attribute__((__noreturn__)); 160 void cpu_spinup_trampoline(void); /* MAGIC */ 161 void cpu_pause(unsigned long); 162 void cpu_resume(unsigned long); 163 #if defined(DDB) 164 void cpu_debug_dump(void); 165 #endif 166 167 /* IEEE and VAX FP completion */ 168 169 void alpha_sts(int, s_float *); /* MAGIC */ 170 void alpha_stt(int, t_float *); /* MAGIC */ 171 void alpha_lds(int, s_float *); /* MAGIC */ 172 void alpha_ldt(int, t_float *); /* MAGIC */ 173 174 uint64_t alpha_read_fpcr(void); /* MAGIC */ 175 void alpha_write_fpcr(u_int64_t); /* MAGIC */ 176 177 u_int64_t alpha_read_fp_c(struct lwp *); 178 void alpha_write_fp_c(struct lwp *, u_int64_t); 179 180 void alpha_enable_fp(struct lwp *, int); 181 int alpha_fp_complete(u_long, u_long, struct lwp *, u_int64_t *); 182 183 /* Security sensitive rate limiting printf */ 184 185 void rlprintf(struct timeval *t, const char *fmt, ...); 186 187 #endif /* _KERNEL */ 188 #endif /* _ALPHA_H_ */ 189