1 /* $NetBSD: cpu.h,v 1.33 2009/05/13 14:33:42 skrll Exp $ */
3 /* $OpenBSD: cpu.h,v 1.55 2008/07/23 17:39:35 kettenis Exp $ */
6 * Copyright (c) 2000-2004 Michael Shalayeff
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 * IN NO EVENT SHALL THE AUTHOR OR HIS RELATIVES BE LIABLE FOR ANY DIRECT,
22 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24 * SERVICES; LOSS OF MIND, USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
27 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
28 * THE POSSIBILITY OF SUCH DAMAGE.
31 * Copyright (c) 1988-1994, The University of Utah and
32 * the Computer Systems Laboratory at the University of Utah (CSL).
33 * All rights reserved.
35 * Permission to use, copy, modify and distribute this software is hereby
36 * granted provided that (1) source code retains these copyright, permission,
37 * and disclaimer notices, and (2) redistributions including binaries
38 * reproduce the notices in supporting documentation, and (3) all advertising
39 * materials mentioning features or use of this software display the following
40 * acknowledgement: ``This product includes software developed by the
41 * Computer Systems Laboratory at the University of Utah.''
43 * THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS
44 * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF
45 * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
47 * CSL requests users of this software to return to csl-dist@cs.utah.edu any
48 * improvements that they make and grant CSL redistribution rights.
50 * Utah $Hdr: cpu.h 1.19 94/12/16$
53 #ifndef _MACHINE_CPU_H_
54 #define _MACHINE_CPU_H_
56 #include <machine/trap.h>
57 #include <machine/frame.h>
58 #include <machine/reg.h>
66 hpcx
, /* PA7000 (x) PA 1.0 */
67 hpcxs
, /* PA7000 (s) PA 1.1a */
68 hpcxt
, /* PA7100 (t) PA 1.1b */
69 hpcxl
, /* PA7100LC (l) PA 1.1c */
70 hpcxtp
, /* PA7200 (t') PA 1.1d */
71 hpcxl2
, /* PA7300LC (l2) PA 1.1e */
72 hpcxu
, /* PA8000 (u) PA 2.0 */
73 hpcxup
, /* PA8200 (u+) PA 2.0 */
74 hpcxw
, /* PA8500 (w) PA 2.0 */
75 hpcxwp
, /* PA8600 (w+) PA 2.0 */
76 hpcxw2
, /* PA8700 (piranha) PA 2.0 */
77 mako
/* PA8800 (mako) PA 2.0 */
83 struct hppa_cpu_info
{
84 /* The official name of the chip. */
85 const char *hci_chip_name
;
87 /* The nickname for the chip. */
88 const char *hci_chip_nickname
;
90 /* The type and PA-RISC specification of the chip. */
91 const char hci_chip_type
[8];
92 enum hppa_cpu_type hci_cputype
;
94 int hci_features
; /* CPU types and features */
95 #define HPPA_FTRS_TLBU 0x00000001
96 #define HPPA_FTRS_BTLBU 0x00000002
97 #define HPPA_FTRS_HVT 0x00000004
98 #define HPPA_FTRS_W32B 0x00000008
100 const char *hci_chip_spec
;
102 int (*desidhash
)(void);
103 const u_int
*itlbh
, *dtlbh
, *itlbnah
, *dtlbnah
, *tlbdh
;
104 int (*dbtlbins
)(int, pa_space_t
, vaddr_t
, paddr_t
, vsize_t
, u_int
);
105 int (*ibtlbins
)(int, pa_space_t
, vaddr_t
, paddr_t
, vsize_t
, u_int
);
107 int (*hptinit
)(vaddr_t
, vsize_t
);
111 extern const struct hppa_cpu_info
*hppa_cpu_info
;
112 extern int cpu_hvers
;
113 extern int cpu_revision
;
114 extern register_t kpsw
;
121 #define HPPA_FPUS 0xc0
122 #define HPPA_PMSFUS 0x20 /* ??? */
125 * Exported definitions unique to hp700/PA-RISC cpu support.
131 #define HPPA_FPUVER(w) (((w) & 0x003ff800) >> 11)
132 #define HPPA_FPU_OP(w) ((w) >> 26)
133 #define HPPA_FPU_UNMPL 0x01 /* exception reg, the rest is << 1 */
134 #define HPPA_FPU_ILL 0x80 /* software-only */
135 #define HPPA_FPU_I 0x01
136 #define HPPA_FPU_U 0x02
137 #define HPPA_FPU_O 0x04
138 #define HPPA_FPU_Z 0x08
139 #define HPPA_FPU_V 0x10
140 #define HPPA_FPU_D 0x20
141 #define HPPA_FPU_T 0x40
142 #define HPPA_FPU_XMASK 0x7f
143 #define HPPA_FPU_T_POS 25
144 #define HPPA_FPU_RM 0x00000600
145 #define HPPA_FPU_CQ 0x00fff800
146 #define HPPA_FPU_C 0x04000000
147 #define HPPA_FPU_FLSH 27
148 #define HPPA_FPU_INIT (0)
149 #define HPPA_FPU_FORK(s) ((s) & ~((uint64_t)(HPPA_FPU_XMASK) << 32))
152 * definitions of cpu-dependent requirements
153 * referenced in generic code
156 #define HPPA_PGALIAS 0x00100000
157 #define HPPA_PGAMASK 0xfff00000
158 #define HPPA_PGAOFF 0x000fffff
159 #define HPPA_SPAMASK 0xf0f0f000
161 #define HPPA_IOSPACE 0xf0000000
162 #define HPPA_IOLEN 0x10000000
163 #define HPPA_PDC_LOW 0xef000000
164 #define HPPA_PDC_HIGH 0xf1000000
165 #define HPPA_IOBCAST 0xfffc0000
166 #define HPPA_LBCAST 0xfffc0000
167 #define HPPA_GBCAST 0xfffe0000
168 #define HPPA_FPA 0xfff80000
169 #define HPPA_FLEX_DATA 0xfff80001
170 #define HPPA_DMA_ENABLE 0x00000001
171 #define HPPA_SPA_ENABLE 0x00000020
172 #define HPPA_NMODSPBUS 64
177 #if defined(_KERNEL_OPT)
178 #include "opt_lockdebug.h"
182 * External definitions unique to PA-RISC cpu support.
183 * These are the "public" declarations - those needed in
184 * machine-independent source code. The "private" ones
187 * Note that the name of this file is NOT meant to imply
188 * that it has anything to do with PA-RISC CPU stuff.
189 * The name "cpu" is historical, and used in the common
190 * code to identify machine-dependent functions, etc.
193 /* clockframe describes the system before we took an interrupt. */
199 #define CLKF_PC(framep) ((framep)->cf_pc)
200 #define CLKF_INTR(framep) ((framep)->cf_flags & TFF_INTR)
201 #define CLKF_USERMODE(framep) ((framep)->cf_flags & T_USER)
203 #define cpu_signotify(l) (setsoftast())
204 #define cpu_need_proftick(l) ((l)->l_pflag |= LP_OWEUPC, setsoftast())
206 #include <sys/cpu_data.h>
208 struct cpu_data ci_data
; /* MI per-cpu data */
210 struct lwp
*ci_curlwp
; /* CPU owner */
211 int ci_cpuid
; /* CPU index (see cpus[] array) */
217 #include <machine/intr.h>
219 extern struct cpu_info cpu_info_store
;
222 * definitions of cpu-dependent requirements
223 * referenced in generic code
226 #define curcpu() (&cpu_info_store)
227 #define cpu_number() 0
229 #define cpu_proc_fork(p1, p2)
231 #ifdef MULTIPROCESSOR
232 #define CPU_IS_PRIMARY(ci) 1
233 #define CPU_INFO_ITERATOR int
234 #define CPU_INFO_FOREACH(cii, ci) cii = 0; ci = curcpu(), cii < 1; cii++
236 void cpu_boot_secondary_processors(void);
239 static __inline
struct lwp
*
244 __asm
volatile("mfctl %1, %0" : "=r" (l
): "i" (CR_CURLWP
));
246 return (struct lwp
*)l
;
249 #define curlwp hppa_curlwp()
251 #define DELAY(x) delay(x)
253 static __inline paddr_t
254 kvtop(const void *va
)
258 __asm
volatile ("lpa %%r0(%1), %0" : "=r" (pa
) : "r" (va
));
262 extern int (*cpu_desidhash
)(void);
265 void hppa_init(paddr_t
, void *);
266 void trap(int, struct trapframe
*);
267 void hppa_ras(struct lwp
*);
268 int spcopy(pa_space_t
, const void *, pa_space_t
, void *, size_t);
269 int spstrcpy(pa_space_t
, const void *, pa_space_t
, void *, size_t,
271 int copy_on_fault(void);
272 void lwp_trampoline(void);
273 void setfunc_trampoline(void);
274 int cpu_dumpsize(void);
279 * Boot arguments stuff
282 #define BOOTARG_LEN (PAGE_SIZE)
283 #define BOOTARG_OFF (0x10000)
286 * CTL_MACHDEP definitions.
288 #define CPU_CONSDEV 1 /* dev_t: console terminal device */
289 #define CPU_BOOTED_KERNEL 2 /* string: booted kernel name */
290 #define CPU_MAXID 3 /* number of valid machdep ids */
294 #endif /* _MACHINE_CPU_H_ */