1/* $FreeBSD: head/sys/ia64/include/cpu.h 107206 2002-11-24 20:15:08Z marcel $ */
| 1/* $FreeBSD: head/sys/ia64/include/cpu.h 115084 2003-05-16 21:26:42Z marcel $ */
|
2/* From: NetBSD: cpu.h,v 1.18 1997/09/23 23:17:49 mjacob Exp */ 3 4/* 5 * Copyright (c) 1988 University of Utah. 6 * Copyright (c) 1982, 1990, 1993 7 * The Regents of the University of California. All rights reserved. 8 * 9 * This code is derived from software contributed to Berkeley by 10 * the Systems Programming Group of the University of Utah Computer 11 * Science Department. 12 * 13 * Redistribution and use in source and binary forms, with or without 14 * modification, are permitted provided that the following conditions 15 * are met: 16 * 1. Redistributions of source code must retain the above copyright 17 * notice, this list of conditions and the following disclaimer. 18 * 2. Redistributions in binary form must reproduce the above copyright 19 * notice, this list of conditions and the following disclaimer in the 20 * documentation and/or other materials provided with the distribution. 21 * 3. All advertising materials mentioning features or use of this software 22 * must display the following acknowledgement: 23 * This product includes software developed by the University of 24 * California, Berkeley and its contributors. 25 * 4. Neither the name of the University nor the names of its contributors 26 * may be used to endorse or promote products derived from this software 27 * without specific prior written permission. 28 * 29 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 30 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 31 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 32 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 33 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 34 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 35 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 36 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 37 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 38 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 39 * SUCH DAMAGE. 40 * 41 * from: Utah $Hdr: cpu.h 1.16 91/03/25$ 42 * 43 * @(#)cpu.h 8.4 (Berkeley) 1/5/94 44 */ 45 46#ifndef _MACHINE_CPU_H_ 47#define _MACHINE_CPU_H_ 48
| 2/* From: NetBSD: cpu.h,v 1.18 1997/09/23 23:17:49 mjacob Exp */ 3 4/* 5 * Copyright (c) 1988 University of Utah. 6 * Copyright (c) 1982, 1990, 1993 7 * The Regents of the University of California. All rights reserved. 8 * 9 * This code is derived from software contributed to Berkeley by 10 * the Systems Programming Group of the University of Utah Computer 11 * Science Department. 12 * 13 * Redistribution and use in source and binary forms, with or without 14 * modification, are permitted provided that the following conditions 15 * are met: 16 * 1. Redistributions of source code must retain the above copyright 17 * notice, this list of conditions and the following disclaimer. 18 * 2. Redistributions in binary form must reproduce the above copyright 19 * notice, this list of conditions and the following disclaimer in the 20 * documentation and/or other materials provided with the distribution. 21 * 3. All advertising materials mentioning features or use of this software 22 * must display the following acknowledgement: 23 * This product includes software developed by the University of 24 * California, Berkeley and its contributors. 25 * 4. Neither the name of the University nor the names of its contributors 26 * may be used to endorse or promote products derived from this software 27 * without specific prior written permission. 28 * 29 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 30 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 31 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 32 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 33 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 34 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 35 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 36 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 37 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 38 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 39 * SUCH DAMAGE. 40 * 41 * from: Utah $Hdr: cpu.h 1.16 91/03/25$ 42 * 43 * @(#)cpu.h 8.4 (Berkeley) 1/5/94 44 */ 45 46#ifndef _MACHINE_CPU_H_ 47#define _MACHINE_CPU_H_ 48
|
49/* 50 * Exported definitions unique to Alpha cpu support. 51 */ 52
| |
53#include <machine/frame.h> 54
| 49#include <machine/frame.h> 50
|
55#define cpu_getstack(td) ((td)->td_frame->tf_r[FRAME_SP]) 56
| |
57/*
| 51/*
|
58 * Arguments to hardclock and gatherstats encapsulate the previous 59 * machine state in an opaque clockframe. One the Alpha, we use 60 * what we push on an interrupt (a trapframe).
| 52 * Arguments to hardclock and gatherstats encapsulate the previous machine 53 * state in an opaque clockframe.
|
61 */ 62struct clockframe {
| 54 */ 55struct clockframe {
|
63 struct trapframe cf_tf;
| 56 struct trapframe cf_tf;
|
64};
| 57};
|
65#define TRAPF_USERMODE(framep) \ 66 (((framep)->tf_cr_ipsr & IA64_PSR_CPL) == IA64_PSR_CPL_USER) 67#define TRAPF_PC(framep) ((framep)->tf_cr_iip)
| 58#define CLKF_PC(cf) ((cf)->cf_tf.tf_special.iip) 59#define CLKF_USERMODE(cf) ((CLKF_PC(cf) >> 61) < 5)
|
68
| 60
|
69#define CLKF_USERMODE(framep) TRAPF_USERMODE(&(framep)->cf_tf) 70#define CLKF_PC(framep) TRAPF_PC(&(framep)->cf_tf)
| 61/* Used by signaling code. */ 62#define cpu_getstack(td) ((td)->td_frame->tf_special.sp)
|
71
| 63
|
| 64/* XXX */ 65#define TRAPF_PC(tf) ((tf)->tf_special.iip) 66#define TRAPF_USERMODE(framep) \ 67 (((framep)->tf_special.psr & IA64_PSR_CPL) == IA64_PSR_CPL_USER) 68
|
72/* 73 * CTL_MACHDEP definitions. 74 */ 75#define CPU_CONSDEV 1 /* dev_t: console terminal device */ 76#define CPU_ROOT_DEVICE 2 /* string: root device name */ 77#define CPU_UNALIGNED_PRINT 3 /* int: print unaligned accesses */ 78#define CPU_UNALIGNED_FIX 4 /* int: fix unaligned accesses */ 79#define CPU_UNALIGNED_SIGBUS 5 /* int: SIGBUS unaligned accesses */ 80#define CPU_BOOTED_KERNEL 6 /* string: booted kernel name */ 81#define CPU_ADJKERNTZ 7 /* int: timezone offset (seconds) */ 82#define CPU_DISRTCSET 8 /* int: disable resettodr() call */ 83#define CPU_WALLCLOCK 9 /* int: indicates wall CMOS clock */ 84#define CPU_MAXID 10 /* valid machdep IDs */ 85 86#define CTL_MACHDEP_NAMES { \ 87 { 0, 0 }, \ 88 { "console_device", CTLTYPE_STRUCT }, \ 89 { "root_device", CTLTYPE_STRING }, \ 90 { "unaligned_print", CTLTYPE_INT }, \ 91 { "unaligned_fix", CTLTYPE_INT }, \ 92 { "unaligned_sigbus", CTLTYPE_INT }, \ 93 { "booted_kernel", CTLTYPE_STRING }, \ 94 { "adjkerntz", CTLTYPE_INT }, \ 95 { "disable_rtc_set", CTLTYPE_INT }, \ 96 { "wall_cmos_clock", CTLTYPE_INT }, \ 97} 98 99#ifdef _KERNEL 100 101struct pcb; 102struct thread; 103struct reg; 104struct rpb; 105struct trapframe; 106 107extern struct rpb *hwrpb; 108extern volatile int mc_expected, mc_received; 109
| 69/* 70 * CTL_MACHDEP definitions. 71 */ 72#define CPU_CONSDEV 1 /* dev_t: console terminal device */ 73#define CPU_ROOT_DEVICE 2 /* string: root device name */ 74#define CPU_UNALIGNED_PRINT 3 /* int: print unaligned accesses */ 75#define CPU_UNALIGNED_FIX 4 /* int: fix unaligned accesses */ 76#define CPU_UNALIGNED_SIGBUS 5 /* int: SIGBUS unaligned accesses */ 77#define CPU_BOOTED_KERNEL 6 /* string: booted kernel name */ 78#define CPU_ADJKERNTZ 7 /* int: timezone offset (seconds) */ 79#define CPU_DISRTCSET 8 /* int: disable resettodr() call */ 80#define CPU_WALLCLOCK 9 /* int: indicates wall CMOS clock */ 81#define CPU_MAXID 10 /* valid machdep IDs */ 82 83#define CTL_MACHDEP_NAMES { \ 84 { 0, 0 }, \ 85 { "console_device", CTLTYPE_STRUCT }, \ 86 { "root_device", CTLTYPE_STRING }, \ 87 { "unaligned_print", CTLTYPE_INT }, \ 88 { "unaligned_fix", CTLTYPE_INT }, \ 89 { "unaligned_sigbus", CTLTYPE_INT }, \ 90 { "booted_kernel", CTLTYPE_STRING }, \ 91 { "adjkerntz", CTLTYPE_INT }, \ 92 { "disable_rtc_set", CTLTYPE_INT }, \ 93 { "wall_cmos_clock", CTLTYPE_INT }, \ 94} 95 96#ifdef _KERNEL 97 98struct pcb; 99struct thread; 100struct reg; 101struct rpb; 102struct trapframe; 103 104extern struct rpb *hwrpb; 105extern volatile int mc_expected, mc_received; 106
|
110int badaddr (void *, size_t);
| 107int badaddr(void *, size_t);
|
111int badaddr_read(void *, size_t, void *); 112u_int64_t console_restart(u_int64_t, u_int64_t, u_int64_t);
| 108int badaddr_read(void *, size_t, void *); 109u_int64_t console_restart(u_int64_t, u_int64_t, u_int64_t);
|
113void do_sir(void);
| 110int do_ast(struct trapframe *);
|
114void dumpconf(void);
| 111void dumpconf(void);
|
115void exception_restore(void); /* MAGIC */
| |
116void frametoreg(struct trapframe *, struct reg *); 117long fswintrberr(void); /* MAGIC */
| 112void frametoreg(struct trapframe *, struct reg *); 113long fswintrberr(void); /* MAGIC */
|
118int ia64_pa_access(u_long);
| 114int ia64_highfp_drop(struct thread *); 115int ia64_highfp_load(struct thread *); 116int ia64_highfp_save(struct thread *);
|
119void ia64_init(u_int64_t, u_int64_t);
| 117void ia64_init(u_int64_t, u_int64_t);
|
120void ia64_fpstate_check(struct thread *p); 121void ia64_fpstate_save(struct thread *p, int write); 122void ia64_fpstate_drop(struct thread *p); 123void ia64_fpstate_switch(struct thread *p);
| 118int ia64_pa_access(u_long);
|
124void init_prom_interface(struct rpb*); 125void interrupt(u_int64_t, struct trapframe *);
| 119void init_prom_interface(struct rpb*); 120void interrupt(u_int64_t, struct trapframe *);
|
126void machine_check 127 (unsigned long, struct trapframe *, unsigned long, unsigned long);
| 121void machine_check(unsigned long, struct trapframe *, unsigned long, 122 unsigned long);
|
128u_int64_t hwrpb_checksum(void); 129void hwrpb_restart_setup(void); 130void regdump(struct trapframe *); 131void regtoframe(struct reg *, struct trapframe *); 132void set_iointr(void (*)(void *, unsigned long)); 133void fork_trampoline(void); /* MAGIC */
| 123u_int64_t hwrpb_checksum(void); 124void hwrpb_restart_setup(void); 125void regdump(struct trapframe *); 126void regtoframe(struct reg *, struct trapframe *); 127void set_iointr(void (*)(void *, unsigned long)); 128void fork_trampoline(void); /* MAGIC */
|
134void syscall(int, u_int64_t *, struct trapframe *); 135void trap(int vector, int imm, struct trapframe *framep);
| 129int syscall(struct trapframe *); 130void trap(int vector, struct trapframe *framep);
|
136void ia64_probe_sapics(void); 137int ia64_count_cpus(void);
| 131void ia64_probe_sapics(void); 132int ia64_count_cpus(void);
|
| 133void map_gateway_page(void);
|
138void map_pal_code(void); 139void map_port_space(void); 140void cpu_mp_add(uint, uint, uint); 141 142/* 143 * Return contents of in-cpu fast counter as a sort of "bogo-time" 144 * for non-critical timing. 145 */ 146static __inline u_int64_t 147get_cyclecount(void) 148{ 149 return (ia64_get_itc()); 150} 151 152#endif /* _KERNEL */ 153 154#endif /* _MACHINE_CPU_H_ */
| 134void map_pal_code(void); 135void map_port_space(void); 136void cpu_mp_add(uint, uint, uint); 137 138/* 139 * Return contents of in-cpu fast counter as a sort of "bogo-time" 140 * for non-critical timing. 141 */ 142static __inline u_int64_t 143get_cyclecount(void) 144{ 145 return (ia64_get_itc()); 146} 147 148#endif /* _KERNEL */ 149 150#endif /* _MACHINE_CPU_H_ */
|