summaryrefslogtreecommitdiff
path: root/include/device
diff options
context:
space:
mode:
Diffstat (limited to 'include/device')
-rw-r--r--include/device/audio_status.h168
-rw-r--r--include/device/bpf.h249
-rw-r--r--include/device/device.defs151
-rw-r--r--include/device/device_reply.defs104
-rw-r--r--include/device/device_request.defs81
-rw-r--r--include/device/device_types.defs64
-rw-r--r--include/device/device_types.h133
-rw-r--r--include/device/disk_status.h306
-rw-r--r--include/device/net_status.h187
-rw-r--r--include/device/tape_status.h128
-rw-r--r--include/device/tty_status.h127
11 files changed, 1698 insertions, 0 deletions
diff --git a/include/device/audio_status.h b/include/device/audio_status.h
new file mode 100644
index 0000000..26bd6c7
--- /dev/null
+++ b/include/device/audio_status.h
@@ -0,0 +1,168 @@
+/*
+ * Mach Operating System
+ * Copyright (c) 1993 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.
+ */
+/*
+ * Copyright (c) 1991, 1992 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 Computer Systems
+ * Engineering Group at Lawrence Berkeley Laboratory.
+ * 4. The name of the Laboratory may not 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 _DEVICE_AUDIO_STATUS_H_
+#define _DEVICE_AUDIO_STATUS_H_
+
+/*
+ * Access to ADC devices, such as the AMD 79C30A/32A.
+ */
+
+/*
+ * Programmable gains, see tables in device drivers
+ * for detailed mapping to device specifics.
+ */
+#define AUDIO_MIN_GAIN (0)
+#define AUDIO_MAX_GAIN (255)
+
+/*
+ * Encoding of audio samples
+ */
+#define AUDIO_ENCODING_ULAW (1)
+#define AUDIO_ENCODING_ALAW (2)
+
+/*
+ * Selection of input/output jack
+ */
+#define AUDIO_MIKE 1
+
+#define AUDIO_SPEAKER 1
+#define AUDIO_HEADPHONE 2
+
+/*
+ * Programming information from/to user application.
+ * Only portions of this might be available on any given chip.
+ */
+struct audio_prinfo {
+ unsigned int sample_rate;
+ unsigned int channels;
+ unsigned int precision;
+ unsigned int encoding;
+ unsigned int gain;
+ unsigned int port; /* input/output jack */
+ unsigned int seek; /* BSD extension */
+ unsigned int ispare[3];
+ unsigned int samples;
+ unsigned int eof;
+
+ unsigned char pause;
+ unsigned char error;
+ unsigned char waiting;
+ unsigned char cspare[3];
+ unsigned char open;
+ unsigned char active;
+
+};
+
+struct audio_info {
+ struct audio_prinfo play;
+ struct audio_prinfo record;
+ unsigned int monitor_gain;
+ /* BSD extensions */
+ unsigned int blocksize; /* input blocking threshold */
+ unsigned int hiwat; /* output high water mark */
+ unsigned int lowat; /* output low water mark */
+ unsigned int backlog; /* samples of output backlog to gen. */
+};
+
+typedef struct audio_info audio_info_t;
+
+#define AUDIO_INITINFO(p)\
+ (void)memset((void *)(p), 0xff, sizeof(struct audio_info))
+
+#define AUDIO_GETINFO _IOR('A', 21, audio_info_t)
+#define AUDIO_SETINFO _IOWR('A', 22, audio_info_t)
+#define AUDIO_DRAIN _IO('A', 23)
+#define AUDIO_FLUSH _IO('A', 24)
+#define AUDIO_WSEEK _IOR('A', 25, unsigned int)
+#define AUDIO_RERROR _IOR('A', 26, int)
+#define AUDIO_WERROR _IOR('A', 27, int)
+
+/*
+ * Low level interface to the amd79c30.
+ * Internal registers of the MAP block,
+ * the Main Audio Processor.
+ */
+struct mapreg {
+ unsigned short mr_x[8];
+ unsigned short mr_r[8];
+ unsigned short mr_gx;
+ unsigned short mr_gr;
+ unsigned short mr_ger;
+ unsigned short mr_stgr;
+ unsigned short mr_ftgr;
+ unsigned short mr_atgr;
+ unsigned char mr_mmr1;
+ unsigned char mr_mmr2;
+};
+
+#define AUDIO_GETMAP _IOR('A', 27, struct mapreg)
+#define AUDIO_SETMAP _IOW('A', 28, struct mapreg)
+
+/*
+ * Compatibility with Sun interface
+ */
+struct audio_ioctl {
+ short control;
+ unsigned char data[46];
+};
+
+#define AUDIOGETREG _IOWR('i',1,struct audio_ioctl)
+#define AUDIOSETREG _IOW('i',2,struct audio_ioctl)
+
+#endif /* _DEVICE_AUDIO_STATUS_H_ */
diff --git a/include/device/bpf.h b/include/device/bpf.h
new file mode 100644
index 0000000..05cbf9b
--- /dev/null
+++ b/include/device/bpf.h
@@ -0,0 +1,249 @@
+/*
+ * Mach Operating System
+ * Copyright (c) 1993 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.
+ */
+
+/*
+ * Berkeley Packet Filter Definitions from Berkeley
+ */
+
+/*-
+ * Copyright (c) 1990-1991 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from the Stanford/CMU enet packet filter,
+ * (net/enet.c) distributed as part of 4.3BSD, and code contributed
+ * to Berkeley by Steven McCanne and Van Jacobson both of 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.
+ *
+ * @(#)bpf.h 7.1 (Berkeley) 5/7/91
+ *
+ */
+
+#ifndef _DEVICE_BPF_H_
+#define _DEVICE_BPF_H_
+
+#if 0 /* not used in MK now */
+/*
+ * Alignment macros. BPF_WORDALIGN rounds up to the next
+ * even multiple of BPF_ALIGNMENT.
+ */
+#define BPF_ALIGNMENT sizeof(int)
+#define BPF_WORDALIGN(x) (((x)+(BPF_ALIGNMENT-1))&~(BPF_ALIGNMENT-1))
+
+/*
+ * Struct return by BIOCVERSION. This represents the version number of
+ * the filter language described by the instruction encodings below.
+ * bpf understands a program iff kernel_major == filter_major &&
+ * kernel_minor >= filter_minor, that is, if the value returned by the
+ * running kernel has the same major number and a minor number equal
+ * equal to or less than the filter being downloaded. Otherwise, the
+ * results are undefined, meaning an error may be returned or packets
+ * may be accepted haphazardly.
+ * It has nothing to do with the source code version.
+ */
+struct bpf_version {
+ u_short bv_major;
+ u_short bv_minor;
+};
+/* Current version number. */
+#define BPF_MAJOR_VERSION 1
+#define BPF_MINOR_VERSION 1
+
+/*
+ * Data-link level type codes.
+ * Currently, only DLT_EN10MB and DLT_SLIP are supported.
+ */
+#define DLT_NULL 0 /* no link-layer encapsulation */
+#define DLT_EN10MB 1 /* Ethernet (10Mb) */
+#define DLT_EN3MB 2 /* Experimental Ethernet (3Mb) */
+#define DLT_AX25 3 /* Amateur Radio AX.25 */
+#define DLT_PRONET 4 /* Proteon ProNET Token Ring */
+#define DLT_CHAOS 5 /* Chaos */
+#define DLT_IEEE802 6 /* IEEE 802 Networks */
+#define DLT_ARCNET 7 /* ARCNET */
+#define DLT_SLIP 8 /* Serial Line IP */
+#define DLT_PPP 9 /* Point-to-point Protocol */
+#define DLT_FDDI 10 /* FDDI */
+
+#endif /* 0 */
+
+/*
+ * The instruction encondings.
+ */
+
+/* Magic number for the first instruction */
+#define BPF_BEGIN NETF_BPF
+
+/* instruction classes */
+#define BPF_CLASS(code) ((code) & 0x07)
+#define BPF_LD 0x00
+#define BPF_LDX 0x01
+#define BPF_ST 0x02
+#define BPF_STX 0x03
+#define BPF_ALU 0x04
+#define BPF_JMP 0x05
+#define BPF_RET 0x06
+#define BPF_MISC 0x07
+
+/* ld/ldx fields */
+#define BPF_SIZE(code) ((code) & 0x18)
+#define BPF_W 0x00
+#define BPF_H 0x08
+#define BPF_B 0x10
+#define BPF_MODE(code) ((code) & 0xe0)
+#define BPF_IMM 0x00
+#define BPF_ABS 0x20
+#define BPF_IND 0x40
+#define BPF_MEM 0x60
+#define BPF_LEN 0x80
+#define BPF_MSH 0xa0
+
+/* alu/jmp fields */
+#define BPF_OP(code) ((code) & 0xf0)
+#define BPF_ADD 0x00
+#define BPF_SUB 0x10
+#define BPF_MUL 0x20
+#define BPF_DIV 0x30
+#define BPF_OR 0x40
+#define BPF_AND 0x50
+#define BPF_LSH 0x60
+#define BPF_RSH 0x70
+#define BPF_NEG 0x80
+#define BPF_JA 0x00
+#define BPF_JEQ 0x10
+#define BPF_JGT 0x20
+#define BPF_JGE 0x30
+#define BPF_JSET 0x40
+#define BPF_CKMATCH_IMM 0x50
+#define BPF_SRC(code) ((code) & 0x08)
+#define BPF_K 0x00
+#define BPF_X 0x08
+
+/* ret - BPF_K and BPF_X also apply */
+#define BPF_RVAL(code) ((code) & 0x38)
+#define BPF_A 0x10
+#define BPF_MATCH_IMM 0x18
+#define BPF_MATCH_DATA 0x20
+
+/* misc */
+#define BPF_MISCOP(code) ((code) & 0xf8)
+#define BPF_TAX 0x00
+#define BPF_TXA 0x80
+#define BPF_KEY 0x10
+#define BPF_REG_DATA 0x18
+#define BPF_POSTPONE 0x20
+
+/*
+ * The instruction data structure.
+ */
+struct bpf_insn {
+ unsigned short code;
+ unsigned char jt;
+ unsigned char jf;
+ int k;
+};
+typedef struct bpf_insn *bpf_insn_t;
+
+/*
+ * largest bpf program size
+ */
+#define NET_MAX_BPF ((NET_MAX_FILTER*sizeof(filter_t))/sizeof(struct bpf_insn))
+
+/*
+ * Macros for insn array initializers.
+ */
+#define BPF_STMT(code, k) { (unsigned short)(code), 0, 0, k }
+#define BPF_JUMP(code, k, jt, jf) { (unsigned short)(code), jt, jf, k }
+#define BPF_RETMATCH(code, k, nkey) { (unsigned short)(code), nkey, 0, k }
+
+#define BPF_INSN_STMT(pc, c, n) {\
+ (pc)->code = (c); \
+ (pc)->jt = (pc)->jf = 0; \
+ (pc)->k = (n); \
+ (pc)++; \
+}
+
+#define BPF_INSN_JUMP(pc, c, n, jtrue, jfalse) {\
+ (pc)->code = (c); \
+ (pc)->jt = (jtrue); \
+ (pc)->jf = (jfalse); \
+ (pc)->k = (n); \
+ (pc)++; \
+}
+
+#define BPF_INSN_RETMATCH(pc, c, n, nkey) {\
+ (pc)->code = (c); \
+ (pc)->jt = (nkey); \
+ (pc)->jf = 0; \
+ (pc)->k = (n); \
+ (pc)++; \
+}
+
+/*
+ * Number of scratch memory words (for BPF_LD|BPF_MEM and BPF_ST).
+ */
+#define BPF_MEMWORDS 16
+
+/*
+ * Link level header can be accessed by adding BPF_DLBASE to an offset.
+ */
+#define BPF_DLBASE (1<<30)
+
+#define BPF_BYTES(n) ((n) * sizeof (struct bpf_insn))
+#define BPF_BYTES2LEN(n) ((n) / sizeof (struct bpf_insn))
+#define BPF_INSN_EQ(p,q) ((p)->code == (q)->code && \
+ (p)->jt == (q)->jt && \
+ (p)->jf == (q)->jf && \
+ (p)->k == (q)->k)
+
+#endif /* _DEVICE_BPF_H_ */
diff --git a/include/device/device.defs b/include/device/device.defs
new file mode 100644
index 0000000..2bbd556
--- /dev/null
+++ b/include/device/device.defs
@@ -0,0 +1,151 @@
+/*
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989 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.
+ */
+/*
+ * File: device/device.defs
+ * Author: Douglas Orr
+ * Feb 10, 1988
+ * Abstract:
+ * Mach device support. Mach devices are accessed through
+ * block and character device interfaces to the kernel.
+ */
+
+#ifdef MACH_KERNEL
+simport <kern/compat_xxx_defs.h>; /* for obsolete routines */
+#endif
+
+subsystem
+#if KERNEL_SERVER
+ KernelServer
+#endif
+ device 2800;
+
+#include <mach/std_types.defs>
+#include <mach/mach_types.defs>
+#include <device/device_types.defs>
+
+serverprefix ds_;
+
+type reply_port_t = MACH_MSG_TYPE_MAKE_SEND_ONCE | polymorphic
+ ctype: mach_port_t;
+
+routine device_open(
+ master_port : mach_port_t;
+ sreplyport reply_port : reply_port_t;
+ mode : dev_mode_t;
+ name : dev_name_t;
+ out device : device_t
+ );
+
+routine device_close(
+ device : device_t
+ );
+
+routine device_write(
+ device : device_t;
+ sreplyport reply_port : reply_port_t;
+ in mode : dev_mode_t;
+ in recnum : recnum_t;
+ in data : io_buf_ptr_t;
+ out bytes_written : int
+ );
+
+routine device_write_inband(
+ device : device_t;
+ sreplyport reply_port : reply_port_t;
+ in mode : dev_mode_t;
+ in recnum : recnum_t;
+ in data : io_buf_ptr_inband_t;
+ out bytes_written : int
+ );
+
+routine device_read(
+ device : device_t;
+ sreplyport reply_port : reply_port_t;
+ in mode : dev_mode_t;
+ in recnum : recnum_t;
+ in bytes_wanted : int;
+ out data : io_buf_ptr_t
+ );
+
+routine device_read_inband(
+ device : device_t;
+ sreplyport reply_port : reply_port_t;
+ in mode : dev_mode_t;
+ in recnum : recnum_t;
+ in bytes_wanted : int;
+ out data : io_buf_ptr_inband_t
+ );
+
+/* obsolete */
+routine xxx_device_set_status(
+ device : device_t;
+ in flavor : dev_flavor_t;
+ in status : dev_status_t, IsLong
+ );
+
+/* obsolete */
+routine xxx_device_get_status(
+ device : device_t;
+ in flavor : dev_flavor_t;
+ out status : dev_status_t, IsLong
+ );
+
+/* obsolete */
+routine xxx_device_set_filter(
+ device : device_t;
+ in receive_port : mach_port_send_t;
+ in priority : int;
+ in filter : filter_array_t, IsLong
+ );
+
+routine device_map(
+ device : device_t;
+ in prot : vm_prot_t;
+ in offset : vm_offset_t;
+ in size : vm_size_t;
+ out pager : memory_object_t;
+ in unmap : int
+ );
+
+routine device_set_status(
+ device : device_t;
+ in flavor : dev_flavor_t;
+ in status : dev_status_t
+ );
+
+routine device_get_status(
+ device : device_t;
+ in flavor : dev_flavor_t;
+ out status : dev_status_t, CountInOut
+ );
+
+routine device_set_filter(
+ device : device_t;
+ in receive_port : mach_port_send_t;
+ in priority : int;
+ in filter : filter_array_t
+ );
+
diff --git a/include/device/device_reply.defs b/include/device/device_reply.defs
new file mode 100644
index 0000000..03c17f5
--- /dev/null
+++ b/include/device/device_reply.defs
@@ -0,0 +1,104 @@
+/*
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989 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.
+ */
+/*
+ * Author: David B. Golub, Carnegie Mellon University
+ * Date: 8/89
+ *
+ * Reply-only side of device interface.
+ */
+
+subsystem
+#if KERNEL_USER
+ KernelUser
+#endif
+ device_reply 2900;
+ /* to match reply numbers for device.defs */
+
+/*
+ * Device_write_reply (only user of this data type) deallocates
+ * the data.
+ */
+
+
+#include <mach/std_types.defs>
+#include <device/device_types.defs>
+
+userprefix ds_;
+
+#if SEQNOS
+serverprefix seqnos_;
+serverdemux seqnos_device_reply_server;
+#endif SEQNOS
+
+type reply_port_t = polymorphic|MACH_MSG_TYPE_PORT_SEND_ONCE
+ ctype: mach_port_t;
+
+simpleroutine device_open_reply(
+ reply_port : reply_port_t;
+#if SEQNOS
+ msgseqno seqno : mach_port_seqno_t;
+#endif SEQNOS
+ in return_code : kern_return_t;
+ in device_port : mach_port_make_send_t
+ );
+
+skip; /* device_close */
+
+simpleroutine device_write_reply(
+ reply_port : reply_port_t;
+#if SEQNOS
+ msgseqno seqno : mach_port_seqno_t;
+#endif SEQNOS
+ in return_code : kern_return_t;
+ in bytes_written : int
+ );
+
+simpleroutine device_write_reply_inband(
+ reply_port : reply_port_t;
+#if SEQNOS
+ msgseqno seqno : mach_port_seqno_t;
+#endif SEQNOS
+ in return_code : kern_return_t;
+ in bytes_written : int
+ );
+
+simpleroutine device_read_reply(
+ reply_port : reply_port_t;
+#if SEQNOS
+ msgseqno seqno : mach_port_seqno_t;
+#endif SEQNOS
+ in return_code : kern_return_t;
+ in data : io_buf_ptr_t, dealloc
+ );
+
+simpleroutine device_read_reply_inband(
+ reply_port : reply_port_t;
+#if SEQNOS
+ msgseqno seqno : mach_port_seqno_t;
+#endif SEQNOS
+ in return_code : kern_return_t;
+ in data : io_buf_ptr_inband_t
+ );
diff --git a/include/device/device_request.defs b/include/device/device_request.defs
new file mode 100644
index 0000000..e8aab2a
--- /dev/null
+++ b/include/device/device_request.defs
@@ -0,0 +1,81 @@
+/*
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989 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.
+ */
+/*
+ * Author: David B. Golub, Carnegie Mellon University
+ * Date: 8/89
+ *
+ * Request-only side of device interface.
+ */
+
+subsystem device_request 2800; /* to match device.defs */
+
+#include <device/device_types.defs>
+
+serverprefix ds_;
+
+type reply_port_t = MACH_MSG_TYPE_MAKE_SEND_ONCE
+ ctype: mach_port_t;
+
+simpleroutine device_open_request(
+ device_server_port : mach_port_t;
+ ureplyport reply_port : reply_port_t;
+ in mode : dev_mode_t;
+ in name : dev_name_t
+ );
+
+skip; /* device_close */
+
+simpleroutine device_write_request(
+ device : device_t;
+ ureplyport reply_port : reply_port_t;
+ in mode : dev_mode_t;
+ in recnum : recnum_t;
+ in data : io_buf_ptr_t
+ );
+
+simpleroutine device_write_request_inband(
+ device : device_t;
+ ureplyport reply_port : reply_port_t;
+ in mode : dev_mode_t;
+ in recnum : recnum_t;
+ in data : io_buf_ptr_inband_t
+ );
+
+simpleroutine device_read_request(
+ device : device_t;
+ ureplyport reply_port : reply_port_t;
+ in mode : dev_mode_t;
+ in recnum : recnum_t;
+ in bytes_wanted : int
+ );
+
+simpleroutine device_read_request_inband(
+ device : device_t;
+ ureplyport reply_port : reply_port_t;
+ in mode : dev_mode_t;
+ in recnum : recnum_t;
+ in bytes_wanted : int
+ );
diff --git a/include/device/device_types.defs b/include/device/device_types.defs
new file mode 100644
index 0000000..c5d8e9d
--- /dev/null
+++ b/include/device/device_types.defs
@@ -0,0 +1,64 @@
+/*
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989 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.
+ */
+/*
+ * Author: David B. Golub, Carnegie Mellon University
+ * Date: 3/89
+ *
+ * Common definitions for device interface types.
+ */
+
+#ifndef _DEVICE_DEVICE_TYPES_DEFS_
+#define _DEVICE_DEVICE_TYPES_DEFS_
+
+/*
+ * Basic types
+ */
+
+#include <mach/std_types.defs>
+
+type recnum_t = unsigned32;
+type dev_mode_t = unsigned32;
+type dev_flavor_t = unsigned32;
+type dev_name_t = (MACH_MSG_TYPE_STRING_C, 8*128);
+type dev_status_t = array[*:1024] of int;
+type io_buf_ptr_t = ^array[] of MACH_MSG_TYPE_INTEGER_8;
+type io_buf_ptr_inband_t= array[*:128] of char;
+type filter_t = short;
+type filter_array_t = array[*:128] of filter_t;
+
+type device_t = mach_port_t
+ ctype: mach_port_t
+#if KERNEL_SERVER
+ intran: device_t dev_port_lookup(mach_port_t)
+ outtran: mach_port_t convert_device_to_port(device_t)
+ destructor: device_deallocate(device_t)
+#endif /* KERNEL_SERVER */
+ ;
+
+import <device/device_types.h>;
+import <device/net_status.h>;
+
+#endif _DEVICE_DEVICE_TYPES_DEFS_
diff --git a/include/device/device_types.h b/include/device/device_types.h
new file mode 100644
index 0000000..d02b8f1
--- /dev/null
+++ b/include/device/device_types.h
@@ -0,0 +1,133 @@
+/*
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989 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.
+ */
+/*
+ * Author: David B. Golub, Carnegie Mellon University
+ * Date: 3/89
+ */
+
+#ifndef DEVICE_TYPES_H
+#define DEVICE_TYPES_H
+
+/*
+ * Types for device interface.
+ */
+#include <mach/std_types.h>
+
+#ifdef MACH_KERNEL
+/*
+ * Get kernel-only type definitions.
+ */
+#include <device/device_types_kernel.h>
+
+#else /* MACH_KERNEL */
+/*
+ * Device handle.
+ */
+typedef mach_port_t device_t;
+
+#endif /* MACH_KERNEL */
+
+/*
+ * Device name string
+ */
+typedef char dev_name_t[128]; /* must match device_types.defs */
+
+/*
+ * Mode for open/read/write
+ */
+typedef unsigned int dev_mode_t;
+#define D_READ 0x1 /* read */
+#define D_WRITE 0x2 /* write */
+#define D_NODELAY 0x4 /* no delay on open */
+#define D_NOWAIT 0x8 /* do not wait if data not available */
+
+/*
+ * IO buffer - out-of-line array of characters.
+ */
+typedef char * io_buf_ptr_t;
+
+/*
+ * IO buffer - in-line array of characters.
+ */
+#define IO_INBAND_MAX (128) /* must match device_types.defs */
+typedef char io_buf_ptr_inband_t[IO_INBAND_MAX];
+
+/*
+ * IO buffer vector - for scatter/gather IO.
+ */
+typedef struct {
+ vm_offset_t data;
+ vm_size_t count;
+} io_buf_vec_t;
+
+/*
+ * Record number for random-access devices
+ */
+typedef unsigned int recnum_t;
+
+/*
+ * Flavors of set/get statuses
+ */
+typedef unsigned int dev_flavor_t;
+
+/*
+ * Generic array for get/set status
+ */
+typedef int *dev_status_t; /* Variable-length array of integers */
+#define DEV_STATUS_MAX (1024) /* Maximum array size */
+
+typedef int dev_status_data_t[DEV_STATUS_MAX];
+
+/*
+ * Mandatory get/set status operations
+ */
+
+/* size a device: op code and indexes for returned values */
+#define DEV_GET_SIZE 0
+# define DEV_GET_SIZE_DEVICE_SIZE 0 /* 0 if unknown */
+# define DEV_GET_SIZE_RECORD_SIZE 1 /* 1 if sequential */
+#define DEV_GET_SIZE_COUNT 2
+
+/*
+ * Device error codes
+ */
+typedef int io_return_t;
+
+#define D_IO_QUEUED (-1) /* IO queued - do not return result */
+#define D_SUCCESS 0
+
+#define D_IO_ERROR 2500 /* hardware IO error */
+#define D_WOULD_BLOCK 2501 /* would block, but D_NOWAIT set */
+#define D_NO_SUCH_DEVICE 2502 /* no such device */
+#define D_ALREADY_OPEN 2503 /* exclusive-use device already open */
+#define D_DEVICE_DOWN 2504 /* device has been shut down */
+#define D_INVALID_OPERATION 2505 /* bad operation for device */
+#define D_INVALID_RECNUM 2506 /* invalid record (block) number */
+#define D_INVALID_SIZE 2507 /* invalid IO size */
+#define D_NO_MEMORY 2508 /* memory allocation failure */
+#define D_READ_ONLY 2509 /* device cannot be written to */
+
+#endif DEVICE_TYPES_H
diff --git a/include/device/disk_status.h b/include/device/disk_status.h
new file mode 100644
index 0000000..868e06e
--- /dev/null
+++ b/include/device/disk_status.h
@@ -0,0 +1,306 @@
+/*
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989 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.
+ */
+/*
+ * Copyright (c) 1987, 1988 Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that the above copyright notice and this paragraph are
+ * duplicated in all such forms and that any documentation,
+ * advertising materials, and other materials related to such
+ * distribution and use acknowledge that the software was developed
+ * by the University of California, Berkeley. The name of the
+ * University may not be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+ * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * @(#)disklabel.h 7.10 (Berkeley) 6/27/88
+ */
+
+#ifndef _DISK_STATUS_H_
+#define _DISK_STATUS_H_
+
+/*
+ * Each disk has a label which includes information about the hardware
+ * disk geometry, filesystem partitions, and drive specific information.
+ * The label is in block 0 or 1, possibly offset from the beginning
+ * to leave room for a bootstrap, etc.
+ */
+
+#define LABELSECTOR 0 /* sector containing label */
+#define LABELOFFSET 64 /* offset of label in sector */
+#define DISKMAGIC ((unsigned int) 0x82564557U) /* The disk magic number */
+#ifndef MAXPARTITIONS
+#define MAXPARTITIONS 8
+#endif
+
+
+#ifndef LOCORE
+struct disklabel {
+ unsigned int d_magic; /* the magic number */
+ short d_type; /* drive type */
+ short d_subtype; /* controller/d_type specific */
+ char d_typename[16]; /* type name, e.g. "eagle" */
+ /*
+ * d_packname contains the pack identifier and is returned when
+ * the disklabel is read off the disk or in-core copy.
+ * d_boot0 and d_boot1 are the (optional) names of the
+ * primary (block 0) and secondary (block 1-15) bootstraps
+ * as found in /usr/mdec. These are returned when using
+ * getdiskbyname(3) to retrieve the values from /etc/disktab.
+ */
+#if defined(MACH_KERNEL) || defined(STANDALONE)
+ char d_packname[16]; /* pack identifier */
+#else
+ union {
+ char un_d_packname[16]; /* pack identifier */
+ struct {
+ char *un_d_boot0; /* primary bootstrap name */
+ char *un_d_boot1; /* secondary bootstrap name */
+ } un_b;
+ } d_un;
+#define d_packname d_un.un_d_packname
+#define d_boot0 d_un.un_b.un_d_boot0
+#define d_boot1 d_un.un_b.un_d_boot1
+#endif /* ! MACH_KERNEL or STANDALONE */
+ /* disk geometry: */
+ unsigned int d_secsize; /* # of bytes per sector */
+ unsigned int d_nsectors; /* # of data sectors per track */
+ unsigned int d_ntracks; /* # of tracks per cylinder */
+ unsigned int d_ncylinders; /* # of data cylinders per unit */
+ unsigned int d_secpercyl; /* # of data sectors per cylinder */
+ unsigned int d_secperunit; /* # of data sectors per unit */
+ /*
+ * Spares (bad sector replacements) below
+ * are not counted in d_nsectors or d_secpercyl.
+ * Spare sectors are assumed to be physical sectors
+ * which occupy space at the end of each track and/or cylinder.
+ */
+ unsigned short d_sparespertrack; /* # of spare sectors per track */
+ unsigned short d_sparespercyl; /* # of spare sectors per cylinder */
+ /*
+ * Alternate cylinders include maintenance, replacement,
+ * configuration description areas, etc.
+ */
+ unsigned int d_acylinders; /* # of alt. cylinders per unit */
+
+ /* hardware characteristics: */
+ /*
+ * d_interleave, d_trackskew and d_cylskew describe perturbations
+ * in the media format used to compensate for a slow controller.
+ * Interleave is physical sector interleave, set up by the formatter
+ * or controller when formatting. When interleaving is in use,
+ * logically adjacent sectors are not physically contiguous,
+ * but instead are separated by some number of sectors.
+ * It is specified as the ratio of physical sectors traversed
+ * per logical sector. Thus an interleave of 1:1 implies contiguous
+ * layout, while 2:1 implies that logical sector 0 is separated
+ * by one sector from logical sector 1.
+ * d_trackskew is the offset of sector 0 on track N
+ * relative to sector 0 on track N-1 on the same cylinder.
+ * Finally, d_cylskew is the offset of sector 0 on cylinder N
+ * relative to sector 0 on cylinder N-1.
+ */
+ unsigned short d_rpm; /* rotational speed */
+ unsigned short d_interleave; /* hardware sector interleave */
+ unsigned short d_trackskew; /* sector 0 skew, per track */
+ unsigned short d_cylskew; /* sector 0 skew, per cylinder */
+ unsigned int d_headswitch; /* head switch time, usec */
+ unsigned int d_trkseek; /* track-to-track seek, usec */
+ unsigned int d_flags; /* generic flags */
+#define NDDATA 5
+ unsigned int d_drivedata[NDDATA]; /* drive-type specific information */
+#define NSPARE 5
+ unsigned int d_spare[NSPARE]; /* reserved for future use */
+ unsigned int d_magic2; /* the magic number (again) */
+ unsigned short d_checksum; /* xor of data incl. partitions */
+
+ /* filesystem and partition information: */
+ unsigned short d_npartitions; /* number of partitions in following */
+ unsigned int d_bbsize; /* size of boot area at sn0, bytes */
+ unsigned int d_sbsize; /* max size of fs superblock, bytes */
+ struct partition { /* the partition table */
+ unsigned int p_size; /* number of sectors in partition */
+ unsigned int p_offset; /* starting sector */
+ unsigned int p_fsize; /* filesystem basic fragment size */
+ unsigned char p_fstype; /* filesystem type, see below */
+ unsigned char p_frag; /* filesystem fragments per block */
+ unsigned short p_cpg; /* filesystem cylinders per group */
+ } d_partitions[MAXPARTITIONS+1]; /* actually may be more */
+
+#if defined(alpha) && defined(MACH_KERNEL)
+ /*
+ * Disgusting hack. If this structure contains a pointer,
+ * as it does for non-kernel, then the compiler rounds
+ * the size to make it pointer-sized properly (arrays of..).
+ * But if I define the pointer for the kernel then instances
+ * of this structure better be aligned otherwise picking
+ * up a short might be done by too-smart compilers (GCC) with
+ * a load-long instruction expecting the short to be aligned.
+ * I bet the OSF folks stomped into this too, since they use
+ * the same disgusting hack below.. [whatelse can I do ??]
+ */
+ int bugfix;
+#endif
+};
+#else LOCORE
+ /*
+ * offsets for asm boot files.
+ */
+ .set d_secsize,40
+ .set d_nsectors,44
+ .set d_ntracks,48
+ .set d_ncylinders,52
+ .set d_secpercyl,56
+ .set d_secperunit,60
+ .set d_end_,276 /* size of disk label */
+#endif LOCORE
+
+/* d_type values: */
+#define DTYPE_SMD 1 /* SMD, XSMD; VAX hp/up */
+#define DTYPE_MSCP 2 /* MSCP */
+#define DTYPE_DEC 3 /* other DEC (rk, rl) */
+#define DTYPE_SCSI 4 /* SCSI */
+#define DTYPE_ESDI 5 /* ESDI interface */
+#define DTYPE_ST506 6 /* ST506 etc. */
+#define DTYPE_FLOPPY 10 /* floppy */
+
+#ifdef DKTYPENAMES
+static char *dktypenames[] = {
+ "unknown",
+ "SMD",
+ "MSCP",
+ "old DEC",
+ "SCSI",
+ "ESDI",
+ "type 6",
+ "type 7",
+ "type 8",
+ "type 9",
+ "floppy",
+ 0
+};
+#define DKMAXTYPES (sizeof(dktypenames) / sizeof(dktypenames[0]) - 1)
+#endif
+
+/*
+ * Filesystem type and version.
+ * Used to interpret other filesystem-specific
+ * per-partition information.
+ */
+#define FS_UNUSED 0 /* unused */
+#define FS_SWAP 1 /* swap */
+#define FS_V6 2 /* Sixth Edition */
+#define FS_V7 3 /* Seventh Edition */
+#define FS_SYSV 4 /* System V */
+#define FS_V71K 5 /* V7 with 1K blocks (4.1, 2.9) */
+#define FS_V8 6 /* Eighth Edition, 4K blocks */
+#define FS_BSDFFS 7 /* 4.2BSD fast file system */
+#define FS_LINUXFS 8 /* Linux file system */
+
+#ifdef DKTYPENAMES
+static char *fstypenames[] = {
+ "unused",
+ "swap",
+ "Version 6",
+ "Version 7",
+ "System V",
+ "4.1BSD",
+ "Eighth Edition",
+ "4.2BSD",
+ "Linux",
+ 0
+};
+#define FSMAXTYPES (sizeof(fstypenames) / sizeof(fstypenames[0]) - 1)
+#endif
+
+/*
+ * flags shared by various drives:
+ */
+#define D_REMOVABLE 0x01 /* removable media */
+#define D_ECC 0x02 /* supports ECC */
+#define D_BADSECT 0x04 /* supports bad sector forw. */
+#define D_RAMDISK 0x08 /* disk emulator */
+#define D_CHAIN 0x10 /* can do back-back transfers */
+
+/*
+ * Drive data for SMD.
+ */
+#define d_smdflags d_drivedata[0]
+#define D_SSE 0x1 /* supports skip sectoring */
+#define d_mindist d_drivedata[1]
+#define d_maxdist d_drivedata[2]
+#define d_sdist d_drivedata[3]
+
+/*
+ * Drive data for ST506.
+ */
+#define d_precompcyl d_drivedata[0]
+#define d_gap3 d_drivedata[1] /* used only when formatting */
+
+/*
+ * IBM controller info (d_precompcyl used, too)
+ */
+#define d_step d_drivedata[2]
+
+#ifndef LOCORE
+/*
+ * Structure used to perform a format
+ * or other raw operation, returning data
+ * and/or register values.
+ * Register identification and format
+ * are device- and driver-dependent.
+ */
+struct format_op {
+ char *df_buf;
+ int df_count; /* value-result */
+ recnum_t df_startblk;
+ int df_reg[8]; /* result */
+};
+
+/*
+ * Disk-specific ioctls.
+ */
+ /* get and set disklabel; DIOCGPART used internally */
+#define DIOCGDINFO _IOR('d', 101, struct disklabel)/* get */
+#define DIOCSDINFO _IOW('d', 102, struct disklabel)/* set */
+#define DIOCWDINFO _IOW('d', 103, struct disklabel)/* set, update disk */
+
+/* do format operation, read or write */
+#define DIOCRFORMAT _IOWR('d', 105, struct format_op)
+#define DIOCWFORMAT _IOWR('d', 106, struct format_op)
+
+#define DIOCSSTEP _IOW('d', 107, int) /* set step rate */
+#define DIOCSRETRIES _IOW('d', 108, int) /* set # of retries */
+#define DIOCWLABEL _IOW('d', 109, int) /* write en/disable label */
+
+#define DIOCSBAD _IOW('d', 110, struct dkbad) /* set kernel dkbad */
+
+#endif LOCORE
+
+#endif /* _DISK_STATUS_H_ */
diff --git a/include/device/net_status.h b/include/device/net_status.h
new file mode 100644
index 0000000..2b29b32
--- /dev/null
+++ b/include/device/net_status.h
@@ -0,0 +1,187 @@
+/*
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989 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.
+ */
+/*
+ * Author: David B. Golub, Carnegie Mellon University
+ * Date: 3/89
+ *
+ * Status information for network interfaces.
+ */
+
+#ifndef _DEVICE_NET_STATUS_H_
+#define _DEVICE_NET_STATUS_H_
+
+#include <device/device_types.h>
+#include <mach/message.h>
+
+/*
+ * General interface status
+ */
+struct net_status {
+ int min_packet_size; /* minimum size, including header */
+ int max_packet_size; /* maximum size, including header */
+ int header_format; /* format of network header */
+ int header_size; /* size of network header */
+ int address_size; /* size of network address */
+ int flags; /* interface status */
+ int mapped_size; /* if mappable, virtual mem needed */
+};
+#define NET_STATUS_COUNT (sizeof(struct net_status)/sizeof(int))
+#define NET_STATUS (('n'<<16) + 1)
+
+/*
+ * Header formats, as given by RFC 826/1010 for ARP:
+ */
+#define HDR_ETHERNET 1 /* Ethernet hardware address */
+#define HDR_EXP_ETHERNET 2 /* 3Mhz experimental Ethernet
+ hardware address */
+#define HDR_PRO_NET 4 /* Proteon ProNET Token Ring */
+#define HDR_CHAOS 5 /* Chaosnet */
+#define HDR_802 6 /* IEEE 802 networks */
+
+
+/*
+ * A network address is an array of bytes. In order to return
+ * this in an array of (long) integers, it is returned in net order.
+ * Use 'ntohl' on each element of the array to retrieve the original
+ * ordering.
+ */
+#define NET_ADDRESS (('n'<<16) + 2)
+
+#define NET_DSTADDR (('n'<<16) + 3)
+
+
+/*
+ * Input packet filter definition
+ */
+#define NET_MAX_FILTER 128 /* was 64, bpf programs are big */
+#define NET_FILTER_STACK_DEPTH 32
+
+/*
+ * We allow specification of up to NET_MAX_FILTER (short) words of a filter
+ * command list to be applied to incoming packets to determine if
+ * those packets should be given to a particular network input filter.
+ *
+ * Each network filter specifies the filter command list via net_add_filter.
+ * Each filter command list specifies a sequences of actions which leave a
+ * boolean value on the top of an internal stack. Each word of the
+ * command list specifies an action from the set {PUSHLIT, PUSHZERO,
+ * PUSHWORD+N} which respectively push the next word of the filter, zero,
+ * or word N of the incoming packet on the stack, and a binary operator
+ * from the set {EQ, LT, LE, GT, GE, AND, OR, XOR} which operates on the
+ * top two elements of the stack and replaces them with its result. The
+ * special action NOPUSH and the special operator NOP can be used to only
+ * perform the binary operation or to only push a value on the stack.
+ *
+ * If the final value of the filter operation is true, then the packet is
+ * accepted for the filter.
+ *
+ */
+
+typedef unsigned short filter_t;
+typedef filter_t *filter_array_t;
+
+#define CSPF_BYTES(n) ((n) * sizeof (filter_t))
+
+/* these must sum to 16! */
+#define NETF_NBPA 10 /* # bits / argument */
+#define NETF_NBPO 6 /* # bits / operator */
+
+#define NETF_ARG(word) ((word) & 0x3ff)
+#define NETF_OP(word) (((word)>>NETF_NBPA)&0x3f)
+
+/* binary operators */
+#define NETF_NOP (0<<NETF_NBPA)
+#define NETF_EQ (1<<NETF_NBPA)
+#define NETF_LT (2<<NETF_NBPA)
+#define NETF_LE (3<<NETF_NBPA)
+#define NETF_GT (4<<NETF_NBPA)
+#define NETF_GE (5<<NETF_NBPA)
+#define NETF_AND (6<<NETF_NBPA)
+#define NETF_OR (7<<NETF_NBPA)
+#define NETF_XOR (8<<NETF_NBPA)
+#define NETF_COR (9<<NETF_NBPA)
+#define NETF_CAND (10<<NETF_NBPA)
+#define NETF_CNOR (11<<NETF_NBPA)
+#define NETF_CNAND (12<<NETF_NBPA)
+#define NETF_NEQ (13<<NETF_NBPA)
+#define NETF_LSH (14<<NETF_NBPA)
+#define NETF_RSH (15<<NETF_NBPA)
+#define NETF_ADD (16<<NETF_NBPA)
+#define NETF_SUB (17<<NETF_NBPA)
+#define NETF_BPF (((1 << NETF_NBPO) - 1) << NETF_NBPA)
+
+
+/* stack arguments */
+#define NETF_NOPUSH 0 /* don`t push */
+#define NETF_PUSHLIT 1 /* next word in filter */
+#define NETF_PUSHZERO 2 /* 0 */
+#define NETF_PUSHIND 14 /* word indexed by stack top */
+#define NETF_PUSHHDRIND 15 /* header word indexed by stack top */
+#define NETF_PUSHWORD 16 /* word 0 .. 944 in packet */
+#define NETF_PUSHHDR 960 /* word 0 .. 31 in header */
+#define NETF_PUSHSTK 992 /* word 0 .. 31 in stack */
+
+/* priorities */
+#define NET_HI_PRI 100
+#define NET_PRI_MAX 255
+
+/*
+ * BPF support.
+ */
+#include <device/bpf.h>
+
+/*
+ * Net receive message format.
+ *
+ * The header and data are packaged separately, since some hardware
+ * supports variable-length headers. We prefix the packet with
+ * a packet_hdr structure so that the real data portion begins
+ * on a long-word boundary, and so that packet filters can address
+ * the type field and packet size uniformly.
+ */
+#define NET_RCV_MAX 4095
+#define NET_HDW_HDR_MAX 64
+
+#define NET_RCV_MSG_ID 2999 /* in device.defs reply range */
+
+struct packet_header {
+ unsigned short length;
+ unsigned short type; /* network order */
+};
+
+struct net_rcv_msg {
+ mach_msg_header_t msg_hdr;
+ mach_msg_type_t header_type;
+ char header[NET_HDW_HDR_MAX];
+ mach_msg_type_t packet_type;
+ char packet[NET_RCV_MAX];
+};
+typedef struct net_rcv_msg *net_rcv_msg_t;
+#define net_rcv_msg_packet_count packet_type.msgt_number
+
+
+
+#endif _DEVICE_NET_STATUS_H_
diff --git a/include/device/tape_status.h b/include/device/tape_status.h
new file mode 100644
index 0000000..e14479d
--- /dev/null
+++ b/include/device/tape_status.h
@@ -0,0 +1,128 @@
+/*
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989 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.
+ */
+/*
+ * Copyright (c) 1982, 1986 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that the above copyright notice and this paragraph are
+ * duplicated in all such forms and that any documentation,
+ * advertising materials, and other materials related to such
+ * distribution and use acknowledge that the software was developed
+ * by the University of California, Berkeley. The name of the
+ * University may not be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+ * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * @(#)mtio.h 7.4 (Berkeley) 8/31/88
+ */
+
+#ifndef _TAPE_STATUS_H_
+#define _TAPE_STATUS_H_
+
+/*
+ * Tape status
+ */
+
+struct tape_status {
+ unsigned int mt_type;
+ unsigned int speed;
+ unsigned int density;
+ unsigned int flags;
+# define TAPE_FLG_REWIND 0x1
+# define TAPE_FLG_WP 0x2
+};
+#define TAPE_STATUS_COUNT (sizeof(struct tape_status)/sizeof(int))
+#define TAPE_STATUS (('m'<<16) + 1)
+
+/*
+ * Constants for mt_type. These are the same
+ * for controllers compatible with the types listed.
+ */
+#define MT_ISTS 0x01 /* TS-11 */
+#define MT_ISHT 0x02 /* TM03 Massbus: TE16, TU45, TU77 */
+#define MT_ISTM 0x03 /* TM11/TE10 Unibus */
+#define MT_ISMT 0x04 /* TM78/TU78 Massbus */
+#define MT_ISUT 0x05 /* SI TU-45 emulation on Unibus */
+#define MT_ISCPC 0x06 /* SUN */
+#define MT_ISAR 0x07 /* SUN */
+#define MT_ISTMSCP 0x08 /* DEC TMSCP protocol (TU81, TK50) */
+#define MT_ISCY 0x09 /* CCI Cipher */
+#define MT_ISSCSI 0x0a /* SCSI tape (all brands) */
+
+
+/*
+ * Set status parameters
+ */
+
+struct tape_params {
+ unsigned int mt_operation;
+ unsigned int mt_repeat_count;
+};
+
+/* operations */
+#define MTWEOF 0 /* write an end-of-file record */
+#define MTFSF 1 /* forward space file */
+#define MTBSF 2 /* backward space file */
+#define MTFSR 3 /* forward space record */
+#define MTBSR 4 /* backward space record */
+#define MTREW 5 /* rewind */
+#define MTOFFL 6 /* rewind and put the drive offline */
+#define MTNOP 7 /* no operation, sets status only */
+#define MTCACHE 8 /* enable controller cache */
+#define MTNOCACHE 9 /* disable controller cache */
+
+
+/*
+ * U*x compatibility
+ */
+
+/* structure for MTIOCGET - mag tape get status command */
+
+struct mtget {
+ short mt_type; /* type of magtape device */
+/* the following two registers are grossly device dependent */
+ short mt_dsreg; /* ``drive status'' register */
+ short mt_erreg; /* ``error'' register */
+/* end device-dependent registers */
+ short mt_resid; /* residual count */
+/* the following two are not yet implemented */
+ unsigned long mt_fileno; /* file number of current position */
+ unsigned long mt_blkno; /* block number of current position */
+/* end not yet implemented */
+};
+
+
+/* mag tape io control commands */
+#define MTIOCTOP _IOW('m', 1, struct tape_params)/* do a mag tape op */
+#define MTIOCGET _IOR('m', 2, struct mtget) /* get tape status */
+#define MTIOCIEOT _IO('m', 3) /* ignore EOT error */
+#define MTIOCEEOT _IO('m', 4) /* enable EOT error */
+
+
+#endif _TAPE_STATUS_H_
diff --git a/include/device/tty_status.h b/include/device/tty_status.h
new file mode 100644
index 0000000..9f5eab8
--- /dev/null
+++ b/include/device/tty_status.h
@@ -0,0 +1,127 @@
+/*
+ * Mach Operating System
+ * Copyright (c) 1991,1990 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.
+ */
+/*
+ * Author: David B. Golub, Carnegie Mellon University
+ * Date: ll/90
+ *
+ * Status information for tty.
+ */
+
+struct tty_status {
+ int tt_ispeed; /* input speed */
+ int tt_ospeed; /* output speed */
+ int tt_breakc; /* character to deliver when break
+ detected on line */
+ int tt_flags; /* mode flags */
+};
+#define TTY_STATUS_COUNT (sizeof(struct tty_status)/sizeof(int))
+#define TTY_STATUS (dev_flavor_t)(('t'<<16) + 1)
+
+/*
+ * Speeds
+ */
+#define B0 0
+#define B50 1
+#define B75 2
+#define B110 3
+#define B134 4
+#define B150 5
+#define B200 6
+#define B300 7
+#define B600 8
+#define B1200 9
+#define B1800 10
+#define B2400 11
+#define B4800 12
+#define B9600 13
+#define EXTA 14 /* XX can we just get rid of EXTA and EXTB? */
+#define EXTB 15
+#define B19200 EXTA
+#define B38400 EXTB
+
+#define NSPEEDS 16
+
+/*
+ * Flags
+ */
+#define TF_TANDEM 0x00000001 /* send stop character when input
+ queue full */
+#define TF_ODDP 0x00000002 /* get/send odd parity */
+#define TF_EVENP 0x00000004 /* get/send even parity */
+#define TF_ANYP (TF_ODDP|TF_EVENP)
+ /* get any parity/send none */
+#define TF_LITOUT 0x00000008 /* output all 8 bits
+ otherwise, characters >= 0x80
+ are time delays XXX */
+#define TF_MDMBUF 0x00000010 /* start/stop output on carrier
+ interrupt
+ otherwise, dropping carrier
+ hangs up line */
+#define TF_NOHANG 0x00000020 /* no hangup signal on carrier drop */
+#define TF_HUPCLS 0x00000040 /* hang up (outgoing) on last close */
+
+/*
+ * Read-only flags - information about device
+ */
+#define TF_ECHO 0x00000080 /* device wants user to echo input */
+#define TF_CRMOD 0x00000100 /* device wants \r\n, not \n */
+#define TF_XTABS 0x00000200 /* device does not understand tabs */
+
+/*
+ * Modem control
+ */
+#define TTY_MODEM_COUNT (1) /* one integer */
+#define TTY_MODEM (dev_flavor_t)(('t'<<16) + 2)
+
+#define TM_LE 0x0001 /* line enable */
+#define TM_DTR 0x0002 /* data terminal ready */
+#define TM_RTS 0x0004 /* request to send */
+#define TM_ST 0x0008 /* secondary transmit */
+#define TM_SR 0x0010 /* secondary receive */
+#define TM_CTS 0x0020 /* clear to send */
+#define TM_CAR 0x0040 /* carrier detect */
+#define TM_RNG 0x0080 /* ring */
+#define TM_DSR 0x0100 /* data set ready */
+
+#define TM_BRK 0x0200 /* set line break (internal) */
+#define TM_HUP 0x0000 /* close line (internal) */
+
+/*
+ * Other controls
+ */
+#define TTY_FLUSH_COUNT (1) /* one integer - D_READ|D_WRITE */
+#define TTY_FLUSH (dev_flavor_t)(('t'<<16) + 3)
+ /* flush input or output */
+#define TTY_STOP (dev_flavor_t)(('t'<<16) + 4)
+ /* stop output */
+#define TTY_START (dev_flavor_t)(('t'<<16) + 5)
+ /* start output */
+#define TTY_SET_BREAK (dev_flavor_t)(('t'<<16) + 6)
+ /* set break condition */
+#define TTY_CLEAR_BREAK (dev_flavor_t)(('t'<<16) + 7)
+ /* clear break condition */
+#define TTY_SET_TRANSLATION (dev_flavor_t)(('t'<<16) + 8)
+ /* set translation table */