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