cpu.h revision 1.1.6.2 1 1.1.6.2 simonb /* $NetBSD: cpu.h,v 1.1.6.2 2006/04/22 11:37:36 simonb Exp $ */
2 1.1.6.2 simonb
3 1.1.6.2 simonb /*-
4 1.1.6.2 simonb * Copyright (c) 2006 The NetBSD Foundation, Inc.
5 1.1.6.2 simonb * All rights reserved.
6 1.1.6.2 simonb *
7 1.1.6.2 simonb * This code is derived from software contributed to The NetBSD Foundation
8 1.1.6.2 simonb * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
9 1.1.6.2 simonb * NASA Ames Research Center, and by Charles M. Hannum.
10 1.1.6.2 simonb *
11 1.1.6.2 simonb * Redistribution and use in source and binary forms, with or without
12 1.1.6.2 simonb * modification, are permitted provided that the following conditions
13 1.1.6.2 simonb * are met:
14 1.1.6.2 simonb * 1. Redistributions of source code must retain the above copyright
15 1.1.6.2 simonb * notice, this list of conditions and the following disclaimer.
16 1.1.6.2 simonb * 2. Redistributions in binary form must reproduce the above copyright
17 1.1.6.2 simonb * notice, this list of conditions and the following disclaimer in the
18 1.1.6.2 simonb * documentation and/or other materials provided with the distribution.
19 1.1.6.2 simonb * 3. All advertising materials mentioning features or use of this software
20 1.1.6.2 simonb * must display the following acknowledgement:
21 1.1.6.2 simonb * This product includes software developed by the NetBSD
22 1.1.6.2 simonb * Foundation, Inc. and its contributors.
23 1.1.6.2 simonb * 4. Neither the name of The NetBSD Foundation nor the names of its
24 1.1.6.2 simonb * contributors may be used to endorse or promote products derived
25 1.1.6.2 simonb * from this software without specific prior written permission.
26 1.1.6.2 simonb *
27 1.1.6.2 simonb * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
28 1.1.6.2 simonb * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
29 1.1.6.2 simonb * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
30 1.1.6.2 simonb * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
31 1.1.6.2 simonb * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
32 1.1.6.2 simonb * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
33 1.1.6.2 simonb * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
34 1.1.6.2 simonb * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
35 1.1.6.2 simonb * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
36 1.1.6.2 simonb * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
37 1.1.6.2 simonb * POSSIBILITY OF SUCH DAMAGE.
38 1.1.6.2 simonb */
39 1.1.6.2 simonb
40 1.1.6.2 simonb
41 1.1.6.2 simonb /*-
42 1.1.6.2 simonb * Copyright (c) 1988 University of Utah.
43 1.1.6.2 simonb * Copyright (c) 1982, 1990, 1993
44 1.1.6.2 simonb * The Regents of the University of California. All rights reserved.
45 1.1.6.2 simonb *
46 1.1.6.2 simonb * This code is derived from software contributed to Berkeley by
47 1.1.6.2 simonb * the Systems Programming Group of the University of Utah Computer
48 1.1.6.2 simonb * Science Department.
49 1.1.6.2 simonb *
50 1.1.6.2 simonb * Redistribution and use in source and binary forms, with or without
51 1.1.6.2 simonb * modification, are permitted provided that the following conditions
52 1.1.6.2 simonb * are met:
53 1.1.6.2 simonb * 1. Redistributions of source code must retain the above copyright
54 1.1.6.2 simonb * notice, this list of conditions and the following disclaimer.
55 1.1.6.2 simonb * 2. Redistributions in binary form must reproduce the above copyright
56 1.1.6.2 simonb * notice, this list of conditions and the following disclaimer in the
57 1.1.6.2 simonb * documentation and/or other materials provided with the distribution.
58 1.1.6.2 simonb * 4. Neither the name of the University nor the names of its contributors
59 1.1.6.2 simonb * may be used to endorse or promote products derived from this software
60 1.1.6.2 simonb * without specific prior written permission.
61 1.1.6.2 simonb *
62 1.1.6.2 simonb * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
63 1.1.6.2 simonb * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
64 1.1.6.2 simonb * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
65 1.1.6.2 simonb * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
66 1.1.6.2 simonb * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
67 1.1.6.2 simonb * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
68 1.1.6.2 simonb * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
69 1.1.6.2 simonb * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
70 1.1.6.2 simonb * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
71 1.1.6.2 simonb * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
72 1.1.6.2 simonb * SUCH DAMAGE.
73 1.1.6.2 simonb *
74 1.1.6.2 simonb * from: Utah $Hdr: cpu.h 1.16 91/03/25$
75 1.1.6.2 simonb *
76 1.1.6.2 simonb * @(#)cpu.h 8.4 (Berkeley) 1/5/94
77 1.1.6.2 simonb */
78 1.1.6.2 simonb
79 1.1.6.2 simonb
80 1.1.6.2 simonb #ifndef _IA64_CPU_H_
81 1.1.6.2 simonb #define _IA64_CPU_H_
82 1.1.6.2 simonb
83 1.1.6.2 simonb #ifdef _KERNEL
84 1.1.6.2 simonb #include <sys/cpu_data.h>
85 1.1.6.2 simonb #include <sys/cc_microtime.h>
86 1.1.6.2 simonb #include <machine/frame.h>
87 1.1.6.2 simonb #include <machine/ia64_cpu.h>
88 1.1.6.2 simonb
89 1.1.6.2 simonb
90 1.1.6.2 simonb struct cpu_info {
91 1.1.6.2 simonb struct device *ci_dev; /* pointer to our device */
92 1.1.6.2 simonb struct cpu_info *ci_self; /* self-pointer */
93 1.1.6.2 simonb /*
94 1.1.6.2 simonb * Public members.
95 1.1.6.2 simonb */
96 1.1.6.2 simonb struct lwp *ci_curlwp; /* current owner of the processor */
97 1.1.6.2 simonb struct cpu_data ci_data; /* MI per-cpu data */
98 1.1.6.2 simonb struct cc_microtime_state ci_cc;/* cc_microtime state */
99 1.1.6.2 simonb struct cpu_info *ci_next; /* next cpu_info structure */
100 1.1.6.2 simonb
101 1.1.6.2 simonb /* XXX: Todo */
102 1.1.6.2 simonb /*
103 1.1.6.2 simonb * Private members.
104 1.1.6.2 simonb */
105 1.1.6.2 simonb cpuid_t ci_cpuid; /* our CPU ID */
106 1.1.6.2 simonb struct pmap *ci_pmap; /* current pmap */
107 1.1.6.2 simonb struct lwp *ci_fpcurlwp; /* current owner of the FPU */
108 1.1.6.2 simonb paddr_t ci_curpcb; /* PA of current HW PCB */
109 1.1.6.2 simonb struct pcb *ci_idle_pcb; /* our idle PCB */
110 1.1.6.2 simonb struct cpu_softc *ci_softc; /* pointer to our device */
111 1.1.6.2 simonb u_long ci_want_resched; /* preempt current process */
112 1.1.6.2 simonb u_long ci_intrdepth; /* interrupt trap depth */
113 1.1.6.2 simonb struct trapframe *ci_db_regs; /* registers for debuggers */
114 1.1.6.2 simonb };
115 1.1.6.2 simonb
116 1.1.6.2 simonb
117 1.1.6.2 simonb extern struct cpu_info cpu_info_primary;
118 1.1.6.2 simonb
119 1.1.6.2 simonb #ifdef MULTIPROCESSOR
120 1.1.6.2 simonb /* XXX: TODO */
121 1.1.6.2 simonb #else
122 1.1.6.2 simonb #define curcpu() (&cpu_info_primary)
123 1.1.6.2 simonb #endif /* MULTIPROCESSOR */
124 1.1.6.2 simonb
125 1.1.6.2 simonb #define cpu_number() 0 /*XXX: FIXME */
126 1.1.6.2 simonb
127 1.1.6.2 simonb #define aston(p) ((p)->p_md.md_astpending = 1)
128 1.1.6.2 simonb
129 1.1.6.2 simonb #define need_resched(ci) /*XXX: FIXME */
130 1.1.6.2 simonb
131 1.1.6.2 simonb struct clockframe {
132 1.1.6.2 simonb struct trapframe cf_tf;
133 1.1.6.2 simonb };
134 1.1.6.2 simonb
135 1.1.6.2 simonb #define CLKF_PC(cf) ((cf)->cf_tf.tf_special.iip)
136 1.1.6.2 simonb #define CLKF_CPL(cf) ((cf)->cf_tf.tf_special.psr & IA64_PSR_CPL)
137 1.1.6.2 simonb #define CLKF_USERMODE(cf) (CLKF_CPL(cf) != IA64_PSR_CPL_KERN)
138 1.1.6.2 simonb #define CLKF_BASEPRI(frame) (0) /*XXX: CHECKME */
139 1.1.6.2 simonb #define CLKF_INTR(frame) (curcpu()->ci_intrdepth)
140 1.1.6.2 simonb
141 1.1.6.2 simonb #define TRAPF_PC(tf) ((tf)->tf_special.iip)
142 1.1.6.2 simonb #define TRAPF_CPL(tf) ((tf)->tf_special.psr & IA64_PSR_CPL)
143 1.1.6.2 simonb #define TRAPF_USERMODE(tf) (TRAPF_CPL(tf) != IA64_PSR_CPL_KERN)
144 1.1.6.2 simonb
145 1.1.6.2 simonb
146 1.1.6.2 simonb
147 1.1.6.2 simonb
148 1.1.6.2 simonb
149 1.1.6.2 simonb
150 1.1.6.2 simonb
151 1.1.6.2 simonb /*
152 1.1.6.2 simonb * Give a profiling tick to the current process when the user profiling
153 1.1.6.2 simonb * buffer pages are invalid. XXX:Fixme.... On the ia64 I haven't yet figured
154 1.1.6.2 simonb * out what to do about this.. XXX.
155 1.1.6.2 simonb */
156 1.1.6.2 simonb
157 1.1.6.2 simonb
158 1.1.6.2 simonb #define need_proftick(p)
159 1.1.6.2 simonb
160 1.1.6.2 simonb /*
161 1.1.6.2 simonb * Notify the current process (p) that it has a signal pending,
162 1.1.6.2 simonb * process as soon as possible.
163 1.1.6.2 simonb */
164 1.1.6.2 simonb #define signotify(p) aston(p)
165 1.1.6.2 simonb
166 1.1.6.2 simonb #define setsoftclock() /*XXX: FIXME */
167 1.1.6.2 simonb
168 1.1.6.2 simonb /* machdep.c */
169 1.1.6.2 simonb int cpu_maxproc(void); /*XXX: Fill in machdep.c */
170 1.1.6.2 simonb
171 1.1.6.2 simonb #define cpu_proc_fork(p1, p2) /* XXX: Look into this. */
172 1.1.6.2 simonb
173 1.1.6.2 simonb
174 1.1.6.2 simonb /* XXX: TODO: generic microtime support kern/kern_microtime.c
175 1.1.6.2 simonb * #define microtime(tv) cc_microtime(tv)
176 1.1.6.2 simonb */
177 1.1.6.2 simonb
178 1.1.6.2 simonb
179 1.1.6.2 simonb #endif /* _KERNEL_ */
180 1.1.6.2 simonb #endif /* _IA64_CPU_H */
181