summaryrefslogtreecommitdiffstats
path: root/sys/ia64/include
diff options
context:
space:
mode:
authordfr <dfr@FreeBSD.org>2000-09-29 13:46:07 +0000
committerdfr <dfr@FreeBSD.org>2000-09-29 13:46:07 +0000
commit263f9f686317c48283eeb1e362d5f2b85791d899 (patch)
tree8fe9163c4a062545fc39dae57fe3beec1daf9cdb /sys/ia64/include
parentfa6af7ab3eed1a53d0df517fc2c374fd886c6e63 (diff)
downloadFreeBSD-src-263f9f686317c48283eeb1e362d5f2b85791d899.zip
FreeBSD-src-263f9f686317c48283eeb1e362d5f2b85791d899.tar.gz
This is the first snapshot of the FreeBSD/ia64 kernel. This kernel will
not work on any real hardware (or fully work on any simulator). Much more needs to happen before this is actually functional but its nice to see the FreeBSD copyright message appear in the ia64 simulator.
Diffstat (limited to 'sys/ia64/include')
-rw-r--r--sys/ia64/include/_limits.h96
-rw-r--r--sys/ia64/include/ansi.h119
-rw-r--r--sys/ia64/include/asm.h257
-rw-r--r--sys/ia64/include/atomic.h190
-rw-r--r--sys/ia64/include/bootinfo.h86
-rw-r--r--sys/ia64/include/bus.h1173
-rw-r--r--sys/ia64/include/bus_memio.h31
-rw-r--r--sys/ia64/include/bus_pio.h31
-rw-r--r--sys/ia64/include/clock.h25
-rw-r--r--sys/ia64/include/clockvar.h53
-rw-r--r--sys/ia64/include/console.h10
-rw-r--r--sys/ia64/include/cpu.h174
-rw-r--r--sys/ia64/include/cpufunc.h197
-rw-r--r--sys/ia64/include/db_machdep.h91
-rw-r--r--sys/ia64/include/efi.h71
-rw-r--r--sys/ia64/include/elf.h203
-rw-r--r--sys/ia64/include/endian.h97
-rw-r--r--sys/ia64/include/exec.h35
-rw-r--r--sys/ia64/include/float.h79
-rw-r--r--sys/ia64/include/floatingpoint.h35
-rw-r--r--sys/ia64/include/fpu.h81
-rw-r--r--sys/ia64/include/frame.h114
-rw-r--r--sys/ia64/include/globaldata.h78
-rw-r--r--sys/ia64/include/globals.h63
-rw-r--r--sys/ia64/include/ia64_cpu.h203
-rw-r--r--sys/ia64/include/ieee.h124
-rw-r--r--sys/ia64/include/ieeefp.h29
-rw-r--r--sys/ia64/include/in_cksum.h80
-rw-r--r--sys/ia64/include/intr.h37
-rw-r--r--sys/ia64/include/intrcnt.h79
-rw-r--r--sys/ia64/include/ioctl_bt848.h288
-rw-r--r--sys/ia64/include/ioctl_fd.h126
-rw-r--r--sys/ia64/include/ioctl_meteor.h187
-rw-r--r--sys/ia64/include/ipl.h132
-rw-r--r--sys/ia64/include/limits.h96
-rw-r--r--sys/ia64/include/lock.h58
-rw-r--r--sys/ia64/include/md_var.h57
-rw-r--r--sys/ia64/include/mouse.h336
-rw-r--r--sys/ia64/include/mutex.h563
-rw-r--r--sys/ia64/include/pal.h95
-rw-r--r--sys/ia64/include/param.h163
-rw-r--r--sys/ia64/include/pcb.h68
-rw-r--r--sys/ia64/include/pcpu.h78
-rw-r--r--sys/ia64/include/pmap.h233
-rw-r--r--sys/ia64/include/proc.h49
-rw-r--r--sys/ia64/include/profile.h237
-rw-r--r--sys/ia64/include/ptrace.h53
-rw-r--r--sys/ia64/include/reg.h58
-rw-r--r--sys/ia64/include/reloc.h33
-rw-r--r--sys/ia64/include/resource.h44
-rw-r--r--sys/ia64/include/setjmp.h46
-rw-r--r--sys/ia64/include/sigframe.h42
-rw-r--r--sys/ia64/include/signal.h77
-rw-r--r--sys/ia64/include/smp.h48
-rw-r--r--sys/ia64/include/stdarg.h50
-rw-r--r--sys/ia64/include/sysarch.h49
-rw-r--r--sys/ia64/include/types.h73
-rw-r--r--sys/ia64/include/ucontext.h67
-rw-r--r--sys/ia64/include/varargs.h57
-rw-r--r--sys/ia64/include/vmparam.h161
60 files changed, 7565 insertions, 0 deletions
diff --git a/sys/ia64/include/_limits.h b/sys/ia64/include/_limits.h
new file mode 100644
index 0000000..99ca2d8
--- /dev/null
+++ b/sys/ia64/include/_limits.h
@@ -0,0 +1,96 @@
+/* $FreeBSD$ */
+/* From: NetBSD: limits.h,v 1.3 1997/04/06 08:47:31 cgd Exp */
+
+/*
+ * Copyright (c) 1988, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)limits.h 8.3 (Berkeley) 1/4/94
+ */
+
+#define CHAR_BIT 8 /* number of bits in a char */
+#define MB_LEN_MAX 6 /* Allow 31 bit UTF2 */
+
+/*
+ * According to ANSI (section 2.2.4.2), the values below must be usable by
+ * #if preprocessing directives. Additionally, the expression must have the
+ * same type as would an expression that is an object of the corresponding
+ * type converted according to the integral promotions. The subtraction for
+ * INT_MIN and LONG_MIN is so the value is not unsigned; 2147483648 is an
+ * unsigned int for 32-bit two's complement ANSI compilers (section 3.1.3.2).
+ * These numbers work for pcc as well. The UINT_MAX and ULONG_MAX values
+ * are written as hex so that GCC will be quiet about large integer constants.
+ */
+#define SCHAR_MAX 0x7f /* max value for a signed char */
+#define SCHAR_MIN (-0x7f-1) /* min value for a signed char */
+
+#define UCHAR_MAX 0xffU /* max value for an unsigned char */
+#define CHAR_MAX 0x7f /* max value for a char */
+#define CHAR_MIN (-0x7f-1) /* min value for a char */
+
+#define USHRT_MAX 0xffffU /* max value for an unsigned short */
+#define SHRT_MAX 0x7fff /* max value for a short */
+#define SHRT_MIN (-0x7fff-1) /* min value for a short */
+
+#define UINT_MAX 0xffffffffU /* max value for an unsigned int */
+#define INT_MAX 0x7fffffff /* max value for an int */
+#define INT_MIN (-0x7fffffff-1) /* min value for an int */
+
+#define ULONG_MAX 0xffffffffffffffffUL /* max for an unsigned long */
+#define LONG_MAX 0x7fffffffffffffffL /* max for a long */
+#define LONG_MIN (-0x7fffffffffffffffL-1) /* min for a long */
+
+#if !defined(_ANSI_SOURCE)
+#define SSIZE_MAX LONG_MAX /* max value for a ssize_t */
+
+#if !defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE)
+#define SIZE_T_MAX ULONG_MAX /* max value for a size_t */
+
+/* Quads and longs are the same on the alpha */
+#define UQUAD_MAX (ULONG_MAX) /* max value for a uquad_t */
+#define QUAD_MAX (LONG_MAX) /* max value for a quad_t */
+#define QUAD_MIN (LONG_MIN) /* min value for a quad_t */
+
+#endif /* !_POSIX_SOURCE && !_XOPEN_SOURCE */
+#endif /* !_ANSI_SOURCE */
+
+#if (!defined(_ANSI_SOURCE)&&!defined(_POSIX_SOURCE)) || defined(_XOPEN_SOURCE)
+#define LONG_BIT 64
+#define WORD_BIT 32
+
+#define DBL_DIG 15
+#define DBL_MAX 1.7976931348623157E+308
+#define DBL_MIN 2.2250738585072014E-308
+
+#define FLT_DIG 6
+#define FLT_MAX 3.40282347E+38F
+#define FLT_MIN 1.17549435E-38F
+#endif
diff --git a/sys/ia64/include/ansi.h b/sys/ia64/include/ansi.h
new file mode 100644
index 0000000..c5ef23d
--- /dev/null
+++ b/sys/ia64/include/ansi.h
@@ -0,0 +1,119 @@
+/* $FreeBSD$ */
+/* From: NetBSD: ansi.h,v 1.9 1997/11/23 20:20:53 kleink Exp */
+
+/*-
+ * Copyright (c) 1990, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)ansi.h 8.2 (Berkeley) 1/4/94
+ */
+
+#ifndef _ANSI_H_
+#define _ANSI_H_
+
+/*
+ * Types which are fundamental to the implementation and may appear in
+ * more than one standard header are defined here. Standard headers
+ * then use:
+ * #ifdef _BSD_SIZE_T_
+ * typedef _BSD_SIZE_T_ size_t;
+ * #undef _BSD_SIZE_T_
+ * #endif
+ */
+#define _BSD_CLOCK_T_ int /* clock() */
+#define _BSD_PTRDIFF_T_ long /* ptr1 - ptr2 */
+#define _BSD_SIZE_T_ unsigned long /* sizeof() */
+#define _BSD_SSIZE_T_ long /* byte count or error */
+#define _BSD_TIME_T_ int /* time() */
+#define _BSD_VA_LIST_ __builtin_va_list /* va_list */
+#define _BSD_CLOCKID_T_ int /* clockid_t */
+#define _BSD_TIMER_T_ int /* timer_t */
+#define _BSD_SUSECONDS_T_ int /* suseconds_t */
+#define _BSD_USECONDS_T_ unsigned int /* useconds_t */
+
+/*
+ * Types which are fundamental to the implementation and must be used
+ * in more than one standard header although they are only declared in
+ * one (perhaps nonstandard) header are defined here. Standard headers
+ * use _BSD_XXX_T_ without undef'ing it.
+ */
+#define _BSD_CT_RUNE_T_ int /* arg type for ctype funcs */
+#define _BSD_OFF_T_ long /* file offset */
+#define _BSD_PID_T_ int /* process [group] */
+
+/*
+ * Runes (wchar_t) is declared to be an ``int'' instead of the more natural
+ * ``unsigned long'' or ``long''. Two things are happening here. It is not
+ * unsigned so that EOF (-1) can be naturally assigned to it and used. Also,
+ * it looks like 10646 will be a 31 bit standard. This means that if your
+ * ints cannot hold 32 bits, you will be in trouble. The reason an int was
+ * chosen over a long is that the is*() and to*() routines take ints (says
+ * ANSI C), but they use _RUNE_T_ instead of int. By changing it here, you
+ * lose a bit of ANSI conformance, but your programs will still work.
+ *
+ * Note that _WCHAR_T_ and _RUNE_T_ must be of the same type. When wchar_t
+ * and rune_t are typedef'd, _WCHAR_T_ will be undef'd, but _RUNE_T remains
+ * defined for ctype.h.
+ */
+#define _BSD_WCHAR_T_ int /* wchar_t */
+#define _BSD_WINT_T_ int /* wint_t */
+#define _BSD_RUNE_T_ int /* rune_t */
+
+/*
+ * Frequencies of the clock ticks reported by clock() and times(). They
+ * are the same as stathz for bogus historical reasons. They should be
+ * 1e6 because clock() and times() are implemented using getrusage() and
+ * there is no good reason why they should be less accurate. There is
+ * the bad reason that (broken) programs might not like clock_t or
+ * CLOCKS_PER_SEC being ``double'' (``unsigned long'' is not large enough
+ * to hold the required 24 hours worth of ticks if the frequency is
+ * 1000000ul, and ``unsigned long long'' would be nonstandard).
+ */
+#define _BSD_CLK_TCK_ 100
+#define _BSD_CLOCKS_PER_SEC_ 100
+
+/*
+ * Internal names for basic integral types. Omit the typedef if
+ * not possible for a machine/compiler combination.
+ */
+typedef __signed char __int8_t;
+typedef unsigned char __uint8_t;
+typedef short __int16_t;
+typedef unsigned short __uint16_t;
+typedef int __int32_t;
+typedef unsigned int __uint32_t;
+typedef long __int64_t;
+typedef unsigned long __uint64_t;
+
+typedef long __intptr_t;
+typedef unsigned long __uintptr_t;
+
+#endif /* _ANSI_H_ */
diff --git a/sys/ia64/include/asm.h b/sys/ia64/include/asm.h
new file mode 100644
index 0000000..4d20be3
--- /dev/null
+++ b/sys/ia64/include/asm.h
@@ -0,0 +1,257 @@
+/* $FreeBSD$ */
+/* From: NetBSD: asm.h,v 1.18 1997/11/03 04:22:06 ross Exp */
+
+/*
+ * Copyright (c) 1991,1990,1989,1994,1995,1996 Carnegie Mellon University
+ * All Rights Reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
+ * School of Computer Science
+ * Carnegie Mellon University
+ * Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+
+/*
+ * Assembly coding style
+ *
+ * This file contains macros and register defines to
+ * aid in writing more readable assembly code.
+ * Some rules to make assembly code understandable by
+ * a debugger are also noted.
+ *
+ * The document
+ *
+ * "ALPHA Calling Standard", DEC 27-Apr-90
+ *
+ * defines (a superset of) the rules and conventions
+ * we use. While we make no promise of adhering to
+ * such standard and its evolution (esp where we
+ * can get faster code paths) it is certainly intended
+ * that we be interoperable with such standard.
+ *
+ * In this sense, this file is a proper part of the
+ * definition of the (software) Alpha architecture.
+ */
+
+/*
+ * Macro to make a local label name.
+ */
+#define LLABEL(name,num) L ## name ## num
+
+/*
+ * MCOUNT
+ */
+
+#if !defined(GPROF) && !defined(PROF)
+#define MCOUNT /* nothing */
+#else
+#define MCOUNT \
+ .set noat; \
+ jsr at_reg,_mcount; \
+ .set at
+#endif
+
+/*
+ * LEAF
+ * Declare a global leaf function.
+ * A leaf function does not call other functions.
+ */
+#define LEAF(_name_, _n_args_) \
+ .global _name_; \
+ .proc _name_; \
+_name_:; \
+ .regstk _n_args_, 0, 0, 0 \
+ MCOUNT
+
+#define LEAF_NOPROFILE(_name_, _n_args_) \
+ .global _name_; \
+ .proc _name_; \
+_name_:; \
+ .regstk _n_args_, 0, 0, 0
+
+/*
+ * STATIC_LEAF
+ * Declare a local leaf function.
+ */
+#define STATIC_LEAF(_name_, _n_args_) \
+ .proc _name_; \
+_name_:; \
+ .regstk _n_args_, 0, 0, 0 \
+ MCOUNT
+/*
+ * XLEAF
+ * Global alias for a leaf function, or alternate entry point
+ */
+#define XLEAF(_name_) \
+ .globl _name_; \
+_name_:
+
+/*
+ * STATIC_XLEAF
+ * Local alias for a leaf function, or alternate entry point
+ */
+#define STATIC_XLEAF(_name_) \
+_name_:
+
+/*
+ * NESTED
+ * Declare a (global) nested function
+ * A nested function calls other functions and needs
+ * to use alloc to save registers.
+ */
+#define NESTED(_name_,_n_args_,_n_locals_,_n_outputs_, \
+ _pfs_reg_,_rp_reg_) \
+ .globl _name_; \
+ .proc _name_; \
+_name_:; \
+ alloc _pfs_reg_=ar.pfs,_n_args_,_n_locals_,_n_outputs_,0;; \
+ mov _rp_reg_=rp \
+ MCOUNT
+
+#define NESTED_NOPROFILE(_name_,_n_args_,_n_locals_,_n_outputs_, \
+ _pfs_reg_,_rp_reg_) \
+ .globl _name_; \
+ .proc _name_; \
+_name_:; \
+ alloc _pfs_reg_=ar.pfs,_n_args_,_n_locals_,_n_outputs_,0;; \
+ mov _rp_reg_=rp
+
+/*
+ * STATIC_NESTED
+ * Declare a local nested function.
+ */
+#define STATIC_NESTED(_name_,_n_args_,_n_locals_,_n_outputs_, \
+ _pfs_reg_,_rp_reg_) \
+ .proc _name_; \
+_name_:; \
+ alloc _pfs_reg_=ar.pfs,_n_args_,_n_locals_,_n_outputs_,0;; \
+ mov _rp_reg_=rp;; \
+ MCOUNT
+
+/*
+ * XNESTED
+ * Same as XLEAF, for a nested function.
+ */
+#define XNESTED(_name_) \
+ .globl _name_; \
+_name_:
+
+
+/*
+ * STATIC_XNESTED
+ * Same as STATIC_XLEAF, for a nested function.
+ */
+#define STATIC_XNESTED(_name_) \
+_name_:
+
+
+/*
+ * END
+ * Function delimiter
+ */
+#define END(_name_) \
+ .endp _name_
+
+
+/*
+ * EXPORT
+ * Export a symbol
+ */
+#define EXPORT(_name_) \
+ .global _name_; \
+_name_:
+
+
+/*
+ * IMPORT
+ * Make an external name visible, typecheck the size
+ */
+#define IMPORT(_name_, _size_) \
+ /* .extern _name_,_size_ */
+
+
+/*
+ * ABS
+ * Define an absolute symbol
+ */
+#define ABS(_name_, _value_) \
+ .globl _name_; \
+_name_ = _value_
+
+
+/*
+ * BSS
+ * Allocate un-initialized space for a global symbol
+ */
+#define BSS(_name_,_numbytes_) \
+ .comm _name_,_numbytes_
+
+
+/*
+ * MSG
+ * Allocate space for a message (a read-only ascii string)
+ */
+#define ASCIZ .asciz
+#define MSG(msg,reg,label) \
+ lda reg, label; \
+ .data; \
+label: ASCIZ msg; \
+ .text;
+
+/*
+ * System call glue.
+ */
+#define SYSCALLNUM(name) \
+ SYS_ ## name
+
+#define CALLSYS_NOERROR(name) \
+ mov r15=SYSCALLNUM(name); \
+ break 0x100000 ;;
+
+/*
+ * WEAK_ALIAS: create a weak alias (ELF only).
+ */
+#ifdef __ELF__
+#define WEAK_ALIAS(alias,sym) \
+ .weak alias; \
+ alias = sym
+#endif
+
+/*
+ * Kernel RCS ID tag and copyright macros
+ */
+
+#ifdef _KERNEL
+
+#ifdef __ELF__
+#define __KERNEL_SECTIONSTRING(_sec, _str) \
+ .section _sec ; .asciz _str ; .text
+#else /* __ELF__ */
+#define __KERNEL_SECTIONSTRING(_sec, _str) \
+ .data ; .asciz _str ; .align 3 ; .text
+#endif /* __ELF__ */
+
+#define __KERNEL_RCSID(_n, _s) __KERNEL_SECTIONSTRING(.ident, _s)
+#define __KERNEL_COPYRIGHT(_n, _s) __KERNEL_SECTIONSTRING(.copyright, _s)
+
+#ifdef NO_KERNEL_RCSIDS
+#undef __KERNEL_RCSID
+#define __KERNEL_RCSID(_n, _s) /* nothing */
+#endif
+
+#endif /* _KERNEL */
diff --git a/sys/ia64/include/atomic.h b/sys/ia64/include/atomic.h
new file mode 100644
index 0000000..a7b3e21
--- /dev/null
+++ b/sys/ia64/include/atomic.h
@@ -0,0 +1,190 @@
+/*-
+ * Copyright (c) 1998 Doug Rabson
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _MACHINE_ATOMIC_H_
+#define _MACHINE_ATOMIC_H_
+
+/*
+ * Various simple arithmetic on memory which is atomic in the presence
+ * of interrupts and SMP safe.
+ */
+
+/*
+ * Everything is built out of cmpxchg.
+ */
+#define IA64_CMPXCHG(sz, sem, type, p, cmpval, newval) \
+({ \
+ type _cmpval = cmpval; \
+ type _newval = newval; \
+ volatile type *_p = (volatile type *) p; \
+ type _ret; \
+ \
+ __asm __volatile ( \
+ "mov ar.ccv=%2;;\n\t" \
+ "cmpxchg" #sz "." #sem " %0=%4,%3,ar.ccv\n\t" \
+ : "=r" (_ret), "=m" (*_p) \
+ : "r" (_cmpval), "r" (_newval), "m" (*_p) \
+ : "memory"); \
+ _ret; \
+})
+
+/*
+ * Some common forms of cmpxch.
+ */
+static __inline u_int32_t
+ia64_cmpxchg_acq_32(volatile u_int32_t* p, u_int32_t cmpval, u_int32_t newval)
+{
+ return IA64_CMPXCHG(4, acq, u_int32_t, p, cmpval, newval);
+}
+
+static __inline u_int32_t
+ia64_cmpxchg_rel_32(volatile u_int32_t* p, u_int32_t cmpval, u_int32_t newval)
+{
+ return IA64_CMPXCHG(4, rel, u_int32_t, p, cmpval, newval);
+}
+
+static __inline u_int64_t
+ia64_cmpxchg_acq_64(volatile u_int64_t* p, u_int64_t cmpval, u_int64_t newval)
+{
+ return IA64_CMPXCHG(8, acq, u_int64_t, p, cmpval, newval);
+}
+
+static __inline u_int64_t
+ia64_cmpxchg_rel_64(volatile u_int64_t* p, u_int64_t cmpval, u_int64_t newval)
+{
+ return IA64_CMPXCHG(8, rel, u_int64_t, p, cmpval, newval);
+}
+
+/*
+ * Store with release semantics is used to release locks.
+ */
+static __inline void
+ia64_st_rel_32(volatile u_int32_t* p, u_int32_t v)
+{
+ __asm __volatile ("st4.rel %0=%1"
+ : "=m" (*p)
+ : "r" (v)
+ : "memory");
+}
+
+static __inline void
+ia64_st_rel_64(volatile u_int64_t* p, u_int64_t v)
+{
+ __asm __volatile ("st8.rel %0=%1"
+ : "=m" (*p)
+ : "r" (v)
+ : "memory");
+}
+
+#define IA64_ATOMIC(sz, type, name, op) \
+ \
+static __inline void \
+atomic_##name(volatile type *p, type v) \
+{ \
+ type old; \
+ do { \
+ old = *p; \
+ } while (IA64_CMPXCHG(sz, acq, type, p, old, old op v) != old); \
+}
+
+IA64_ATOMIC(1, u_int8_t, set_8, |)
+IA64_ATOMIC(2, u_int16_t, set_16, |)
+IA64_ATOMIC(4, u_int32_t, set_32, |)
+IA64_ATOMIC(8, u_int64_t, set_64, |)
+
+IA64_ATOMIC(1, u_int8_t, clear_8, &~)
+IA64_ATOMIC(2, u_int16_t, clear_16, &~)
+IA64_ATOMIC(4, u_int32_t, clear_32, &~)
+IA64_ATOMIC(8, u_int64_t, clear_64, &~)
+
+IA64_ATOMIC(1, u_int8_t, add_8, +)
+IA64_ATOMIC(2, u_int16_t, add_16, +)
+IA64_ATOMIC(4, u_int32_t, add_32, +)
+IA64_ATOMIC(8, u_int64_t, add_64, +)
+
+IA64_ATOMIC(1, u_int8_t, subtract_8, -)
+IA64_ATOMIC(2, u_int16_t, subtract_16, -)
+IA64_ATOMIC(4, u_int32_t, subtract_32, -)
+IA64_ATOMIC(8, u_int64_t, subtract_64, -)
+
+#undef IA64_ATOMIC
+#undef IA64_CMPXCHG
+
+#define atomic_set_char atomic_set_8
+#define atomic_clear_char atomic_clear_8
+#define atomic_add_char atomic_add_8
+#define atomic_subtract_char atomic_subtract_8
+
+#define atomic_set_short atomic_set_16
+#define atomic_clear_short atomic_clear_16
+#define atomic_add_short atomic_add_16
+#define atomic_subtract_short atomic_subtract_16
+
+#define atomic_set_int atomic_set_32
+#define atomic_clear_int atomic_clear_32
+#define atomic_add_int atomic_add_32
+#define atomic_subtract_int atomic_subtract_32
+
+#define atomic_set_long atomic_set_64
+#define atomic_clear_long atomic_clear_64
+#define atomic_add_long atomic_add_64
+#define atomic_subtract_long atomic_subtract_64
+
+/*
+ * Atomically compare the value stored at *p with cmpval and if the
+ * two values are equal, update the value of *p with newval. Returns
+ * zero if the compare failed, nonzero otherwise.
+ */
+static __inline int
+atomic_cmpset_32(volatile u_int32_t* p, u_int32_t cmpval, u_int32_t newval)
+{
+ return ia64_cmpxchg_acq_32(p, cmpval, newval) == cmpval;
+}
+
+/*
+ * Atomically compare the value stored at *p with cmpval and if the
+ * two values are equal, update the value of *p with newval. Returns
+ * zero if the compare failed, nonzero otherwise.
+ */
+static __inline int
+atomic_cmpset_64(volatile u_int64_t* p, u_int64_t cmpval, u_int64_t newval)
+{
+ return ia64_cmpxchg_acq_64(p, cmpval, newval) == cmpval;
+}
+
+#define atomic_cmpset_int atomic_cmpset_32
+#define atomic_cmpset_long atomic_cmpset_64
+
+static __inline int
+atomic_cmpset_ptr(volatile void *dst, void *exp, void *src)
+{
+ return atomic_cmpset_long((volatile u_long *)dst,
+ (u_long)exp, (u_long)src);
+}
+
+#endif /* ! _MACHINE_ATOMIC_H_ */
diff --git a/sys/ia64/include/bootinfo.h b/sys/ia64/include/bootinfo.h
new file mode 100644
index 0000000..86b7e7a
--- /dev/null
+++ b/sys/ia64/include/bootinfo.h
@@ -0,0 +1,86 @@
+/* $FreeBSD$ */
+/*
+ * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
+ * All rights reserved.
+ *
+ * Author: Chris G. Demetriou
+ *
+ * Permission to use, copy, modify and distribute this software and
+ * its documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
+ * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
+ * School of Computer Science
+ * Carnegie Mellon University
+ * Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie the
+ * rights to redistribute these changes.
+ */
+
+/*
+ * The boot program passes a pointer (in the boot environment virtual
+ * address address space; "BEVA") to a bootinfo to the kernel using
+ * the following convention:
+ *
+ * a0 contains first free page frame number
+ * a1 contains page number of current level 1 page table
+ * if a2 contains BOOTINFO_MAGIC and a4 is nonzero:
+ * a3 contains pointer (BEVA) to bootinfo
+ * a4 contains bootinfo version number
+ * if a2 contains BOOTINFO_MAGIC and a4 contains 0 (backward compat):
+ * a3 contains pointer (BEVA) to bootinfo version
+ * (u_long), then the bootinfo
+ */
+
+#define BOOTINFO_MAGIC 0xdeadbeeffeedface
+
+struct bootinfo_v1 {
+ u_long ssym; /* 0: start of kernel sym table */
+ u_long esym; /* 8: end of kernel sym table */
+ char boot_flags[64]; /* 16: boot flags */
+ char booted_kernel[64]; /* 80: name of booted kernel */
+ void *hwrpb; /* 144: hwrpb pointer (BEVA) */
+ u_long hwrpbsize; /* 152: size of hwrpb data */
+ int (*cngetc) __P((void)); /* 160: console getc pointer */
+ void (*cnputc) __P((int)); /* 168: console putc pointer */
+ void (*cnpollc) __P((int)); /* 176: console pollc pointer */
+ u_long pad[6]; /* 184: rsvd for future use */
+ char *envp; /* 232: start of environment */
+ u_long kernend; /* 240: end of kernel */
+ u_long modptr; /* 248: FreeBSD module base */
+ /* 256: total size */
+};
+
+/*
+ * Kernel-internal structure used to hold important bits of boot
+ * information. NOT to be used by boot blocks.
+ *
+ * Note that not all of the fields from the bootinfo struct(s)
+ * passed by the boot blocks aren't here (because they're not currently
+ * used by the kernel!). Fields here which aren't supplied by the
+ * bootinfo structure passed by the boot blocks are supposed to be
+ * filled in at startup with sane contents.
+ */
+struct bootinfo_kernel {
+ u_long ssym; /* start of syms */
+ u_long esym; /* end of syms */
+ u_long modptr; /* FreeBSD module pointer */
+ u_long kernend; /* "end of kernel" from boot code */
+ char *envp; /* "end of kernel" from boot code */
+ u_long hwrpb_phys; /* hwrpb physical address */
+ u_long hwrpb_size; /* size of hwrpb data */
+ char boot_flags[64]; /* boot flags */
+ char booted_kernel[64]; /* name of booted kernel */
+ char booted_dev[64]; /* name of booted device */
+};
+
+extern struct bootinfo_kernel bootinfo;
diff --git a/sys/ia64/include/bus.h b/sys/ia64/include/bus.h
new file mode 100644
index 0000000..c054193
--- /dev/null
+++ b/sys/ia64/include/bus.h
@@ -0,0 +1,1173 @@
+/* $NetBSD: bus.h,v 1.12 1997/10/01 08:25:15 fvdl Exp $ */
+
+/*-
+ * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
+ * NASA Ames Research Center.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * Copyright (c) 1996 Charles M. Hannum. All rights reserved.
+ * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Christopher G. Demetriou
+ * for the NetBSD Project.
+ * 4. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/* $FreeBSD$ */
+
+#ifndef _MACHINE_BUS_H_
+#define _MACHINE_BUS_H_
+
+#include <machine/cpufunc.h>
+
+/*
+ * To remain compatible with NetBSD's interface, default to both memio and
+ * pio when neither of them is defined.
+ */
+#if !defined(_MACHINE_BUS_PIO_H_) && !defined(_IA64_BUS_MEMIO_H_)
+#define _MACHINE_BUS_PIO_H_
+#define _MACHINE_BUS_MEMIO_H_
+#endif
+
+/*
+ * Values for the ia64 bus space tag, not to be used directly by MI code.
+ */
+#define IA64_BUS_SPACE_IO 0 /* space is i/o space */
+#define IA64_BUS_SPACE_MEM 1 /* space is mem space */
+
+/*
+ * Bus address and size types
+ */
+typedef u_long bus_addr_t;
+typedef u_long bus_size_t;
+
+#define BUS_SPACE_MAXSIZE_24BIT 0xFFFFFF
+#define BUS_SPACE_MAXSIZE_32BIT 0xFFFFFFFF
+#define BUS_SPACE_MAXSIZE (64 * 1024) /* Maximum supported size */
+#define BUS_SPACE_MAXADDR_24BIT 0xFFFFFF
+#define BUS_SPACE_MAXADDR_32BIT 0xFFFFFFFF
+#define BUS_SPACE_MAXADDR 0xFFFFFFFF
+
+#define BUS_SPACE_UNRESTRICTED (~0)
+
+/*
+ * Access methods for bus resources and address space.
+ */
+typedef int bus_space_tag_t;
+typedef u_long bus_space_handle_t;
+
+/*
+ * Map a region of device bus space into CPU virtual address space.
+ */
+
+#define BUS_SPACE_MAP_CACHEABLE 0x01
+#define BUS_SPACE_MAP_LINEAR 0x02
+
+int bus_space_map(bus_space_tag_t t, bus_addr_t addr, bus_size_t size,
+ int flags, bus_space_handle_t *bshp);
+
+/*
+ * Unmap a region of device bus space.
+ */
+
+void bus_space_unmap(bus_space_tag_t t, bus_space_handle_t bsh,
+ bus_size_t size);
+
+/*
+ * Get a new handle for a subregion of an already-mapped area of bus space.
+ */
+
+int bus_space_subregion(bus_space_tag_t t, bus_space_handle_t bsh,
+ bus_size_t offset, bus_size_t size,
+ bus_space_handle_t *nbshp);
+
+/*
+ * Allocate a region of memory that is accessible to devices in bus space.
+ */
+
+int bus_space_alloc(bus_space_tag_t t, bus_addr_t rstart,
+ bus_addr_t rend, bus_size_t size, bus_size_t align,
+ bus_size_t boundary, int flags, bus_addr_t *addrp,
+ bus_space_handle_t *bshp);
+
+/*
+ * Free a region of bus space accessible memory.
+ */
+
+void bus_space_free(bus_space_tag_t t, bus_space_handle_t bsh,
+ bus_size_t size);
+
+#if defined(_MACHINE_BUS_PIO_H_) || defined(_MACHINE_BUS_MEMIO_H_)
+
+/*
+ * Read a 1, 2, 4, or 8 byte quantity from bus space
+ * described by tag/handle/offset.
+ */
+static __inline u_int8_t bus_space_read_1(bus_space_tag_t tag,
+ bus_space_handle_t handle,
+ bus_size_t offset);
+
+static __inline u_int16_t bus_space_read_2(bus_space_tag_t tag,
+ bus_space_handle_t handle,
+ bus_size_t offset);
+
+static __inline u_int32_t bus_space_read_4(bus_space_tag_t tag,
+ bus_space_handle_t handle,
+ bus_size_t offset);
+
+static __inline u_int8_t
+bus_space_read_1(bus_space_tag_t tag, bus_space_handle_t handle,
+ bus_size_t offset)
+{
+#if defined (_MACHINE_BUS_PIO_H_)
+#if defined (_MACHINE_BUS_MEMIO_H_)
+ if (tag == IA64_BUS_SPACE_IO)
+#endif
+ return (inb(handle + offset));
+#endif
+#if defined (_MACHINE_BUS_MEMIO_H_)
+ return (readb(handle + offset));
+#endif
+}
+
+static __inline u_int16_t
+bus_space_read_2(bus_space_tag_t tag, bus_space_handle_t handle,
+ bus_size_t offset)
+{
+#if defined(_MACHINE_BUS_PIO_H_)
+#if defined(_MACHINE_BUS_MEMIO_H_)
+ if (tag == IA64_BUS_SPACE_IO)
+#endif
+ return (inw(handle + offset));
+#endif
+#if defined(_MACHINE_BUS_MEMIO_H_)
+ return (readw(handle + offset));
+#endif
+}
+
+static __inline u_int32_t
+bus_space_read_4(bus_space_tag_t tag, bus_space_handle_t handle,
+ bus_size_t offset)
+{
+#if defined(_MACHINE_BUS_PIO_H_)
+#if defined(_MACHINE_BUS_MEMIO_H_)
+ if (tag == IA64_BUS_SPACE_IO)
+#endif
+ return (inl(handle + offset));
+#endif
+#if defined(_MACHINE_BUS_MEMIO_H_)
+ return (readl(handle + offset));
+#endif
+}
+
+#if 0 /* Cause a link error for bus_space_read_8 */
+#define bus_space_read_8(t, h, o) !!! bus_space_read_8 unimplemented !!!
+#endif
+
+/*
+ * Read `count' 1, 2, 4, or 8 byte quantities from bus space
+ * described by tag/handle/offset and copy into buffer provided.
+ */
+static __inline void bus_space_read_multi_1(bus_space_tag_t tag,
+ bus_space_handle_t bsh,
+ bus_size_t offset, u_int8_t *addr,
+ size_t count);
+
+static __inline void bus_space_read_multi_2(bus_space_tag_t tag,
+ bus_space_handle_t bsh,
+ bus_size_t offset, u_int16_t *addr,
+ size_t count);
+
+static __inline void bus_space_read_multi_4(bus_space_tag_t tag,
+ bus_space_handle_t bsh,
+ bus_size_t offset, u_int32_t *addr,
+ size_t count);
+
+static __inline void
+bus_space_read_multi_1(bus_space_tag_t tag, bus_space_handle_t bsh,
+ bus_size_t offset, u_int8_t *addr, size_t count)
+{
+#if defined(_MACHINE_BUS_PIO_H_)
+#if defined(_MACHINE_BUS_MEMIO_H_)
+ if (tag == IA64_BUS_SPACE_IO)
+#endif
+ while (count--)
+ *addr++ = inb(bsh + offset);
+#endif
+#if defined(_MACHINE_BUS_MEMIO_H_)
+#if defined(_MACHINE_BUS_PIO_H_)
+ else
+#endif
+ while (count--)
+ *addr++ = readb(bsh + offset);
+#endif
+}
+
+static __inline void
+bus_space_read_multi_2(bus_space_tag_t tag, bus_space_handle_t bsh,
+ bus_size_t offset, u_int16_t *addr, size_t count)
+{
+ bus_addr_t baddr = bsh + offset;
+#if defined(_MACHINE_BUS_PIO_H_)
+#if defined(_MACHINE_BUS_MEMIO_H_)
+ if (tag == IA64_BUS_SPACE_IO)
+#endif
+ while (count--)
+ *addr++ = inw(baddr);
+#endif
+#if defined(_MACHINE_BUS_MEMIO_H_)
+#if defined(_MACHINE_BUS_PIO_H_)
+ else
+#endif
+ while (count--)
+ *addr++ = readw(baddr);
+#endif
+}
+
+static __inline void
+bus_space_read_multi_4(bus_space_tag_t tag, bus_space_handle_t bsh,
+ bus_size_t offset, u_int32_t *addr, size_t count)
+{
+ bus_addr_t baddr = bsh + offset;
+#if defined(_MACHINE_BUS_PIO_H_)
+#if defined(_MACHINE_BUS_MEMIO_H_)
+ if (tag == IA64_BUS_SPACE_IO)
+#endif
+ while (count--)
+ *addr++ = inl(baddr);
+#endif
+#if defined(_MACHINE_BUS_MEMIO_H_)
+#if defined(_MACHINE_BUS_PIO_H_)
+ else
+#endif
+ while (count--)
+ *addr++ = readl(baddr);
+#endif
+}
+
+#if 0 /* Cause a link error for bus_space_read_multi_8 */
+#define bus_space_read_multi_8 !!! bus_space_read_multi_8 unimplemented !!!
+#endif
+
+/*
+ * Read `count' 1, 2, 4, or 8 byte quantities from bus space
+ * described by tag/handle and starting at `offset' and copy into
+ * buffer provided.
+ */
+static __inline void bus_space_read_region_1(bus_space_tag_t tag,
+ bus_space_handle_t bsh,
+ bus_size_t offset, u_int8_t *addr,
+ size_t count);
+
+static __inline void bus_space_read_region_2(bus_space_tag_t tag,
+ bus_space_handle_t bsh,
+ bus_size_t offset, u_int16_t *addr,
+ size_t count);
+
+static __inline void bus_space_read_region_4(bus_space_tag_t tag,
+ bus_space_handle_t bsh,
+ bus_size_t offset, u_int32_t *addr,
+ size_t count);
+
+
+static __inline void
+bus_space_read_region_1(bus_space_tag_t tag, bus_space_handle_t bsh,
+ bus_size_t offset, u_int8_t *addr, size_t count)
+{
+ bus_addr_t baddr = bsh + offset;
+#if defined(_MACHINE_BUS_PIO_H_)
+#if defined(_MACHINE_BUS_MEMIO_H_)
+ if (tag == IA64_BUS_SPACE_IO)
+#endif
+ while (count--) {
+ *addr++ = inb(baddr);
+ baddr += 1;
+ }
+#endif
+#if defined(_MACHINE_BUS_MEMIO_H_)
+#if defined(_MACHINE_BUS_PIO_H_)
+ else
+#endif
+ while (count--) {
+ *addr++ = readb(baddr);
+ baddr += 1;
+ }
+#endif
+}
+
+static __inline void
+bus_space_read_region_2(bus_space_tag_t tag, bus_space_handle_t bsh,
+ bus_size_t offset, u_int16_t *addr, size_t count)
+{
+ bus_addr_t baddr = bsh + offset;
+#if defined(_MACHINE_BUS_PIO_H_)
+#if defined(_MACHINE_BUS_MEMIO_H_)
+ if (tag == IA64_BUS_SPACE_IO)
+#endif
+ while (count--) {
+ *addr++ = inw(baddr);
+ baddr += 2;
+ }
+#endif
+#if defined(_MACHINE_BUS_MEMIO_H_)
+#if defined(_MACHINE_BUS_PIO_H_)
+ else
+#endif
+ while (count--) {
+ *addr++ = readw(baddr);
+ baddr += 2;
+ }
+#endif
+}
+
+static __inline void
+bus_space_read_region_4(bus_space_tag_t tag, bus_space_handle_t bsh,
+ bus_size_t offset, u_int32_t *addr, size_t count)
+{
+ bus_addr_t baddr = bsh + offset;
+#if defined(_MACHINE_BUS_PIO_H_)
+#if defined(_MACHINE_BUS_MEMIO_H_)
+ if (tag == IA64_BUS_SPACE_IO)
+#endif
+ while (count--) {
+ *addr++ = inl(baddr);
+ baddr += 4;
+ }
+#endif
+#if defined(_MACHINE_BUS_MEMIO_H_)
+#if defined(_MACHINE_BUS_PIO_H_)
+ else
+#endif
+ while (count--) {
+ *addr++ = readb(baddr);
+ baddr += 4;
+ }
+#endif
+}
+
+#if 0 /* Cause a link error for bus_space_read_region_8 */
+#define bus_space_read_region_8 !!! bus_space_read_region_8 unimplemented !!!
+#endif
+
+/*
+ * Write the 1, 2, 4, or 8 byte value `value' to bus space
+ * described by tag/handle/offset.
+ */
+
+static __inline void bus_space_write_1(bus_space_tag_t tag,
+ bus_space_handle_t bsh,
+ bus_size_t offset, u_int8_t value);
+
+static __inline void bus_space_write_2(bus_space_tag_t tag,
+ bus_space_handle_t bsh,
+ bus_size_t offset, u_int16_t value);
+
+static __inline void bus_space_write_4(bus_space_tag_t tag,
+ bus_space_handle_t bsh,
+ bus_size_t offset, u_int32_t value);
+
+static __inline void
+bus_space_write_1(bus_space_tag_t tag, bus_space_handle_t bsh,
+ bus_size_t offset, u_int8_t value)
+{
+#if defined(_MACHINE_BUS_PIO_H_)
+#if defined(_MACHINE_BUS_MEMIO_H_)
+ if (tag == IA64_BUS_SPACE_IO)
+#endif
+ outb(bsh + offset, value);
+#endif
+#if defined(_MACHINE_BUS_MEMIO_H_)
+#if defined(_MACHINE_BUS_PIO_H_)
+ else
+#endif
+ writeb(bsh + offset, value);
+#endif
+}
+
+static __inline void
+bus_space_write_2(bus_space_tag_t tag, bus_space_handle_t bsh,
+ bus_size_t offset, u_int16_t value)
+{
+#if defined(_MACHINE_BUS_PIO_H_)
+#if defined(_MACHINE_BUS_MEMIO_H_)
+ if (tag == IA64_BUS_SPACE_IO)
+#endif
+ outw(bsh + offset, value);
+#endif
+#if defined(_MACHINE_BUS_MEMIO_H_)
+#if defined(_MACHINE_BUS_PIO_H_)
+ else
+#endif
+ writew(bsh + offset, value);
+#endif
+}
+
+static __inline void
+bus_space_write_4(bus_space_tag_t tag, bus_space_handle_t bsh,
+ bus_size_t offset, u_int32_t value)
+{
+#if defined(_MACHINE_BUS_PIO_H_)
+#if defined(_MACHINE_BUS_MEMIO_H_)
+ if (tag == IA64_BUS_SPACE_IO)
+#endif
+ outl(bsh + offset, value);
+#endif
+#if defined(_MACHINE_BUS_MEMIO_H_)
+#if defined(_MACHINE_BUS_PIO_H_)
+ else
+#endif
+ writel(bsh + offset, value);
+#endif
+}
+
+#if 0 /* Cause a link error for bus_space_write_8 */
+#define bus_space_write_8 !!! bus_space_write_8 not implemented !!!
+#endif
+
+/*
+ * Write `count' 1, 2, 4, or 8 byte quantities from the buffer
+ * provided to bus space described by tag/handle/offset.
+ */
+
+static __inline void bus_space_write_multi_1(bus_space_tag_t tag,
+ bus_space_handle_t bsh,
+ bus_size_t offset,
+ const u_int8_t *addr,
+ size_t count);
+static __inline void bus_space_write_multi_2(bus_space_tag_t tag,
+ bus_space_handle_t bsh,
+ bus_size_t offset,
+ const u_int16_t *addr,
+ size_t count);
+
+static __inline void bus_space_write_multi_4(bus_space_tag_t tag,
+ bus_space_handle_t bsh,
+ bus_size_t offset,
+ const u_int32_t *addr,
+ size_t count);
+
+static __inline void
+bus_space_write_multi_1(bus_space_tag_t tag, bus_space_handle_t bsh,
+ bus_size_t offset, const u_int8_t *addr, size_t count)
+{
+ bus_addr_t baddr = bsh + offset;
+#if defined(_MACHINE_BUS_PIO_H_)
+#if defined(_MACHINE_BUS_MEMIO_H_)
+ if (tag == IA64_BUS_SPACE_IO)
+#endif
+ while (count--)
+ outb(baddr, *addr++);
+#endif
+#if defined(_MACHINE_BUS_MEMIO_H_)
+#if defined(_MACHINE_BUS_PIO_H_)
+ else
+#endif
+ while (count--)
+ writeb(baddr, *addr++);
+#endif
+}
+
+static __inline void
+bus_space_write_multi_2(bus_space_tag_t tag, bus_space_handle_t bsh,
+ bus_size_t offset, const u_int16_t *addr, size_t count)
+{
+ bus_addr_t baddr = bsh + offset;
+#if defined(_MACHINE_BUS_PIO_H_)
+#if defined(_MACHINE_BUS_MEMIO_H_)
+ if (tag == IA64_BUS_SPACE_IO)
+#endif
+ while (count--)
+ outw(baddr, *addr++);
+#endif
+#if defined(_MACHINE_BUS_MEMIO_H_)
+#if defined(_MACHINE_BUS_PIO_H_)
+ else
+#endif
+ while (count--)
+ writew(baddr, *addr++);
+#endif
+}
+
+static __inline void
+bus_space_write_multi_4(bus_space_tag_t tag, bus_space_handle_t bsh,
+ bus_size_t offset, const u_int32_t *addr, size_t count)
+{
+ bus_addr_t baddr = bsh + offset;
+#if defined(_MACHINE_BUS_PIO_H_)
+#if defined(_MACHINE_BUS_MEMIO_H_)
+ if (tag == IA64_BUS_SPACE_IO)
+#endif
+ while (count--)
+ outl(baddr, *addr++);
+#endif
+#if defined(_MACHINE_BUS_MEMIO_H_)
+#if defined(_MACHINE_BUS_PIO_H_)
+ else
+#endif
+ while (count--)
+ writel(baddr, *addr++);
+#endif
+}
+
+#if 0 /* Cause a link error for bus_space_write_multi_8 */
+#define bus_space_write_multi_8(t, h, o, a, c) \
+ !!! bus_space_write_multi_8 unimplemented !!!
+#endif
+
+/*
+ * Write `count' 1, 2, 4, or 8 byte quantities from the buffer provided
+ * to bus space described by tag/handle starting at `offset'.
+ */
+
+static __inline void bus_space_write_region_1(bus_space_tag_t tag,
+ bus_space_handle_t bsh,
+ bus_size_t offset,
+ const u_int8_t *addr,
+ size_t count);
+static __inline void bus_space_write_region_2(bus_space_tag_t tag,
+ bus_space_handle_t bsh,
+ bus_size_t offset,
+ const u_int16_t *addr,
+ size_t count);
+static __inline void bus_space_write_region_4(bus_space_tag_t tag,
+ bus_space_handle_t bsh,
+ bus_size_t offset,
+ const u_int32_t *addr,
+ size_t count);
+
+static __inline void
+bus_space_write_region_1(bus_space_tag_t tag, bus_space_handle_t bsh,
+ bus_size_t offset, const u_int8_t *addr, size_t count)
+{
+ bus_addr_t baddr = bsh + offset;
+#if defined(_MACHINE_BUS_PIO_H_)
+#if defined(_MACHINE_BUS_MEMIO_H_)
+ if (tag == IA64_BUS_SPACE_IO)
+#endif
+ while (count--) {
+ outb(baddr, *addr++);
+ baddr += 1;
+ }
+#endif
+#if defined(_MACHINE_BUS_MEMIO_H_)
+#if defined(_MACHINE_BUS_PIO_H_)
+ else
+#endif
+ while (count--) {
+ writeb(baddr, *addr++);
+ baddr += 1;
+ }
+#endif
+}
+
+static __inline void
+bus_space_write_region_2(bus_space_tag_t tag, bus_space_handle_t bsh,
+ bus_size_t offset, const u_int16_t *addr, size_t count)
+{
+ bus_addr_t baddr = bsh + offset;
+#if defined(_MACHINE_BUS_PIO_H_)
+#if defined(_MACHINE_BUS_MEMIO_H_)
+ if (tag == IA64_BUS_SPACE_IO)
+#endif
+ while (count--) {
+ outw(baddr, *addr++);
+ baddr += 2;
+ }
+#endif
+#if defined(_MACHINE_BUS_MEMIO_H_)
+#if defined(_MACHINE_BUS_PIO_H_)
+ else
+#endif
+ while (count--) {
+ writew(baddr, *addr++);
+ baddr += 2;
+ }
+#endif
+}
+
+static __inline void
+bus_space_write_region_4(bus_space_tag_t tag, bus_space_handle_t bsh,
+ bus_size_t offset, const u_int32_t *addr, size_t count)
+{
+ bus_addr_t baddr = bsh + offset;
+#if defined(_MACHINE_BUS_PIO_H_)
+#if defined(_MACHINE_BUS_MEMIO_H_)
+ if (tag == IA64_BUS_SPACE_IO)
+#endif
+ while (count--) {
+ outl(baddr, *addr++);
+ baddr += 4;
+ }
+#endif
+#if defined(_MACHINE_BUS_MEMIO_H_)
+#if defined(_MACHINE_BUS_PIO_H_)
+ else
+#endif
+ while (count--) {
+ writel(baddr, *addr++);
+ baddr += 4;
+ }
+#endif
+}
+
+#if 0 /* Cause a link error for bus_space_write_region_8 */
+#define bus_space_write_region_8 \
+ !!! bus_space_write_region_8 unimplemented !!!
+#endif
+
+/*
+ * Write the 1, 2, 4, or 8 byte value `val' to bus space described
+ * by tag/handle/offset `count' times.
+ */
+
+static __inline void bus_space_set_multi_1(bus_space_tag_t tag,
+ bus_space_handle_t bsh,
+ bus_size_t offset,
+ u_int8_t value, size_t count);
+static __inline void bus_space_set_multi_2(bus_space_tag_t tag,
+ bus_space_handle_t bsh,
+ bus_size_t offset,
+ u_int16_t value, size_t count);
+static __inline void bus_space_set_multi_4(bus_space_tag_t tag,
+ bus_space_handle_t bsh,
+ bus_size_t offset,
+ u_int32_t value, size_t count);
+
+static __inline void
+bus_space_set_multi_1(bus_space_tag_t tag, bus_space_handle_t bsh,
+ bus_size_t offset, u_int8_t value, size_t count)
+{
+ bus_addr_t addr = bsh + offset;
+
+#if defined(_MACHINE_BUS_PIO_H_)
+#if defined(_MACHINE_BUS_MEMIO_H_)
+ if (tag == IA64_BUS_SPACE_IO)
+#endif
+ while (count--)
+ outb(addr, value);
+#endif
+#if defined(_MACHINE_BUS_MEMIO_H_)
+#if defined(_MACHINE_BUS_PIO_H_)
+ else
+#endif
+ while (count--)
+ writeb(addr, value);
+#endif
+}
+
+static __inline void
+bus_space_set_multi_2(bus_space_tag_t tag, bus_space_handle_t bsh,
+ bus_size_t offset, u_int16_t value, size_t count)
+{
+ bus_addr_t addr = bsh + offset;
+
+#if defined(_MACHINE_BUS_PIO_H_)
+#if defined(_MACHINE_BUS_MEMIO_H_)
+ if (tag == IA64_BUS_SPACE_IO)
+#endif
+ while (count--)
+ outw(addr, value);
+#endif
+#if defined(_MACHINE_BUS_MEMIO_H_)
+#if defined(_MACHINE_BUS_PIO_H_)
+ else
+#endif
+ while (count--)
+ writew(addr, value);
+#endif
+}
+
+static __inline void
+bus_space_set_multi_4(bus_space_tag_t tag, bus_space_handle_t bsh,
+ bus_size_t offset, u_int32_t value, size_t count)
+{
+ bus_addr_t addr = bsh + offset;
+
+#if defined(_MACHINE_BUS_PIO_H_)
+#if defined(_MACHINE_BUS_MEMIO_H_)
+ if (tag == IA64_BUS_SPACE_IO)
+#endif
+ while (count--)
+ outl(addr, value);
+#endif
+#if defined(_MACHINE_BUS_MEMIO_H_)
+#if defined(_MACHINE_BUS_PIO_H_)
+ else
+#endif
+ while (count--)
+ writel(addr, value);
+#endif
+}
+
+#if 0 /* Cause a link error for bus_space_set_multi_8 */
+#define bus_space_set_multi_8 !!! bus_space_set_multi_8 unimplemented !!!
+#endif
+
+/*
+ * Write `count' 1, 2, 4, or 8 byte value `val' to bus space described
+ * by tag/handle starting at `offset'.
+ */
+
+static __inline void bus_space_set_region_1(bus_space_tag_t tag,
+ bus_space_handle_t bsh,
+ bus_size_t offset, u_int8_t value,
+ size_t count);
+static __inline void bus_space_set_region_2(bus_space_tag_t tag,
+ bus_space_handle_t bsh,
+ bus_size_t offset, u_int16_t value,
+ size_t count);
+static __inline void bus_space_set_region_4(bus_space_tag_t tag,
+ bus_space_handle_t bsh,
+ bus_size_t offset, u_int32_t value,
+ size_t count);
+
+static __inline void
+bus_space_set_region_1(bus_space_tag_t tag, bus_space_handle_t bsh,
+ bus_size_t offset, u_int8_t value, size_t count)
+{
+ bus_addr_t addr = bsh + offset;
+
+#if defined(_MACHINE_BUS_PIO_H_)
+#if defined(_MACHINE_BUS_MEMIO_H_)
+ if (tag == IA64_BUS_SPACE_IO)
+#endif
+ for (; count != 0; count--, addr++)
+ outb(addr, value);
+#endif
+#if defined(_MACHINE_BUS_MEMIO_H_)
+#if defined(_MACHINE_BUS_PIO_H_)
+ else
+#endif
+ for (; count != 0; count--, addr++)
+ writeb(addr, value);
+#endif
+}
+
+static __inline void
+bus_space_set_region_2(bus_space_tag_t tag, bus_space_handle_t bsh,
+ bus_size_t offset, u_int16_t value, size_t count)
+{
+ bus_addr_t addr = bsh + offset;
+
+#if defined(_MACHINE_BUS_PIO_H_)
+#if defined(_MACHINE_BUS_MEMIO_H_)
+ if (tag == IA64_BUS_SPACE_IO)
+#endif
+ for (; count != 0; count--, addr += 2)
+ outw(addr, value);
+#endif
+#if defined(_MACHINE_BUS_MEMIO_H_)
+#if defined(_MACHINE_BUS_PIO_H_)
+ else
+#endif
+ for (; count != 0; count--, addr += 2)
+ writew(addr, value);
+#endif
+}
+
+static __inline void
+bus_space_set_region_4(bus_space_tag_t tag, bus_space_handle_t bsh,
+ bus_size_t offset, u_int32_t value, size_t count)
+{
+ bus_addr_t addr = bsh + offset;
+
+#if defined(_MACHINE_BUS_PIO_H_)
+#if defined(_MACHINE_BUS_MEMIO_H_)
+ if (tag == IA64_BUS_SPACE_IO)
+#endif
+ for (; count != 0; count--, addr += 4)
+ outl(addr, value);
+#endif
+#if defined(_MACHINE_BUS_MEMIO_H_)
+#if defined(_MACHINE_BUS_PIO_H_)
+ else
+#endif
+ for (; count != 0; count--, addr += 4)
+ writel(addr, value);
+#endif
+}
+
+#if 0 /* Cause a link error for bus_space_set_region_8 */
+#define bus_space_set_region_8 !!! bus_space_set_region_8 unimplemented !!!
+#endif
+
+/*
+ * Copy `count' 1, 2, 4, or 8 byte values from bus space starting
+ * at tag/bsh1/off1 to bus space starting at tag/bsh2/off2.
+ */
+
+static __inline void bus_space_copy_region_1(bus_space_tag_t tag,
+ bus_space_handle_t bsh1,
+ bus_size_t off1,
+ bus_space_handle_t bsh2,
+ bus_size_t off2, size_t count);
+
+static __inline void bus_space_copy_region_2(bus_space_tag_t tag,
+ bus_space_handle_t bsh1,
+ bus_size_t off1,
+ bus_space_handle_t bsh2,
+ bus_size_t off2, size_t count);
+
+static __inline void bus_space_copy_region_4(bus_space_tag_t tag,
+ bus_space_handle_t bsh1,
+ bus_size_t off1,
+ bus_space_handle_t bsh2,
+ bus_size_t off2, size_t count);
+
+static __inline void
+bus_space_copy_region_1(bus_space_tag_t tag, bus_space_handle_t bsh1,
+ bus_size_t off1, bus_space_handle_t bsh2,
+ bus_size_t off2, size_t count)
+{
+ bus_addr_t addr1 = bsh1 + off1;
+ bus_addr_t addr2 = bsh2 + off2;
+
+#if defined(_MACHINE_BUS_PIO_H_)
+#if defined(_MACHINE_BUS_MEMIO_H_)
+ if (tag == IA64_BUS_SPACE_IO)
+#endif
+ {
+ if (addr1 >= addr2) {
+ /* src after dest: copy forward */
+ for (; count != 0; count--, addr1++, addr2++)
+ outb(addr2, inb(addr1));
+ } else {
+ /* dest after src: copy backwards */
+ for (addr1 += (count - 1), addr2 += (count - 1);
+ count != 0; count--, addr1--, addr2--)
+ outb(addr2, inb(addr1));
+ }
+ }
+#endif
+#if defined(_MACHINE_BUS_MEMIO_H_)
+#if defined(_MACHINE_BUS_PIO_H_)
+ else
+#endif
+ {
+ if (addr1 >= addr2) {
+ /* src after dest: copy forward */
+ for (; count != 0; count--, addr1++, addr2++)
+ writeb(addr2, readb(addr1));
+ } else {
+ /* dest after src: copy backwards */
+ for (addr1 += (count - 1), addr2 += (count - 1);
+ count != 0; count--, addr1--, addr2--)
+ writeb(addr2, readb(addr1));
+ }
+ }
+#endif
+}
+
+static __inline void
+bus_space_copy_region_2(bus_space_tag_t tag, bus_space_handle_t bsh1,
+ bus_size_t off1, bus_space_handle_t bsh2,
+ bus_size_t off2, size_t count)
+{
+ bus_addr_t addr1 = bsh1 + off1;
+ bus_addr_t addr2 = bsh2 + off2;
+
+#if defined(_MACHINE_BUS_PIO_H_)
+#if defined(_MACHINE_BUS_MEMIO_H_)
+ if (tag == IA64_BUS_SPACE_IO)
+#endif
+ {
+ if (addr1 >= addr2) {
+ /* src after dest: copy forward */
+ for (; count != 0; count--, addr1 += 2, addr2 += 2)
+ outw(addr2, inw(addr1));
+ } else {
+ /* dest after src: copy backwards */
+ for (addr1 += 2 * (count - 1), addr2 += 2 * (count - 1);
+ count != 0; count--, addr1 -= 2, addr2 -= 2)
+ outw(addr2, inw(addr1));
+ }
+ }
+#endif
+#if defined(_MACHINE_BUS_MEMIO_H_)
+#if defined(_MACHINE_BUS_PIO_H_)
+ else
+#endif
+ {
+ if (addr1 >= addr2) {
+ /* src after dest: copy forward */
+ for (; count != 0; count--, addr1 += 2, addr2 += 2)
+ writew(addr2, readw(addr1));
+ } else {
+ /* dest after src: copy backwards */
+ for (addr1 += 2 * (count - 1), addr2 += 2 * (count - 1);
+ count != 0; count--, addr1 -= 2, addr2 -= 2)
+ writew(addr2, readw(addr1));
+ }
+ }
+#endif
+}
+
+static __inline void
+bus_space_copy_region_4(bus_space_tag_t tag, bus_space_handle_t bsh1,
+ bus_size_t off1, bus_space_handle_t bsh2,
+ bus_size_t off2, size_t count)
+{
+ bus_addr_t addr1 = bsh1 + off1;
+ bus_addr_t addr2 = bsh2 + off2;
+
+#if defined(_MACHINE_BUS_PIO_H_)
+#if defined(_MACHINE_BUS_MEMIO_H_)
+ if (tag == IA64_BUS_SPACE_IO)
+#endif
+ {
+ if (addr1 >= addr2) {
+ /* src after dest: copy forward */
+ for (; count != 0; count--, addr1 += 4, addr2 += 4)
+ outl(addr2, inl(addr1));
+ } else {
+ /* dest after src: copy backwards */
+ for (addr1 += 4 * (count - 1), addr2 += 4 * (count - 1);
+ count != 0; count--, addr1 -= 4, addr2 -= 4)
+ outl(addr2, inl(addr1));
+ }
+ }
+#endif
+#if defined(_MACHINE_BUS_MEMIO_H_)
+#if defined(_MACHINE_BUS_PIO_H_)
+ else
+#endif
+ {
+ if (addr1 >= addr2) {
+ /* src after dest: copy forward */
+ for (; count != 0; count--, addr1 += 4, addr2 += 4)
+ writel(addr2, readl(addr1));
+ } else {
+ /* dest after src: copy backwards */
+ for (addr1 += 4 * (count - 1), addr2 += 4 * (count - 1);
+ count != 0; count--, addr1 -= 4, addr2 -= 4)
+ writel(addr2, readl(addr1));
+ }
+ }
+#endif
+}
+
+#endif /* defined(_MACHINE_BUS_PIO_H_) || defined(_MACHINE_BUS_MEMIO_H_) */
+
+#if 0 /* Cause a link error for bus_space_copy_8 */
+#define bus_space_copy_region_8 !!! bus_space_copy_region_8 unimplemented !!!
+#endif
+
+/*
+ * Bus read/write barrier methods.
+ *
+ * void bus_space_barrier(bus_space_tag_t tag, bus_space_handle_t bsh,
+ * bus_size_t offset, bus_size_t len, int flags);
+ *
+ */
+#define BUS_SPACE_BARRIER_READ 0x01 /* force read barrier */
+#define BUS_SPACE_BARRIER_WRITE 0x02 /* force write barrier */
+
+static __inline void
+bus_space_barrier(bus_space_tag_t tag, bus_space_handle_t bsh,
+ bus_size_t offset, bus_size_t len, int flags)
+{
+ ia64_mf();
+}
+
+
+/*
+ * Flags used in various bus DMA methods.
+ */
+#define BUS_DMA_WAITOK 0x00 /* safe to sleep (pseudo-flag) */
+#define BUS_DMA_NOWAIT 0x01 /* not safe to sleep */
+#define BUS_DMA_ALLOCNOW 0x02 /* perform resource allocation now */
+#define BUS_DMAMEM_NOSYNC 0x04 /* map memory to not require sync */
+#define BUS_DMA_ISA 0x10 /* map memory for ISA dma */
+#define BUS_DMA_BUS2 0x20 /* placeholders for bus functions... */
+#define BUS_DMA_BUS3 0x40
+#define BUS_DMA_BUS4 0x80
+
+/* Forwards needed by prototypes below. */
+struct mbuf;
+struct uio;
+
+/*
+ * bus_dmasync_op_t
+ *
+ * Operations performed by bus_dmamap_sync().
+ */
+typedef enum {
+ BUS_DMASYNC_PREREAD,
+ BUS_DMASYNC_POSTREAD,
+ BUS_DMASYNC_PREWRITE,
+ BUS_DMASYNC_POSTWRITE
+} bus_dmasync_op_t;
+
+/*
+ * bus_dma_tag_t
+ *
+ * A machine-dependent opaque type describing the characteristics
+ * of how to perform DMA mappings. This structure encapsultes
+ * information concerning address and alignment restrictions, number
+ * of S/G segments, amount of data per S/G segment, etc.
+ */
+typedef struct bus_dma_tag *bus_dma_tag_t;
+
+/*
+ * bus_dmamap_t
+ *
+ * DMA mapping instance information.
+ */
+typedef struct bus_dmamap *bus_dmamap_t;
+
+/*
+ * bus_dma_segment_t
+ *
+ * Describes a single contiguous DMA transaction. Values
+ * are suitable for programming into DMA registers.
+ */
+typedef struct bus_dma_segment {
+ bus_addr_t ds_addr; /* DMA address */
+ bus_size_t ds_len; /* length of transfer */
+} bus_dma_segment_t;
+
+/*
+ * A function that returns 1 if the address cannot be accessed by
+ * a device and 0 if it can be.
+ */
+typedef int bus_dma_filter_t(void *, bus_addr_t);
+
+/*
+ * Allocate a device specific dma_tag encapsulating the constraints of
+ * the parent tag in addition to other restrictions specified:
+ *
+ * alignment: alignment for segments.
+ * boundary: Boundary that segments cannot cross.
+ * lowaddr: Low restricted address that cannot appear in a mapping.
+ * highaddr: High restricted address that cannot appear in a mapping.
+ * filtfunc: An optional function to further test if an address
+ * within the range of lowaddr and highaddr cannot appear
+ * in a mapping.
+ * filtfuncarg: An argument that will be passed to filtfunc in addition
+ * to the address to test.
+ * maxsize: Maximum mapping size supported by this tag.
+ * nsegments: Number of discontinuities allowed in maps.
+ * maxsegsz: Maximum size of a segment in the map.
+ * flags: Bus DMA flags.
+ * dmat: A pointer to set to a valid dma tag should the return
+ * value of this function indicate success.
+ */
+/* XXX Should probably allow specification of alignment */
+int bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignemnt,
+ bus_size_t boundary, bus_addr_t lowaddr,
+ bus_addr_t highaddr, bus_dma_filter_t *filtfunc,
+ void *filtfuncarg, bus_size_t maxsize, int nsegments,
+ bus_size_t maxsegsz, int flags, bus_dma_tag_t *dmat);
+
+int bus_dma_tag_destroy(bus_dma_tag_t dmat);
+
+/*
+ * Allocate a handle for mapping from kva/uva/physical
+ * address space into bus device space.
+ */
+int bus_dmamap_create(bus_dma_tag_t dmat, int flags, bus_dmamap_t *mapp);
+
+/*
+ * Destroy a handle for mapping from kva/uva/physical
+ * address space into bus device space.
+ */
+int bus_dmamap_destroy(bus_dma_tag_t dmat, bus_dmamap_t map);
+
+/*
+ * Allocate a piece of memory that can be efficiently mapped into
+ * bus device space based on the constraints lited in the dma tag.
+ * A dmamap to for use with dmamap_load is also allocated.
+ */
+int bus_dmamem_alloc(bus_dma_tag_t dmat, void** vaddr, int flags,
+ bus_dmamap_t *mapp);
+
+/*
+ * Free a piece of memory and it's allociated dmamap, that was allocated
+ * via bus_dmamem_alloc.
+ */
+void bus_dmamem_free(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map);
+
+/*
+ * A function that processes a successfully loaded dma map or an error
+ * from a delayed load map.
+ */
+typedef void bus_dmamap_callback_t(void *, bus_dma_segment_t *, int, int);
+
+/*
+ * Map the buffer buf into bus space using the dmamap map.
+ */
+int bus_dmamap_load(bus_dma_tag_t dmat, bus_dmamap_t map, void *buf,
+ bus_size_t buflen, bus_dmamap_callback_t *callback,
+ void *callback_arg, int flags);
+
+/*
+ * Perform a syncronization operation on the given map.
+ */
+void _bus_dmamap_sync(bus_dma_tag_t, bus_dmamap_t, bus_dmasync_op_t);
+#define bus_dmamap_sync(dmat, dmamap, op) \
+ if ((dmamap) != NULL) \
+ _bus_dmamap_sync(dmat, dmamap, op)
+
+/*
+ * Release the mapping held by map.
+ */
+void _bus_dmamap_unload(bus_dma_tag_t dmat, bus_dmamap_t map);
+#define bus_dmamap_unload(dmat, dmamap) \
+ if ((dmamap) != NULL) \
+ _bus_dmamap_unload(dmat, dmamap)
+
+#endif /* _MACHINE_BUS_H_ */
diff --git a/sys/ia64/include/bus_memio.h b/sys/ia64/include/bus_memio.h
new file mode 100644
index 0000000..a3b5e9e
--- /dev/null
+++ b/sys/ia64/include/bus_memio.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 1997 Justin Gibbs.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions, and the following disclaimer,
+ * without modification, immediately at the beginning of the file.
+ * 2. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _MACHINE_BUS_MEMIO_H_
+#define _MACHINE_BUS_MEMIO_H_
+#endif /* _MACHINE_BUS_MEMIO_H_ */
diff --git a/sys/ia64/include/bus_pio.h b/sys/ia64/include/bus_pio.h
new file mode 100644
index 0000000..00f6e3d
--- /dev/null
+++ b/sys/ia64/include/bus_pio.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 1997 Justin Gibbs.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions, and the following disclaimer,
+ * without modification, immediately at the beginning of the file.
+ * 2. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _MACHINE_BUS_PIO_H_
+#define _MACHINE_BUS_PIO_H_
+#endif /* _MACHINE_BUS_PIO_H_ */
diff --git a/sys/ia64/include/clock.h b/sys/ia64/include/clock.h
new file mode 100644
index 0000000..a5f1b62
--- /dev/null
+++ b/sys/ia64/include/clock.h
@@ -0,0 +1,25 @@
+/*
+ * Kernel interface to machine-dependent clock driver.
+ * Garrett Wollman, September 1994.
+ * This file is in the public domain.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _MACHINE_CLOCK_H_
+#define _MACHINE_CLOCK_H_
+
+#ifdef _KERNEL
+
+extern int disable_rtc_set;
+extern int wall_cmos_clock;
+extern int adjkerntz;
+
+void DELAY __P((int usec));
+int sysbeep __P((int pitch, int period));
+int acquire_timer2 __P((int mode));
+int release_timer2 __P((void));
+
+#endif
+
+#endif /* !_MACHINE_CLOCK_H_ */
diff --git a/sys/ia64/include/clockvar.h b/sys/ia64/include/clockvar.h
new file mode 100644
index 0000000..f13d1df
--- /dev/null
+++ b/sys/ia64/include/clockvar.h
@@ -0,0 +1,53 @@
+/* $FreeBSD$ */
+/* $NetBSD: clockvar.h,v 1.4 1997/06/22 08:02:18 jonathan Exp $ */
+
+/*
+ * Copyright (c) 1994, 1995 Carnegie-Mellon University.
+ * All rights reserved.
+ *
+ * Author: Chris G. Demetriou
+ *
+ * Permission to use, copy, modify and distribute this software and
+ * its documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
+ * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
+ * School of Computer Science
+ * Carnegie Mellon University
+ * Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie the
+ * rights to redistribute these changes.
+ */
+
+/*
+ * Definitions for cpu-independent clock handling for the alpha and pmax.
+ */
+
+/*
+ * clocktime structure:
+ *
+ * structure passed to TOY clocks when setting them. broken out this
+ * way, so that the time_t -> field conversion can be shared.
+ */
+struct clocktime {
+ int year; /* year - 1900 */
+ int mon; /* month (1 - 12) */
+ int day; /* day (1 - 31) */
+ int hour; /* hour (0 - 23) */
+ int min; /* minute (0 - 59) */
+ int sec; /* second (0 - 59) */
+ int dow; /* day of week (0 - 6; 0 = Sunday) */
+};
+
+#include "clock_if.h"
+
+void clockattach(device_t);
diff --git a/sys/ia64/include/console.h b/sys/ia64/include/console.h
new file mode 100644
index 0000000..fe7f10e
--- /dev/null
+++ b/sys/ia64/include/console.h
@@ -0,0 +1,10 @@
+/* $FreeBSD$ */
+
+#ifndef _MACHINE_CONSOLE_H_
+#define _MACHINE_CONSOLE_H_
+
+#include <sys/fbio.h>
+#include <sys/kbio.h>
+#include <sys/consio.h>
+
+#endif /* !_MACHINE_CONSOLE_H_ */
diff --git a/sys/ia64/include/cpu.h b/sys/ia64/include/cpu.h
new file mode 100644
index 0000000..3da3331
--- /dev/null
+++ b/sys/ia64/include/cpu.h
@@ -0,0 +1,174 @@
+/* $FreeBSD$ */
+/* From: NetBSD: cpu.h,v 1.18 1997/09/23 23:17:49 mjacob Exp */
+
+/*
+ * Copyright (c) 1988 University of Utah.
+ * Copyright (c) 1982, 1990, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * the Systems Programming Group of the University of Utah Computer
+ * Science Department.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * from: Utah $Hdr: cpu.h 1.16 91/03/25$
+ *
+ * @(#)cpu.h 8.4 (Berkeley) 1/5/94
+ */
+
+#ifndef _MACHINE_CPU_H_
+#define _MACHINE_CPU_H_
+
+/*
+ * Exported definitions unique to Alpha cpu support.
+ */
+
+#include <machine/frame.h>
+
+/*
+ * Arguments to hardclock and gatherstats encapsulate the previous
+ * machine state in an opaque clockframe. One the Alpha, we use
+ * what we push on an interrupt (a trapframe).
+ */
+struct clockframe {
+ struct trapframe cf_tf;
+};
+#define CLKF_USERMODE(framep) \
+ (((framep)->cf_tf.tf_cr_ipsr & IA64_PSR_CPL) == IA64_PSR_CPL_USER)
+#define CLKF_BASEPRI(framep) \
+ (((framep)->cf_tf.tf_cr_ipsr & IA64_PSR_I) == 0)
+#define CLKF_PC(framep) ((framep)->cf_tf.tf_cr_iip)
+#define CLKF_INTR(framep) (intr_nesting_level >= 2)
+
+/*
+ * Preempt the current process if in interrupt from user mode,
+ * or after the current trap/syscall if in system mode.
+ */
+#define need_resched() do { want_resched = 1; aston(); } while (0)
+
+#define resched_wanted() want_resched
+
+/*
+ * Give a profiling tick to the current process when the user profiling
+ * buffer pages are invalid. On the hp300, request an ast to send us
+ * through trap, marking the proc as needing a profiling tick.
+ */
+#define need_proftick(p) \
+ do { (p)->p_flag |= P_OWEUPC; aston(); } while (0)
+
+/*
+ * Notify the current process (p) that it has a signal pending,
+ * process as soon as possible.
+ */
+#define signotify(p) aston()
+
+#define aston() PCPU_SET(astpending, 1)
+
+#ifdef _KERNEL
+extern u_int32_t intr_nesting_level; /* bookeeping only; counts sw intrs */
+extern u_int32_t want_resched; /* resched() was called */
+#endif
+
+
+/*
+ * CTL_MACHDEP definitions.
+ */
+#define CPU_CONSDEV 1 /* dev_t: console terminal device */
+#define CPU_ROOT_DEVICE 2 /* string: root device name */
+#define CPU_UNALIGNED_PRINT 3 /* int: print unaligned accesses */
+#define CPU_UNALIGNED_FIX 4 /* int: fix unaligned accesses */
+#define CPU_UNALIGNED_SIGBUS 5 /* int: SIGBUS unaligned accesses */
+#define CPU_BOOTED_KERNEL 6 /* string: booted kernel name */
+#define CPU_ADJKERNTZ 7 /* int: timezone offset (seconds) */
+#define CPU_DISRTCSET 8 /* int: disable resettodr() call */
+#define CPU_WALLCLOCK 9 /* int: indicates wall CMOS clock */
+#define CPU_MAXID 9 /* 9 valid machdep IDs */
+
+#define CTL_MACHDEP_NAMES { \
+ { 0, 0 }, \
+ { "console_device", CTLTYPE_STRUCT }, \
+ { "root_device", CTLTYPE_STRING }, \
+ { "unaligned_print", CTLTYPE_INT }, \
+ { "unaligned_fix", CTLTYPE_INT }, \
+ { "unaligned_sigbus", CTLTYPE_INT }, \
+ { "booted_kernel", CTLTYPE_STRING }, \
+ { "adjkerntz", CTLTYPE_INT }, \
+ { "disable_rtc_set", CTLTYPE_INT }, \
+ { "wall_cmos_clock", CTLTYPE_INT }, \
+}
+
+#ifdef _KERNEL
+
+struct pcb;
+struct proc;
+struct reg;
+struct rpb;
+struct trapframe;
+
+extern struct proc *fpcurproc;
+extern struct rpb *hwrpb;
+extern volatile int mc_expected, mc_received;
+
+void ast __P((struct trapframe *));
+int badaddr __P((void *, size_t));
+int badaddr_read __P((void *, size_t, void *));
+void child_return __P((struct proc *p));
+u_int64_t console_restart __P((u_int64_t, u_int64_t, u_int64_t));
+void do_sir __P((void));
+void dumpconf __P((void));
+void exception_return __P((void)); /* MAGIC */
+void frametoreg __P((struct trapframe *, struct reg *));
+long fswintrberr __P((void)); /* MAGIC */
+int ia64_pa_access __P((u_long));
+void ia64_init __P((void));
+void ia64_fpstate_check __P((struct proc *p));
+void ia64_fpstate_save __P((struct proc *p, int write));
+void ia64_fpstate_drop __P((struct proc *p));
+void ia64_fpstate_switch __P((struct proc *p));
+void init_prom_interface __P((struct rpb*));
+void interrupt
+ __P((unsigned long, unsigned long, unsigned long, struct trapframe *));
+void machine_check
+ __P((unsigned long, struct trapframe *, unsigned long, unsigned long));
+u_int64_t hwrpb_checksum __P((void));
+void hwrpb_restart_setup __P((void));
+void regdump __P((struct trapframe *));
+void regtoframe __P((struct reg *, struct trapframe *));
+int savectx __P((struct pcb *));
+void restorectx __P((struct pcb *));
+void set_iointr __P((void (*)(void *, unsigned long)));
+void switch_exit __P((struct proc *)); /* MAGIC */
+void switch_trampoline __P((void)); /* MAGIC */
+void syscall __P((u_int64_t, struct trapframe *));
+void trap __P((int vector, struct trapframe *framep));
+
+#endif /* _KERNEL */
+
+#endif /* _MACHINE_CPU_H_ */
diff --git a/sys/ia64/include/cpufunc.h b/sys/ia64/include/cpufunc.h
new file mode 100644
index 0000000..3128f70
--- /dev/null
+++ b/sys/ia64/include/cpufunc.h
@@ -0,0 +1,197 @@
+/*-
+ * Copyright (c) 1998 Doug Rabson
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _MACHINE_CPUFUNC_H_
+#define _MACHINE_CPUFUNC_H_
+
+#ifdef _KERNEL
+
+#include <sys/types.h>
+
+#ifdef __GNUC__
+
+static __inline void
+breakpoint(void)
+{
+ __asm __volatile("break 0x80100"); /* XXX use linux value */
+}
+
+#endif
+
+static __inline u_int8_t
+inb(u_int port)
+{
+ return 0; /* TODO: implement this */
+}
+
+static __inline u_int16_t
+inw(u_int port)
+{
+ return 0; /* TODO: implement this */
+}
+
+static __inline u_int32_t
+inl(u_int port)
+{
+ return 0; /* TODO: implement this */
+}
+
+static __inline void
+insb(u_int port, void *addr, size_t count)
+{
+ u_int8_t *p = addr;
+ while (count--)
+ *p++ = inb(port);
+}
+
+static __inline void
+insw(u_int port, void *addr, size_t count)
+{
+ u_int16_t *p = addr;
+ while (count--)
+ *p++ = inw(port);
+}
+
+static __inline void
+insl(u_int port, void *addr, size_t count)
+{
+ u_int32_t *p = addr;
+ while (count--)
+ *p++ = inl(port);
+}
+
+static __inline void
+outb(u_int port, u_int8_t data)
+{
+ return; /* TODO: implement this */
+}
+
+static __inline void
+outw(u_int port, u_int16_t data)
+{
+ return; /* TODO: implement this */
+}
+
+static __inline void
+outl(u_int port, u_int32_t data)
+{
+ return; /* TODO: implement this */
+}
+
+static __inline void
+outsb(u_int port, const void *addr, size_t count)
+{
+ const u_int8_t *p = addr;
+ while (count--)
+ outb(port, *p++);
+}
+
+static __inline void
+outsw(u_int port, const void *addr, size_t count)
+{
+ const u_int16_t *p = addr;
+ while (count--)
+ outw(port, *p++);
+}
+
+static __inline void
+outsl(u_int port, const void *addr, size_t count)
+{
+ const u_int32_t *p = addr;
+ while (count--)
+ outl(port, *p++);
+}
+
+static __inline u_int8_t
+readb(u_int addr)
+{
+ return 0; /* TODO: implement this */
+}
+
+static __inline u_int16_t
+readw(u_int addr)
+{
+ return 0; /* TODO: implement this */
+}
+
+static __inline u_int32_t
+readl(u_int addr)
+{
+ return 0; /* TODO: implement this */
+}
+
+static __inline void
+writeb(u_int addr, u_int8_t data)
+{
+ return; /* TODO: implement this */
+}
+
+static __inline void
+writew(u_int addr, u_int16_t data)
+{
+ return; /* TODO: implement this */
+}
+
+static __inline void
+writel(u_int addr, u_int32_t data)
+{
+ return; /* TODO: implement this */
+}
+
+/*
+ * Bogus interrupt manipulation
+ */
+static __inline void
+disable_intr(void)
+{
+ __asm __volatile ("rsm psr.i;;");
+}
+
+static __inline void
+enable_intr(void)
+{
+ __asm __volatile (";; ssm psr.i;; srlz.d");
+}
+
+static __inline u_int
+save_intr(void)
+{
+ u_int psr;
+ __asm __volatile ("mov %0=psr;;" : "=r" (psr));
+ return psr;
+}
+
+static __inline void
+restore_intr(u_int psr)
+{
+ __asm __volatile ("mov psr.l=%0;; srlz.d" :: "r" (psr));
+}
+
+#endif /* _KERNEL */
+
+#endif /* !_MACHINE_CPUFUNC_H_ */
diff --git a/sys/ia64/include/db_machdep.h b/sys/ia64/include/db_machdep.h
new file mode 100644
index 0000000..1517a54
--- /dev/null
+++ b/sys/ia64/include/db_machdep.h
@@ -0,0 +1,91 @@
+/* $FreeBSD$ */
+/* $NetBSD: db_machdep.h,v 1.6 1997/09/06 02:02:25 thorpej Exp $ */
+
+/*
+ * Copyright (c) 1995 Carnegie-Mellon University.
+ * All rights reserved.
+ *
+ * Author: Chris G. Demetriou
+ *
+ * Permission to use, copy, modify and distribute this software and
+ * its documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
+ * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
+ * School of Computer Science
+ * Carnegie Mellon University
+ * Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie the
+ * rights to redistribute these changes.
+ */
+
+#ifndef _ALPHA_DB_MACHDEP_H_
+#define _ALPHA_DB_MACHDEP_H_
+
+/*
+ * Machine-dependent defines for new kernel debugger.
+ */
+
+#include <sys/param.h>
+#include <vm/vm.h>
+#include <machine/frame.h>
+
+#define DB_NO_AOUT
+
+typedef vm_offset_t db_addr_t; /* address - unsigned */
+typedef long db_expr_t; /* expression - signed */
+
+typedef struct trapframe db_regs_t;
+db_regs_t ddb_regs; /* register state */
+#define DDB_REGS (&ddb_regs)
+
+#define PC_REGS(regs) ((db_addr_t)(regs)->tf_regs[FRAME_PC])
+
+#define BKPT_INST 0x00000080 /* breakpoint instruction */
+#define BKPT_SIZE (4) /* size of breakpoint inst */
+#define BKPT_SET(inst) (BKPT_INST)
+
+#define FIXUP_PC_AFTER_BREAK \
+ (ddb_regs.tf_regs[FRAME_PC] -= BKPT_SIZE);
+
+#define IS_BREAKPOINT_TRAP(type, code) ((type) == ALPHA_KENTRY_IF && \
+ (code) == ALPHA_IF_CODE_BPT)
+#define IS_WATCHPOINT_TRAP(type, code) 0
+
+/*
+ * Functions needed for software single-stepping.
+ */
+
+/* No delay slots on Alpha. */
+#define next_instr_address(v, b) ((db_addr_t) ((b) ? (v) : ((v) + 4)))
+
+u_long db_register_value __P((db_regs_t *, int));
+int kdb_trap __P((unsigned long, unsigned long, unsigned long,
+ unsigned long, struct trapframe *));
+
+/*
+ * Pretty arbitrary
+ */
+#define DB_SMALL_VALUE_MAX 0x7fffffff
+#define DB_SMALL_VALUE_MIN (-0x400001)
+
+/*
+ * We define some of our own commands.
+ */
+#define DB_MACHINE_COMMANDS
+
+/*
+ * We use Elf64 symbols in DDB.
+ */
+#define DB_ELFSIZE 64
+
+#endif /* _ALPHA_DB_MACHDEP_H_ */
diff --git a/sys/ia64/include/efi.h b/sys/ia64/include/efi.h
new file mode 100644
index 0000000..077fe89
--- /dev/null
+++ b/sys/ia64/include/efi.h
@@ -0,0 +1,71 @@
+/*-
+ * Copyright (c) 2000 Doug Rabson
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _MACHINE_EFI_H_
+#define _MACHINE_EFI_H_
+
+/*
+ * Memory types.
+ */
+#define EFI_RESERVED_MEMORY_TYPE 0
+#define EFI_LOADER_CODE 1
+#define EFI_LOADER_DATA 2
+#define EFI_BOOT_SERVICES_CODE 3
+#define EFI_BOOT_SERVICES_DATA 4
+#define EFI_RUNTIME_SERVICES_CODE 5
+#define EFI_RUNTIME_SERVICES_DATA 6
+#define EFI_CONVENTIONAL_MEMORY 7
+#define EFI_UNUSABLE_MEMORY 8
+#define EFI_ACPI_RECLAIM_MEMORY 9
+#define EFI_ACPI_MEMORY_NVS 10
+#define EFI_MEMORY_MAPPED_IO 11
+#define EFI_MEMORY_MAPPED_IO_PORT_SPACE 12
+#define EFI_PAL_CODE 13
+
+struct efi_memory_descriptor {
+ u_int32_t emd_type;
+ vm_offset_t emd_physical_start;
+ vm_offset_t emd_virtul_start;
+ u_int64_t emd_number_of_pages;
+ u_int64_t emd_attribute;
+};
+
+/*
+ * Values for emd_attribute.
+ */
+#define EFI_MEMORY_UC 0x0000000000000001
+#define EFI_MEMORY_WC 0x0000000000000002
+#define EFI_MEMORY_WT 0x0000000000000004
+#define EFI_MEMORY_WB 0x0000000000000008
+#define EFI_MEMORY_UCE 0x0000000000000010
+#define EFI_MEMORY_WP 0x0000000000001000
+#define EFI_MEMORY_RP 0x0000000000002000
+#define EFI_MEMORY_XP 0x0000000000004000
+#define EFI_MEMORY_RUNTIME 0x8000000000000000
+
+#endif /* _MACHINE_EFI_H_ */
diff --git a/sys/ia64/include/elf.h b/sys/ia64/include/elf.h
new file mode 100644
index 0000000..3ed5220
--- /dev/null
+++ b/sys/ia64/include/elf.h
@@ -0,0 +1,203 @@
+/*-
+ * Copyright (c) 1996-1997 John D. Polstra.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _MACHINE_ELF_H_
+#define _MACHINE_ELF_H_ 1
+
+/*
+ * ELF definitions for the IA-64 architecture.
+ */
+
+#include <sys/elf64.h> /* Definitions common to all 64 bit architectures. */
+
+#define __ELF_WORD_SIZE 64 /* Used by <sys/elf_generic.h> */
+#include <sys/elf_generic.h>
+
+#define ELF_ARCH EM_IA_64
+
+#define ELF_MACHINE_OK(x) ((x) == EM_IA_64)
+
+/*
+ * Auxiliary vector entries for passing information to the interpreter.
+ *
+ * The i386 supplement to the SVR4 ABI specification names this "auxv_t",
+ * but POSIX lays claim to all symbols ending with "_t".
+ */
+
+typedef struct { /* Auxiliary vector entry on initial stack */
+ int a_type; /* Entry type. */
+ union {
+ long a_val; /* Integer value. */
+ void *a_ptr; /* Address. */
+ void (*a_fcn)(void); /* Function pointer (not used). */
+ } a_un;
+} Elf64_Auxinfo;
+
+__ElfType(Auxinfo);
+
+/* Values for a_type. */
+#define AT_NULL 0 /* Terminates the vector. */
+#define AT_IGNORE 1 /* Ignored entry. */
+#define AT_EXECFD 2 /* File descriptor of program to load. */
+#define AT_PHDR 3 /* Program header of program already loaded. */
+#define AT_PHENT 4 /* Size of each program header entry. */
+#define AT_PHNUM 5 /* Number of program header entries. */
+#define AT_PAGESZ 6 /* Page size in bytes. */
+#define AT_BASE 7 /* Interpreter's base address. */
+#define AT_FLAGS 8 /* Flags (unused for i386). */
+#define AT_ENTRY 9 /* Where interpreter should transfer control. */
+
+/*
+ * The following non-standard values are used for passing information
+ * from John Polstra's testbed program to the dynamic linker. These
+ * are expected to go away soon.
+ *
+ * Unfortunately, these overlap the Linux non-standard values, so they
+ * must not be used in the same context.
+ */
+#define AT_BRK 10 /* Starting point for sbrk and brk. */
+#define AT_DEBUG 11 /* Debugging level. */
+
+/*
+ * The following non-standard values are used in Linux ELF binaries.
+ */
+#define AT_NOTELF 10 /* Program is not ELF ?? */
+#define AT_UID 11 /* Real uid. */
+#define AT_EUID 12 /* Effective uid. */
+#define AT_GID 13 /* Real gid. */
+#define AT_EGID 14 /* Effective gid. */
+
+#define AT_COUNT 15 /* Count of defined aux entry types. */
+
+/*
+ * Values for e_flags.
+ */
+#define EF_IA_64_MASKOS 0x00ff000f
+#define EF_IA_64_ABI64 0x00000010
+#define EF_IA_64_REDUCEDFP 0x00000020
+#define EF_IA_64_CONS_GP 0x00000040
+#define EF_IA_64_NOFUNCDESC_CONS_GP 0x00000080
+#define EF_IA_64_ABSOLUTE 0x00000100
+#define EF_IA_64_ARCH 0xff000000
+
+/*
+ * Section types.
+ */
+#define SHT_IA_64_EXT 0x70000000
+#define SHT_IA_64_UNWIND 0x70000001
+#define SHT_IA_64_LOPSREG 0x78000000
+#define SHT_IA_64_HIPSREG 0x7fffffff
+
+/*
+ * Section attribute flags.
+ */
+#define SHF_IA_64_SHORT 0x10000000
+#define SHF_IA_64_NORECOV 0x20000000
+
+/*
+ * Relocation types.
+ */
+
+/* Name Value Field Calculation */
+#define R_IA64_NONE 0 /* None */
+#define R_IA64_IMM14 0x21 /* immediate14 S + A */
+#define R_IA64_IMM22 0x22 /* immediate22 S + A */
+#define R_IA64_IMM64 0x23 /* immediate64 S + A */
+#define R_IA64_DIR32MSB 0x24 /* word32 MSB S + A */
+#define R_IA64_DIR32LSB 0x25 /* word32 LSB S + A */
+#define R_IA64_DIR64MSB 0x26 /* word64 MSB S + A */
+#define R_IA64_DIR64LSB 0x27 /* word64 LSB S + A */
+#define R_IA64_GPREL22 0x2a /* immediate22 @gprel(S + A) */
+#define R_IA64_GPREL64I 0x2b /* immediate64 @gprel(S + A) */
+#define R_IA64_GPREL64MSB 0x2e /* word64 MSB @gprel(S + A) */
+#define R_IA64_GPREL64LSB 0x2f /* word64 LSB @gprel(S + A) */
+#define R_IA64_LTOFF22 0x32 /* immediate22 @ltoff(S + A) */
+#define R_IA64_LTOFF64I 0x33 /* immediate64 @ltoff(S + A) */
+#define R_IA64_PLTOFF22 0x3a /* immediate22 @pltoff(S + A) */
+#define R_IA64_PLTOFF64I 0x3b /* immediate64 @pltoff(S + A) */
+#define R_IA64_PLTOFF64MSB 0x3e /* word64 MSB @pltoff(S + A) */
+#define R_IA64_PLTOFF64LSB 0x3f /* word64 LSB @pltoff(S + A) */
+#define R_IA64_FPTR64I 0x43 /* immediate64 @fptr(S + A) */
+#define R_IA64_FPTR32MSB 0x44 /* word32 MSB @fptr(S + A) */
+#define R_IA64_FPTR32LSB 0x45 /* word32 LSB @fptr(S + A) */
+#define R_IA64_FPTR64MSB 0x46 /* word64 MSB @fptr(S + A) */
+#define R_IA64_FPTR64LSB 0x47 /* word64 LSB @fptr(S + A) */
+#define R_IA64_PCREL21B 0x49 /* immediate21 form1 S + A - P */
+#define R_IA64_PCREL21M 0x4a /* immediate21 form2 S + A - P */
+#define R_IA64_PCREL21F 0x4b /* immediate21 form3 S + A - P */
+#define R_IA64_PCREL32MSB 0x4c /* word32 MSB S + A - P */
+#define R_IA64_PCREL32LSB 0x4d /* word32 LSB S + A - P */
+#define R_IA64_PCREL64MSB 0x4e /* word64 MSB S + A - P */
+#define R_IA64_PCREL64LSB 0x4f /* word64 LSB S + A - P */
+#define R_IA64_LTOFF_FPTR22 0x52 /* immediate22 @ltoff(@fptr(S + A)) */
+#define R_IA64_LTOFF_FPTR64I 0x53 /* immediate64 @ltoff(@fptr(S + A)) */
+#define R_IA64_LTOFF_FPTR32MSB 0x54 /* word32 MSB @ltoff(@fptr(S + A)) */
+#define R_IA64_LTOFF_FPTR32LSB 0x55 /* word32 LSB @ltoff(@fptr(S + A)) */
+#define R_IA64_LTOFF_FPTR64MSB 0x56 /* word64 MSB @ltoff(@fptr(S + A)) */
+#define R_IA64_LTOFF_FPTR64LSB 0x57 /* word64 LSB @ltoff(@fptr(S + A)) */
+#define R_IA64_SEGREL32MSB 0x5c /* word32 MSB @segrel(S + A) */
+#define R_IA64_SEGREL32LSB 0x5d /* word32 LSB @segrel(S + A) */
+#define R_IA64_SEGREL64MSB 0x5e /* word64 MSB @segrel(S + A) */
+#define R_IA64_SEGREL64LSB 0x5f /* word64 LSB @segrel(S + A) */
+#define R_IA64_SECREL32MSB 0x64 /* word32 MSB @secrel(S + A) */
+#define R_IA64_SECREL32LSB 0x65 /* word32 LSB @secrel(S + A) */
+#define R_IA64_SECREL64MSB 0x66 /* word64 MSB @secrel(S + A) */
+#define R_IA64_SECREL64LSB 0x67 /* word64 LSB @secrel(S + A) */
+#define R_IA64_REL32MSB 0x6c /* word32 MSB BD + A */
+#define R_IA64_REL32LSB 0x6d /* word32 LSB BD + A */
+#define R_IA64_REL64MSB 0x6e /* word64 MSB BD + A */
+#define R_IA64_REL64LSB 0x6f /* word64 LSB BD + A */
+#define R_IA64_LTV32MSB 0x74 /* word32 MSB S + A */
+#define R_IA64_LTV32LSB 0x75 /* word32 LSB S + A */
+#define R_IA64_LTV64MSB 0x76 /* word64 MSB S + A */
+#define R_IA64_LTV64LSB 0x77 /* word64 LSB S + A */
+#define R_IA64_IPLTMSB 0x80 /* function descriptor MSB special */
+#define R_IA64_IPLTLSB 0x81 /* function descriptor LSB speciaal */
+#define R_IA64_SUB 0x85 /* immediate64 A - S */
+#define R_IA64_LTOFF22X 0x86 /* immediate22 special */
+#define R_IA64_LDXMOV 0x87 /* immediate22 special */
+
+/* Define "machine" characteristics */
+#define ELF_TARG_CLASS ELFCLASS64
+#define ELF_TARG_DATA ELFDATA2LSB
+#define ELF_TARG_MACH EM_IA_64
+#define ELF_TARG_VER 1
+
+#ifdef _KERNEL
+
+/*
+ * On the ia64 we load the dynamic linker where a userland call
+ * to mmap(0, ...) would put it. The rationale behind this
+ * calculation is that it leaves room for the heap to grow to
+ * its maximum allowed size.
+ */
+#define ELF_RTLD_ADDR(vmspace) \
+ (round_page((vm_offset_t)(vmspace)->vm_daddr + MAXDSIZ))
+
+#endif /* _KERNEL */
+#endif /* !_MACHINE_ELF_H_ */
diff --git a/sys/ia64/include/endian.h b/sys/ia64/include/endian.h
new file mode 100644
index 0000000..67e4540
--- /dev/null
+++ b/sys/ia64/include/endian.h
@@ -0,0 +1,97 @@
+/* $FreeBSD$ */
+/* From: NetBSD: endian.h,v 1.5 1997/10/09 15:42:19 bouyer Exp */
+
+/*
+ * Copyright (c) 1987, 1991, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)endian.h 8.1 (Berkeley) 6/10/93
+ */
+
+#ifndef _ENDIAN_H_
+#define _ENDIAN_H_
+
+/*
+ * Define the order of 32-bit words in 64-bit words.
+ */
+#define _QUAD_HIGHWORD 1
+#define _QUAD_LOWWORD 0
+
+#ifndef _POSIX_SOURCE
+/*
+ * Definitions for byte order, according to byte significance from low
+ * address to high.
+ */
+#define LITTLE_ENDIAN 1234 /* LSB first: i386, vax */
+#define BIG_ENDIAN 4321 /* MSB first: 68000, ibm, net */
+#define PDP_ENDIAN 3412 /* LSB first in word, MSW first in long */
+
+#define BYTE_ORDER LITTLE_ENDIAN
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+
+typedef u_int32_t in_addr_t;
+typedef u_int16_t in_port_t;
+
+__BEGIN_DECLS
+in_addr_t htonl __P((in_addr_t));
+in_port_t htons __P((in_port_t));
+in_addr_t ntohl __P((in_addr_t));
+in_port_t ntohs __P((in_port_t));
+u_int16_t bswap16 __P((u_int16_t));
+u_int32_t bswap32 __P((u_int32_t));
+u_int64_t bswap64 __P((u_int64_t));
+__END_DECLS
+
+/*
+ * Macros for network/external number representation conversion.
+ */
+#if BYTE_ORDER == BIG_ENDIAN && !defined(lint)
+#define ntohl(x) (x)
+#define ntohs(x) (x)
+#define htonl(x) (x)
+#define htons(x) (x)
+
+#define NTOHL(x) (x)
+#define NTOHS(x) (x)
+#define HTONL(x) (x)
+#define HTONS(x) (x)
+
+#else
+
+#define NTOHL(x) (x) = ntohl((in_addr_t)x)
+#define NTOHS(x) (x) = ntohs((in_port_t)x)
+#define HTONL(x) (x) = htonl((in_addr_t)x)
+#define HTONS(x) (x) = htons((in_port_t)x)
+#endif
+#endif /* !_POSIX_SOURCE */
+#endif /* !_ENDIAN_H_ */
diff --git a/sys/ia64/include/exec.h b/sys/ia64/include/exec.h
new file mode 100644
index 0000000..52baf9e
--- /dev/null
+++ b/sys/ia64/include/exec.h
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 1998 John Birrell <jb@cimlogic.com.au>.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by John Birrell.
+ * 4. Neither the name of the author nor the names of any co-contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#define __LDPGSZ 4096
diff --git a/sys/ia64/include/float.h b/sys/ia64/include/float.h
new file mode 100644
index 0000000..0420ffb
--- /dev/null
+++ b/sys/ia64/include/float.h
@@ -0,0 +1,79 @@
+/* $FreeBSD$ */
+/* From: NetBSD: float.h,v 1.6 1997/07/17 21:36:03 thorpej Exp */
+
+/*
+ * Copyright (c) 1989, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef _MACHINE_FLOAT_H_
+#define _MACHINE_FLOAT_H_
+
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+int __flt_rounds __P((void));
+__END_DECLS
+
+#define FLT_RADIX 2 /* b */
+#define FLT_ROUNDS __flt_rounds()
+
+#define FLT_MANT_DIG 24 /* p */
+#define FLT_EPSILON 1.19209290E-07F /* b**(1-p) */
+#define FLT_DIG 6 /* floor((p-1)*log10(b))+(b == 10) */
+#define FLT_MIN_EXP -125 /* emin */
+#define FLT_MIN 1.17549435E-38F /* b**(emin-1) */
+#define FLT_MIN_10_EXP -37 /* ceil(log10(b**(emin-1))) */
+#define FLT_MAX_EXP 128 /* emax */
+#define FLT_MAX 3.40282347E+38F /* (1-b**(-p))*b**emax */
+#define FLT_MAX_10_EXP 38 /* floor(log10((1-b**(-p))*b**emax)) */
+
+#define DBL_MANT_DIG 53
+#define DBL_EPSILON 2.2204460492503131E-16
+#define DBL_DIG 15
+#define DBL_MIN_EXP -1021
+#define DBL_MIN 2.2250738585072014E-308
+#define DBL_MIN_10_EXP -307
+#define DBL_MAX_EXP 1024
+#define DBL_MAX 1.7976931348623157E+308
+#define DBL_MAX_10_EXP 308
+
+#define LDBL_MANT_DIG DBL_MANT_DIG
+#define LDBL_EPSILON DBL_EPSILON
+#define LDBL_DIG DBL_DIG
+#define LDBL_MIN_EXP DBL_MIN_EXP
+#define LDBL_MIN DBL_MIN
+#define LDBL_MIN_10_EXP DBL_MIN_10_EXP
+#define LDBL_MAX_EXP DBL_MAX_EXP
+#define LDBL_MAX DBL_MAX
+#define LDBL_MAX_10_EXP DBL_MAX_10_EXP
+
+#endif /* _MACHINE_FLOAT_H_ */
diff --git a/sys/ia64/include/floatingpoint.h b/sys/ia64/include/floatingpoint.h
new file mode 100644
index 0000000..e2faa5e
--- /dev/null
+++ b/sys/ia64/include/floatingpoint.h
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 1998 John Birrell <jb@cimlogic.com.au>.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by John Birrell.
+ * 4. Neither the name of the author nor the names of any co-contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#include <machine/ieeefp.h>
diff --git a/sys/ia64/include/fpu.h b/sys/ia64/include/fpu.h
new file mode 100644
index 0000000..f9d426c
--- /dev/null
+++ b/sys/ia64/include/fpu.h
@@ -0,0 +1,81 @@
+/*-
+ * Copyright (c) 1998 Doug Rabson
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _MACHINE_FPU_H_
+#define _MACHINE_FPU_H_
+
+/*
+ * Floating point status register bits.
+ */
+
+#define IA64_FPSR_TRAP_VD 0x0000000000000001L
+#define IA64_FPSR_TRAP_DD 0x0000000000000002L
+#define IA64_FPSR_TRAP_ZD 0x0000000000000004L
+#define IA64_FPSR_TRAP_OD 0x0000000000000008L
+#define IA64_FPSR_TRAP_UD 0x0000000000000010L
+#define IA64_FPSR_TRAP_ID 0x0000000000000020L
+#define IA64_FPSR_SF(i,v) ((v) << ((i)*13+6))
+
+#define IA64_SF_FTZ 0x0001L
+#define IA64_SF_WRE 0x0002L
+#define IA64_SF_PC 0x000cL
+#define IA64_SF_PC_0 0x0000L
+#define IA64_SF_PC_1 0x0004L
+#define IA64_SF_PC_2 0x0008L
+#define IA64_SF_PC_3 0x000cL
+#define IA64_SF_RC 0x0030L
+#define IA64_SF_RC_NEAREST 0x0000L
+#define IA64_SF_RC_NEGINF 0x0010L
+#define IA64_SF_RC_POSINF 0x0020L
+#define IA64_SF_RC_TRUNC 0x0030L
+#define IA64_SF_TD 0x0040L
+#define IA64_SF_V 0x0080L
+#define IA64_SF_D 0x0100L
+#define IA64_SF_Z 0x0200L
+#define IA64_SF_O 0x0400L
+#define IA64_SF_U 0x0800L
+#define IA64_SF_I 0x1000L
+
+#define IA64_SF_DEFAULT (IA64_SF_PC_3 | IA64_SF_RC_NEAREST)
+
+#define IA64_FPSR_DEFAULT (IA64_FPSR_TRAP_VD \
+ | IA64_FPSR_TRAP_DD \
+ | IA64_FPSR_TRAP_ZD \
+ | IA64_FPSR_TRAP_OD \
+ | IA64_FPSR_TRAP_UD \
+ | IA64_FPSR_TRAP_ID \
+ | IA64_FPSR_SF(0, IA64_SF_DEFAULT) \
+ | IA64_FPSR_SF(1, (IA64_SF_DEFAULT \
+ | IA64_SF_TD \
+ | IA64_SF_WRE)) \
+ | IA64_FPSR_SF(2, (IA64_SF_DEFAULT \
+ | IA64_SF_TD)) \
+ | IA64_FPSR_SF(3, (IA64_SF_DEFAULT \
+ | IA64_SF_TD)))
+
+#endif /* ! _MACHINE_FPU_H_ */
diff --git a/sys/ia64/include/frame.h b/sys/ia64/include/frame.h
new file mode 100644
index 0000000..2304770
--- /dev/null
+++ b/sys/ia64/include/frame.h
@@ -0,0 +1,114 @@
+/*-
+ * Copyright (c) 2000 Doug Rabson
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _MACHINE_FRAME_H_
+#define _MACHINE_FRAME_H_
+
+#include <machine/reg.h>
+
+/*
+ * Software trap, exception, and syscall frame.
+ *
+ * This is loosely based on the Linux pt_regs structure. When I
+ * understand things better, I might change it.
+ */
+struct trapframe {
+ u_int64_t tf_cr_iip;
+ u_int64_t tf_cr_ipsr;
+ u_int64_t tf_cr_isr;
+ u_int64_t tf_cr_ifa;
+ u_int64_t tf_pr;
+ u_int64_t tf_ar_rsc;
+ u_int64_t tf_ar_pfs;
+ u_int64_t tf_cr_ifs;
+ u_int64_t tf_ar_bspstore;
+ u_int64_t tf_ar_rnat;
+ u_int64_t tf_ar_bsp;
+ u_int64_t tf_ar_unat;
+ u_int64_t tf_ar_ccv;
+ u_int64_t tf_ar_fpsr;
+
+ u_int64_t tf_b[8];
+
+ u_int64_t tf_r[31]; /* don't need to save r0 */
+#define FRAME_R1 0
+#define FRAME_GP 0
+#define FRAME_R2 1
+#define FRAME_R3 2
+#define FRAME_R4 3
+#define FRAME_R5 4
+#define FRAME_R6 5
+#define FRAME_R7 6
+#define FRAME_R8 7
+#define FRAME_R9 8
+#define FRAME_R10 9
+#define FRAME_R11 10
+#define FRAME_R12 11
+#define FRAME_SP 11
+#define FRAME_R13 12
+#define FRAME_TP 12
+#define FRAME_R14 13
+#define FRAME_R15 14
+#define FRAME_R16 15
+#define FRAME_R17 16
+#define FRAME_R18 17
+#define FRAME_R19 18
+#define FRAME_R20 19
+#define FRAME_R21 20
+#define FRAME_R22 21
+#define FRAME_R23 22
+#define FRAME_R24 23
+#define FRAME_R25 24
+#define FRAME_R26 25
+#define FRAME_R27 26
+#define FRAME_R28 27
+#define FRAME_R29 28
+#define FRAME_R30 29
+#define FRAME_R31 30
+
+ u_int64_t tf_pad1;
+
+ /*
+ * We rely on the compiler to save/restore f2-f5 and
+ * f16-f31. We also tell the compiler to avoid f32-f127
+ * completely so we don't worry about them at all.
+ */
+ struct ia64_fpreg tf_f[10];
+#define FRAME_F6 0
+#define FRAME_F7 1
+#define FRAME_F8 2
+#define FRAME_F9 3
+#define FRAME_F10 3
+#define FRAME_F11 3
+#define FRAME_F12 3
+#define FRAME_F13 3
+#define FRAME_F14 3
+#define FRAME_F15 3
+};
+
+#endif /* _MACHINE_FRAME_H_ */
diff --git a/sys/ia64/include/globaldata.h b/sys/ia64/include/globaldata.h
new file mode 100644
index 0000000..87c9fe5
--- /dev/null
+++ b/sys/ia64/include/globaldata.h
@@ -0,0 +1,78 @@
+/*-
+ * Copyright (c) 1999 Luoqi Chen <luoqi@freebsd.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _MACHINE_GLOBALDATA_H_
+#define _MACHINE_GLOBALDATA_H_
+
+#ifdef _KERNEL
+
+#include <sys/queue.h>
+
+/*
+ * This structure maps out the global data that needs to be kept on a
+ * per-cpu basis. genassym uses this to generate offsets for the assembler
+ * code, which also provides external symbols so that C can get at them as
+ * though they were really globals. This structure is pointed to by
+ * the per-cpu system value (see alpha_pal_rdval() and alpha_pal_wrval()).
+ * Inside the kernel, the globally reserved register t7 is used to
+ * point at the globaldata structure.
+ */
+struct globaldata {
+ struct proc *gd_curproc; /* current process */
+ struct proc *gd_idleproc; /* idle process */
+ struct proc *gd_fpcurproc; /* fp state owner */
+ struct pcb *gd_curpcb; /* current pcb */
+ struct timeval gd_switchtime;
+ int gd_switchticks;
+ u_int gd_cpuno; /* this cpu number */
+ u_int gd_other_cpus; /* all other cpus */
+ int gd_inside_intr;
+ u_int64_t gd_idlepcbphys; /* pa of gd_idlepcb */
+ u_int64_t gd_pending_ipis; /* pending IPI events */
+ u_int32_t gd_next_asn; /* next ASN to allocate */
+ u_int32_t gd_current_asngen; /* ASN rollover check */
+ u_int32_t gd_intr_nesting_level; /* interrupt recursion */
+
+ u_int gd_astpending;
+ SLIST_ENTRY(globaldata) gd_allcpu;
+#ifdef KTR_PERCPU
+ volatile int gd_ktr_idx; /* Index into trace table */
+ char *gd_ktr_buf;
+ char gd_ktr_buf_data[0];
+#endif
+};
+
+SLIST_HEAD(cpuhead, globaldata);
+extern struct cpuhead cpuhead;
+
+void globaldata_init(struct globaldata *pcpu, int cpuno, size_t sz);
+struct globaldata *globaldata_find(int cpuno);
+
+#endif /* _KERNEL */
+
+#endif /* !_MACHINE_GLOBALDATA_H_ */
diff --git a/sys/ia64/include/globals.h b/sys/ia64/include/globals.h
new file mode 100644
index 0000000..4046bff
--- /dev/null
+++ b/sys/ia64/include/globals.h
@@ -0,0 +1,63 @@
+/*-
+ * Copyright (c) 1999 Luoqi Chen <luoqi@freebsd.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _MACHINE_GLOBALS_H_
+#define _MACHINE_GLOBALS_H_
+
+#ifdef _KERNEL
+
+register struct globaldata *globalp __asm__("r13");
+
+#if 1
+#define GLOBALP globalp
+#else
+#define GLOBALP ((struct globaldata *) alpha_pal_rdval())
+#endif
+
+#define PCPU_GET(name) (GLOBALP->gd_##name)
+#define PCPU_SET(name,value) (GLOBALP->gd_##name = (value))
+
+/*
+ * The following set of macros works for UP kernel as well, but for maximum
+ * performance we allow the global variables to be accessed directly. On the
+ * other hand, kernel modules should always use these macros to maintain
+ * portability between UP and SMP kernels.
+ */
+#define CURPROC PCPU_GET(curproc)
+#define curproc PCPU_GET(curproc)
+#define idleproc PCPU_GET(idleproc)
+#define curpcb PCPU_GET(curpcb)
+#define fpcurproc PCPU_GET(fpcurproc)
+#define switchtime PCPU_GET(switchtime)
+#define switchticks PCPU_GET(switchticks)
+#define cpuid PCPU_GET(cpuno)
+#define prevproc PCPU_GET(curproc) /* XXX - until ithreads */
+
+#endif /* _KERNEL */
+
+#endif /* !_MACHINE_GLOBALS_H_ */
diff --git a/sys/ia64/include/ia64_cpu.h b/sys/ia64/include/ia64_cpu.h
new file mode 100644
index 0000000..ca205c2
--- /dev/null
+++ b/sys/ia64/include/ia64_cpu.h
@@ -0,0 +1,203 @@
+/*-
+ * Copyright (c) 2000 Doug Rabson
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _MACHINE_IA64_CPU_H_
+#define _MACHINE_IA64_CPU_H_
+
+/*
+ * Definition of PSR and IPSR bits.
+ */
+#define IA64_PSR_BE 0x0000000000000002
+#define IA64_PSR_UP 0x0000000000000004
+#define IA64_PSR_AC 0x0000000000000008
+#define IA64_PSR_MFL 0x0000000000000010
+#define IA64_PSR_MFH 0x0000000000000020
+#define IA64_PSR_IC 0x0000000000002000
+#define IA64_PSR_I 0x0000000000004000
+#define IA64_PSR_PK 0x0000000000008000
+#define IA64_PSR_DT 0x0000000000020000
+#define IA64_PSR_DFL 0x0000000000040000
+#define IA64_PSR_DFH 0x0000000000080000
+#define IA64_PSR_SP 0x0000000000100000
+#define IA64_PSR_PP 0x0000000000200000
+#define IA64_PSR_DI 0x0000000000400000
+#define IA64_PSR_SI 0x0000000000800000
+#define IA64_PSR_DB 0x0000000001000000
+#define IA64_PSR_LP 0x0000000002000000
+#define IA64_PSR_TB 0x0000000004000000
+#define IA64_PSR_RT 0x0000000008000000
+#define IA64_PSR_CPL 0x0000000300000000
+#define IA64_PSR_CPL_KERN 0x0000000000000000
+#define IA64_PSR_CPL_1 0x0000000100000000
+#define IA64_PSR_CPL_2 0x0000000200000000
+#define IA64_PSR_CPL_USER 0x0000000300000000
+#define IA64_PSR_IS 0x0000000400000000
+#define IA64_PSR_MC 0x0000000800000000
+#define IA64_PSR_IT 0x0000001000000000
+#define IA64_PSR_ID 0x0000002000000000
+#define IA64_PSR_DA 0x0000004000000000
+#define IA64_PSR_DD 0x0000008000000000
+#define IA64_PSR_SS 0x0000010000000000
+#define IA64_PSR_RI 0x0000060000000000
+#define IA64_PSR_RI_0 0x0000000000000000
+#define IA64_PSR_RI_1 0x0000020000000000
+#define IA64_PSR_RI_2 0x0000040000000000
+#define IA64_PSR_ED 0x0000080000000000
+#define IA64_PSR_BN 0x0000100000000000
+#define IA64_PSR_IA 0x0000200000000000
+
+/*
+ * Definition of ISR bits.
+ */
+#define IA64_ISR_CODE 0x000000000000ffff
+#define IA64_ISR_VECTOR 0x0000000000ff0000
+#define IA64_ISR_X 0x0000000100000000
+#define IA64_ISR_W 0x0000000200000000
+#define IA64_ISR_R 0x0000000400000000
+#define IA64_ISR_NA 0x0000000800000000
+#define IA64_ISR_SP 0x0000001000000000
+#define IA64_ISR_RS 0x0000002000000000
+#define IA64_ISR_IR 0x0000004000000000
+#define IA64_ISR_NI 0x0000008000000000
+#define IA64_ISR_SO 0x0000010000000000
+#define IA64_ISR_EI 0x0000060000000000
+#define IA64_ISR_EI_0 0x0000000000000000
+#define IA64_ISR_EI_1 0x0000020000000000
+#define IA64_ISR_EI_2 0x0000040000000000
+#define IA64_ISR_ED 0x0000080000000000
+
+/*
+ * Vector numbers for various ia64 interrupts.
+ */
+#define IA64_VEC_VHPT 0
+#define IA64_VEC_ITLB 1
+#define IA64_VEC_DTLB 2
+#define IA64_VEC_ALT_ITLB 3
+#define IA64_VEC_ALT_DTLB 4
+#define IA64_VEC_NESTED_DTLB 5
+#define IA64_VEC_IKEY_MISS 6
+#define IA64_VEC_DKEY_MISS 7
+#define IA64_VEC_DIRTY_BIT 8
+#define IA64_VEC_INST_ACCESS 9
+#define IA64_VEC_DATA_ACCESS 10
+#define IA64_VEC_BREAK 11
+#define IA64_VEC_EXT_INTR 12
+#define IA64_VEC_PAGE_NOT_PRESENT 20
+#define IA64_VEC_KEY_PERMISSION 21
+#define IA64_VEC_INST_ACCESS_RIGHTS 22
+#define IA64_VEC_DATA_ACCESS_RIGHTS 23
+#define IA64_VEC_GENERAL_EXCEPTION 24
+#define IA64_VEC_DISABLED_FP 25
+#define IA64_VEC_NAT_CONSUMPTION 26
+#define IA64_VEC_SPECULATION 27
+#define IA64_VEC_DEBUG 29
+#define IA64_VEC_UNALIGNED_REFERENCE 30
+#define IA64_VEC_UNSUPP_DATA_REFERENCE 31
+#define IA64_VEC_FLOATING_POINT_FAULT 32
+#define IA64_VEC_FLOATING_POINT_TRAP 33
+#define IA64_VEC_LOWER_PRIVILEGE_TRANSFER 34
+#define IA64_VEC_TAKEN_BRANCH_TRAP 35
+#define IA64_VEC_SINGLE_STEP_TRAP 36
+#define IA64_VEC_IA32_EXCEPTION 45
+#define IA64_VEC_IA32_INTERCEPT 46
+#define IA64_VEC_IA32_INTERRUPT 47
+
+/*
+ * Manipulating region bits of an address.
+ */
+#define IA64_RR_BASE(n) (((u_int64_t) (n)) << 61)
+#define IA64_RR_MASK(x) ((x) & ((1L << 61) - 1))
+
+#define IA64_PHYS_TO_RR6(x) ((x) | IA64_RR_BASE(6))
+#define IA64_PHYS_TO_RR7(x) ((x) | IA64_RR_BASE(7))
+
+/*
+ * Various special ia64 instructions.
+ */
+
+/*
+ * Memory Fence.
+ */
+static __inline void
+ia64_mf(void)
+{
+ __asm __volatile("mf");
+}
+
+/*
+ * Calculate address in VHPT for va.
+ */
+static __inline u_int64_t
+ia64_thash(u_int64_t va)
+{
+ u_int64_t result;
+ __asm __volatile("thash %0=%1" : "=r" (result) : "r" (va));
+ return result;
+}
+
+/*
+ * Calculate VHPT tag for va.
+ */
+static __inline u_int64_t
+ia64_ttag(u_int64_t va)
+{
+ u_int64_t result;
+ __asm __volatile("ttag %0=%1" : "=r" (result) : "r" (va));
+ return result;
+}
+
+/*
+ * Convert virtual address to physical.
+ */
+static __inline u_int64_t
+ia64_tpa(u_int64_t va)
+{
+ u_int64_t result;
+ __asm __volatile("tpa %0=%1" : "=r" (result) : "r" (va));
+ return result;
+}
+
+/*
+ * Read the value of ar.itc.
+ */
+static __inline u_int64_t
+ia64_read_itc(void)
+{
+ u_int64_t result;
+ __asm __volatile("mov %0=ar.itc" : "=r" (result));
+ return result;
+}
+
+static __inline void
+ia64_set_rr(u_int64_t rrbase, u_int64_t v)
+{
+ __asm __volatile("mov rr[%0]=%1" :: "r"(rrbase), "r"(v) : "memory");
+}
+
+#endif /* _MACHINE_IA64_CPU_H_ */
+
diff --git a/sys/ia64/include/ieee.h b/sys/ia64/include/ieee.h
new file mode 100644
index 0000000..654d6ee
--- /dev/null
+++ b/sys/ia64/include/ieee.h
@@ -0,0 +1,124 @@
+/* $FreeBSD$ */
+/* From: NetBSD: ieee.h,v 1.2 1997/04/06 08:47:27 cgd Exp */
+
+/*
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This software was developed by the Computer Systems Engineering group
+ * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
+ * contributed to Berkeley.
+ *
+ * All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Lawrence Berkeley Laboratory.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)ieee.h 8.1 (Berkeley) 6/11/93
+ *
+ * from: Header: ieee.h,v 1.7 92/11/26 02:04:37 torek Exp
+ */
+
+/*
+ * ieee.h defines the machine-dependent layout of the machine's IEEE
+ * floating point. It does *not* define (yet?) any of the rounding
+ * mode bits, exceptions, and so forth.
+ */
+
+/*
+ * Define the number of bits in each fraction and exponent.
+ *
+ * k k+1
+ * Note that 1.0 x 2 == 0.1 x 2 and that denorms are represented
+ *
+ * (-exp_bias+1)
+ * as fractions that look like 0.fffff x 2 . This means that
+ *
+ * -126
+ * the number 0.10000 x 2 , for instance, is the same as the normalized
+ *
+ * -127 -128
+ * float 1.0 x 2 . Thus, to represent 2 , we need one leading zero
+ *
+ * -129
+ * in the fraction; to represent 2 , we need two, and so on. This
+ *
+ * (-exp_bias-fracbits+1)
+ * implies that the smallest denormalized number is 2
+ *
+ * for whichever format we are talking about: for single precision, for
+ *
+ * -126 -149
+ * instance, we get .00000000000000000000001 x 2 , or 1.0 x 2 , and
+ *
+ * -149 == -127 - 23 + 1.
+ */
+#define SNG_EXPBITS 8
+#define SNG_FRACBITS 23
+
+#define DBL_EXPBITS 11
+#define DBL_FRACBITS 52
+
+struct ieee_single {
+ u_int sng_frac:23;
+ u_int sng_exp:8;
+ u_int sng_sign:1;
+};
+
+struct ieee_double {
+ u_int dbl_fracl;
+ u_int dbl_frach:20;
+ u_int dbl_exp:11;
+ u_int dbl_sign:1;
+};
+
+/*
+ * Floats whose exponent is in [1..INFNAN) (of whatever type) are
+ * `normal'. Floats whose exponent is INFNAN are either Inf or NaN.
+ * Floats whose exponent is zero are either zero (iff all fraction
+ * bits are zero) or subnormal values.
+ *
+ * A NaN is a `signalling NaN' if its QUIETNAN bit is clear in its
+ * high fraction; if the bit is set, it is a `quiet NaN'.
+ */
+#define SNG_EXP_INFNAN 255
+#define DBL_EXP_INFNAN 2047
+
+#if 0
+#define SNG_QUIETNAN (1 << 22)
+#define DBL_QUIETNAN (1 << 19)
+#endif
+
+/*
+ * Exponent biases.
+ */
+#define SNG_EXP_BIAS 127
+#define DBL_EXP_BIAS 1023
diff --git a/sys/ia64/include/ieeefp.h b/sys/ia64/include/ieeefp.h
new file mode 100644
index 0000000..d673507
--- /dev/null
+++ b/sys/ia64/include/ieeefp.h
@@ -0,0 +1,29 @@
+/* $FreeBSD$ */
+/* From: NetBSD: ieeefp.h,v 1.2 1997/04/06 08:47:28 cgd Exp */
+
+/*
+ * Written by J.T. Conklin, Apr 28, 1995
+ * Public domain.
+ */
+
+#ifndef _ALPHA_IEEEFP_H_
+#define _ALPHA_IEEEFP_H_
+
+typedef int fp_except_t;
+#define FP_X_INV (1LL << 1) /* invalid operation exception */
+#define FP_X_DZ (1LL << 2) /* divide-by-zero exception */
+#define FP_X_OFL (1LL << 3) /* overflow exception */
+#define FP_X_UFL (1LL << 4) /* underflow exception */
+#define FP_X_IMP (1LL << 5) /* imprecise(inexact) exception */
+#if 0
+#define FP_X_IOV (1LL << 6) /* integer overflow XXX? */
+#endif
+
+typedef enum {
+ FP_RZ=0, /* round to zero (truncate) */
+ FP_RM=1, /* round toward negative infinity */
+ FP_RN=2, /* round to nearest representable number */
+ FP_RP=3 /* round toward positive infinity */
+} fp_rnd_t;
+
+#endif /* _ALPHA_IEEEFP_H_ */
diff --git a/sys/ia64/include/in_cksum.h b/sys/ia64/include/in_cksum.h
new file mode 100644
index 0000000..7a98720
--- /dev/null
+++ b/sys/ia64/include/in_cksum.h
@@ -0,0 +1,80 @@
+/*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * from tahoe: in_cksum.c 1.2 86/01/05
+ * from: @(#)in_cksum.c 1.3 (Berkeley) 1/19/91
+ * from: Id: in_cksum.c,v 1.8 1995/12/03 18:35:19 bde Exp
+ * $FreeBSD$
+ */
+
+#ifndef _MACHINE_IN_CKSUM_H_
+#define _MACHINE_IN_CKSUM_H_ 1
+
+#include <sys/cdefs.h>
+
+#define in_cksum(m, len) in_cksum_skip(m, len, 0)
+
+/*
+ * It it useful to have an Internet checksum routine which is inlineable
+ * and optimized specifically for the task of computing IP header checksums
+ * in the normal case (where there are no options and the header length is
+ * therefore always exactly five 32-bit words.
+ */
+#ifdef __GNUC__
+
+static __inline void
+in_cksum_update(struct ip *ip)
+{
+ int __tmpsum;
+ __tmpsum = (int)ntohs(ip->ip_sum) + 256;
+ ip->ip_sum = htons(__tmpsum + (__tmpsum >> 16));
+}
+
+#else
+
+#define in_cksum_update(ip) \
+ do { \
+ int __tmpsum; \
+ __tmpsum = (int)ntohs(ip->ip_sum) + 256; \
+ ip->ip_sum = htons(__tmpsum + (__tmpsum >> 16)); \
+ } while(0)
+
+#endif
+
+#ifdef _KERNEL
+u_int in_cksum_hdr(const struct ip *ip);
+u_short in_addword(u_short sum, u_short b);
+u_short in_pseudo(u_int sum, u_int b, u_int c);
+u_short in_cksum_skip(struct mbuf *m, int len, int skip);
+#endif
+
+#endif /* _MACHINE_IN_CKSUM_H_ */
diff --git a/sys/ia64/include/intr.h b/sys/ia64/include/intr.h
new file mode 100644
index 0000000..4f00388
--- /dev/null
+++ b/sys/ia64/include/intr.h
@@ -0,0 +1,37 @@
+/*-
+ * Copyright (c) 1998 Doug Rabson
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _MACHINE_INTR_H_
+#define _MACHINE_INTR_H_
+
+int alpha_setup_intr(int vector, driver_intr_t *intr, void *arg,
+ void **cookiep, volatile long *cntp);
+int alpha_teardown_intr(void *cookie);
+void alpha_dispatch_intr(void *frame, unsigned long vector);
+
+#endif /* !_MACHINE_INTR_H_ */
diff --git a/sys/ia64/include/intrcnt.h b/sys/ia64/include/intrcnt.h
new file mode 100644
index 0000000..440f819
--- /dev/null
+++ b/sys/ia64/include/intrcnt.h
@@ -0,0 +1,79 @@
+/* $FreeBSD$ */
+/* $NetBSD: intrcnt.h,v 1.17 1998/11/19 01:48:04 ross Exp $ */
+
+/*
+ * Copyright (c) 1995, 1996 Carnegie-Mellon University.
+ * All rights reserved.
+ *
+ * Author: Chris G. Demetriou
+ *
+ * Permission to use, copy, modify and distribute this software and
+ * its documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
+ * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
+ * School of Computer Science
+ * Carnegie Mellon University
+ * Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie the
+ * rights to redistribute these changes.
+ */
+
+#define INTRCNT_CLOCK 0
+#define INTRCNT_ISA_IRQ (INTRCNT_CLOCK + 1)
+#define INTRCNT_ISA_IRQ_LEN 16
+#define INTRCNT_OTHER_BASE (INTRCNT_ISA_IRQ + INTRCNT_ISA_IRQ_LEN)
+#define INTRCNT_OTHER_LEN 48
+#define INTRCNT_COUNT (INTRCNT_OTHER_BASE + INTRCNT_OTHER_LEN)
+
+#define INTRCNT_A12_IRQ INTRCNT_OTHER_BASE
+#define INTRCNT_DEC_1000A_IRQ INTRCNT_OTHER_BASE
+#define INTRCNT_DEC_1000_IRQ INTRCNT_OTHER_BASE
+#define INTRCNT_DEC_2100_A500_IRQ INTRCNT_OTHER_BASE
+#define INTRCNT_DEC_550_IRQ INTRCNT_OTHER_BASE
+#define INTRCNT_EB164_IRQ INTRCNT_OTHER_BASE
+#define INTRCNT_EB64PLUS_IRQ INTRCNT_OTHER_BASE
+#define INTRCNT_EB66_IRQ INTRCNT_OTHER_BASE
+#define INTRCNT_IOASIC INTRCNT_OTHER_BASE
+#define INTRCNT_KN15 INTRCNT_OTHER_BASE
+#define INTRCNT_KN16 INTRCNT_OTHER_BASE
+#define INTRCNT_KN20AA_IRQ INTRCNT_OTHER_BASE
+#define INTRCNT_KN300_IRQ INTRCNT_OTHER_BASE
+#define INTRCNT_KN8AE_IRQ INTRCNT_OTHER_BASE
+#define INTRCNT_TCDS INTRCNT_OTHER_BASE
+
+#define INTRCNT_A12_IRQ_LEN 10
+#define INTRCNT_DEC_1000A_IRQ_LEN 32
+#define INTRCNT_DEC_1000_IRQ_LEN 16
+#define INTRCNT_DEC_2100_A500_IRQ_LEN 16
+#define INTRCNT_DEC_550_IRQ_LEN 48
+#define INTRCNT_EB164_IRQ_LEN 24
+#define INTRCNT_EB64PLUS_IRQ_LEN 32
+#define INTRCNT_EB66_IRQ_LEN 32
+#define INTRCNT_IOASIC_LEN 4
+#define INTRCNT_ISA_IRQ_LEN 16
+#define INTRCNT_KN15_LEN 9
+#define INTRCNT_KN16_LEN 5
+#define INTRCNT_KN20AA_IRQ_LEN 32
+#define INTRCNT_KN300_LEN 19
+#define INTRCNT_KN8AE_IRQ_LEN 2
+#define INTRCNT_TCDS_LEN 2
+
+# define INTRCNT_KN300_NCR810 INTRCNT_KN300_IRQ + 16
+# define INTRCNT_KN300_I2C_CTRL INTRCNT_KN300_IRQ + 17
+# define INTRCNT_KN300_I2C_BUS INTRCNT_KN300_IRQ + 18
+
+#ifdef _KERNEL
+#ifndef _LOCORE
+extern volatile long intrcnt[];
+#endif
+#endif
diff --git a/sys/ia64/include/ioctl_bt848.h b/sys/ia64/include/ioctl_bt848.h
new file mode 100644
index 0000000..4b6a8fb
--- /dev/null
+++ b/sys/ia64/include/ioctl_bt848.h
@@ -0,0 +1,288 @@
+/*
+ * extensions to ioctl_meteor.h for the bt848 cards
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _MACHINE_IOCTL_BT848_H_
+#define _MACHINE_IOCTL_BT848_H_
+
+/*
+ * frequency sets
+ */
+#define CHNLSET_NABCST 1
+#define CHNLSET_CABLEIRC 2
+#define CHNLSET_CABLEHRC 3
+#define CHNLSET_WEUROPE 4
+#define CHNLSET_JPNBCST 5
+#define CHNLSET_JPNCABLE 6
+#define CHNLSET_XUSSR 7
+#define CHNLSET_AUSTRALIA 8
+#define CHNLSET_FRANCE 9
+#define CHNLSET_MIN CHNLSET_NABCST
+#define CHNLSET_MAX CHNLSET_FRANCE
+
+
+/*
+ * constants for various tuner registers
+ */
+#define BT848_HUEMIN (-90)
+#define BT848_HUEMAX 90
+#define BT848_HUECENTER 0
+#define BT848_HUERANGE 179.3
+#define BT848_HUEREGMIN (-128)
+#define BT848_HUEREGMAX 127
+#define BT848_HUESTEPS 256
+
+#define BT848_BRIGHTMIN (-50)
+#define BT848_BRIGHTMAX 50
+#define BT848_BRIGHTCENTER 0
+#define BT848_BRIGHTRANGE 99.6
+#define BT848_BRIGHTREGMIN (-128)
+#define BT848_BRIGHTREGMAX 127
+#define BT848_BRIGHTSTEPS 256
+
+#define BT848_CONTRASTMIN 0
+#define BT848_CONTRASTMAX 237
+#define BT848_CONTRASTCENTER 100
+#define BT848_CONTRASTRANGE 236.57
+#define BT848_CONTRASTREGMIN 0
+#define BT848_CONTRASTREGMAX 511
+#define BT848_CONTRASTSTEPS 512
+
+#define BT848_CHROMAMIN 0
+#define BT848_CHROMAMAX 284
+#define BT848_CHROMACENTER 100
+#define BT848_CHROMARANGE 283.89
+#define BT848_CHROMAREGMIN 0
+#define BT848_CHROMAREGMAX 511
+#define BT848_CHROMASTEPS 512
+
+#define BT848_SATUMIN 0
+#define BT848_SATUMAX 202
+#define BT848_SATUCENTER 100
+#define BT848_SATURANGE 201.18
+#define BT848_SATUREGMIN 0
+#define BT848_SATUREGMAX 511
+#define BT848_SATUSTEPS 512
+
+#define BT848_SATVMIN 0
+#define BT848_SATVMAX 284
+#define BT848_SATVCENTER 100
+#define BT848_SATVRANGE 283.89
+#define BT848_SATVREGMIN 0
+#define BT848_SATVREGMAX 511
+#define BT848_SATVSTEPS 512
+
+
+/*
+ * audio stuff
+ */
+#define AUDIO_TUNER 0x00 /* command for the audio routine */
+#define AUDIO_EXTERN 0x01 /* don't confuse them with bit */
+#define AUDIO_INTERN 0x02 /* settings */
+#define AUDIO_MUTE 0x80
+#define AUDIO_UNMUTE 0x81
+
+
+/*
+ * EEProm stuff
+ */
+struct eeProm {
+ short offset;
+ short count;
+ u_char bytes[ 256 ];
+};
+
+
+/*
+ * XXX: this is a hack, should be in ioctl_meteor.h
+ * here to avoid touching that file for now...
+ */
+#define TVTUNER_SETCHNL _IOW('x', 32, unsigned int) /* set channel */
+#define TVTUNER_GETCHNL _IOR('x', 32, unsigned int) /* get channel */
+#define TVTUNER_SETTYPE _IOW('x', 33, unsigned int) /* set tuner type */
+#define TVTUNER_GETTYPE _IOR('x', 33, unsigned int) /* get tuner type */
+#define TVTUNER_GETSTATUS _IOR('x', 34, unsigned int) /* get tuner status */
+#define TVTUNER_SETFREQ _IOW('x', 35, unsigned int) /* set frequency */
+#define TVTUNER_GETFREQ _IOR('x', 36, unsigned int) /* get frequency */
+
+
+#define BT848_SHUE _IOW('x', 37, int) /* set hue */
+#define BT848_GHUE _IOR('x', 37, int) /* get hue */
+#define BT848_SBRIG _IOW('x', 38, int) /* set brightness */
+#define BT848_GBRIG _IOR('x', 38, int) /* get brightness */
+#define BT848_SCSAT _IOW('x', 39, int) /* set chroma sat */
+#define BT848_GCSAT _IOR('x', 39, int) /* get UV saturation */
+#define BT848_SCONT _IOW('x', 40, int) /* set contrast */
+#define BT848_GCONT _IOR('x', 40, int) /* get contrast */
+#define BT848_SVSAT _IOW('x', 41, int) /* set chroma V sat */
+#define BT848_GVSAT _IOR('x', 41, int) /* get V saturation */
+#define BT848_SUSAT _IOW('x', 42, int) /* set chroma U sat */
+#define BT848_GUSAT _IOR('x', 42, int) /* get U saturation */
+
+#define BT848_SCBARS _IOR('x', 43, int) /* set colorbar */
+#define BT848_CCBARS _IOR('x', 44, int) /* clear colorbar */
+
+
+#define BT848_SAUDIO _IOW('x', 46, int) /* set audio channel */
+#define BT848_GAUDIO _IOR('x', 47, int) /* get audio channel */
+#define BT848_SBTSC _IOW('x', 48, int) /* set audio channel */
+
+#define BT848_GSTATUS _IOR('x', 49, unsigned int) /* reap status */
+
+#define BT848_WEEPROM _IOWR('x', 50, struct eeProm) /* write to EEProm */
+#define BT848_REEPROM _IOWR('x', 51, struct eeProm) /* read from EEProm */
+
+#define BT848_SIGNATURE _IOWR('x', 52, struct eeProm) /* read card sig */
+
+#define TVTUNER_SETAFC _IOW('x', 53, int) /* turn AFC on/off */
+#define TVTUNER_GETAFC _IOR('x', 54, int) /* query AFC on/off */
+#define BT848_SLNOTCH _IOW('x', 55, int) /* set luma notch */
+#define BT848_GLNOTCH _IOR('x', 56, int) /* get luma notch */
+
+/* Read/Write the BT848's I2C bus directly
+ * b7-b0: data (read/write)
+ * b15-b8: internal peripheral register (write)
+ * b23-b16: i2c addr (write)
+ * b31-b24: 1 = write, 0 = read
+ */
+#define BT848_I2CWR _IOWR('x', 57, u_long) /* i2c read-write */
+
+/* Support for radio tuner */
+#define RADIO_SETMODE _IOW('x', 58, unsigned int) /* set radio modes */
+#define RADIO_GETMODE _IOR('x', 58, unsigned char) /* get radio modes */
+#define RADIO_AFC 0x01 /* These modes will probably not */
+#define RADIO_MONO 0x02 /* work on the FRxxxx. It does */
+#define RADIO_MUTE 0x08 /* work on the FMxxxx. */
+#define RADIO_SETFREQ _IOW('x', 59, unsigned int) /* set frequency */
+#define RADIO_GETFREQ _IOR('x', 59, unsigned int) /* set frequency */
+ /* Argument is frequency*100MHz */
+
+/*
+ * XXX: more bad magic,
+ * we need to fix the METEORGINPUT to return something public
+ * duplicate them here for now...
+ */
+#define METEOR_DEV0 0x00001000
+#define METEOR_DEV1 0x00002000
+#define METEOR_DEV2 0x00004000
+#define METEOR_DEV3 0x00008000
+#define METEOR_DEV_SVIDEO 0x00006000
+/*
+ * right now I don't know were to put these, but as they are suppose to be
+ * a part of a common video capture interface, these should be relocated to
+ * another place. Probably most of the METEOR_xxx defines need to be
+ * renamed and moved to a common header
+ */
+
+typedef enum { METEOR_PIXTYPE_RGB, METEOR_PIXTYPE_YUV,
+ METEOR_PIXTYPE_YUV_PACKED,
+ METEOR_PIXTYPE_YUV_12 } METEOR_PIXTYPE;
+
+
+struct meteor_pixfmt {
+ u_int index; /* Index in supported pixfmt list */
+ METEOR_PIXTYPE type; /* What's the board gonna feed us */
+ u_int Bpp; /* Bytes per pixel */
+ u_long masks[3]; /* R,G,B or Y,U,V masks, respectively */
+ unsigned swap_bytes :1; /* Bytes swapped within shorts */
+ unsigned swap_shorts:1; /* Shorts swapped within longs */
+};
+
+
+struct bktr_clip {
+ int x_min;
+ int x_max;
+ int y_min;
+ int y_max;
+};
+
+#define BT848_MAX_CLIP_NODE 100
+struct _bktr_clip {
+ struct bktr_clip x[BT848_MAX_CLIP_NODE];
+};
+
+/*
+ * I'm using METEOR_xxx just because that will be common to other interface
+ * and less of a surprise
+ */
+#define METEORSACTPIXFMT _IOW('x', 64, int )
+#define METEORGACTPIXFMT _IOR('x', 64, int )
+#define METEORGSUPPIXFMT _IOWR('x', 65, struct meteor_pixfmt)
+
+/* set clip list */
+#define BT848SCLIP _IOW('x', 66, struct _bktr_clip )
+#define BT848GCLIP _IOR('x', 66, struct _bktr_clip )
+
+
+/* set input format */
+#define BT848SFMT _IOW('x', 67, unsigned long )
+#define BT848GFMT _IOR('x', 67, unsigned long )
+
+/* set clear-buffer-on-start */
+#define BT848SCBUF _IOW('x', 68, int)
+#define BT848GCBUF _IOR('x', 68, int)
+
+/* set capture area */
+/* The capture area is the area of the video image which is grabbed */
+/* Usually the capture area is 640x480 (768x576 PAL) pixels */
+/* This area is then scaled to the dimensions the user requires */
+/* using the METEORGEO ioctl */
+/* However, the capture area could be 400x300 pixels from the top right */
+/* corner of the video image */
+struct bktr_capture_area {
+ int x_offset;
+ int y_offset;
+ int x_size;
+ int y_size;
+};
+#define BT848_SCAPAREA _IOW('x', 69, struct bktr_capture_area)
+#define BT848_GCAPAREA _IOR('x', 69, struct bktr_capture_area)
+
+
+/* Get channel Set */
+#define BT848_MAX_CHNLSET_NAME_LEN 16
+struct bktr_chnlset {
+ short index;
+ short max_channel;
+ char name[BT848_MAX_CHNLSET_NAME_LEN];
+};
+#define TVTUNER_GETCHNLSET _IOWR('x', 70, struct bktr_chnlset)
+
+
+
+/* Infra Red Remote Control */
+struct bktr_remote {
+ unsigned char data[3];
+};
+#define REMOTE_GETKEY _IOR('x', 71, struct bktr_remote)/*read the remote */
+ /*control receiver*/
+ /*returns raw data*/
+
+
+/*
+ * Direct access to GPIO pins. You must add BKTR_GPIO_ACCESS to your kernel
+ * configuration file to use these
+ */
+#define BT848_GPIO_SET_EN _IOW('x', 72, int) /* set gpio_out_en */
+#define BT848_GPIO_GET_EN _IOR('x', 73, int) /* get gpio_out_en */
+#define BT848_GPIO_SET_DATA _IOW('x', 74, int) /* set gpio_data */
+#define BT848_GPIO_GET_DATA _IOR('x', 75, int) /* get gpio_data */
+
+
+
+/* XXX - Copied from /sys/pci/brktree_reg.h */
+#define BT848_IFORM_FORMAT (0x7<<0)
+# define BT848_IFORM_F_RSVD (0x7)
+# define BT848_IFORM_F_SECAM (0x6)
+# define BT848_IFORM_F_PALN (0x5)
+# define BT848_IFORM_F_PALM (0x4)
+# define BT848_IFORM_F_PALBDGHI (0x3)
+# define BT848_IFORM_F_NTSCJ (0x2)
+# define BT848_IFORM_F_NTSCM (0x1)
+# define BT848_IFORM_F_AUTO (0x0)
+
+
+#endif /* _MACHINE_IOCTL_BT848_H_ */
+
diff --git a/sys/ia64/include/ioctl_fd.h b/sys/ia64/include/ioctl_fd.h
new file mode 100644
index 0000000..dd6e9d0
--- /dev/null
+++ b/sys/ia64/include/ioctl_fd.h
@@ -0,0 +1,126 @@
+/*
+ * Copyright (C) 1992-1994 by Joerg Wunsch, Dresden
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+ * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ *
+ * $FreeBSD$
+ * from: ioctl_fd.h,v 1.11
+ */
+
+#ifndef _MACHINE_IOCTL_FD_H_
+#define _MACHINE_IOCTL_FD_H_
+
+#ifndef _KERNEL
+#include <sys/types.h>
+#endif
+#include <sys/ioccom.h>
+
+#define FD_FORMAT_VERSION 110 /* used to validate before formatting */
+#define FD_MAX_NSEC 36 /* highest known number of spt - allow for */
+ /* 2.88 MB drives */
+
+struct fd_formb {
+ int format_version; /* == FD_FORMAT_VERSION */
+ int cyl, head;
+ int transfer_rate; /* fdreg.h: FDC_???KBPS */
+
+ union {
+ struct fd_form_data {
+ /*
+ * DO NOT CHANGE THE LAYOUT OF THIS STRUCTS
+ * it is hardware-dependent since it exactly
+ * matches the byte sequence to write to FDC
+ * during its `format track' operation
+ */
+ u_char secshift; /* 0 -> 128, ...; usually 2 -> 512 */
+ u_char nsecs; /* must be <= FD_MAX_NSEC */
+ u_char gaplen; /* GAP 3 length; usually 84 */
+ u_char fillbyte; /* usually 0xf6 */
+ struct fd_idfield_data {
+ /*
+ * data to write into id fields;
+ * for obscure formats, they mustn't match
+ * the real values (but mostly do)
+ */
+ u_char cylno; /* 0 thru 79 (or 39) */
+ u_char headno; /* 0, or 1 */
+ u_char secno; /* starting at 1! */
+ u_char secsize; /* usually 2 */
+ } idfields[FD_MAX_NSEC]; /* 0 <= idx < nsecs used */
+ } structured;
+ u_char raw[1]; /* to have continuous indexed access */
+ } format_info;
+};
+
+/* make life easier */
+# define fd_formb_secshift format_info.structured.secshift
+# define fd_formb_nsecs format_info.structured.nsecs
+# define fd_formb_gaplen format_info.structured.gaplen
+# define fd_formb_fillbyte format_info.structured.fillbyte
+/* these data must be filled in for(i = 0; i < fd_formb_nsecs; i++) */
+# define fd_formb_cylno(i) format_info.structured.idfields[i].cylno
+# define fd_formb_headno(i) format_info.structured.idfields[i].headno
+# define fd_formb_secno(i) format_info.structured.idfields[i].secno
+# define fd_formb_secsize(i) format_info.structured.idfields[i].secsize
+
+struct fd_type {
+ int sectrac; /* sectors per track */
+ int secsize; /* size code for sectors */
+ int datalen; /* data len when secsize = 0 */
+ int gap; /* gap len between sectors */
+ int tracks; /* total num of tracks */
+ int size; /* size of disk in sectors */
+ int steptrac; /* steps per cylinder */
+ int trans; /* transfer speed code */
+ int heads; /* number of heads */
+ int f_gap; /* format gap len */
+ int f_inter; /* format interleave factor */
+};
+
+#define FD_FORM _IOW('F', 61, struct fd_formb) /* format a track */
+#define FD_GTYPE _IOR('F', 62, struct fd_type) /* get drive type */
+#define FD_STYPE _IOW('F', 63, struct fd_type) /* set drive type */
+
+#define FD_GOPTS _IOR('F', 64, int) /* drive options, see below */
+#define FD_SOPTS _IOW('F', 65, int)
+
+#define FD_DEBUG _IOW('F', 66, int)
+
+#define FDOPT_NORETRY 0x0001 /* no retries on failure (cleared on close) */
+
+/*
+ * The following definitions duplicate those in sys/i386/isa/fdreg.h
+ * They are here since their values are to be used in the above
+ * structure when formatting a floppy. For very obvious reasons, both
+ * definitions must match ;-)
+ */
+#ifndef FDC_500KBPS
+#define FDC_500KBPS 0x00 /* 500KBPS MFM drive transfer rate */
+#define FDC_300KBPS 0x01 /* 300KBPS MFM drive transfer rate */
+#define FDC_250KBPS 0x02 /* 250KBPS MFM drive transfer rate */
+#define FDC_125KBPS 0x03 /* 125KBPS FM drive transfer rate */
+ /* for some controllers 1MPBS instead */
+#endif /* FDC_500KBPS */
+
+#endif /* !_MACHINE_IOCTL_FD_H_ */
diff --git a/sys/ia64/include/ioctl_meteor.h b/sys/ia64/include/ioctl_meteor.h
new file mode 100644
index 0000000..f62d392
--- /dev/null
+++ b/sys/ia64/include/ioctl_meteor.h
@@ -0,0 +1,187 @@
+/*
+ * Copyright (c) 1995 Mark Tinguely and Jim Lowe
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Mark Tinguely and Jim Lowe
+ * 4. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+/*
+ * ioctl constants for Matrox Meteor Capture card.
+ */
+
+#ifndef _MACHINE_IOCTL_METEOR_H_
+#define _MACHINE_IOCTL_METEOR_H_
+
+#ifndef _KERNEL
+#include <sys/types.h>
+#endif
+#include <sys/ioccom.h>
+
+struct meteor_capframe {
+ short command; /* see below for valid METEORCAPFRM commands */
+ short lowat; /* start transfer if < this number */
+ short hiwat; /* stop transfer if > this number */
+} ;
+
+/* structure for METEOR[GS]ETGEO - get/set geometry */
+struct meteor_geomet {
+ u_short rows;
+ u_short columns;
+ u_short frames;
+ u_long oformat;
+} ;
+
+/* structure for METEORGCOUNT-get count of frames, fifo errors and dma errors */
+struct meteor_counts {
+ u_long fifo_errors; /* count of fifo errors since open */
+ u_long dma_errors; /* count of dma errors since open */
+ u_long frames_captured; /* count of frames captured since open */
+ u_long even_fields_captured; /* count of even fields captured */
+ u_long odd_fields_captured; /* count of odd fields captured */
+} ;
+
+/* structure for getting and setting direct transfers to vram */
+struct meteor_video {
+ u_long addr; /* Address of location to dma to */
+ u_long width; /* Width of memory area */
+ u_long banksize; /* Size of Vram bank */
+ u_long ramsize; /* Size of Vram */
+};
+
+#define METEORCAPTUR _IOW('x', 1, int) /* capture a frame */
+#define METEORCAPFRM _IOW('x', 2, struct meteor_capframe) /* sync capture */
+#define METEORSETGEO _IOW('x', 3, struct meteor_geomet) /* set geometry */
+#define METEORGETGEO _IOR('x', 4, struct meteor_geomet) /* get geometry */
+#define METEORSTATUS _IOR('x', 5, unsigned short) /* get status */
+#define METEORSHUE _IOW('x', 6, signed char) /* set hue */
+#define METEORGHUE _IOR('x', 6, signed char) /* get hue */
+#define METEORSFMT _IOW('x', 7, unsigned long) /* set format */
+#define METEORGFMT _IOR('x', 7, unsigned long) /* get format */
+#define METEORSINPUT _IOW('x', 8, unsigned long) /* set input dev */
+#define METEORGINPUT _IOR('x', 8, unsigned long) /* get input dev */
+#define METEORSCHCV _IOW('x', 9, unsigned char) /* set uv gain */
+#define METEORGCHCV _IOR('x', 9, unsigned char) /* get uv gain */
+#define METEORSCOUNT _IOW('x',10, struct meteor_counts)
+#define METEORGCOUNT _IOR('x',10, struct meteor_counts)
+#define METEORSFPS _IOW('x',11, unsigned short) /* set fps */
+#define METEORGFPS _IOR('x',11, unsigned short) /* get fps */
+#define METEORSSIGNAL _IOW('x', 12, unsigned int) /* set signal */
+#define METEORGSIGNAL _IOR('x', 12, unsigned int) /* get signal */
+#define METEORSVIDEO _IOW('x', 13, struct meteor_video) /* set video */
+#define METEORGVIDEO _IOR('x', 13, struct meteor_video) /* get video */
+#define METEORSBRIG _IOW('x', 14, unsigned char) /* set brightness */
+#define METEORGBRIG _IOR('x', 14, unsigned char) /* get brightness */
+#define METEORSCSAT _IOW('x', 15, unsigned char) /* set chroma sat */
+#define METEORGCSAT _IOR('x', 15, unsigned char) /* get uv saturation */
+#define METEORSCONT _IOW('x', 16, unsigned char) /* set contrast */
+#define METEORGCONT _IOR('x', 16, unsigned char) /* get contrast */
+#define METEORSBT254 _IOW('x', 17, unsigned short) /* set Bt254 reg */
+#define METEORGBT254 _IOR('x', 17, unsigned short) /* get Bt254 reg */
+#define METEORSHWS _IOW('x', 18, unsigned char) /* set hor start reg */
+#define METEORGHWS _IOR('x', 18, unsigned char) /* get hor start reg */
+#define METEORSVWS _IOW('x', 19, unsigned char) /* set vert start reg */
+#define METEORGVWS _IOR('x', 19, unsigned char) /* get vert start reg */
+#define METEORSTS _IOW('x', 20, unsigned char) /* set time stamp */
+#define METEORGTS _IOR('x', 20, unsigned char) /* get time stamp */
+
+#define METEOR_STATUS_ID_MASK 0xf000 /* ID of 7196 */
+#define METEOR_STATUS_DIR 0x0800 /* Direction of Expansion port YUV */
+#define METEOR_STATUS_OEF 0x0200 /* Field detected: Even/Odd */
+#define METEOR_STATUS_SVP 0x0100 /* State of VRAM Port:inactive/active */
+#define METEOR_STATUS_STTC 0x0080 /* Time Constant: TV/VCR */
+#define METEOR_STATUS_HCLK 0x0040 /* Horiz PLL: locked/unlocked */
+#define METEOR_STATUS_FIDT 0x0020 /* Field detect: 50/60hz */
+#define METEOR_STATUS_ALTD 0x0002 /* Line alt: no line alt/line alt */
+#define METEOR_STATUS_CODE 0x0001 /* Colour info: no colour/colour */
+
+ /* METEORCAPTUR capture options */
+#define METEOR_CAP_SINGLE 0x0001 /* capture one frame */
+#define METEOR_CAP_CONTINOUS 0x0002 /* continuously capture */
+#define METEOR_CAP_STOP_CONT 0x0004 /* stop the continuous capture */
+
+ /* METEORCAPFRM capture commands */
+#define METEOR_CAP_N_FRAMES 0x0001 /* capture N frames */
+#define METEOR_CAP_STOP_FRAMES 0x0002 /* stop capture N frames */
+#define METEOR_HALT_N_FRAMES 0x0003 /* halt of capture N frames */
+#define METEOR_CONT_N_FRAMES 0x0004 /* continue after above halt */
+
+ /* valid video input formats: */
+#define METEOR_FMT_NTSC 0x00100 /* NTSC -- initialized default */
+#define METEOR_FMT_PAL 0x00200 /* PAL */
+#define METEOR_FMT_SECAM 0x00400 /* SECAM */
+#define METEOR_FMT_AUTOMODE 0x00800 /* auto-mode */
+#define METEOR_INPUT_DEV0 0x01000 /* camera input 0 -- default */
+#define METEOR_INPUT_DEV_RCA METEOR_INPUT_DEV0
+#define METEOR_INPUT_DEV1 0x02000 /* camera input 1 */
+#define METEOR_INPUT_DEV2 0x04000 /* camera input 2 */
+#define METEOR_INPUT_DEV3 0x08000 /* camera input 3 */
+#define METEOR_INPUT_DEV_RGB 0x0a000 /* for rgb version of meteor */
+#define METEOR_INPUT_DEV_SVIDEO 0x06000 /* S-video input port */
+
+ /* valid video output formats: */
+#define METEOR_GEO_RGB16 0x0010000 /* packed -- initialized default */
+#define METEOR_GEO_RGB24 0x0020000 /* RBG 24 bits packed */
+ /* internally stored in 32 bits */
+#define METEOR_GEO_YUV_PACKED 0x0040000 /* 4-2-2 YUV 16 bits packed */
+#define METEOR_GEO_YUV_PLANAR 0x0080000 /* 4-2-2 YUV 16 bits planer */
+#define METEOR_GEO_YUV_PLANER METEOR_GEO_YUV_PLANAR
+#define METEOR_GEO_UNSIGNED 0x0400000 /* unsigned uv outputs */
+#define METEOR_GEO_EVEN_ONLY 0x1000000 /* set for even only field capture */
+#define METEOR_GEO_ODD_ONLY 0x2000000 /* set for odd only field capture */
+#define METEOR_GEO_FIELD_MASK 0x3000000
+#define METEOR_GEO_YUV_422 0x4000000 /* 4-2-2 YUV in Y-U-V combined */
+#define METEOR_GEO_OUTPUT_MASK 0x40f0000
+#define METEOR_GEO_YUV_12 0x10000000 /* YUV 12 format */
+#define METEOR_GEO_YUV_9 0x40000000 /* YUV 9 format */
+
+#define METEOR_FIELD_MODE 0x80000000 /* Field cap or Frame cap */
+
+#define METEOR_SIG_MODE_MASK 0xffff0000
+#define METEOR_SIG_FRAME 0x00000000 /* signal every frame */
+#define METEOR_SIG_FIELD 0x00010000 /* signal every field */
+
+ /* following structure is used to coordinate the synchronous */
+
+struct meteor_mem {
+ /* kernel write only */
+ int frame_size; /* row*columns*depth */
+ unsigned num_bufs; /* number of frames in buffer (1-32) */
+ /* user and kernel change these */
+ int lowat; /* kernel starts capture if < this number */
+ int hiwat; /* kernel stops capture if > this number.
+ hiwat <= numbufs */
+ unsigned active; /* bit mask of active frame buffers
+ kernel sets, user clears */
+ int num_active_bufs; /* count of active frame buffer
+ kernel increments, user decrements */
+
+ /* reference to mmapped data */
+ caddr_t buf; /* The real space (virtual addr) */
+} ;
+
+#endif /* !_MACHINE_IOCTL_METEOR_H_ */
diff --git a/sys/ia64/include/ipl.h b/sys/ia64/include/ipl.h
new file mode 100644
index 0000000..2a021eb
--- /dev/null
+++ b/sys/ia64/include/ipl.h
@@ -0,0 +1,132 @@
+/*-
+ * Copyright (c) 1998 Doug Rabson
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _MACHINE_IPL_H_
+#define _MACHINE_IPL_H_
+
+
+#include <machine/cpu.h> /* for pal inlines */
+
+/*
+ * Software interrupt bit numbers
+ */
+#define SWI_TTY 0
+#define SWI_NET 1
+#define SWI_CAMNET 2
+#define SWI_CAMBIO 3
+#define SWI_VM 4
+#define SWI_CLOCK 5
+#define SWI_TQ 6
+#define NSWI 32
+#define NHWI 0
+
+extern u_int32_t ipending;
+
+#define getcpl() (alpha_pal_rdps() & ALPHA_PSL_IPL_MASK)
+
+#define SPLDOWN(name, pri) \
+ \
+static __inline int name(void) \
+{ \
+ return 0; \
+}
+
+SPLDOWN(splsoftclock, SOFT)
+SPLDOWN(splsoft, SOFT)
+
+#define SPLUP(name, pri) \
+ \
+static __inline int name(void) \
+{ \
+ return 0; \
+}
+
+SPLUP(splsoftcam, SOFT)
+SPLUP(splsoftnet, SOFT)
+SPLUP(splsoftvm, SOFT)
+SPLUP(splsofttq, SOFT)
+SPLUP(splnet, IO)
+SPLUP(splbio, IO)
+SPLUP(splcam, IO)
+SPLUP(splimp, IO)
+SPLUP(spltty, IO)
+SPLUP(splvm, IO)
+SPLUP(splclock, CLOCK)
+SPLUP(splstatclock, CLOCK)
+SPLUP(splhigh, HIGH)
+
+static __inline void
+spl0(void)
+{
+ if (ipending)
+ do_sir(); /* lowers ipl to SOFT */
+}
+
+static __inline void
+splx(int s)
+{
+}
+
+extern void setdelayed(void);
+extern void setsofttty(void);
+extern void setsoftnet(void);
+extern void setsoftcamnet(void);
+extern void setsoftcambio(void);
+extern void setsoftvm(void);
+extern void setsofttq(void);
+extern void setsoftclock(void);
+
+extern void schedsofttty(void);
+extern void schedsoftnet(void);
+extern void schedsoftcamnet(void);
+extern void schedsoftcambio(void);
+extern void schedsoftvm(void);
+extern void schedsofttq(void);
+extern void schedsoftclock(void);
+
+#if 0
+/* XXX bogus */
+extern unsigned cpl; /* current priority level mask */
+#endif
+
+/*
+ * Interprocessor interrupts for SMP.
+ */
+#define IPI_INVLTLB 0x0001
+#define IPI_RENDEZVOUS 0x0002
+#define IPI_AST 0x0004
+#define IPI_CHECKSTATE 0x0008
+#define IPI_STOP 0x0010
+
+void smp_ipi_selected(u_int32_t cpus, u_int64_t ipi);
+void smp_ipi_all(u_int64_t ipi);
+void smp_ipi_all_but_self(u_int64_t ipi);
+void smp_ipi_self(u_int64_t ipi);
+void smp_handle_ipi(struct trapframe *frame);
+
+#endif /* !_MACHINE_MD_VAR_H_ */
diff --git a/sys/ia64/include/limits.h b/sys/ia64/include/limits.h
new file mode 100644
index 0000000..99ca2d8
--- /dev/null
+++ b/sys/ia64/include/limits.h
@@ -0,0 +1,96 @@
+/* $FreeBSD$ */
+/* From: NetBSD: limits.h,v 1.3 1997/04/06 08:47:31 cgd Exp */
+
+/*
+ * Copyright (c) 1988, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)limits.h 8.3 (Berkeley) 1/4/94
+ */
+
+#define CHAR_BIT 8 /* number of bits in a char */
+#define MB_LEN_MAX 6 /* Allow 31 bit UTF2 */
+
+/*
+ * According to ANSI (section 2.2.4.2), the values below must be usable by
+ * #if preprocessing directives. Additionally, the expression must have the
+ * same type as would an expression that is an object of the corresponding
+ * type converted according to the integral promotions. The subtraction for
+ * INT_MIN and LONG_MIN is so the value is not unsigned; 2147483648 is an
+ * unsigned int for 32-bit two's complement ANSI compilers (section 3.1.3.2).
+ * These numbers work for pcc as well. The UINT_MAX and ULONG_MAX values
+ * are written as hex so that GCC will be quiet about large integer constants.
+ */
+#define SCHAR_MAX 0x7f /* max value for a signed char */
+#define SCHAR_MIN (-0x7f-1) /* min value for a signed char */
+
+#define UCHAR_MAX 0xffU /* max value for an unsigned char */
+#define CHAR_MAX 0x7f /* max value for a char */
+#define CHAR_MIN (-0x7f-1) /* min value for a char */
+
+#define USHRT_MAX 0xffffU /* max value for an unsigned short */
+#define SHRT_MAX 0x7fff /* max value for a short */
+#define SHRT_MIN (-0x7fff-1) /* min value for a short */
+
+#define UINT_MAX 0xffffffffU /* max value for an unsigned int */
+#define INT_MAX 0x7fffffff /* max value for an int */
+#define INT_MIN (-0x7fffffff-1) /* min value for an int */
+
+#define ULONG_MAX 0xffffffffffffffffUL /* max for an unsigned long */
+#define LONG_MAX 0x7fffffffffffffffL /* max for a long */
+#define LONG_MIN (-0x7fffffffffffffffL-1) /* min for a long */
+
+#if !defined(_ANSI_SOURCE)
+#define SSIZE_MAX LONG_MAX /* max value for a ssize_t */
+
+#if !defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE)
+#define SIZE_T_MAX ULONG_MAX /* max value for a size_t */
+
+/* Quads and longs are the same on the alpha */
+#define UQUAD_MAX (ULONG_MAX) /* max value for a uquad_t */
+#define QUAD_MAX (LONG_MAX) /* max value for a quad_t */
+#define QUAD_MIN (LONG_MIN) /* min value for a quad_t */
+
+#endif /* !_POSIX_SOURCE && !_XOPEN_SOURCE */
+#endif /* !_ANSI_SOURCE */
+
+#if (!defined(_ANSI_SOURCE)&&!defined(_POSIX_SOURCE)) || defined(_XOPEN_SOURCE)
+#define LONG_BIT 64
+#define WORD_BIT 32
+
+#define DBL_DIG 15
+#define DBL_MAX 1.7976931348623157E+308
+#define DBL_MIN 2.2250738585072014E-308
+
+#define FLT_DIG 6
+#define FLT_MAX 3.40282347E+38F
+#define FLT_MIN 1.17549435E-38F
+#endif
diff --git a/sys/ia64/include/lock.h b/sys/ia64/include/lock.h
new file mode 100644
index 0000000..189b966
--- /dev/null
+++ b/sys/ia64/include/lock.h
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 1997, by Steve Passe
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. The name of the developer may NOT be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+
+#ifndef _MACHINE_LOCK_H_
+#define _MACHINE_LOCK_H_
+
+
+/*
+ * Simple spin lock.
+ * It is an error to hold one of these locks while a process is sleeping.
+ */
+struct simplelock {
+ volatile int lock_data;
+};
+
+/* functions in mp_machdep.c */
+void s_lock_init __P((struct simplelock *));
+void s_lock __P((struct simplelock *));
+int s_lock_try __P((struct simplelock *));
+
+/* inline simplelock functions */
+static __inline void
+s_unlock(struct simplelock *lkp)
+{
+#if 0 /* XXX */
+ ia64_st_rel_32(&lkp->lock_data, 0);
+#endif
+}
+
+#define COM_LOCK()
+#define COM_UNLOCK()
+
+#endif /* !_MACHINE_LOCK_H_ */
diff --git a/sys/ia64/include/md_var.h b/sys/ia64/include/md_var.h
new file mode 100644
index 0000000..eeaff20
--- /dev/null
+++ b/sys/ia64/include/md_var.h
@@ -0,0 +1,57 @@
+/*-
+ * Copyright (c) 1998 Doug Rabson
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _MACHINE_MD_VAR_H_
+#define _MACHINE_MD_VAR_H_
+
+/*
+ * Miscellaneous machine-dependent declarations.
+ */
+
+extern char sigcode[];
+extern char esigcode[];
+extern int szsigcode;
+extern int Maxmem;
+extern void (*netisrs[32]) __P((void));
+
+struct fpreg;
+struct proc;
+struct reg;
+
+void busdma_swi __P((void));
+void cpu_halt __P((void));
+void cpu_reset __P((void));
+int is_physical_memory __P((vm_offset_t addr));
+void swi_vm __P((void));
+int vm_page_zero_idle __P((void));
+int fill_regs __P((struct proc *, struct reg *));
+int set_regs __P((struct proc *, struct reg *));
+int fill_fpregs __P((struct proc *, struct fpreg *));
+int set_fpregs __P((struct proc *, struct fpreg *));
+
+#endif /* !_MACHINE_MD_VAR_H_ */
diff --git a/sys/ia64/include/mouse.h b/sys/ia64/include/mouse.h
new file mode 100644
index 0000000..1f9d63b
--- /dev/null
+++ b/sys/ia64/include/mouse.h
@@ -0,0 +1,336 @@
+/*-
+ * Copyright (c) 1992, 1993 Erik Forsberg.
+ * Copyright (c) 1996, 1997 Kazutaka YOKOTA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * THIS SOFTWARE IS PROVIDED BY ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
+ * NO EVENT SHALL I BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ * from: i386/include mouse.h,v 1.10
+ */
+
+#ifndef _MACHINE_MOUSE_H_
+#define _MACHINE_MOUSE_H_
+
+#include <sys/types.h>
+#include <sys/ioccom.h>
+
+/* ioctls */
+#define MOUSE_GETSTATUS _IOR('M', 0, mousestatus_t)
+#define MOUSE_GETHWINFO _IOR('M', 1, mousehw_t)
+#define MOUSE_GETMODE _IOR('M', 2, mousemode_t)
+#define MOUSE_SETMODE _IOW('M', 3, mousemode_t)
+#define MOUSE_GETLEVEL _IOR('M', 4, int)
+#define MOUSE_SETLEVEL _IOW('M', 5, int)
+#define MOUSE_GETVARS _IOR('M', 6, mousevar_t)
+#define MOUSE_SETVARS _IOW('M', 7, mousevar_t)
+#define MOUSE_READSTATE _IOWR('M', 8, mousedata_t)
+#define MOUSE_READDATA _IOWR('M', 9, mousedata_t)
+
+#if notyet
+#define MOUSE_SETRESOLUTION _IOW('M', 10, int)
+#define MOUSE_SETSCALING _IOW('M', 11, int)
+#define MOUSE_SETRATE _IOW('M', 12, int)
+#define MOUSE_GETHWID _IOR('M', 13, int)
+#endif
+
+/* mouse status block */
+typedef struct mousestatus {
+ int flags; /* state change flags */
+ int button; /* button status */
+ int obutton; /* previous button status */
+ int dx; /* x movement */
+ int dy; /* y movement */
+ int dz; /* z movement */
+} mousestatus_t;
+
+/* button */
+#define MOUSE_BUTTON1DOWN 0x0001 /* left */
+#define MOUSE_BUTTON2DOWN 0x0002 /* middle */
+#define MOUSE_BUTTON3DOWN 0x0004 /* right */
+#define MOUSE_BUTTON4DOWN 0x0008
+#define MOUSE_BUTTON5DOWN 0x0010
+#define MOUSE_BUTTON6DOWN 0x0020
+#define MOUSE_BUTTON7DOWN 0x0040
+#define MOUSE_BUTTON8DOWN 0x0080
+#define MOUSE_MAXBUTTON 31
+#define MOUSE_STDBUTTONS 0x0007 /* buttons 1-3 */
+#define MOUSE_EXTBUTTONS 0x7ffffff8 /* the others (28 of them!) */
+#define MOUSE_BUTTONS (MOUSE_STDBUTTONS | MOUSE_EXTBUTTONS)
+
+/* flags */
+#define MOUSE_STDBUTTONSCHANGED MOUSE_STDBUTTONS
+#define MOUSE_EXTBUTTONSCHANGED MOUSE_EXTBUTTONS
+#define MOUSE_BUTTONSCHANGED MOUSE_BUTTONS
+#define MOUSE_POSCHANGED 0x80000000
+
+typedef struct mousehw {
+ int buttons; /* -1 if unknown */
+ int iftype; /* MOUSE_IF_XXX */
+ int type; /* mouse/track ball/pad... */
+ int model; /* I/F dependent model ID: MOUSE_MODEL_XXX */
+ int hwid; /* I/F dependent hardware ID
+ * for the PS/2 mouse, it will be PSM_XXX_ID
+ */
+} mousehw_t;
+
+/* iftype */
+#define MOUSE_IF_UNKNOWN (-1)
+#define MOUSE_IF_SERIAL 0
+#define MOUSE_IF_BUS 1
+#define MOUSE_IF_INPORT 2
+#define MOUSE_IF_PS2 3
+#define MOUSE_IF_SYSMOUSE 4
+#define MOUSE_IF_USB 5
+
+/* type */
+#define MOUSE_UNKNOWN (-1) /* should be treated as a mouse */
+#define MOUSE_MOUSE 0
+#define MOUSE_TRACKBALL 1
+#define MOUSE_STICK 2
+#define MOUSE_PAD 3
+
+/* model */
+#define MOUSE_MODEL_UNKNOWN (-1)
+#define MOUSE_MODEL_GENERIC 0
+#define MOUSE_MODEL_GLIDEPOINT 1
+#define MOUSE_MODEL_NETSCROLL 2
+#define MOUSE_MODEL_NET 3
+#define MOUSE_MODEL_INTELLI 4
+#define MOUSE_MODEL_THINK 5
+#define MOUSE_MODEL_EASYSCROLL 6
+#define MOUSE_MODEL_MOUSEMANPLUS 7
+#define MOUSE_MODEL_KIDSPAD 8
+#define MOUSE_MODEL_VERSAPAD 9
+#define MOUSE_MODEL_EXPLORER 10
+#define MOUSE_MODEL_4D 11
+#define MOUSE_MODEL_4DPLUS 12
+
+typedef struct mousemode {
+ int protocol; /* MOUSE_PROTO_XXX */
+ int rate; /* report rate (per sec), -1 if unknown */
+ int resolution; /* MOUSE_RES_XXX, -1 if unknown */
+ int accelfactor; /* accelation factor (must be 1 or greater) */
+ int level; /* driver operation level */
+ int packetsize; /* the length of the data packet */
+ unsigned char syncmask[2]; /* sync. data bits in the header byte */
+} mousemode_t;
+
+/* protocol */
+/*
+ * Serial protocols:
+ * Microsoft, MouseSystems, Logitech, MM series, MouseMan, Hitachi Tablet,
+ * GlidePoint, IntelliMouse, Thinking Mouse, MouseRemote, Kidspad,
+ * VersaPad
+ * Bus mouse protocols:
+ * bus, InPort
+ * PS/2 mouse protocol:
+ * PS/2
+ */
+#define MOUSE_PROTO_UNKNOWN (-1)
+#define MOUSE_PROTO_MS 0 /* Microsoft Serial, 3 bytes */
+#define MOUSE_PROTO_MSC 1 /* Mouse Systems, 5 bytes */
+#define MOUSE_PROTO_LOGI 2 /* Logitech, 3 bytes */
+#define MOUSE_PROTO_MM 3 /* MM series, 3 bytes */
+#define MOUSE_PROTO_LOGIMOUSEMAN 4 /* Logitech MouseMan 3/4 bytes */
+#define MOUSE_PROTO_BUS 5 /* MS/Logitech bus mouse */
+#define MOUSE_PROTO_INPORT 6 /* MS/ATI InPort mouse */
+#define MOUSE_PROTO_PS2 7 /* PS/2 mouse, 3 bytes */
+#define MOUSE_PROTO_HITTAB 8 /* Hitachi Tablet 3 bytes */
+#define MOUSE_PROTO_GLIDEPOINT 9 /* ALPS GlidePoint, 3/4 bytes */
+#define MOUSE_PROTO_INTELLI 10 /* MS IntelliMouse, 4 bytes */
+#define MOUSE_PROTO_THINK 11 /* Kensignton Thinking Mouse, 3/4 bytes */
+#define MOUSE_PROTO_SYSMOUSE 12 /* /dev/sysmouse */
+#define MOUSE_PROTO_X10MOUSEREM 13 /* X10 MouseRemote, 3 bytes */
+#define MOUSE_PROTO_KIDSPAD 14 /* Genius Kidspad */
+#define MOUSE_PROTO_VERSAPAD 15 /* Interlink VersaPad, 6 bytes */
+
+#define MOUSE_RES_UNKNOWN (-1)
+#define MOUSE_RES_DEFAULT 0
+#define MOUSE_RES_LOW (-2)
+#define MOUSE_RES_MEDIUMLOW (-3)
+#define MOUSE_RES_MEDIUMHIGH (-4)
+#define MOUSE_RES_HIGH (-5)
+
+typedef struct mousedata {
+ int len; /* # of data in the buffer */
+ int buf[16]; /* data buffer */
+} mousedata_t;
+
+#if (defined(MOUSE_GETVARS))
+
+typedef struct mousevar {
+ int var[16];
+} mousevar_t;
+
+/* magic numbers in var[0] */
+#define MOUSE_VARS_PS2_SIG 0x00325350 /* 'PS2' */
+#define MOUSE_VARS_BUS_SIG 0x00535542 /* 'BUS' */
+#define MOUSE_VARS_INPORT_SIG 0x00504e49 /* 'INP' */
+
+#endif /* MOUSE_GETVARS */
+
+/* Microsoft Serial mouse data packet */
+#define MOUSE_MSS_PACKETSIZE 3
+#define MOUSE_MSS_SYNCMASK 0x40
+#define MOUSE_MSS_SYNC 0x40
+#define MOUSE_MSS_BUTTONS 0x30
+#define MOUSE_MSS_BUTTON1DOWN 0x20 /* left */
+#define MOUSE_MSS_BUTTON2DOWN 0x00 /* no middle button */
+#define MOUSE_MSS_BUTTON3DOWN 0x10 /* right */
+
+/* Logitech MouseMan data packet (M+ protocol) */
+#define MOUSE_LMAN_BUTTON2DOWN 0x20 /* middle button, the 4th byte */
+
+/* ALPS GlidePoint extention (variant of M+ protocol) */
+#define MOUSE_ALPS_BUTTON2DOWN 0x20 /* middle button, the 4th byte */
+#define MOUSE_ALPS_TAP 0x10 /* `tapping' action, the 4th byte */
+
+/* Kinsington Thinking Mouse extention (variant of M+ protocol) */
+#define MOUSE_THINK_BUTTON2DOWN 0x20 /* lower-left button, the 4th byte */
+#define MOUSE_THINK_BUTTON4DOWN 0x10 /* lower-right button, the 4th byte */
+
+/* MS IntelliMouse (variant of MS Serial) */
+#define MOUSE_INTELLI_PACKETSIZE 4
+#define MOUSE_INTELLI_BUTTON2DOWN 0x10 /* middle button in the 4th byte */
+
+/* Mouse Systems Corp. mouse data packet */
+#define MOUSE_MSC_PACKETSIZE 5
+#define MOUSE_MSC_SYNCMASK 0xf8
+#define MOUSE_MSC_SYNC 0x80
+#define MOUSE_MSC_BUTTONS 0x07
+#define MOUSE_MSC_BUTTON1UP 0x04 /* left */
+#define MOUSE_MSC_BUTTON2UP 0x02 /* middle */
+#define MOUSE_MSC_BUTTON3UP 0x01 /* right */
+#define MOUSE_MSC_MAXBUTTON 3
+
+/* MM series mouse data packet */
+#define MOUSE_MM_PACKETSIZE 3
+#define MOUSE_MM_SYNCMASK 0xe0
+#define MOUSE_MM_SYNC 0x80
+#define MOUSE_MM_BUTTONS 0x07
+#define MOUSE_MM_BUTTON1DOWN 0x04 /* left */
+#define MOUSE_MM_BUTTON2DOWN 0x02 /* middle */
+#define MOUSE_MM_BUTTON3DOWN 0x01 /* right */
+#define MOUSE_MM_XPOSITIVE 0x10
+#define MOUSE_MM_YPOSITIVE 0x08
+
+/* PS/2 mouse data packet */
+#define MOUSE_PS2_PACKETSIZE 3
+#define MOUSE_PS2_SYNCMASK 0xc8
+#define MOUSE_PS2_SYNC 0x08
+#define MOUSE_PS2_BUTTONS 0x07 /* 0x03 for 2 button mouse */
+#define MOUSE_PS2_BUTTON1DOWN 0x01 /* left */
+#define MOUSE_PS2_BUTTON2DOWN 0x04 /* middle */
+#define MOUSE_PS2_BUTTON3DOWN 0x02 /* right */
+#define MOUSE_PS2_TAP MOUSE_PS2_SYNC /* GlidePoint (PS/2) `tapping'
+ * Yes! this is the same bit
+ * as SYNC!
+ */
+
+#define MOUSE_PS2_XNEG 0x10
+#define MOUSE_PS2_YNEG 0x20
+#define MOUSE_PS2_XOVERFLOW 0x40
+#define MOUSE_PS2_YOVERFLOW 0x80
+
+/* Logitech MouseMan+ (PS/2) data packet (PS/2++ protocol) */
+#define MOUSE_PS2PLUS_SYNCMASK 0x48
+#define MOUSE_PS2PLUS_SYNC 0x48
+#define MOUSE_PS2PLUS_ZNEG 0x08 /* sign bit */
+#define MOUSE_PS2PLUS_BUTTON4DOWN 0x10 /* 4th button on MouseMan+ */
+#define MOUSE_PS2PLUS_BUTTON5DOWN 0x20
+
+/* IBM ScrollPoint (PS/2) also uses PS/2++ protocol */
+#define MOUSE_SPOINT_ZNEG 0x80 /* sign bits */
+#define MOUSE_SPOINT_WNEG 0x08
+
+/* MS IntelliMouse (PS/2) data packet */
+#define MOUSE_PS2INTELLI_PACKETSIZE 4
+/* some compatible mice have additional buttons */
+#define MOUSE_PS2INTELLI_BUTTON4DOWN 0x40
+#define MOUSE_PS2INTELLI_BUTTON5DOWN 0x80
+
+/* MS IntelliMouse Explorer (PS/2) data packet (variation of IntelliMouse) */
+#define MOUSE_EXPLORER_ZNEG 0x08 /* sign bit */
+/* IntelliMouse Explorer has additional button data in the fourth byte */
+#define MOUSE_EXPLORER_BUTTON4DOWN 0x10
+#define MOUSE_EXPLORER_BUTTON5DOWN 0x20
+
+/* Interlink VersaPad (serial I/F) data packet */
+#define MOUSE_VERSA_PACKETSIZE 6
+#define MOUSE_VERSA_IN_USE 0x04
+#define MOUSE_VERSA_SYNCMASK 0xc3
+#define MOUSE_VERSA_SYNC 0xc0
+#define MOUSE_VERSA_BUTTONS 0x30
+#define MOUSE_VERSA_BUTTON1DOWN 0x20 /* left */
+#define MOUSE_VERSA_BUTTON2DOWN 0x00 /* middle */
+#define MOUSE_VERSA_BUTTON3DOWN 0x10 /* right */
+#define MOUSE_VERSA_TAP 0x08
+
+/* Interlink VersaPad (PS/2 I/F) data packet */
+#define MOUSE_PS2VERSA_PACKETSIZE 6
+#define MOUSE_PS2VERSA_IN_USE 0x10
+#define MOUSE_PS2VERSA_SYNCMASK 0xe8
+#define MOUSE_PS2VERSA_SYNC 0xc8
+#define MOUSE_PS2VERSA_BUTTONS 0x05
+#define MOUSE_PS2VERSA_BUTTON1DOWN 0x04 /* left */
+#define MOUSE_PS2VERSA_BUTTON2DOWN 0x00 /* middle */
+#define MOUSE_PS2VERSA_BUTTON3DOWN 0x01 /* right */
+#define MOUSE_PS2VERSA_TAP 0x02
+
+/* A4 Tech 4D Mouse (PS/2) data packet */
+#define MOUSE_4D_PACKETSIZE 3
+#define MOUSE_4D_WHEELBITS 0xf0
+
+/* A4 Tech 4D+ Mouse (PS/2) data packet */
+#define MOUSE_4DPLUS_PACKETSIZE 3
+#define MOUSE_4DPLUS_ZNEG 0x04 /* sign bit */
+#define MOUSE_4DPLUS_BUTTON4DOWN 0x08
+
+/* sysmouse extended data packet */
+/*
+ * /dev/sysmouse sends data in two formats, depending on the protocol
+ * level. At the level 0, format is exactly the same as MousSystems'
+ * five byte packet. At the level 1, the first five bytes are the same
+ * as at the level 0. There are additional three bytes which shows
+ * `dz' and the states of additional buttons. `dz' is expressed as the
+ * sum of the byte 5 and 6 which contain signed seven bit values.
+ * The states of the button 4 though 10 are in the bit 0 though 6 in
+ * the byte 7 respectively: 1 indicates the button is up.
+ */
+#define MOUSE_SYS_PACKETSIZE 8
+#define MOUSE_SYS_SYNCMASK 0xf8
+#define MOUSE_SYS_SYNC 0x80
+#define MOUSE_SYS_BUTTON1UP 0x04 /* left, 1st byte */
+#define MOUSE_SYS_BUTTON2UP 0x02 /* middle, 1st byte */
+#define MOUSE_SYS_BUTTON3UP 0x01 /* right, 1st byte */
+#define MOUSE_SYS_BUTTON4UP 0x0001 /* 7th byte */
+#define MOUSE_SYS_BUTTON5UP 0x0002
+#define MOUSE_SYS_BUTTON6UP 0x0004
+#define MOUSE_SYS_BUTTON7UP 0x0008
+#define MOUSE_SYS_BUTTON8UP 0x0010
+#define MOUSE_SYS_BUTTON9UP 0x0020
+#define MOUSE_SYS_BUTTON10UP 0x0040
+#define MOUSE_SYS_MAXBUTTON 10
+#define MOUSE_SYS_STDBUTTONS 0x07
+#define MOUSE_SYS_EXTBUTTONS 0x7f /* the others */
+
+/* Mouse remote socket */
+#define _PATH_MOUSEREMOTE "/var/run/MouseRemote"
+
+#endif /* _MACHINE_MOUSE_H_ */
diff --git a/sys/ia64/include/mutex.h b/sys/ia64/include/mutex.h
new file mode 100644
index 0000000..b858079
--- /dev/null
+++ b/sys/ia64/include/mutex.h
@@ -0,0 +1,563 @@
+/*-
+ * Copyright (c) 1997 Berkeley Software Design, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Berkeley Software Design Inc's name may not be used to endorse or
+ * promote products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY BERKELEY SOFTWARE DESIGN INC ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL BERKELEY SOFTWARE DESIGN INC BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * from BSDI $Id: mutex.h,v 2.7.2.35 2000/04/27 03:10:26 cp Exp $
+ * $FreeBSD$
+ */
+
+#ifndef _MACHINE_MUTEX_H_
+#define _MACHINE_MUTEX_H_
+
+#ifndef LOCORE
+
+#include <sys/ktr.h>
+#include <sys/queue.h>
+#include <machine/atomic.h>
+#include <machine/cpufunc.h>
+#include <machine/globaldata.h>
+#include <machine/globals.h>
+
+/*
+ * If kern_mutex.c is being built, compile non-inlined versions of various
+ * functions so that kernel modules can use them.
+ */
+#ifndef _KERN_MUTEX_C_
+#define _MTX_INLINE static __inline
+#else
+#define _MTX_INLINE
+#endif
+
+/*
+ * Mutex flags
+ *
+ * Types
+ */
+#define MTX_DEF 0x1 /* Default (spin/sleep) */
+#define MTX_SPIN 0x2 /* Spin only lock */
+
+/* Options */
+#define MTX_RLIKELY 0x4 /* (opt) Recursion likely */
+#define MTX_NORECURSE 0x8 /* No recursion possible */
+#define MTX_NOSPIN 0x10 /* Don't spin before sleeping */
+#define MTX_NOSWITCH 0x20 /* Do not switch on release */
+#define MTX_FIRST 0x40 /* First spin lock holder */
+#define MTX_TOPHALF 0x80 /* Interrupts not disabled on spin */
+
+/* options that should be passed on to mtx_enter_hard, mtx_exit_hard */
+#define MTX_HARDOPTS (MTX_DEF | MTX_SPIN | MTX_FIRST | MTX_TOPHALF | MTX_NOSWITCH)
+
+/* Flags/value used in mtx_lock */
+#define MTX_RECURSE 0x01 /* (non-spin) lock held recursively */
+#define MTX_CONTESTED 0x02 /* (non-spin) lock contested */
+#define MTX_FLAGMASK ~(MTX_RECURSE | MTX_CONTESTED)
+#define MTX_UNOWNED 0x8 /* Cookie for free mutex */
+
+struct proc; /* XXX */
+
+/*
+ * Sleep/spin mutex
+ */
+struct mtx {
+ volatile u_int64_t mtx_lock; /* lock owner/gate/flags */
+ volatile u_int32_t mtx_recurse; /* number of recursive holds */
+ u_int32_t mtx_savepsr; /* saved psr (for spin locks) */
+ char *mtx_description;
+ TAILQ_HEAD(, proc) mtx_blocked;
+ LIST_ENTRY(mtx) mtx_contested;
+ struct mtx *mtx_next; /* all locks in system */
+ struct mtx *mtx_prev;
+#ifdef SMP_DEBUG
+ /* If you add anything here, adjust the mtxf_t definition below */
+ struct witness *mtx_witness;
+ LIST_ENTRY(mtx) mtx_held;
+ const char *mtx_file;
+ int mtx_line;
+#endif /* SMP_DEBUG */
+};
+
+/*
+ * Filler for structs which need to remain the same size
+ * whether or not SMP_DEBUG is turned on.
+ */
+typedef struct mtxf {
+#ifdef SMP_DEBUG
+ char mtxf_data[0];
+#else
+ char mtxf_data[4*sizeof(void *) + sizeof(int)];
+#endif
+} mtxf_t;
+
+#define mp_fixme(string)
+
+#ifdef _KERNEL
+/* Misc */
+#define CURTHD ((u_int64_t)CURPROC) /* Current thread ID */
+
+/* Prototypes */
+void mtx_init(struct mtx *m, char *description, int flag);
+void mtx_enter_hard(struct mtx *, int type, int psr);
+void mtx_exit_hard(struct mtx *, int type);
+void mtx_destroy(struct mtx *m);
+
+/*
+ * Wrap the following functions with cpp macros so that filenames and line
+ * numbers are embedded in the code correctly.
+ */
+#if (defined(KLD_MODULE) || defined(_KERN_MUTEX_C_))
+void _mtx_enter(struct mtx *mtxp, int type, const char *file, int line);
+int _mtx_try_enter(struct mtx *mtxp, int type, const char *file, int line);
+void _mtx_exit(struct mtx *mtxp, int type, const char *file, int line);
+#endif
+
+#define mtx_enter(mtxp, type) \
+ _mtx_enter((mtxp), (type), __FILE__, __LINE__)
+
+#define mtx_try_enter(mtxp, type) \
+ _mtx_try_enter((mtxp), (type), __FILE__, __LINE__)
+
+#define mtx_exit(mtxp, type) \
+ _mtx_exit((mtxp), (type), __FILE__, __LINE__)
+
+/* Global locks */
+extern struct mtx sched_lock;
+extern struct mtx Giant;
+
+/*
+ * Used to replace return with an exit Giant and return.
+ */
+
+#define EGAR(a) \
+do { \
+ mtx_exit(&Giant, MTX_DEF); \
+ return (a); \
+} while (0)
+
+#define VEGAR \
+do { \
+ mtx_exit(&Giant, MTX_DEF); \
+ return; \
+} while (0)
+
+#define DROP_GIANT() \
+do { \
+ int _giantcnt; \
+ WITNESS_SAVE_DECL(Giant); \
+ \
+ WITNESS_SAVE(&Giant, Giant); \
+ for (_giantcnt = 0; mtx_owned(&Giant); _giantcnt++) \
+ mtx_exit(&Giant, MTX_DEF)
+
+#define PICKUP_GIANT() \
+ mtx_assert(&Giant, MA_NOTOWNED); \
+ while (_giantcnt--) \
+ mtx_enter(&Giant, MTX_DEF); \
+ WITNESS_RESTORE(&Giant, Giant); \
+} while (0)
+
+#define PARTIAL_PICKUP_GIANT() \
+ mtx_assert(&Giant, MA_NOTOWNED); \
+ while (_giantcnt--) \
+ mtx_enter(&Giant, MTX_DEF); \
+ WITNESS_RESTORE(&Giant, Giant)
+
+/*
+ * Debugging
+ */
+#ifndef SMP_DEBUG
+#define mtx_assert(m, what)
+#else /* SMP_DEBUG */
+
+#define MA_OWNED 1
+#define MA_NOTOWNED 2
+#define mtx_assert(m, what) { \
+ switch ((what)) { \
+ case MA_OWNED: \
+ ASS(mtx_owned((m))); \
+ break; \
+ case MA_NOTOWNED: \
+ ASS(!mtx_owned((m))); \
+ break; \
+ default: \
+ panic("unknown mtx_assert at %s:%d", __FILE__, __LINE__); \
+ } \
+}
+
+#ifdef INVARIANTS
+#define ASS(ex) MPASS(ex)
+#define MPASS(ex) if (!(ex)) panic("Assertion %s failed at %s:%d", \
+ #ex, __FILE__, __LINE__)
+#define MPASS2(ex, what) if (!(ex)) panic("Assertion %s failed at %s:%d", \
+ what, __FILE__, __LINE__)
+
+#ifdef MTX_STRS
+char STR_IEN[] = "psr.i";
+char STR_IDIS[] = "!psr.i";
+#else /* MTX_STRS */
+extern char STR_IEN[];
+extern char STR_IDIS[];
+#endif /* MTX_STRS */
+#define ASS_IEN MPASS2((save_intr() & (1 << 14)), STR_IEN)
+#define ASS_IDIS MPASS2(!(save_intr() & (1 << 14)), STR_IDIS)
+#endif /* INVARIANTS */
+
+#endif /* SMP_DEBUG */
+
+#if !defined(SMP_DEBUG) || !defined(INVARIANTS)
+#define ASS(ex)
+#define MPASS(ex)
+#define MPASS2(ex, where)
+#define ASS_IEN
+#define ASS_IDIS
+#endif /* !defined(SMP_DEBUG) || !defined(INVARIANTS) */
+
+#ifdef WITNESS
+#ifndef SMP_DEBUG
+#error WITNESS requires SMP_DEBUG
+#endif /* SMP_DEBUG */
+#define WITNESS_ENTER(m, t, f, l) \
+ if ((m)->mtx_witness != NULL) \
+ witness_enter((m), (t), (f), (l))
+#define WITNESS_EXIT(m, t, f, l) \
+ if ((m)->mtx_witness != NULL) \
+ witness_exit((m), (t), (f), (l))
+
+#define WITNESS_SLEEP(check, m) witness_sleep(check, (m), __FILE__, __LINE__)
+#define WITNESS_SAVE_DECL(n) \
+ const char * __CONCAT(n, __wf); \
+ int __CONCAT(n, __wl)
+
+#define WITNESS_SAVE(m, n) \
+do { \
+ if ((m)->mtx_witness != NULL) \
+ witness_save(m, &__CONCAT(n, __wf), &__CONCAT(n, __wl)); \
+} while (0)
+
+#define WITNESS_RESTORE(m, n) \
+do { \
+ if ((m)->mtx_witness != NULL) \
+ witness_restore(m, __CONCAT(n, __wf), __CONCAT(n, __wl)); \
+} while (0)
+
+void witness_init(struct mtx *, int flag);
+void witness_destroy(struct mtx *);
+void witness_enter(struct mtx *, int, const char *, int);
+void witness_try_enter(struct mtx *, int, const char *, int);
+void witness_exit(struct mtx *, int, const char *, int);
+void witness_display(void(*)(const char *fmt, ...));
+void witness_list(struct proc *);
+int witness_sleep(int, struct mtx *, const char *, int);
+void witness_save(struct mtx *, const char **, int *);
+void witness_restore(struct mtx *, const char *, int);
+#else /* WITNESS */
+#define WITNESS_ENTER(m, t, f, l)
+#define WITNESS_EXIT(m, t, f, l)
+#define WITNESS_SLEEP(check, m)
+#define WITNESS_SAVE_DECL(n)
+#define WITNESS_SAVE(m, n)
+#define WITNESS_RESTORE(m, n)
+
+/*
+ * flag++ is slezoid way of shutting up unused parameter warning
+ * in mtx_init()
+ */
+#define witness_init(m, flag) flag++
+#define witness_destroy(m)
+#define witness_enter(m, t, f, l)
+#define witness_try_enter(m, t, f, l)
+#define witness_exit(m, t, f, l)
+#endif /* WITNESS */
+
+/*
+ * Assembly macros (for internal use only)
+ *--------------------------------------------------------------------------
+ */
+
+/*
+ * Get a sleep lock, deal with recursion inline
+ */
+
+#define _V(x) __STRING(x)
+
+#define _getlock_sleep(mp, tid, type) do { \
+ if (ia64_cmpxchg_acq_64(&(mp)->mtx_lock, \
+ MTX_UNOWNED, (tid)) != MTX_UNOWNED) { \
+ if (((mp)->mtx_lock & MTX_FLAGMASK) != (tid)) \
+ mtx_enter_hard(mp, (type) & MTX_HARDOPTS, 0); \
+ else { \
+ atomic_set_64(&(mp)->mtx_lock, MTX_RECURSE); \
+ (mp)->mtx_recurse++; \
+ } \
+ } \
+} while (0)
+
+/*
+ * Get a spin lock, handle recusion inline (as the less common case)
+ */
+
+#define _getlock_spin_block(mp, tid, type) do { \
+ u_int _psr = save_intr(); \
+ disable_intr(); \
+ if (ia64_cmpxchg_acq_64(&(mp)->mtx_lock, \
+ MTX_UNOWNED, (tid)) != MTX_UNOWNED) \
+ mtx_enter_hard(mp, (type) & MTX_HARDOPTS, _psr); \
+ else \
+ (mp)->mtx_savepsr = _psr; \
+} while (0)
+
+/*
+ * Get a lock without any recursion handling. Calls the hard enter
+ * function if we can't get it inline.
+ */
+
+#define _getlock_norecurse(mp, tid, type) do { \
+ if (ia64_cmpxchg_acq_64(&(mp)->mtx_lock, \
+ MTX_UNOWNED, (tid)) != MTX_UNOWNED) \
+ mtx_enter_hard(mp, (type) & MTX_HARDOPTS, 0); \
+} while (0)
+
+/*
+ * Release a sleep lock assuming we haven't recursed on it, recursion is
+ * handled in the hard function.
+ */
+
+#define _exitlock_norecurse(mp, tid, type) do { \
+ if (ia64_cmpxchg_rel_64(&(mp)->mtx_lock, \
+ (tid), MTX_UNOWNED) != (tid)) \
+ mtx_exit_hard((mp), (type) & MTX_HARDOPTS); \
+} while (0)
+
+/*
+ * Release a sleep lock when its likely we recursed (the code to
+ * deal with simple recursion is inline).
+ */
+
+#define _exitlock(mp, tid, type) do { \
+ if (ia64_cmpxchg_rel_64(&(mp)->mtx_lock, \
+ (tid), MTX_UNOWNED) != (tid)) { \
+ if (((mp)->mtx_lock & MTX_RECURSE) && \
+ (--(mp)->mtx_recurse == 0)) \
+ atomic_clear_64(&(mp)->mtx_lock, MTX_RECURSE); \
+ else \
+ mtx_exit_hard((mp), (type) & MTX_HARDOPTS); \
+ } \
+} while (0)
+
+/*
+ * Release a spin lock (with possible recursion)
+ */
+
+#define _exitlock_spin(mp) do { \
+ if ((mp)->mtx_recurse == 0) { \
+ int _psr = (mp)->mtx_savepsr; \
+ ia64_st_rel_64(&(mp)->mtx_lock, MTX_UNOWNED); \
+ restore_intr(_psr); \
+ } else { \
+ (mp)->mtx_recurse--; \
+ } \
+} while (0)
+
+/*
+ * Externally visible mutex functions
+ *------------------------------------------------------------------------
+ */
+
+/*
+ * Return non-zero if a mutex is already owned by the current thread
+ */
+#define mtx_owned(m) (((m)->mtx_lock & MTX_FLAGMASK) == CURTHD)
+
+/* Common strings */
+#ifdef MTX_STRS
+char STR_mtx_enter_fmt[] = "GOT %s [%p] at %s:%d r=%d";
+char STR_mtx_bad_type[] = "((type) & (MTX_NORECURSE | MTX_NOSWITCH)) == 0";
+char STR_mtx_exit_fmt[] = "REL %s [%p] at %s:%d r=%d";
+char STR_mtx_owned[] = "mtx_owned(mpp)";
+char STR_mtx_recurse[] = "mpp->mtx_recurse == 0";
+char STR_mtx_try_enter_fmt[] = "TRY_ENTER %s [%p] at %s:%d result=%d";
+#else /* MTX_STRS */
+extern char STR_mtx_enter_fmt[];
+extern char STR_mtx_bad_type[];
+extern char STR_mtx_exit_fmt[];
+extern char STR_mtx_owned[];
+extern char STR_mtx_recurse[];
+extern char STR_mtx_try_enter_fmt[];
+#endif /* MTX_STRS */
+
+#ifndef KLD_MODULE
+/*
+ * Get lock 'm', the macro handles the easy (and most common cases) and
+ * leaves the slow stuff to the mtx_enter_hard() function.
+ *
+ * Note: since type is usually a constant much of this code is optimized out
+ */
+_MTX_INLINE void
+_mtx_enter(struct mtx *mtxp, int type, const char *file, int line)
+{
+ struct mtx *mpp = mtxp;
+
+ /* bits only valid on mtx_exit() */
+ MPASS2(((type) & (MTX_NORECURSE | MTX_NOSWITCH)) == 0,
+ STR_mtx_bad_type);
+
+ if ((type) & MTX_SPIN) {
+ /*
+ * Easy cases of spin locks:
+ *
+ * 1) We already own the lock and will simply recurse on it (if
+ * RLIKELY)
+ *
+ * 2) The lock is free, we just get it
+ */
+ if ((type) & MTX_RLIKELY) {
+ /*
+ * Check for recursion, if we already have this lock we
+ * just bump the recursion count.
+ */
+ if (mpp->mtx_lock == CURTHD) {
+ mpp->mtx_recurse++;
+ goto done;
+ }
+ }
+
+ if (((type) & MTX_TOPHALF) == 0) {
+ /*
+ * If an interrupt thread uses this we must block
+ * interrupts here.
+ */
+ _getlock_spin_block(mpp, CURTHD, (type) & MTX_HARDOPTS);
+ } else
+ _getlock_norecurse(mpp, CURTHD, (type) & MTX_HARDOPTS);
+ } else {
+ /* Sleep locks */
+ if ((type) & MTX_RLIKELY)
+ _getlock_sleep(mpp, CURTHD, (type) & MTX_HARDOPTS);
+ else
+ _getlock_norecurse(mpp, CURTHD, (type) & MTX_HARDOPTS);
+ }
+ done:
+ WITNESS_ENTER(mpp, type, file, line);
+ CTR5(KTR_LOCK, STR_mtx_enter_fmt,
+ mpp->mtx_description, mpp, file, line,
+ mpp->mtx_recurse);
+}
+
+/*
+ * Attempt to get MTX_DEF lock, return non-zero if lock acquired
+ *
+ * XXX DOES NOT HANDLE RECURSION
+ */
+_MTX_INLINE int
+_mtx_try_enter(struct mtx *mtxp, int type, const char *file, int line)
+{
+ struct mtx *const mpp = mtxp;
+ int rval;
+
+ rval = atomic_cmpset_64(&mpp->mtx_lock, MTX_UNOWNED, CURTHD);
+#ifdef SMP_DEBUG
+ if (rval && mpp->mtx_witness != NULL) {
+ ASS(mpp->mtx_recurse == 0);
+ witness_try_enter(mpp, type, file, line);
+ }
+#endif
+ CTR5(KTR_LOCK, STR_mtx_try_enter_fmt,
+ mpp->mtx_description, mpp, file, line, rval);
+
+ return rval;
+}
+
+/*
+ * Release lock m
+ */
+_MTX_INLINE void
+_mtx_exit(struct mtx *mtxp, int type, const char *file, int line)
+{
+ struct mtx *const mpp = mtxp;
+
+ MPASS2(mtx_owned(mpp), STR_mtx_owned);
+ WITNESS_EXIT(mpp, type, file, line);
+ CTR5(KTR_LOCK, STR_mtx_exit_fmt,
+ mpp->mtx_description, mpp, file, line,
+ mpp->mtx_recurse);
+ if ((type) & MTX_SPIN) {
+ if ((type) & MTX_NORECURSE) {
+ MPASS2(mpp->mtx_recurse == 0, STR_mtx_recurse);
+ ia64_st_rel_64(&mpp->mtx_lock, MTX_UNOWNED);
+ if (((type) & MTX_TOPHALF) == 0)
+ restore_intr(mpp->mtx_savepsr);
+ } else
+ if ((type) & MTX_TOPHALF) {
+ _exitlock_norecurse(mpp, CURTHD,
+ (type) & MTX_HARDOPTS);
+ } else
+ _exitlock_spin(mpp);
+ } else {
+ /* Handle sleep locks */
+ if ((type) & MTX_RLIKELY) {
+ _exitlock(mpp, CURTHD, (type) & MTX_HARDOPTS);
+ } else {
+ _exitlock_norecurse(mpp, CURTHD,
+ (type) & MTX_HARDOPTS);
+ }
+ }
+}
+
+#endif /* KLD_MODULE */
+#endif /* _KERNEL */
+
+#else /* !LOCORE */
+
+/*
+ * Simple assembly macros to get and release non-recursive spin locks
+ */
+#define MTX_ENTER(lck, rPSR, rOLD, rNEW, rLCK) \
+ mov rPSR=psr ; \
+ mov rNEW=globalp ; \
+ mov rLCK=lck+MTX_LOCK ;; \
+ rsm psr.i ; \
+ mov ar.ccv=MTX_UNOWNED ; \
+ add rNEW=PC_CURPROC,rNEW ;; \
+ ld8 rNEW=[rNEW] ;; \
+1: cmpxchg8.acq rOLD=[rLCK],rNEW,ar.ccv ;; \
+ cmp.eq p1,p0=MTX_UNOWNED,rOLD ;; \
+(p1) br.cond.spnt.few 1b ;; \
+ mov rLCK=lck+MTX_SAVEPSR ;; \
+ st4 [rLCK]=rPSR
+
+#define MTX_EXIT(lck, rTMP, rLCK) \
+ mov rTMP=MTX_UNOWNED ; \
+ addl rLCK=@ltoff(lck),gp;; \
+ add rLCK=MTX_LOCK,rLCK;; \
+ st8.rel [rLCK]=rTMP ;; \
+ addl rLCK=@ltoff(lck),gp;; \
+ add rLCK=MTX_SAVEPSR,rLCK;; \
+ ld4 rTMP=[rLCK] ;; \
+ mov psr.l=rTMP ;; \
+ srlz.d
+
+#endif /* !LOCORE */
+
+#endif /* __MACHINE_MUTEX_H */
diff --git a/sys/ia64/include/pal.h b/sys/ia64/include/pal.h
new file mode 100644
index 0000000..39c12a4
--- /dev/null
+++ b/sys/ia64/include/pal.h
@@ -0,0 +1,95 @@
+/*-
+ * Copyright (c) 2000 Doug Rabson
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _MACHINE_PAL_H_
+#define _MACHINE_PAL_H_
+
+/*
+ * Architected static calling convention procedures.
+ */
+#define PAL_CACHE_FLUSH 1
+#define PAL_CACHE_INFO 2
+#define PAL_CACHE_INIT 3
+#define PAL_CACHE_SUMMARY 4
+#define PAL_MEM_ATTRIB 5
+#define PAL_PTCE_INFO 6
+#define PAL_VM_INFO 7
+#define PAL_VM_SUMMARY 8
+#define PAL_BUS_GET_FEATURES 9
+#define PAL_BUS_SET_FEATURES 10
+#define PAL_DEBUG_INFO 11
+#define PAL_FIXED_ADDR 12
+#define PAL_FREQ_BASE 13
+#define PAL_FREQ_RATIOS 14
+#define PAL_PERF_MON_INFO 15
+#define PAL_PLATFORM_ADDR 16
+#define PAL_PROC_GET_FEATURE 17
+#define PAL_PROC_SET_FEATURE 18
+#define PAL_RSE_INFO 19
+#define PAL_VERSION 20
+#define PAL_MC_CLEAR_LOG 21
+#define PAL_MC_DRAIN 22
+#define PAL_MC_DYNAMIC_STATE 24
+#define PAL_MC_ERROR_INFO 25
+#define PAL_MC_EXPECTED 23
+#define PAL_MC_REGISTER_MEM 27
+#define PAL_MC_RESUME 26
+#define PAL_HALT 28
+#define PAL_HALT_LIGHT 29
+#define PAL_COPY_INFO 30
+#define PAL_CACHE_LINE_INIT 31
+#define PAL_PMI_ENTRYPOINT 32
+#define PAL_ENTER_IA_32_ENV 33
+#define PAL_VM_PAGE_SIZE 34
+#define PAL_MEM_FOR_TEST 37
+#define PAL_CACHE_PROT_INFO 38
+#define PAL_REGISTER_INFO 39
+#define PAL_SHUTDOWN 40
+#define PAL_PREFETCH_VISIBILITY 41
+
+/*
+ * Architected stacked calling convention procedures.
+ */
+#define PAL_COPY_PAL 256
+#define PAL_HALT_INFO 257
+#define PAL_TEST_PROC 258
+#define PAL_CACHE_READ 259
+#define PAL_CACHE_WRITE 260
+#define PAL_VM_TR_READ 261
+
+struct ia64_pal_result {
+ int64_t pal_status;
+ u_int64_t pal_result[3];
+};
+
+extern struct ia64_pal_result
+ ia64_call_pal_static(u_int64_t proc, u_int64_t arg1,
+ u_int64_t arg2, u_int64_t arg3);
+
+
+#endif /* _MACHINE_PAL_H_ */
diff --git a/sys/ia64/include/param.h b/sys/ia64/include/param.h
new file mode 100644
index 0000000..d67a0fc
--- /dev/null
+++ b/sys/ia64/include/param.h
@@ -0,0 +1,163 @@
+/* $FreeBSD$ */
+/* From: NetBSD: param.h,v 1.20 1997/09/19 13:52:53 leo Exp */
+
+/*
+ * Copyright (c) 1988 University of Utah.
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * the Systems Programming Group of the University of Utah Computer
+ * Science Department and Ralph Campbell.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * from: Utah $Hdr: machparam.h 1.11 89/08/14$
+ *
+ * @(#)param.h 8.1 (Berkeley) 6/10/93
+ */
+
+/*
+ * Machine dependent constants for the IA64.
+ */
+#ifndef _MACHINE
+#define _MACHINE ia64
+#endif
+#ifndef MACHINE
+#define MACHINE "ia64"
+#endif
+#ifndef _MACHINE_ARCH
+#define _MACHINE_ARCH ia64
+#endif
+#ifndef MACHINE_ARCH
+#define MACHINE_ARCH "ia64"
+#endif
+#define MID_MACHINE MID_IA64
+
+#include <machine/ia64_cpu.h>
+#include <machine/cpu.h>
+
+/*
+ * OBJFORMAT_NAMES is a comma-separated list of the object formats
+ * that are supported on the architecture.
+ */
+#define OBJFORMAT_NAMES "elf"
+#define OBJFORMAT_DEFAULT "elf"
+
+#define NCPUS 1
+
+/*
+ * Round p (pointer or byte index) up to a correctly-aligned value for all
+ * data types (int, long, ...). The result is u_long and must be cast to
+ * any desired pointer type.
+ *
+ * ALIGNED_POINTER is a boolean macro that checks whether an address
+ * is valid to fetch data elements of type t from on this architecture.
+ * This does not reflect the optimal alignment, just the possibility
+ * (within reasonable limits).
+ *
+ */
+#define ALIGNBYTES 7
+#define ALIGN(p) (((u_long)(p) + ALIGNBYTES) &~ ALIGNBYTES)
+#define ALIGNED_POINTER(p,t) ((((u_long)(p)) & (sizeof(t)-1)) == 0)
+
+#define PAGE_SIZE 4096 /* bytes/page */
+#define PAGE_SHIFT 12
+#define PAGE_MASK (PAGE_SIZE-1)
+#define NPTEPG (PAGE_SIZE/(sizeof (pt_entry_t)))
+
+#define KERNBASE 0xfffffc0000300000LL /* start of kernel virtual */
+#define BTOPKERNBASE ((u_long)KERNBASE >> PGSHIFT)
+
+#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */
+#define DEV_BSIZE (1<<DEV_BSHIFT)
+
+#ifndef BLKDEV_IOSIZE
+#define BLKDEV_IOSIZE PAGE_SIZE /* default block device I/O size */
+#endif
+#define DFLTPHYS (64 * 1024) /* default max raw I/O transfer size */
+#define MAXPHYS (128 * 1024) /* max raw I/O transfer size */
+
+#define CLSIZE 1
+#define CLSIZELOG2 0
+
+/* NOTE: SSIZE, SINCR and UPAGES must be multiples of CLSIZE */
+#define SSIZE 1 /* initial stack size/NBPG */
+#define SINCR 1 /* increment of stack/NBPG */
+
+#define UPAGES 4 /* pages of u-area */
+#define USPACE (UPAGES * PAGE_SIZE) /* total size of u-area */
+
+/*
+ * Constants related to network buffer management.
+ * MCLBYTES must be no larger than CLBYTES (the software page size), and,
+ * on machines that exchange pages of input or output buffers with mbuf
+ * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple
+ * of the hardware page size.
+ */
+#define MSIZE 256 /* size of an mbuf */
+#ifndef MCLSHIFT
+# define MCLSHIFT 11 /* convert bytes to m_buf clusters */
+ /* 2K cluster can hold Ether frame */
+#endif /* MCLSHIFT */
+#define MCLBYTES (1 << MCLSHIFT) /* size of a m_buf cluster */
+#define MCLOFSET (MCLBYTES - 1)
+
+/*
+ * Size of kernel malloc arena in CLBYTES-sized logical pages
+ */
+#ifndef NKMEMCLUSTERS
+#define NKMEMCLUSTERS (4096*1024/CLBYTES) /* XXX? */
+#endif
+
+/* pages ("clicks") to disk blocks */
+#define ctod(x) ((x) << (PAGE_SHIFT - DEV_BSHIFT))
+#define dtoc(x) ((x) >> (PAGE_SHIFT - DEV_BSHIFT))
+
+/* pages to bytes */
+#define ctob(x) ((x) << PAGE_SHIFT)
+#define btoc(x) (((x) + PAGE_MASK) >> PAGE_SHIFT)
+
+/* bytes to disk blocks */
+#define btodb(x) ((x) >> DEV_BSHIFT)
+#define dbtob(x) ((x) << DEV_BSHIFT)
+
+/*
+ * Mach derived conversion macros
+ */
+#define round_page(x) ((((unsigned long)(x)) + PAGE_MASK) & ~(PAGE_MASK))
+#define trunc_page(x) ((unsigned long)(x) & ~(PAGE_MASK))
+
+#define atop(x) ((unsigned long)(x) >> PAGE_SHIFT)
+#define ptoa(x) ((unsigned long)(x) << PAGE_SHIFT)
+
+#define ia64_btop(x) ((unsigned long)(x) >> PAGE_SHIFT)
+#define ia64_ptob(x) ((unsigned long)(x) << PAGE_SHIFT)
+
+#define pgtok(x) ((x) * (PAGE_SIZE / 1024))
diff --git a/sys/ia64/include/pcb.h b/sys/ia64/include/pcb.h
new file mode 100644
index 0000000..41c3777
--- /dev/null
+++ b/sys/ia64/include/pcb.h
@@ -0,0 +1,68 @@
+/*-
+ * Copyright (c) 2000 Doug Rabson
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _MACHINE_PCB_H_
+#define _MACHINE_PCB_H_
+
+/*
+ * PCB: process control block
+ */
+struct pcb {
+ u_int64_t pcb_r4;
+ u_int64_t pcb_r5;
+ u_int64_t pcb_r6;
+ u_int64_t pcb_r7;
+
+ struct ia64_fpreg pcb_f2;
+ struct ia64_fpreg pcb_f3;
+ struct ia64_fpreg pcb_f4;
+ struct ia64_fpreg pcb_f5;
+
+ u_int64_t pcb_old_unat; /* caller's ar.unat */
+ u_int64_t pcb_sp;
+ u_int64_t pcb_pfs;
+ u_int64_t pcb_bspstore;
+
+ u_int64_t pcb_unat; /* ar.unat for r4..r7 */
+ u_int64_t pcb_rnat;
+ u_int64_t pcb_pr; /* predicates */
+ u_int64_t pcb_iip; /* address to restart */
+
+ unsigned long pcb_onfault; /* for copy faults */
+ unsigned long pcb_accessaddr; /* for [fs]uswintr */
+};
+
+/*
+ * The pcb is augmented with machine-dependent additional data for
+ * core dumps. For the Alpha, that's a trap frame.
+ */
+struct md_coredump {
+ struct trapframe md_tf;
+};
+
+#endif /* _MACHINE_PCB_H_ */
diff --git a/sys/ia64/include/pcpu.h b/sys/ia64/include/pcpu.h
new file mode 100644
index 0000000..87c9fe5
--- /dev/null
+++ b/sys/ia64/include/pcpu.h
@@ -0,0 +1,78 @@
+/*-
+ * Copyright (c) 1999 Luoqi Chen <luoqi@freebsd.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _MACHINE_GLOBALDATA_H_
+#define _MACHINE_GLOBALDATA_H_
+
+#ifdef _KERNEL
+
+#include <sys/queue.h>
+
+/*
+ * This structure maps out the global data that needs to be kept on a
+ * per-cpu basis. genassym uses this to generate offsets for the assembler
+ * code, which also provides external symbols so that C can get at them as
+ * though they were really globals. This structure is pointed to by
+ * the per-cpu system value (see alpha_pal_rdval() and alpha_pal_wrval()).
+ * Inside the kernel, the globally reserved register t7 is used to
+ * point at the globaldata structure.
+ */
+struct globaldata {
+ struct proc *gd_curproc; /* current process */
+ struct proc *gd_idleproc; /* idle process */
+ struct proc *gd_fpcurproc; /* fp state owner */
+ struct pcb *gd_curpcb; /* current pcb */
+ struct timeval gd_switchtime;
+ int gd_switchticks;
+ u_int gd_cpuno; /* this cpu number */
+ u_int gd_other_cpus; /* all other cpus */
+ int gd_inside_intr;
+ u_int64_t gd_idlepcbphys; /* pa of gd_idlepcb */
+ u_int64_t gd_pending_ipis; /* pending IPI events */
+ u_int32_t gd_next_asn; /* next ASN to allocate */
+ u_int32_t gd_current_asngen; /* ASN rollover check */
+ u_int32_t gd_intr_nesting_level; /* interrupt recursion */
+
+ u_int gd_astpending;
+ SLIST_ENTRY(globaldata) gd_allcpu;
+#ifdef KTR_PERCPU
+ volatile int gd_ktr_idx; /* Index into trace table */
+ char *gd_ktr_buf;
+ char gd_ktr_buf_data[0];
+#endif
+};
+
+SLIST_HEAD(cpuhead, globaldata);
+extern struct cpuhead cpuhead;
+
+void globaldata_init(struct globaldata *pcpu, int cpuno, size_t sz);
+struct globaldata *globaldata_find(int cpuno);
+
+#endif /* _KERNEL */
+
+#endif /* !_MACHINE_GLOBALDATA_H_ */
diff --git a/sys/ia64/include/pmap.h b/sys/ia64/include/pmap.h
new file mode 100644
index 0000000..edb7ec5
--- /dev/null
+++ b/sys/ia64/include/pmap.h
@@ -0,0 +1,233 @@
+/*
+ * Copyright (c) 1991 Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * the Systems Programming Group of the University of Utah Computer
+ * Science Department and William Jolitz of UUNET Technologies Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * Derived from hp300 version by Mike Hibler, this version by William
+ * Jolitz uses a recursive map [a pde points to the page directory] to
+ * map the page tables using the pagetables themselves. This is done to
+ * reduce the impact on kernel virtual memory for lots of sparse address
+ * space, and to reduce the cost of memory to each process.
+ *
+ * from: hp300: @(#)pmap.h 7.2 (Berkeley) 12/16/90
+ * from: @(#)pmap.h 7.4 (Berkeley) 5/12/91
+ * from: i386 pmap.h,v 1.54 1997/11/20 19:30:35 bde Exp
+ * $FreeBSD$
+ */
+
+#ifndef _MACHINE_PMAP_H_
+#define _MACHINE_PMAP_H_
+
+#ifdef LOCORE
+
+#define PTE_P (1<<0)
+#define PTE_MA_WB (0<<2)
+#define PTE_MA_UC (4<<2)
+#define PTE_MA_UCE (5<<2)
+#define PTE_MA_WC (6<<2)
+#define PTE_MA_NATPAGE (7<<2)
+#define PTE_A (1<<5)
+#define PTE_D (1<<6)
+#define PTE_PL_KERN (0<<7)
+#define PTE_PL_USER (3<<7)
+#define PTE_AR_R (0<<9)
+#define PTE_AR_RX (1<<9)
+#define PTE_AR_RW (2<<9)
+#define PTE_AR_RWX (3<<9)
+#define PTE_AR_R_RW (4<<9)
+#define PTE_AR_RX_RWX (5<<9)
+#define PTE_AR_RWX_RW (6<<9)
+#define PTE_AR_X_RX (7<<9)
+
+#else
+
+#define PTE_MA_WB 0
+#define PTE_MA_UC 4
+#define PTE_MA_UCE 5
+#define PTE_MA_WC 6
+#define PTE_MA_NATPAGE 7
+
+#define PTE_PL_KERN 0
+#define PTE_PL_USER 3
+
+#define PTE_AR_R 0
+#define PTE_AR_RX 1
+#define PTE_AR_RW 2
+#define PTE_AR_RWX 3
+#define PTE_AR_R_RW 4
+#define PTE_AR_RX_RWX 5
+#define PTE_AR_RWX_RW 6
+#define PTE_AR_X_RX 7
+
+#define PTE_IG_WIRED 1
+#define PTE_IG_MANAGED 2
+
+/*
+ * A short-format VHPT entry. Also matches the TLB insertion format.
+ */
+struct ia64_pte {
+ u_int64_t pte_p :1; /* bits 0..0 */
+ u_int64_t pte_rv1 :1; /* bits 1..1 */
+ u_int64_t pte_ma :3; /* bits 2..4 */
+ u_int64_t pte_a :1; /* bits 5..5 */
+ u_int64_t pte_d :1; /* bits 6..6 */
+ u_int64_t pte_pl :2; /* bits 7..8 */
+ u_int64_t pte_ar :3; /* bits 9..11 */
+ u_int64_t pte_ppn :38; /* bits 12..49 */
+ u_int64_t pte_rv2 :2; /* bits 50..51 */
+ u_int64_t pte_ed :1; /* bits 52..52 */
+ u_int64_t pte_ig :11; /* bits 53..63 */
+};
+
+/*
+ * A long-format VHPT entry.
+ */
+struct ia64_lpte {
+ u_int64_t pte_p :1; /* bits 0..0 */
+ u_int64_t pte_rv1 :1; /* bits 1..1 */
+ u_int64_t pte_ma :3; /* bits 2..4 */
+ u_int64_t pte_a :1; /* bits 5..5 */
+ u_int64_t pte_d :1; /* bits 6..6 */
+ u_int64_t pte_pl :2; /* bits 7..8 */
+ u_int64_t pte_ar :3; /* bits 9..11 */
+ u_int64_t pte_ppn :38; /* bits 12..49 */
+ u_int64_t pte_rv2 :2; /* bits 50..51 */
+ u_int64_t pte_ed :1; /* bits 52..52 */
+ u_int64_t pte_ig :11; /* bits 53..63 */
+
+ u_int64_t pte_rv3 :2; /* bits 0..1 */
+ u_int64_t pte_ps :6; /* bits 2..7 */
+ u_int64_t pte_key :24; /* bits 8..31 */
+ u_int64_t pte_rv4 :32; /* bits 32..63 */
+
+ u_int64_t pte_tag; /* includes ti */
+
+ u_int64_t pte_chain; /* pa of collision chain */
+};
+
+#include <sys/queue.h>
+
+#ifdef _KERNEL
+
+/*
+ * Routine: pmap_kextract
+ * Function:
+ * Extract the physical page address associated
+ * kernel virtual address.
+ */
+static __inline vm_offset_t
+pmap_kextract(vm_offset_t va)
+{
+ return ia64_tpa(va);
+}
+
+#define vtophys(va) pmap_kextract(((vm_offset_t) (va)))
+
+#endif /* _KERNEL */
+
+/*
+ * Pmap stuff
+ */
+struct pv_entry;
+
+struct md_page {
+ int pv_list_count;
+ TAILQ_HEAD(,pv_entry) pv_list;
+};
+
+struct pmap {
+ TAILQ_HEAD(,pv_entry) pm_pvlist; /* list of mappings in pmap */
+ int pm_count; /* reference count */
+ int pm_flags; /* pmap flags */
+ int pm_active; /* active flag */
+ int pm_asn; /* address space number */
+ u_int pm_asngen; /* generation number of pm_asn */
+ struct pmap_statistics pm_stats; /* pmap statistics */
+ struct vm_page *pm_ptphint; /* pmap ptp hint */
+};
+
+#define pmap_resident_count(pmap) (pmap)->pm_stats.resident_count
+
+#define PM_FLAG_LOCKED 0x1
+#define PM_FLAG_WANTED 0x2
+
+typedef struct pmap *pmap_t;
+
+#ifdef _KERNEL
+extern pmap_t kernel_pmap;
+#endif
+
+/*
+ * For each vm_page_t, there is a list of all currently valid virtual
+ * mappings of that page. An entry is a pv_entry_t, the list is pv_table.
+ */
+typedef struct pv_entry {
+ struct ia64_lpte pv_pte; /* pte for collision walker */
+ pmap_t pv_pmap; /* pmap where mapping lies */
+ vm_offset_t pv_va; /* virtual address for mapping */
+ TAILQ_ENTRY(pv_entry) pv_list;
+ TAILQ_ENTRY(pv_entry) pv_plist;
+} *pv_entry_t;
+
+#define PV_ENTRY_NULL ((pv_entry_t) 0)
+
+#ifdef _KERNEL
+
+extern vm_offset_t avail_end;
+extern vm_offset_t avail_start;
+extern vm_offset_t clean_eva;
+extern vm_offset_t clean_sva;
+extern vm_offset_t phys_avail[];
+extern char *ptvmmap; /* poor name! */
+extern vm_offset_t virtual_avail;
+extern vm_offset_t virtual_end;
+
+vm_offset_t pmap_steal_memory __P((vm_size_t));
+void pmap_bootstrap __P((void));
+void pmap_setdevram __P((unsigned long long basea, vm_offset_t sizea));
+int pmap_uses_prom_console __P((void));
+pmap_t pmap_kernel __P((void));
+void *pmap_mapdev __P((vm_offset_t, vm_size_t));
+unsigned *pmap_pte __P((pmap_t, vm_offset_t)) __pure2;
+vm_page_t pmap_use_pt __P((pmap_t, vm_offset_t));
+void pmap_set_opt __P((unsigned *));
+void pmap_set_opt_bsp __P((void));
+void pmap_deactivate __P((struct proc *p));
+void pmap_emulate_reference __P((struct proc *p, vm_offset_t v, int user, int write));
+
+#endif /* _KERNEL */
+
+#endif /* !LOCORE */
+
+#endif /* !_MACHINE_PMAP_H_ */
diff --git a/sys/ia64/include/proc.h b/sys/ia64/include/proc.h
new file mode 100644
index 0000000..a2e9716
--- /dev/null
+++ b/sys/ia64/include/proc.h
@@ -0,0 +1,49 @@
+/* $FreeBSD$ */
+/* From: NetBSD: proc.h,v 1.3 1997/04/06 08:47:36 cgd Exp */
+
+/*
+ * Copyright (c) 1994, 1995 Carnegie-Mellon University.
+ * All rights reserved.
+ *
+ * Author: Chris G. Demetriou
+ *
+ * Permission to use, copy, modify and distribute this software and
+ * its documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
+ * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
+ * School of Computer Science
+ * Carnegie Mellon University
+ * Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie the
+ * rights to redistribute these changes.
+ */
+
+#include <machine/globaldata.h>
+#include <machine/globals.h>
+
+/*
+ * Machine-dependent part of the proc struct for the Alpha.
+ */
+
+struct mdproc {
+ u_long md_flags;
+ struct trapframe *md_tf; /* trap/syscall registers */
+ struct pcb *md_pcbpaddr; /* phys addr of the pcb */
+};
+
+#define MDP_FPUSED 0x0001 /* Process used the FPU */
+#define MDP_UAC_NOPRINT 0x0010 /* Don't print unaligned traps */
+#define MDP_UAC_NOFIX 0x0020 /* Don't fixup unaligned traps */
+#define MDP_UAC_SIGBUS 0x0040 /* Deliver SIGBUS upon
+ unaligned access */
+#define MDP_UAC_MASK (MDP_UAC_NOPRINT | MDP_UAC_NOFIX | MDP_UAC_SIGBUS)
diff --git a/sys/ia64/include/profile.h b/sys/ia64/include/profile.h
new file mode 100644
index 0000000..57fbb69
--- /dev/null
+++ b/sys/ia64/include/profile.h
@@ -0,0 +1,237 @@
+/* $FreeBSD$ */
+/* From: NetBSD: profile.h,v 1.9 1997/04/06 08:47:37 cgd Exp */
+
+/*
+ * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
+ * All rights reserved.
+ *
+ * Author: Chris G. Demetriou
+ *
+ * Permission to use, copy, modify and distribute this software and
+ * its documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
+ * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
+ * School of Computer Science
+ * Carnegie Mellon University
+ * Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie the
+ * rights to redistribute these changes.
+ */
+
+#define _MCOUNT_DECL void mcount
+
+#define FUNCTION_ALIGNMENT 32
+
+typedef u_long fptrdiff_t;
+
+#if 0
+/*
+ * XXX The definition of MCOUNT below is really the following code, run
+ * XXX through cpp, since the inline assembly isn't preprocessed.
+ */
+#define OFFSET_AT 0
+#define OFFSET_V0 8
+#define OFFSET_T0 16
+#define OFFSET_T1 24
+#define OFFSET_T2 32
+#define OFFSET_T3 40
+#define OFFSET_T4 48
+#define OFFSET_T5 56
+#define OFFSET_T6 64
+#define OFFSET_T7 72
+#define OFFSET_S6 80
+#define OFFSET_A0 88
+#define OFFSET_A1 96
+#define OFFSET_A2 104
+#define OFFSET_A3 112
+#define OFFSET_A4 120
+#define OFFSET_A5 128
+#define OFFSET_T8 136
+#define OFFSET_T9 144
+#define OFFSET_T10 152
+#define OFFSET_T11 160
+#define OFFSET_RA 168
+#define OFFSET_T12 176
+#define OFFSET_GP 184
+#define FRAME_SIZE 192
+
+LEAF(_mcount,0) /* XXX */
+ .set noat
+ .set noreorder
+
+ lda sp, -FRAME_SIZE(sp)
+
+ stq at_reg, OFFSET_AT(sp)
+ stq v0, OFFSET_V0(sp)
+ stq t0, OFFSET_T0(sp)
+ stq t1, OFFSET_T1(sp)
+ stq t2, OFFSET_T2(sp)
+ stq t3, OFFSET_T3(sp)
+ stq t4, OFFSET_T4(sp)
+ stq t5, OFFSET_T5(sp)
+ stq t6, OFFSET_T6(sp)
+ stq t7, OFFSET_T7(sp)
+ stq s6, OFFSET_S6(sp) /* XXX because run _after_ prologue. */
+ stq a0, OFFSET_A0(sp)
+ stq a1, OFFSET_A1(sp)
+ stq a2, OFFSET_A2(sp)
+ stq a3, OFFSET_A3(sp)
+ stq a4, OFFSET_A4(sp)
+ stq a5, OFFSET_A5(sp)
+ stq t8, OFFSET_T8(sp)
+ stq t9, OFFSET_T9(sp)
+ stq t10, OFFSET_T10(sp)
+ stq t11, OFFSET_T11(sp)
+ stq ra, OFFSET_RA(sp)
+ stq t12, OFFSET_T12(sp)
+ stq gp, OFFSET_GP(sp)
+
+ br pv, LX99
+LX99: SETGP(pv)
+ mov ra, a0
+ mov at_reg, a1
+ CALL(mcount)
+
+ ldq v0, OFFSET_V0(sp)
+ ldq t0, OFFSET_T0(sp)
+ ldq t1, OFFSET_T1(sp)
+ ldq t2, OFFSET_T2(sp)
+ ldq t3, OFFSET_T3(sp)
+ ldq t4, OFFSET_T4(sp)
+ ldq t5, OFFSET_T5(sp)
+ ldq t6, OFFSET_T6(sp)
+ ldq t7, OFFSET_T7(sp)
+ ldq s6, OFFSET_S6(sp) /* XXX because run _after_ prologue. */
+ ldq a0, OFFSET_A0(sp)
+ ldq a1, OFFSET_A1(sp)
+ ldq a2, OFFSET_A2(sp)
+ ldq a3, OFFSET_A3(sp)
+ ldq a4, OFFSET_A4(sp)
+ ldq a5, OFFSET_A5(sp)
+ ldq t8, OFFSET_T8(sp)
+ ldq t9, OFFSET_T9(sp)
+ ldq t10, OFFSET_T10(sp)
+ ldq t11, OFFSET_T11(sp)
+ ldq ra, OFFSET_RA(sp)
+ stq t12, OFFSET_T12(sp)
+ ldq gp, OFFSET_GP(sp)
+
+ ldq at_reg, OFFSET_AT(sp)
+
+ lda sp, FRAME_SIZE(sp)
+ ret zero, (at_reg), 1
+
+ END(_mcount)
+#endif /* 0 */
+
+#define MCOUNT __asm (" \
+ .globl _mcount; \
+ .ent _mcount 0; \
+_mcount:; \
+ .frame $30,0,$26; \
+ .set noat; \
+ .set noreorder; \
+ \
+ lda $30, -192($30); \
+ \
+ stq $28, 0($30); \
+ stq $0, 8($30); \
+ stq $1, 16($30); \
+ stq $2, 24($30); \
+ stq $3, 32($30); \
+ stq $4, 40($30); \
+ stq $5, 48($30); \
+ stq $6, 56($30); \
+ stq $7, 64($30); \
+ stq $8, 72($30); \
+ stq $15, 80($30); \
+ stq $16, 88($30); \
+ stq $17, 96($30); \
+ stq $18, 104($30); \
+ stq $19, 112($30); \
+ stq $20, 120($30); \
+ stq $21, 128($30); \
+ stq $22, 136($30); \
+ stq $23, 144($30); \
+ stq $24, 152($30); \
+ stq $25, 160($30); \
+ stq $26, 168($30); \
+ stq $27, 176($30); \
+ stq $29, 184($30); \
+ \
+ br $27, LX98; \
+LX98: ldgp $29,0($27); \
+ mov $26, $16; \
+ mov $28, $17; \
+ jsr $26,mcount; \
+ ldgp $29,0($26); \
+ \
+ ldq $0, 8($30); \
+ ldq $1, 16($30); \
+ ldq $2, 24($30); \
+ ldq $3, 32($30); \
+ ldq $4, 40($30); \
+ ldq $5, 48($30); \
+ ldq $6, 56($30); \
+ ldq $7, 64($30); \
+ ldq $8, 72($30); \
+ ldq $15, 80($30); \
+ ldq $16, 88($30); \
+ ldq $17, 96($30); \
+ ldq $18, 104($30); \
+ ldq $19, 112($30); \
+ ldq $20, 120($30); \
+ ldq $21, 128($30); \
+ ldq $22, 136($30); \
+ ldq $23, 144($30); \
+ ldq $24, 152($30); \
+ ldq $25, 160($30); \
+ ldq $26, 168($30); \
+ ldq $27, 176($30); \
+ ldq $29, 184($30); \
+ \
+ ldq $28, 0($30); \
+ \
+ lda $30, 192($30); \
+ ret $31, ($28), 1; \
+ \
+ .end _mcount");
+
+#ifdef _KERNEL
+/*
+ * The following two macros do splhigh and splx respectively.
+ * _alpha_pal_swpipl is a special version of alpha_pal_swpipl which
+ * doesn't include profiling support.
+ *
+ * XXX These macros should probably use inline assembly.
+ */
+#define MCOUNT_ENTER(s) \
+ s = _alpha_pal_swpipl(ALPHA_PSL_IPL_HIGH)
+#define MCOUNT_EXIT(s) \
+ (void)_alpha_pal_swpipl(s);
+#define MCOUNT_DECL(s) u_long s;
+#ifdef GUPROF
+struct gmonparam;
+
+void nullfunc_loop_profiled __P((void));
+void nullfunc_profiled __P((void));
+void startguprof __P((struct gmonparam *p));
+void stopguprof __P((struct gmonparam *p));
+#else
+#define startguprof(p)
+#define stopguprof(p)
+#endif /* GUPROF */
+
+#else /* !_KERNEL */
+typedef u_long uintfptr_t;
+#endif
diff --git a/sys/ia64/include/ptrace.h b/sys/ia64/include/ptrace.h
new file mode 100644
index 0000000..8a7ff84
--- /dev/null
+++ b/sys/ia64/include/ptrace.h
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)ptrace.h 8.1 (Berkeley) 6/11/93
+ * $FreeBSD$
+ */
+
+#ifndef _MACHINE_PTRACE_H_
+#define _MACHINE_PTRACE_H_
+
+/*
+ * Machine dependent trace commands.
+ */
+#define PT_GETREGS (PT_FIRSTMACH + 1)
+#define PT_SETREGS (PT_FIRSTMACH + 2)
+#define PT_GETFPREGS (PT_FIRSTMACH + 3)
+#define PT_SETFPREGS (PT_FIRSTMACH + 4)
+
+#ifdef _KERNEL
+int ptrace_read_u_check __P((struct proc *p, vm_offset_t off, size_t len));
+#endif
+
+#endif
+
diff --git a/sys/ia64/include/reg.h b/sys/ia64/include/reg.h
new file mode 100644
index 0000000..7378e37
--- /dev/null
+++ b/sys/ia64/include/reg.h
@@ -0,0 +1,58 @@
+/*-
+ * Copyright (c) 2000 Doug Rabson
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _MACHINE_REG_H_
+#define _MACHINE_REG_H_
+
+struct ia64_fpreg {
+ u_int64_t fpr_bits[2];
+} __attribute__ ((aligned (16)));
+
+struct reg {
+ u_int64_t r_regs[128];
+};
+
+struct fpreg {
+ struct ia64_fpreg fpr_regs[128];
+};
+
+struct dbreg {
+ u_int64_t dbr_data[8];
+ u_int64_t dbr_inst[8];
+};
+
+#ifdef _KERNEL
+
+struct proc;
+
+void restorefpstate __P((struct fpreg *));
+void savefpstate __P((struct fpreg *));
+void setregs __P((struct proc *, u_long, u_long, u_long));
+#endif
+
+#endif /* _MACHINE_REG_H_ */
diff --git a/sys/ia64/include/reloc.h b/sys/ia64/include/reloc.h
new file mode 100644
index 0000000..a8ce0b1
--- /dev/null
+++ b/sys/ia64/include/reloc.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 1998 John Birrell <jb@cimlogic.com.au>.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by John Birrell.
+ * 4. Neither the name of the author nor the names of any co-contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
diff --git a/sys/ia64/include/resource.h b/sys/ia64/include/resource.h
new file mode 100644
index 0000000..28fcc98
--- /dev/null
+++ b/sys/ia64/include/resource.h
@@ -0,0 +1,44 @@
+/* $FreeBSD$ */
+/*
+ * Copyright 1998 Massachusetts Institute of Technology
+ *
+ * Permission to use, copy, modify, and distribute this software and
+ * its documentation for any purpose and without fee is hereby
+ * granted, provided that both the above copyright notice and this
+ * permission notice appear in all copies, that both the above
+ * copyright notice and this permission notice appear in all
+ * supporting documentation, and that the name of M.I.T. not be used
+ * in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission. M.I.T. makes
+ * no representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied
+ * warranty.
+ *
+ * THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS
+ * ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
+ * SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef _MACHINE_RESOURCE_H_
+#define _MACHINE_RESOURCE_H_ 1
+
+/*
+ * Definitions of resource types for Intel Architecture machines
+ * with support for legacy ISA devices and drivers.
+ */
+
+#define SYS_RES_IRQ 1 /* interrupt lines */
+#define SYS_RES_DRQ 2 /* isa dma lines */
+#define SYS_RES_MEMORY 3 /* i/o memory */
+#define SYS_RES_IOPORT 4 /* i/o ports */
+
+#endif /* !_MACHINE_RESOURCE_H_ */
diff --git a/sys/ia64/include/setjmp.h b/sys/ia64/include/setjmp.h
new file mode 100644
index 0000000..5fcfe2a
--- /dev/null
+++ b/sys/ia64/include/setjmp.h
@@ -0,0 +1,46 @@
+/* $FreeBSD$ */
+/* From: NetBSD: setjmp.h,v 1.2 1997/04/06 08:47:41 cgd Exp */
+
+/*
+ * Copyright (c) 1994, 1995 Carnegie-Mellon University.
+ * All rights reserved.
+ *
+ * Author: Chris G. Demetriou
+ *
+ * Permission to use, copy, modify and distribute this software and
+ * its documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
+ * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
+ * School of Computer Science
+ * Carnegie Mellon University
+ * Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie the
+ * rights to redistribute these changes.
+ */
+
+/*
+ * machine/setjmp.h: machine dependent setjmp-related information.
+ */
+
+#define _JBLEN 81 /* size, in longs, of a jmp_buf */
+
+/*
+ * jmp_buf and sigjmp_buf are encapsulated in different structs to force
+ * compile-time diagnostics for mismatches. The structs are the same
+ * internally to avoid some run-time errors for mismatches.
+ */
+#ifndef _ANSI_SOURCE
+typedef struct { long _sjb[_JBLEN + 1]; } sigjmp_buf[1];
+#endif /* not ANSI */
+
+typedef struct { long _jb[_JBLEN + 1]; } jmp_buf[1];
diff --git a/sys/ia64/include/sigframe.h b/sys/ia64/include/sigframe.h
new file mode 100644
index 0000000..491ce76
--- /dev/null
+++ b/sys/ia64/include/sigframe.h
@@ -0,0 +1,42 @@
+/*-
+ * Copyright (c) 1999 Marcel Moolenaar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer
+ * in this position and unchanged.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _MACHINE_SIGFRAME_H_
+#define _MACHINE_SIGFRAME_H_ 1
+
+struct osigframe {
+};
+
+struct sigframe {
+ ucontext_t sf_uc;
+ siginfo_t sf_si;
+};
+
+#endif /* _MACHINE_SIGFRAME_H_ */
diff --git a/sys/ia64/include/signal.h b/sys/ia64/include/signal.h
new file mode 100644
index 0000000..5474941
--- /dev/null
+++ b/sys/ia64/include/signal.h
@@ -0,0 +1,77 @@
+/* $FreeBSD$ */
+/* From: NetBSD: signal.h,v 1.3 1997/04/06 08:47:43 cgd Exp */
+
+/*
+ * Copyright (c) 1994, 1995 Carnegie-Mellon University.
+ * All rights reserved.
+ *
+ * Author: Chris G. Demetriou
+ *
+ * Permission to use, copy, modify and distribute this software and
+ * its documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
+ * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
+ * School of Computer Science
+ * Carnegie Mellon University
+ * Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie the
+ * rights to redistribute these changes.
+ */
+
+#ifndef _MACHINE_SIGNAL_H_
+#define _MACHINE_SIGNAL_H_
+
+typedef long sig_atomic_t;
+
+#ifndef _ANSI_SOURCE
+
+/*
+ * Information pushed on stack when a signal is delivered.
+ * This is used by the kernel to restore state following
+ * execution of the signal handler. It is also made available
+ * to the handler to allow it to restore state properly if
+ * a non-standard exit is performed.
+ *
+ * Note that sc_regs[] and sc_fpregs[]+sc_fpcr are inline
+ * representations of 'struct reg' and 'struct fpreg', respectively.
+ */
+typedef unsigned int osigset_t;
+struct osigcontext {};
+
+/*
+ * The sequence of the fields should match those in
+ * mcontext_t. Keep them in sync!
+ */
+struct sigcontext {
+ sigset_t sc_mask; /* signal mask to restore */
+ unsigned long sc_flags;
+ unsigned long sc_nat;
+ unsigned long sc_sp;
+ unsigned long sc_ip;
+ unsigned long sc_cfm;
+ unsigned long sc_um;
+ unsigned long sc_ar_rsc;
+ unsigned long sc_ar_bsp;
+ unsigned long sc_ar_rnat;
+ unsigned long sc_ar_ccv;
+ unsigned long sc_ar_unat;
+ unsigned long sc_ar_fpsr;
+ unsigned long sc_ar_pfs;
+ unsigned long sc_pr;
+ unsigned long sc_br[8];
+ unsigned long sc_gr[32];
+ struct ia64_fpreg sc_fr[128];
+};
+
+#endif /* !_ANSI_SOURCE */
+#endif /* !_MACHINE_SIGNAL_H_*/
diff --git a/sys/ia64/include/smp.h b/sys/ia64/include/smp.h
new file mode 100644
index 0000000..65c85ef
--- /dev/null
+++ b/sys/ia64/include/smp.h
@@ -0,0 +1,48 @@
+/*
+ * $FreeBSD$
+ */
+#ifndef _MACHINE_SMP_H_
+#define _MACHINE_SMP_H_
+
+#ifdef _KERNEL
+
+#include <machine/mutex.h>
+#include <machine/ipl.h>
+#include <sys/ktr.h>
+
+#ifndef LOCORE
+
+#define BETTER_CLOCK /* unconditional on ia64 */
+
+/* global data in mp_machdep.c */
+extern volatile u_int checkstate_probed_cpus;
+extern volatile u_int checkstate_need_ast;
+extern volatile u_int resched_cpus;
+extern void (*cpustop_restartfunc) __P((void));
+
+extern int smp_active;
+extern int mp_ncpus;
+extern u_int all_cpus;
+extern u_int started_cpus;
+extern u_int stopped_cpus;
+
+/* functions in mp_machdep.c */
+void mp_start(void);
+void mp_announce(void);
+void smp_invltlb(void);
+void forward_statclock(int pscnt);
+void forward_hardclock(int pscnt);
+void forward_signal(struct proc *);
+void forward_roundrobin(void);
+int stop_cpus(u_int);
+int restart_cpus(u_int);
+void smp_rendezvous_action(void);
+void smp_rendezvous(void (*)(void *),
+ void (*)(void *),
+ void (*)(void *),
+ void *arg);
+void smp_init_secondary(void);
+
+#endif /* !LOCORE */
+#endif /* _KERNEL */
+#endif
diff --git a/sys/ia64/include/stdarg.h b/sys/ia64/include/stdarg.h
new file mode 100644
index 0000000..e8dde78
--- /dev/null
+++ b/sys/ia64/include/stdarg.h
@@ -0,0 +1,50 @@
+/* $FreeBSD$ */
+/* From: NetBSD: stdarg.h,v 1.7 1997/04/06 08:47:44 cgd Exp */
+
+/*-
+ * Copyright (c) 1991, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)stdarg.h 8.1 (Berkeley) 6/10/93
+ */
+
+#ifndef _MACHINE_STDARG_H_
+#define _MACHINE_STDARG_H_
+
+#include <machine/ansi.h>
+
+typedef _BSD_VA_LIST_ va_list;
+
+#define va_start(list, parmN) __builtin_stdarg_start(&(list), parmN)
+#define va_end __builtin_va_end
+#define va_arg __builtin_va_arg
+
+#endif /* !_MACHINE_STDARG_H_ */
diff --git a/sys/ia64/include/sysarch.h b/sys/ia64/include/sysarch.h
new file mode 100644
index 0000000..b990bcd
--- /dev/null
+++ b/sys/ia64/include/sysarch.h
@@ -0,0 +1,49 @@
+/*-
+ * Copyright (c) 1993 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+/*
+ * Architecture specific syscalls (alpha)
+ */
+#ifndef _MACHINE_SYSARCH_H_
+#define _MACHINE_SYSARCH_H_
+
+#ifndef _KERNEL
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+__END_DECLS
+#endif
+
+#endif /* !_MACHINE_SYSARCH_H_ */
diff --git a/sys/ia64/include/types.h b/sys/ia64/include/types.h
new file mode 100644
index 0000000..ccb7793
--- /dev/null
+++ b/sys/ia64/include/types.h
@@ -0,0 +1,73 @@
+/* $FreeBSD$ */
+/* From: NetBSD: types.h,v 1.8 1997/04/06 08:47:45 cgd Exp */
+
+/*-
+ * Copyright (c) 1990, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)types.h 8.3 (Berkeley) 1/5/94
+ */
+
+#ifndef _MACHTYPES_H_
+#define _MACHTYPES_H_
+
+#include <sys/cdefs.h>
+
+#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
+typedef struct _physadr {
+ long r[1];
+} *physadr;
+
+typedef struct label_t {
+ long val[10];
+} label_t;
+#endif
+
+typedef unsigned long vm_offset_t;
+typedef long vm_ooffset_t;
+typedef unsigned long vm_pindex_t;
+typedef unsigned long vm_size_t;
+
+
+typedef __int64_t register_t;
+
+#ifdef _KERNEL
+typedef long intfptr_t;
+typedef unsigned long uintfptr_t;
+#endif
+
+/* Interrupt mask (spl, xxx_imask, etc) */
+typedef __uint32_t intrmask_t;
+
+/* Interrupt handler function type */
+typedef void inthand2_t(void *);
+
+#endif /* _MACHTYPES_H_ */
diff --git a/sys/ia64/include/ucontext.h b/sys/ia64/include/ucontext.h
new file mode 100644
index 0000000..bb18d76
--- /dev/null
+++ b/sys/ia64/include/ucontext.h
@@ -0,0 +1,67 @@
+/*-
+ * Copyright (c) 1999 Marcel Moolenaar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer
+ * in this position and unchanged.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _MACHINE_UCONTEXT_H_
+#define _MACHINE_UCONTEXT_H_
+
+#define IA64_MC_FLAG_ONSTACK 0
+#define IA64_MC_FLAG_IN_SYSCALL 1
+#define IA64_MC_FLAG_FPH_VALID 2
+
+typedef struct __mcontext {
+ /*
+ * These fields must match the definition
+ * of struct sigcontext. That way we can support
+ * struct sigcontext and ucontext_t at the same
+ * time.
+ *
+ * We use the same layout as Linux/ia64 to make emulation
+ * easier.
+ */
+ unsigned long mc_flags;
+ unsigned long mc_nat;
+ unsigned long mc_sp;
+ unsigned long mc_ip;
+ unsigned long mc_cfm;
+ unsigned long mc_um;
+ unsigned long mc_ar_rsc;
+ unsigned long mc_ar_bsp;
+ unsigned long mc_ar_rnat;
+ unsigned long mc_ar_ccv;
+ unsigned long mc_ar_unat;
+ unsigned long mc_ar_fpsr;
+ unsigned long mc_ar_pfs;
+ unsigned long mc_pr;
+ unsigned long mc_br[8];
+ unsigned long mc_gr[32];
+ struct ia64_fpreg mc_fr[128];
+} mcontext_t;
+
+#endif /* !_MACHINE_UCONTEXT_H_ */
diff --git a/sys/ia64/include/varargs.h b/sys/ia64/include/varargs.h
new file mode 100644
index 0000000..25b156b
--- /dev/null
+++ b/sys/ia64/include/varargs.h
@@ -0,0 +1,57 @@
+/* $FreeBSD$ */
+/* From: NetBSD: varargs.h,v 1.7 1997/04/06 08:47:46 cgd Exp */
+
+/*-
+ * Copyright (c) 1990, 1993
+ * The Regents of the University of California. All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)varargs.h 8.2 (Berkeley) 3/22/94
+ */
+
+#ifndef _MACHINE_VARARGS_H_
+#define _MACHINE_VARARGS_H_
+
+#include <machine/stdarg.h>
+
+typedef int __builtin_va_alist_t __attribute__((__mode__(__word__)));
+
+#define va_alist __builtin_va_alist
+#define va_dcl __builtin_va_alist_t __builtin_va_alist; ...
+
+#undef va_start
+#define va_start(ap) __builtin_varargs_start(&(ap))
+
+#endif /* !_MACHINE_VARARGS_H_ */
diff --git a/sys/ia64/include/vmparam.h b/sys/ia64/include/vmparam.h
new file mode 100644
index 0000000..2cdc959
--- /dev/null
+++ b/sys/ia64/include/vmparam.h
@@ -0,0 +1,161 @@
+/* $FreeBSD$ */
+/* From: NetBSD: vmparam.h,v 1.6 1997/09/23 23:23:23 mjacob Exp */
+#ifndef _ALPHA_VMPARAM_H
+#define _ALPHA_VMPARAM_H
+/*
+ * Copyright (c) 1988 University of Utah.
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * the Systems Programming Group of the University of Utah Computer
+ * Science Department and Ralph Campbell.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * from: Utah $Hdr: vmparam.h 1.16 91/01/18$
+ *
+ * @(#)vmparam.h 8.2 (Berkeley) 4/22/94
+ */
+
+/*
+ * Machine dependent constants for Alpha.
+ */
+/*
+ * USRTEXT is the start of the user text/data space, while USRSTACK
+ * is the top (end) of the user stack. Immediately above the user stack
+ * resides the user structure, which is UPAGES long and contains the
+ * kernel stack.
+ */
+#define USRTEXT CLBYTES
+/* #define USRSTACK VM_MAXUSER_ADDRESS */
+
+/*
+ * This stack location is suitable for OSF1 emulation. Some OSF
+ * programs are built as 32bit and assume that the stack is reachable
+ * with a 32bit value. OSF1 manages to have a variable location for
+ * the user stack which we should probably also support.
+ */
+#define USRSTACK (0x12000000LL - (UPAGES*PAGE_SIZE))
+
+/*
+ * Virtual memory related constants, all in bytes
+ */
+#ifndef MAXTSIZ
+#define MAXTSIZ (1<<30) /* max text size (1G) */
+#endif
+#ifndef DFLDSIZ
+#define DFLDSIZ (1<<27) /* initial data size (128M) */
+#endif
+#ifndef MAXDSIZ
+#define MAXDSIZ (1<<30) /* max data size (1G) */
+#endif
+#ifndef DFLSSIZ
+#define DFLSSIZ (1<<21) /* initial stack size (2M) */
+#endif
+#ifndef MAXSSIZ
+#define MAXSSIZ (1<<25) /* max stack size (32M) */
+#endif
+#ifndef SGROWSIZ
+#define SGROWSIZ (128UL*1024) /* amount to grow stack */
+#endif
+
+/*
+ * PTEs for mapping user space into the kernel for phyio operations.
+ * 64 pte's are enough to cover 8 disks * MAXBSIZE.
+ */
+#ifndef USRIOSIZE
+#define USRIOSIZE 64
+#endif
+
+/*
+ * Boundary at which to place first MAPMEM segment if not explicitly
+ * specified. Should be a power of two. This allows some slop for
+ * the data segment to grow underneath the first mapped segment.
+ */
+#define MMSEG 0x200000
+
+/*
+ * The size of the clock loop.
+ */
+#define LOOPPAGES (maxfree - firstfree)
+
+/*
+ * The time for a process to be blocked before being very swappable.
+ * This is a number of seconds which the system takes as being a non-trivial
+ * amount of real time. You probably shouldn't change this;
+ * it is used in subtle ways (fractions and multiples of it are, that is, like
+ * half of a ``long time'', almost a long time, etc.)
+ * It is related to human patience and other factors which don't really
+ * change over time.
+ */
+#define MAXSLP 20
+
+/*
+ * A swapped in process is given a small amount of core without being bothered
+ * by the page replacement algorithm. Basically this says that if you are
+ * swapped in you deserve some resources. We protect the last SAFERSS
+ * pages against paging and will just swap you out rather than paging you.
+ * Note that each process has at least UPAGES+CLSIZE pages which are not
+ * paged anyways, in addition to SAFERSS.
+ */
+#define SAFERSS 10 /* nominal ``small'' resident set size
+ protected against replacement */
+
+/*
+ * Mach derived constants
+ */
+
+/* user/kernel map constants */
+#define VM_MIN_ADDRESS 0
+#define VM_MAXUSER_ADDRESS IA64_RR_BASE(5)
+#define VM_MAX_ADDRESS VM_MAXUSER_ADDRESS
+#define VM_MIN_KERNEL_ADDRESS IA64_RR_BASE(5)
+#define VM_MAX_KERNEL_ADDRESS (IA64_RR_BASE(6) - 1)
+
+/* virtual sizes (bytes) for various kernel submaps */
+#ifndef VM_KMEM_SIZE
+#define VM_KMEM_SIZE (12 * 1024 * 1024)
+#endif
+
+/*
+ * How many physical pages per KVA page allocated.
+ * min(max(VM_KMEM_SIZE, Physical memory/VM_KMEM_SIZE_SCALE), VM_KMEM_SIZE_MAX)
+ * is the total KVA space allocated for kmem_map.
+ */
+#ifndef VM_KMEM_SIZE_SCALE
+#define VM_KMEM_SIZE_SCALE (4) /* XXX 8192 byte pages */
+#endif
+
+/* initial pagein size of beginning of executable file */
+#ifndef VM_INITIAL_PAGEIN
+#define VM_INITIAL_PAGEIN 16
+#endif
+
+#endif /* !_ALPHA_VMPARAM_H */
OpenPOWER on IntegriCloud