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