summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Schwinge <tschwinge@gnu.org>2007-03-27 22:47:11 +0000
committerThomas Schwinge <tschwinge@gnu.org>2009-06-18 00:27:07 +0200
commitd35703f70a6c0f89bcec1c97801532ab0d1b945f (patch)
treea7c20e38b9e65384a4637ca1d535d1c5cafb431d
parent211fe231c99b8cf1aa3f91c97b1f00c73b857865 (diff)
2007-03-27 Thomas Schwinge <tschwinge@gnu.org>
Unconditionally use the device driver multiplexing. Suggested by Gianluca Guida <glguida@gmail.com>. * i386/i386at/dev_hdr.h: Merge into `device/dev_hdr.h' and remove. * i386/i386at/device_emul.h: Rename to `device/device_emul.h'. Adapt all users. * i386/i386at/i386at_ds_routines.c: Merge into `device/ds_routines.c' and remove. * i386/linux/dev/include/linux_emul.h: Remove file. * Makefrag.am (libkernel_a_SOURCES): Add `device/device_emul.h'. * i386/Makefrag.am (libkernel_a_SOURCES): Remove `i386/i386at/dev_hdr.h', `i386/i386at/device_emul.h' and `i386/i386at/i386at_ds_routines.c'. * i386/linux/Makefrag.am (liblinux_a_SOURCES): Remove `i386/linux/dev/include/linux_emul.h'. * dev/dev_hdr.h: Adapt all users of `i386' as if it were always defined. * device/dev_lookup.c: Likewise. * device/ds_routines.c: Likewise. * device/device_init.c (ds_init): Rename to `mach_device_init'. * device/ds_routines.c (ds_init): Likewise. (ds_trap_init): Rename to `mach_device_trap_init'. (mach_device_trap_init): Make it `static'. * linux/dev/glue/block.c: Don't include <linux_emul.h>, but instead include <device/device_emul.h> and <i386at/disk.h>. * linux/dev/glue/net.c: Don't include <linux_emul.h>, but instead include <device/device_emul.h>. * linux/pcmcia-cs/glue/ds.c: Likewise.
-rw-r--r--ChangeLog28
-rw-r--r--Makefrag.am1
-rw-r--r--device/dev_hdr.h48
-rw-r--r--device/dev_lookup.c29
-rw-r--r--device/device_emul.h (renamed from i386/i386at/device_emul.h)0
-rw-r--r--device/device_init.c4
-rw-r--r--device/ds_routines.c639
-rw-r--r--i386/Makefrag.am3
-rw-r--r--i386/i386at/dev_hdr.h43
-rw-r--r--i386/i386at/i386at_ds_routines.c284
-rw-r--r--i386/linux/Makefrag.am1
-rw-r--r--i386/linux/dev/include/linux_emul.h8
-rw-r--r--linux/dev/glue/block.c4
-rw-r--r--linux/dev/glue/net.c3
-rw-r--r--linux/pcmcia-cs/glue/ds.c4
15 files changed, 419 insertions, 680 deletions
diff --git a/ChangeLog b/ChangeLog
index e6ddbe9..85fa9a4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,33 @@
2007-03-27 Thomas Schwinge <tschwinge@gnu.org>
+ Unconditionally use the device driver multiplexing. Suggested by
+ Gianluca Guida <glguida@gmail.com>.
+ * i386/i386at/dev_hdr.h: Merge into `device/dev_hdr.h' and remove.
+ * i386/i386at/device_emul.h: Rename to `device/device_emul.h'. Adapt
+ all users.
+ * i386/i386at/i386at_ds_routines.c: Merge into `device/ds_routines.c'
+ and remove.
+ * i386/linux/dev/include/linux_emul.h: Remove file.
+ * Makefrag.am (libkernel_a_SOURCES): Add `device/device_emul.h'.
+ * i386/Makefrag.am (libkernel_a_SOURCES): Remove
+ `i386/i386at/dev_hdr.h', `i386/i386at/device_emul.h' and
+ `i386/i386at/i386at_ds_routines.c'.
+ * i386/linux/Makefrag.am (liblinux_a_SOURCES): Remove
+ `i386/linux/dev/include/linux_emul.h'.
+ * dev/dev_hdr.h: Adapt all users of `i386' as if it were always
+ defined.
+ * device/dev_lookup.c: Likewise.
+ * device/ds_routines.c: Likewise.
+ * device/device_init.c (ds_init): Rename to `mach_device_init'.
+ * device/ds_routines.c (ds_init): Likewise.
+ (ds_trap_init): Rename to `mach_device_trap_init'.
+ (mach_device_trap_init): Make it `static'.
+ * linux/dev/glue/block.c: Don't include <linux_emul.h>, but instead
+ include <device/device_emul.h> and <i386at/disk.h>.
+ * linux/dev/glue/net.c: Don't include <linux_emul.h>, but instead
+ include <device/device_emul.h>.
+ * linux/pcmcia-cs/glue/ds.c: Likewise.
+
* kern/pcsample.h: Remove the automatic cvs log appending machinery.
* linux/dev/drivers/scsi/g_NCR5380.c: Likewise.
* linux/src/drivers/net/sk_g16.h: Likewise.
diff --git a/Makefrag.am b/Makefrag.am
index 95e59f8..b6bdc57 100644
--- a/Makefrag.am
+++ b/Makefrag.am
@@ -255,6 +255,7 @@ libkernel_a_SOURCES += \
device/conf.h \
device/cons.c \
device/cons.h \
+ device/device_emul.h \
device/dev_hdr.h \
device/dev_lookup.c \
device/dev_master.h \
diff --git a/device/dev_hdr.h b/device/dev_hdr.h
index b976caf..50e2977 100644
--- a/device/dev_hdr.h
+++ b/device/dev_hdr.h
@@ -28,6 +28,31 @@
* Date: 3/89
*/
+/*
+ * Mach device emulation definitions (i386at version).
+ *
+ * Copyright (c) 1996 The University of Utah and
+ * the Computer Systems Laboratory at the University of Utah (CSL).
+ * All rights reserved.
+ *
+ * Permission to use, copy, modify and distribute this software is hereby
+ * granted provided that (1) source code retains these copyright, permission,
+ * and disclaimer notices, and (2) redistributions including binaries
+ * reproduce the notices in supporting documentation, and (3) all advertising
+ * materials mentioning features or use of this software display the following
+ * acknowledgement: ``This product includes software developed by the
+ * Computer Systems Laboratory at the University of Utah.''
+ *
+ * THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS
+ * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF
+ * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * CSL requests users of this software to return to csl-dist@cs.utah.edu any
+ * improvements that they make and grant CSL redistribution rights.
+ *
+ * Author: Shantanu Goel, University of Utah CSL
+ */
+
#ifndef _DEVICE_DEV_HDR_H_
#define _DEVICE_DEV_HDR_H_
@@ -37,16 +62,17 @@
#include <device/conf.h>
-#ifdef i386
-#include <i386at/dev_hdr.h>
-#else
-#define mach_device device
-#define mach_device_t device_t
-#define MACH_DEVICE_NULL DEVICE_NULL
-#define mach_device_reference device_reference
-#define mach_device_deallocate device_deallocate
-#define mach_convert_device_to_port convert_device_to_port
-#endif
+/* This structure is associated with each open device port.
+ The port representing the device points to this structure. */
+struct device
+{
+ struct device_emulation_ops *emul_ops;
+ void *emul_data;
+};
+
+typedef struct device *device_t;
+
+#define DEVICE_NULL ((device_t) 0)
/*
* Generic device header. May be allocated with the device,
@@ -72,9 +98,7 @@ struct mach_device {
int dev_number; /* device number */
int bsize; /* replacement for DEV_BSIZE */
struct dev_ops *dev_ops; /* and operations vector */
-#ifdef i386
struct device dev; /* the real device structure */
-#endif
};
typedef struct mach_device *mach_device_t;
#define MACH_DEVICE_NULL ((mach_device_t)0)
diff --git a/device/dev_lookup.c b/device/dev_lookup.c
index 3243a2c..2391e8d 100644
--- a/device/dev_lookup.c
+++ b/device/dev_lookup.c
@@ -42,9 +42,7 @@
#include <ipc/ipc_port.h>
#include <kern/ipc_kobject.h>
-#ifdef i386
-#include <i386at/device_emul.h>
-#endif
+#include <device/device_emul.h>
/*
* Device structure routines: reference counting, port->device.
@@ -255,7 +253,7 @@ dev_port_enter(device)
register mach_device_t device;
{
mach_device_reference(device);
-#ifdef i386
+
ipc_kobject_set(device->port,
(ipc_kobject_t) &device->dev, IKOT_DEVICE);
device->dev.emul_data = device;
@@ -264,9 +262,6 @@ dev_port_enter(device)
device->dev.emul_ops = &mach_device_emulation_ops;
}
-#else
- ipc_kobject_set(device->port, (ipc_kobject_t) device, IKOT_DEVICE);
-#endif
}
/*
@@ -296,12 +291,8 @@ dev_port_lookup(port)
ip_lock(port);
if (ip_active(port) && (ip_kotype(port) == IKOT_DEVICE)) {
device = (device_t) port->ip_kobject;
-#ifdef i386
if (device->emul_ops->reference)
(*device->emul_ops->reference)(device->emul_data);
-#else
- mach_device_reference(device);
-#endif
}
else
device = DEVICE_NULL;
@@ -318,26 +309,10 @@ ipc_port_t
convert_device_to_port(device)
register device_t device;
{
-#ifndef i386
- register ipc_port_t port;
-#endif
-
if (device == DEVICE_NULL)
return IP_NULL;
-#ifdef i386
return (*device->emul_ops->dev_to_port) (device->emul_data);
-#else
- device_lock(device);
- if (device->state == DEV_STATE_OPEN)
- port = ipc_port_make_send(device->port);
- else
- port = IP_NULL;
- device_unlock(device);
-
- mach_device_deallocate(device);
- return port;
-#endif
}
/*
diff --git a/i386/i386at/device_emul.h b/device/device_emul.h
index 957bd50..957bd50 100644
--- a/i386/i386at/device_emul.h
+++ b/device/device_emul.h
diff --git a/device/device_init.c b/device/device_init.c
index 1208fbf..4f57fc2 100644
--- a/device/device_init.c
+++ b/device/device_init.c
@@ -39,7 +39,7 @@
-extern void ds_init();
+extern void mach_device_init();
extern void dev_lookup_init();
extern void net_io_init();
extern void device_pager_init();
@@ -57,7 +57,7 @@ device_service_create()
if (master_device_port == IP_NULL)
panic("can't allocate master device port");
- ds_init();
+ mach_device_init();
dev_lookup_init();
net_io_init();
device_pager_init();
diff --git a/device/ds_routines.c b/device/ds_routines.c
index 0abd75b..8b5e1e5 100644
--- a/device/ds_routines.c
+++ b/device/ds_routines.c
@@ -28,6 +28,31 @@
* Date: 3/89
*/
+/*
+ * Mach device server routines (i386at version).
+ *
+ * Copyright (c) 1996 The University of Utah and
+ * the Computer Systems Laboratory at the University of Utah (CSL).
+ * All rights reserved.
+ *
+ * Permission to use, copy, modify and distribute this software is hereby
+ * granted provided that (1) source code retains these copyright, permission,
+ * and disclaimer notices, and (2) redistributions including binaries
+ * reproduce the notices in supporting documentation, and (3) all advertising
+ * materials mentioning features or use of this software display the following
+ * acknowledgement: ``This product includes software developed by the
+ * Computer Systems Laboratory at the University of Utah.''
+ *
+ * THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS
+ * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF
+ * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * CSL requests users of this software to return to csl-dist@cs.utah.edu any
+ * improvements that they make and grant CSL redistribution rights.
+ *
+ * Author: Shantanu Goel, University of Utah CSL
+ */
+
#include <kern/printf.h>
#include <string.h>
@@ -64,42 +89,321 @@
#include <device/net_status.h>
#include <device/device_port.h>
#include <device/device_reply.user.h>
+#include <device/device_emul.h>
#include <machine/machspl.h>
+
+#ifdef LINUX_DEV
+extern struct device_emulation_ops linux_block_emulation_ops;
+#ifdef CONFIG_INET
+extern struct device_emulation_ops linux_net_emulation_ops;
+#ifdef CONFIG_PCMCIA
+extern struct device_emulation_ops linux_pcmcia_emulation_ops;
+#endif
+#endif
+#endif
+extern struct device_emulation_ops mach_device_emulation_ops;
-#ifdef i386
-#include <i386at/device_emul.h>
+/* List of emulations. */
+static struct device_emulation_ops *emulation_list[] =
+{
+#ifdef LINUX_DEV
+ &linux_block_emulation_ops,
+#ifdef CONFIG_INET
+ &linux_net_emulation_ops,
+#ifdef CONFIG_PCMCIA
+ &linux_pcmcia_emulation_ops,
#endif
+#endif
+#endif
+ &mach_device_emulation_ops,
+};
+
+#define NUM_EMULATION (sizeof (emulation_list) / sizeof (emulation_list[0]))
+
+io_return_t
+ds_device_open (ipc_port_t open_port, ipc_port_t reply_port,
+ mach_msg_type_name_t reply_port_type, dev_mode_t mode,
+ char *name, device_t *devp)
+{
+ int i;
+ io_return_t err;
+
+ /* Open must be called on the master device port. */
+ if (open_port != master_device_port)
+ return D_INVALID_OPERATION;
+
+ /* There must be a reply port. */
+ if (! IP_VALID (reply_port))
+ {
+ printf ("ds_* invalid reply port\n");
+ Debugger ("ds_* reply_port");
+ return MIG_NO_REPLY;
+ }
+
+ /* Call each emulation's open routine to find the device. */
+ for (i = 0; i < NUM_EMULATION; i++)
+ {
+ err = (*emulation_list[i]->open) (reply_port, reply_port_type,
+ mode, name, devp);
+ if (err != D_NO_SUCH_DEVICE)
+ break;
+ }
+
+ return err;
+}
+
+io_return_t
+ds_device_close (device_t dev)
+{
+ /* Refuse if device is dead or not completely open. */
+ if (dev == DEVICE_NULL)
+ return D_NO_SUCH_DEVICE;
+
+ return (dev->emul_ops->close
+ ? (*dev->emul_ops->close) (dev->emul_data)
+ : D_SUCCESS);
+}
+
+io_return_t
+ds_device_write (device_t dev, ipc_port_t reply_port,
+ mach_msg_type_name_t reply_port_type, dev_mode_t mode,
+ recnum_t recnum, io_buf_ptr_t data, unsigned int count,
+ int *bytes_written)
+{
+ /* Refuse if device is dead or not completely open. */
+ if (dev == DEVICE_NULL)
+ return D_NO_SUCH_DEVICE;
+
+ if (data == 0)
+ return D_INVALID_SIZE;
+
+ if (! dev->emul_ops->write)
+ return D_INVALID_OPERATION;
+
+ return (*dev->emul_ops->write) (dev->emul_data, reply_port,
+ reply_port_type, mode, recnum,
+ data, count, bytes_written);
+}
+
+io_return_t
+ds_device_write_inband (device_t dev, ipc_port_t reply_port,
+ mach_msg_type_name_t reply_port_type,
+ dev_mode_t mode, recnum_t recnum,
+ io_buf_ptr_inband_t data, unsigned count,
+ int *bytes_written)
+{
+ /* Refuse if device is dead or not completely open. */
+ if (dev == DEVICE_NULL)
+ return D_NO_SUCH_DEVICE;
+
+ if (data == 0)
+ return D_INVALID_SIZE;
+
+ if (! dev->emul_ops->write_inband)
+ return D_INVALID_OPERATION;
+
+ return (*dev->emul_ops->write_inband) (dev->emul_data, reply_port,
+ reply_port_type, mode, recnum,
+ data, count, bytes_written);
+}
+
+io_return_t
+ds_device_read (device_t dev, ipc_port_t reply_port,
+ mach_msg_type_name_t reply_port_type, dev_mode_t mode,
+ recnum_t recnum, int count, io_buf_ptr_t *data,
+ unsigned *bytes_read)
+{
+ /* Refuse if device is dead or not completely open. */
+ if (dev == DEVICE_NULL)
+ return D_NO_SUCH_DEVICE;
+
+ if (! dev->emul_ops->read)
+ return D_INVALID_OPERATION;
+
+ return (*dev->emul_ops->read) (dev->emul_data, reply_port,
+ reply_port_type, mode, recnum,
+ count, data, bytes_read);
+}
+
+io_return_t
+ds_device_read_inband (device_t dev, ipc_port_t reply_port,
+ mach_msg_type_name_t reply_port_type, dev_mode_t mode,
+ recnum_t recnum, int count, char *data,
+ unsigned *bytes_read)
+{
+ /* Refuse if device is dead or not completely open. */
+ if (dev == DEVICE_NULL)
+ return D_NO_SUCH_DEVICE;
+
+ if (! dev->emul_ops->read_inband)
+ return D_INVALID_OPERATION;
+
+ return (*dev->emul_ops->read_inband) (dev->emul_data, reply_port,
+ reply_port_type, mode, recnum,
+ count, data, bytes_read);
+}
+
+io_return_t
+ds_device_set_status (device_t dev, dev_flavor_t flavor,
+ dev_status_t status, mach_msg_type_number_t status_count)
+{
+ /* Refuse if device is dead or not completely open. */
+ if (dev == DEVICE_NULL)
+ return D_NO_SUCH_DEVICE;
+
+ if (! dev->emul_ops->set_status)
+ return D_INVALID_OPERATION;
+
+ return (*dev->emul_ops->set_status) (dev->emul_data, flavor, status,
+ status_count);
+}
+
+io_return_t
+ds_device_get_status (device_t dev, dev_flavor_t flavor, dev_status_t status,
+ mach_msg_type_number_t *status_count)
+{
+ /* Refuse if device is dead or not completely open. */
+ if (dev == DEVICE_NULL)
+ return D_NO_SUCH_DEVICE;
+
+ if (! dev->emul_ops->get_status)
+ return D_INVALID_OPERATION;
+
+ return (*dev->emul_ops->get_status) (dev->emul_data, flavor, status,
+ status_count);
+}
+
+io_return_t
+ds_device_set_filter (device_t dev, ipc_port_t receive_port, int priority,
+ filter_t *filter, unsigned filter_count)
+{
+ /* Refuse if device is dead or not completely open. */
+ if (dev == DEVICE_NULL)
+ return D_NO_SUCH_DEVICE;
+
+ if (! dev->emul_ops->set_filter)
+ return D_INVALID_OPERATION;
+
+ return (*dev->emul_ops->set_filter) (dev->emul_data, receive_port,
+ priority, filter, filter_count);
+}
+
+io_return_t
+ds_device_map (device_t dev, vm_prot_t prot, vm_offset_t offset,
+ vm_size_t size, ipc_port_t *pager, boolean_t unmap)
+{
+ /* Refuse if device is dead or not completely open. */
+ if (dev == DEVICE_NULL)
+ return D_NO_SUCH_DEVICE;
+
+ if (! dev->emul_ops->map)
+ return D_INVALID_OPERATION;
+
+ return (*dev->emul_ops->map) (dev->emul_data, prot,
+ offset, size, pager, unmap);
+}
+
+boolean_t
+ds_notify (mach_msg_header_t *msg)
+{
+ if (msg->msgh_id == MACH_NOTIFY_NO_SENDERS)
+ {
+ device_t dev;
+ mach_no_senders_notification_t *ns;
+
+ ns = (mach_no_senders_notification_t *) msg;
+ dev = dev_port_lookup((ipc_port_t) ns->not_header.msgh_remote_port);
+ assert(dev);
+ if (dev->emul_ops->no_senders)
+ (*dev->emul_ops->no_senders) (ns);
+ return TRUE;
+ }
+
+ printf ("ds_notify: strange notification %d\n", msg->msgh_id);
+ return FALSE;
+}
+
+io_return_t
+ds_device_write_trap (device_t dev, dev_mode_t mode,
+ recnum_t recnum, vm_offset_t data, vm_size_t count)
+{
+ /* Refuse if device is dead or not completely open. */
+ if (dev == DEVICE_NULL)
+ return D_NO_SUCH_DEVICE;
+
+ if (! dev->emul_ops->write_trap)
+ return D_INVALID_OPERATION;
+
+ return (*dev->emul_ops->write_trap) (dev->emul_data,
+ mode, recnum, data, count);
+}
+
+io_return_t
+ds_device_writev_trap (device_t dev, dev_mode_t mode,
+ recnum_t recnum, io_buf_vec_t *iovec, vm_size_t count)
+{
+ /* Refuse if device is dead or not completely open. */
+ if (dev == DEVICE_NULL)
+ return D_NO_SUCH_DEVICE;
+
+ if (! dev->emul_ops->writev_trap)
+ return D_INVALID_OPERATION;
+
+ return (*dev->emul_ops->writev_trap) (dev->emul_data,
+ mode, recnum, iovec, count);
+}
+
+void
+device_reference (device_t dev)
+{
+ /* Refuse if device is dead or not completely open. */
+ if (dev == DEVICE_NULL)
+ return;
+
+ if (dev->emul_ops->reference)
+ (*dev->emul_ops->reference) (dev->emul_data);
+}
+
+void
+device_deallocate (device_t dev)
+{
+ /* Refuse if device is dead or not completely open. */
+ if (dev == DEVICE_NULL)
+ return;
+
+ if (dev->emul_ops->dealloc)
+ (*dev->emul_ops->dealloc) (dev->emul_data);
+}
+
+/*
+ * What follows is the interface for the native Mach devices.
+ */
-#ifdef i386
ipc_port_t
-mach_convert_device_to_port (void *d)
+mach_convert_device_to_port (mach_device_t device)
{
ipc_port_t port;
- mach_device_t device = d;
if (! device)
return IP_NULL;
+
device_lock(device);
+
if (device->state == DEV_STATE_OPEN)
port = ipc_port_make_send(device->port);
else
port = IP_NULL;
+
device_unlock(device);
+
mach_device_deallocate(device);
+
return port;
}
-#endif /* i386 */
-#ifdef i386
static io_return_t
device_open(reply_port, reply_port_type, mode, name, device_p)
-#else
-io_return_t
-ds_device_open(open_port, reply_port, reply_port_type,
- mode, name, device_p)
- ipc_port_t open_port;
-#endif
ipc_port_t reply_port;
mach_msg_type_name_t reply_port_type;
dev_mode_t mode;
@@ -111,24 +415,6 @@ ds_device_open(open_port, reply_port, reply_port_type,
register io_req_t ior;
ipc_port_t notify;
-#ifndef i386
- /*
- * Open must be called on the master device port.
- */
- if (open_port != master_device_port)
- return (D_INVALID_OPERATION);
-
- /*
- * There must be a reply port.
- */
- if (!IP_VALID(reply_port)) {
- printf("ds_* invalid reply port\n");
- Debugger("ds_* reply_port");
- return (MIG_NO_REPLY); /* no sense in doing anything */
- }
-
-#endif /* ! i386 */
-
/*
* Find the device.
*/
@@ -165,11 +451,7 @@ ds_device_open(open_port, reply_port, reply_port_type,
device->open_count++;
device_unlock(device);
-#ifdef i386
*device_p = &device->dev;
-#else
- *device_p = device;
-#endif
return (D_SUCCESS);
/*
* Return deallocates device reference while acquiring
@@ -293,32 +575,17 @@ ds_open_done(ior)
(void) ds_device_open_reply(ior->io_reply_port,
ior->io_reply_port_type,
result,
-#ifdef i386
- (mach_convert_device_to_port
- (device)));
-#else
- convert_device_to_port(device));
-#endif
+ mach_convert_device_to_port(device));
} else
mach_device_deallocate(device);
return (TRUE);
}
-#ifdef i386
static io_return_t
device_close(device)
-#else
-io_return_t
-ds_device_close(device)
-#endif
register mach_device_t device;
{
-#ifndef i386
- if (device == DEVICE_NULL)
- return (D_NO_SUCH_DEVICE);
-#endif
-
device_lock(device);
/*
@@ -378,17 +645,10 @@ ds_device_close(device)
/*
* Write to a device.
*/
-#ifdef i386
static io_return_t
-device_write(d, reply_port, reply_port_type, mode, recnum,
+device_write(device, reply_port, reply_port_type, mode, recnum,
data, data_count, bytes_written)
- void *d;
-#else
-io_return_t
-ds_device_write(device, reply_port, reply_port_type, mode, recnum,
- data, data_count, bytes_written)
- register mach_device_t device;
-#endif
+ mach_device_t device;
ipc_port_t reply_port;
mach_msg_type_name_t reply_port_type;
dev_mode_t mode;
@@ -397,28 +657,12 @@ ds_device_write(device, reply_port, reply_port_type, mode, recnum,
unsigned int data_count;
int *bytes_written; /* out */
{
-#ifdef i386
- register mach_device_t device = d;
-#endif
register io_req_t ior;
register io_return_t result;
-#ifndef i386
- /*
- * Refuse if device is dead or not completely open.
- */
- if (device == DEVICE_NULL)
- return (D_NO_SUCH_DEVICE);
-#endif
-
if (device->state != DEV_STATE_OPEN)
return (D_NO_SUCH_DEVICE);
-#ifndef i386
- if (data == 0)
- return (D_INVALID_SIZE);
-#endif
-
/*
* XXX Need logic to reject ridiculously big requests.
*/
@@ -492,17 +736,10 @@ ds_device_write(device, reply_port, reply_port_type, mode, recnum,
/*
* Write to a device, but memory is in message.
*/
-#ifdef i386
static io_return_t
-device_write_inband(d, reply_port, reply_port_type, mode, recnum,
+device_write_inband(device, reply_port, reply_port_type, mode, recnum,
data, data_count, bytes_written)
- void *d;
-#else
-io_return_t
-ds_device_write_inband(device, reply_port, reply_port_type, mode, recnum,
- data, data_count, bytes_written)
- register mach_device_t device;
-#endif
+ mach_device_t device;
ipc_port_t reply_port;
mach_msg_type_name_t reply_port_type;
dev_mode_t mode;
@@ -511,28 +748,12 @@ ds_device_write_inband(device, reply_port, reply_port_type, mode, recnum,
unsigned int data_count;
int *bytes_written; /* out */
{
-#ifdef i386
- register mach_device_t device = d;
-#endif
register io_req_t ior;
register io_return_t result;
-#ifndef i386
- /*
- * Refuse if device is dead or not completely open.
- */
- if (device == DEVICE_NULL)
- return (D_NO_SUCH_DEVICE);
-#endif
-
if (device->state != DEV_STATE_OPEN)
return (D_NO_SUCH_DEVICE);
-#ifndef i386
- if (data == 0)
- return (D_INVALID_SIZE);
-#endif
-
/* XXX note that a CLOSE may proceed at any point */
/*
@@ -713,7 +934,7 @@ device_write_dealloc(ior)
* To prevent a possible deadlock with the default pager,
* we have to release space in the device_io_map before
* we allocate any memory. (Which vm_map_copy_invoke_cont
- * might do.) See the discussion in ds_init.
+ * might do.) See the discussion in mach_device_init.
*/
kmem_io_map_deallocate(device_io_map,
@@ -831,17 +1052,10 @@ ds_write_done(ior)
/*
* Read from a device.
*/
-#ifdef i386
static io_return_t
-device_read(d, reply_port, reply_port_type, mode, recnum,
+device_read(device, reply_port, reply_port_type, mode, recnum,
bytes_wanted, data, data_count)
- void *d;
-#else
-io_return_t
-ds_device_read(device, reply_port, reply_port_type, mode, recnum,
- bytes_wanted, data, data_count)
- register mach_device_t device;
-#endif
+ mach_device_t device;
ipc_port_t reply_port;
mach_msg_type_name_t reply_port_type;
dev_mode_t mode;
@@ -850,9 +1064,6 @@ ds_device_read(device, reply_port, reply_port_type, mode, recnum,
io_buf_ptr_t *data; /* out */
unsigned int *data_count; /* out */
{
-#ifdef i386
- register mach_device_t device = d;
-#endif
register io_req_t ior;
register io_return_t result;
@@ -861,14 +1072,6 @@ ds_device_read(device, reply_port, reply_port_type, mode, recnum,
*data_count = *data_count;
#endif /* lint */
-#ifndef i386
- /*
- * Refuse if device is dead or not completely open.
- */
- if (device == DEVICE_NULL)
- return (D_NO_SUCH_DEVICE);
-#endif
-
if (device->state != DEV_STATE_OPEN)
return (D_NO_SUCH_DEVICE);
@@ -931,17 +1134,10 @@ ds_device_read(device, reply_port, reply_port_type, mode, recnum,
/*
* Read from a device, but return the data 'inband.'
*/
-#ifdef i386
static io_return_t
-device_read_inband(d, reply_port, reply_port_type, mode, recnum,
+device_read_inband(device, reply_port, reply_port_type, mode, recnum,
bytes_wanted, data, data_count)
- void *d;
-#else
-io_return_t
-ds_device_read_inband(device, reply_port, reply_port_type, mode, recnum,
- bytes_wanted, data, data_count)
- register mach_device_t device;
-#endif
+ mach_device_t device;
ipc_port_t reply_port;
mach_msg_type_name_t reply_port_type;
dev_mode_t mode;
@@ -950,9 +1146,6 @@ ds_device_read_inband(device, reply_port, reply_port_type, mode, recnum,
char *data; /* pointer to OUT array */
unsigned int *data_count; /* out */
{
-#ifdef i386
- register mach_device_t device = d;
-#endif
register io_req_t ior;
register io_return_t result;
@@ -961,14 +1154,6 @@ ds_device_read_inband(device, reply_port, reply_port_type, mode, recnum,
*data_count = *data_count;
#endif /* lint */
-#ifndef i386
- /*
- * Refuse if device is dead or not completely open.
- */
- if (device == DEVICE_NULL)
- return (D_NO_SUCH_DEVICE);
-#endif
-
if (device->state != DEV_STATE_OPEN)
return (D_NO_SUCH_DEVICE);
@@ -1030,7 +1215,6 @@ ds_device_read_inband(device, reply_port, reply_port_type, mode, recnum,
return (MIG_NO_REPLY); /* reply has already been sent. */
}
-
/*
* Allocate wired-down memory for device read.
*/
@@ -1158,31 +1342,13 @@ boolean_t ds_read_done(ior)
return (TRUE);
}
-#ifdef i386
static io_return_t
-device_set_status(d, flavor, status, status_count)
- void *d;
-#else
-io_return_t
-ds_device_set_status(device, flavor, status, status_count)
- register mach_device_t device;
-#endif
+device_set_status(device, flavor, status, status_count)
+ mach_device_t device;
dev_flavor_t flavor;
dev_status_t status;
mach_msg_type_number_t status_count;
{
-#ifdef i386
- register mach_device_t device = d;
-#endif
-
-#ifndef i386
- /*
- * Refuse if device is dead or not completely open.
- */
- if (device == DEVICE_NULL)
- return (D_NO_SUCH_DEVICE);
-#endif
-
if (device->state != DEV_STATE_OPEN)
return (D_NO_SUCH_DEVICE);
@@ -1194,31 +1360,13 @@ ds_device_set_status(device, flavor, status, status_count)
status_count));
}
-#ifdef i386
io_return_t
-mach_device_get_status(d, flavor, status, status_count)
- void *d;
-#else
-io_return_t
-ds_device_get_status(device, flavor, status, status_count)
- register mach_device_t device;
-#endif
+mach_device_get_status(device, flavor, status, status_count)
+ mach_device_t device;
dev_flavor_t flavor;
dev_status_t status; /* pointer to OUT array */
mach_msg_type_number_t *status_count; /* out */
{
-#ifdef i386
- register mach_device_t device = d;
-#endif
-
-#ifndef i386
- /*
- * Refuse if device is dead or not completely open.
- */
- if (device == DEVICE_NULL)
- return (D_NO_SUCH_DEVICE);
-#endif
-
if (device->state != DEV_STATE_OPEN)
return (D_NO_SUCH_DEVICE);
@@ -1230,32 +1378,14 @@ ds_device_get_status(device, flavor, status, status_count)
status_count));
}
-#ifdef i386
static io_return_t
-device_set_filter(d, receive_port, priority, filter, filter_count)
- void *d;
-#else
-io_return_t
-ds_device_set_filter(device, receive_port, priority, filter, filter_count)
- register mach_device_t device;
-#endif
+device_set_filter(device, receive_port, priority, filter, filter_count)
+ mach_device_t device;
ipc_port_t receive_port;
int priority;
filter_t filter[]; /* pointer to IN array */
unsigned int filter_count;
{
-#ifdef i386
- register mach_device_t device = d;
-#endif
-
-#ifndef i386
- /*
- * Refuse if device is dead or not completely open.
- */
- if (device == DEVICE_NULL)
- return (D_NO_SUCH_DEVICE);
-#endif
-
if (device->state != DEV_STATE_OPEN)
return (D_NO_SUCH_DEVICE);
@@ -1274,39 +1404,21 @@ ds_device_set_filter(device, receive_port, priority, filter, filter_count)
filter_count));
}
-#ifdef i386
static io_return_t
-device_map(d, protection, offset, size, pager, unmap)
- void *d;
-#else
-io_return_t
-ds_device_map(device, protection, offset, size, pager, unmap)
- register mach_device_t device;
-#endif
+device_map(device, protection, offset, size, pager, unmap)
+ mach_device_t device;
vm_prot_t protection;
vm_offset_t offset;
vm_size_t size;
ipc_port_t *pager; /* out */
boolean_t unmap; /* ? */
{
-#ifdef i386
- register mach_device_t device = d;
-#endif
-
#ifdef lint
unmap = unmap;
#endif /* lint */
if (protection & ~VM_PROT_ALL)
return (KERN_INVALID_ARGUMENT);
-#ifndef i386
- /*
- * Refuse if device is dead or not completely open.
- */
- if (device == DEVICE_NULL)
- return (D_NO_SUCH_DEVICE);
-#endif
-
if (device->state != DEV_STATE_OPEN)
return (D_NO_SUCH_DEVICE);
@@ -1319,11 +1431,7 @@ ds_device_map(device, protection, offset, size, pager, unmap)
/*
* Doesn't do anything (yet).
*/
-#ifdef i386
static void
-#else
-void
-#endif
ds_no_senders(notification)
mach_no_senders_notification_t *notification;
{
@@ -1332,23 +1440,6 @@ ds_no_senders(notification)
notification->not_count);
}
-#ifndef i386
-boolean_t
-ds_notify(msg)
- mach_msg_header_t *msg;
-{
- switch (msg->msgh_id) {
- case MACH_NOTIFY_NO_SENDERS:
- ds_no_senders((mach_no_senders_notification_t *) msg);
- return TRUE;
-
- default:
- printf("ds_notify: strange notification %d\n", msg->msgh_id);
- return FALSE;
- }
-}
-#endif
-
queue_head_t io_done_list;
decl_simple_lock_data(, io_done_list_lock)
@@ -1394,7 +1485,7 @@ void io_done_thread_continue()
register spl_t s;
register io_req_t ior;
-#if defined (i386) && defined (LINUX_DEV) && defined (CONFIG_INET)
+#if defined (LINUX_DEV) && defined (CONFIG_INET)
free_skbuffs ();
#endif
s = splio();
@@ -1438,9 +1529,9 @@ void io_done_thread()
#define DEVICE_IO_MAP_SIZE (2 * 1024 * 1024)
-extern void ds_trap_init(void); /* forward */
+static void mach_device_trap_init(void); /* forward */
-void ds_init()
+void mach_device_init()
{
vm_offset_t device_io_min, device_io_max;
@@ -1477,7 +1568,7 @@ void ds_init()
FALSE,
"io inband read buffers");
- ds_trap_init();
+ mach_device_trap_init();
}
void iowait(ior)
@@ -1514,10 +1605,10 @@ void iowait(ior)
zone_t io_trap_zone;
/*
- * Initialization. Called from ds_init().
+ * Initialization. Called from mach_device_init().
*/
-void
-ds_trap_init(void)
+static void
+mach_device_trap_init(void)
{
io_trap_zone = zinit(IOTRAP_REQSIZE, 0,
256 * IOTRAP_REQSIZE,
@@ -1564,33 +1655,13 @@ ds_trap_write_done(io_req_t ior)
/*
* Like device_write except that data is in user space.
*/
-#ifdef i386
static io_return_t
-device_write_trap (void *d, dev_mode_t mode,
+device_write_trap (mach_device_t device, dev_mode_t mode,
recnum_t recnum, vm_offset_t data, vm_size_t data_count)
-#else
-io_return_t
-ds_device_write_trap(device_t device,
- dev_mode_t mode,
- recnum_t recnum,
- vm_offset_t data,
- vm_size_t data_count)
-#endif
{
-#ifdef i386
- mach_device_t device = d;
-#endif
io_req_t ior;
io_return_t result;
-#ifndef i386
- /*
- * Refuse if device is dead or not completely open.
- */
- if (device == DEVICE_NULL)
- return (D_NO_SUCH_DEVICE);
-#endif
-
if (device->state != DEV_STATE_OPEN)
return (D_NO_SUCH_DEVICE);
@@ -1652,36 +1723,16 @@ ds_device_write_trap(device_t device,
return (result);
}
-#ifdef i386
static io_return_t
-device_writev_trap (void *d, dev_mode_t mode,
+device_writev_trap (mach_device_t device, dev_mode_t mode,
recnum_t recnum, io_buf_vec_t *iovec, vm_size_t iocount)
-#else
-io_return_t
-ds_device_writev_trap(device_t device,
- dev_mode_t mode,
- recnum_t recnum,
- io_buf_vec_t *iovec,
- vm_size_t iocount)
-#endif
{
-#ifdef i386
- mach_device_t device = d;
-#endif
io_req_t ior;
io_return_t result;
io_buf_vec_t stack_iovec[16]; /* XXX */
vm_size_t data_count;
int i;
-#ifndef i386
- /*
- * Refuse if device is dead or not completely open.
- */
- if (device == DEVICE_NULL)
- return (D_NO_SUCH_DEVICE);
-#endif
-
if (device->state != DEV_STATE_OPEN)
return (D_NO_SUCH_DEVICE);
@@ -1763,7 +1814,6 @@ ds_device_writev_trap(device_t device,
return (result);
}
-#ifdef i386
struct device_emulation_ops mach_device_emulation_ops =
{
mach_device_reference,
@@ -1783,4 +1833,3 @@ struct device_emulation_ops mach_device_emulation_ops =
device_write_trap,
device_writev_trap
};
-#endif
diff --git a/i386/Makefrag.am b/i386/Makefrag.am
index d90ab63..3b97d86 100644
--- a/i386/Makefrag.am
+++ b/i386/Makefrag.am
@@ -25,11 +25,8 @@ libkernel_a_SOURCES += \
i386/i386at/conf.c \
i386/i386at/cons_conf.c \
i386/i386at/cram.h \
- i386/i386at/dev_hdr.h \
- i386/i386at/device_emul.h \
i386/i386at/disk.h \
i386/i386at/rtc.c \
- i386/i386at/i386at_ds_routines.c \
i386/i386at/i8250.h \
i386/i386at/idt.h \
i386/i386at/immc.c \
diff --git a/i386/i386at/dev_hdr.h b/i386/i386at/dev_hdr.h
deleted file mode 100644
index 7af644b..0000000
--- a/i386/i386at/dev_hdr.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Mach device definitions (i386at version).
- *
- * Copyright (c) 1996 The University of Utah and
- * the Computer Systems Laboratory at the University of Utah (CSL).
- * All rights reserved.
- *
- * Permission to use, copy, modify and distribute this software is hereby
- * granted provided that (1) source code retains these copyright, permission,
- * and disclaimer notices, and (2) redistributions including binaries
- * reproduce the notices in supporting documentation, and (3) all advertising
- * materials mentioning features or use of this software display the following
- * acknowledgement: ``This product includes software developed by the
- * Computer Systems Laboratory at the University of Utah.''
- *
- * THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS
- * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF
- * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * CSL requests users of this software to return to csl-dist@cs.utah.edu any
- * improvements that they make and grant CSL redistribution rights.
- *
- * Author: Shantanu Goel, University of Utah CSL
- */
-
-#ifndef _I386AT_DEV_HDR_H_
-#define _I386AT_DEV_HDR_H_
-
-struct device_emulation_ops;
-
-/* This structure is associated with each open device port.
- The port representing the device points to this structure. */
-struct device
-{
- struct device_emulation_ops *emul_ops;
- void *emul_data;
-};
-
-typedef struct device *device_t;
-
-#define DEVICE_NULL ((device_t) 0)
-
-#endif /* _I386AT_DEV_HDR_H_ */
diff --git a/i386/i386at/i386at_ds_routines.c b/i386/i386at/i386at_ds_routines.c
deleted file mode 100644
index bd9b08a..0000000
--- a/i386/i386at/i386at_ds_routines.c
+++ /dev/null
@@ -1,284 +0,0 @@
-/*
- * Mach device server routines (i386at version).
- *
- * Copyright (c) 1996 The University of Utah and
- * the Computer Systems Laboratory at the University of Utah (CSL).
- * All rights reserved.
- *
- * Permission to use, copy, modify and distribute this software is hereby
- * granted provided that (1) source code retains these copyright, permission,
- * and disclaimer notices, and (2) redistributions including binaries
- * reproduce the notices in supporting documentation, and (3) all advertising
- * materials mentioning features or use of this software display the following
- * acknowledgement: ``This product includes software developed by the
- * Computer Systems Laboratory at the University of Utah.''
- *
- * THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS
- * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF
- * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * CSL requests users of this software to return to csl-dist@cs.utah.edu any
- * improvements that they make and grant CSL redistribution rights.
- *
- * Author: Shantanu Goel, University of Utah CSL
- */
-
-#include <kern/printf.h>
-
-#include <mach/boolean.h>
-#include <mach/kern_return.h>
-#include <mach/mig_errors.h>
-#include <mach/port.h>
-#include <mach/notify.h>
-
-#include <device/device_types.h>
-#include <device/device_port.h>
-#include <device/device.server.h>
-
-#include <i386at/dev_hdr.h>
-#include <i386at/device_emul.h>
-
-extern struct device_emulation_ops mach_device_emulation_ops;
-#ifdef LINUX_DEV
-extern struct device_emulation_ops linux_block_emulation_ops;
-#ifdef CONFIG_INET
-extern struct device_emulation_ops linux_net_emulation_ops;
-#ifdef CONFIG_PCMCIA
-extern struct device_emulation_ops linux_pcmcia_emulation_ops;
-#endif
-#endif
-#endif
-
-/* List of emulations. */
-static struct device_emulation_ops *emulation_list[] =
-{
-#ifdef LINUX_DEV
- &linux_block_emulation_ops,
-#ifdef CONFIG_INET
- &linux_net_emulation_ops,
-#ifdef CONFIG_PCMCIA
- &linux_pcmcia_emulation_ops,
-#endif
-#endif
-#endif
- &mach_device_emulation_ops,
-};
-
-#define NUM_EMULATION (sizeof (emulation_list) / sizeof (emulation_list[0]))
-
-io_return_t
-ds_device_open (ipc_port_t open_port, ipc_port_t reply_port,
- mach_msg_type_name_t reply_port_type, dev_mode_t mode,
- char *name, device_t *devp)
-{
- int i;
- io_return_t err;
-
- /* Open must be called on the master device port. */
- if (open_port != master_device_port)
- return D_INVALID_OPERATION;
-
- /* There must be a reply port. */
- if (! IP_VALID (reply_port))
- {
- printf ("ds_* invalid reply port\n");
- Debugger ("ds_* reply_port");
- return MIG_NO_REPLY;
- }
-
- /* Call each emulation's open routine to find the device. */
- for (i = 0; i < NUM_EMULATION; i++)
- {
- err = (*emulation_list[i]->open) (reply_port, reply_port_type,
- mode, name, devp);
- if (err != D_NO_SUCH_DEVICE)
- break;
- }
-
- return err;
-}
-
-io_return_t
-ds_device_close (device_t dev)
-{
- if (dev == DEVICE_NULL)
- return D_NO_SUCH_DEVICE;
- return (dev->emul_ops->close
- ? (*dev->emul_ops->close) (dev->emul_data)
- : D_SUCCESS);
-}
-
-io_return_t
-ds_device_write (device_t dev, ipc_port_t reply_port,
- mach_msg_type_name_t reply_port_type, dev_mode_t mode,
- recnum_t recnum, io_buf_ptr_t data, unsigned int count,
- int *bytes_written)
-{
- if (dev == DEVICE_NULL)
- return D_NO_SUCH_DEVICE;
- if (! data)
- return D_INVALID_SIZE;
- if (! dev->emul_ops->write)
- return D_INVALID_OPERATION;
- return (*dev->emul_ops->write) (dev->emul_data, reply_port,
- reply_port_type, mode, recnum,
- data, count, bytes_written);
-}
-
-io_return_t
-ds_device_write_inband (device_t dev, ipc_port_t reply_port,
- mach_msg_type_name_t reply_port_type,
- dev_mode_t mode, recnum_t recnum,
- io_buf_ptr_inband_t data, unsigned count,
- int *bytes_written)
-{
- if (dev == DEVICE_NULL)
- return D_NO_SUCH_DEVICE;
- if (! data)
- return D_INVALID_SIZE;
- if (! dev->emul_ops->write_inband)
- return D_INVALID_OPERATION;
- return (*dev->emul_ops->write_inband) (dev->emul_data, reply_port,
- reply_port_type, mode, recnum,
- data, count, bytes_written);
-}
-
-io_return_t
-ds_device_read (device_t dev, ipc_port_t reply_port,
- mach_msg_type_name_t reply_port_type, dev_mode_t mode,
- recnum_t recnum, int count, io_buf_ptr_t *data,
- unsigned *bytes_read)
-{
- if (dev == DEVICE_NULL)
- return D_NO_SUCH_DEVICE;
- if (! dev->emul_ops->read)
- return D_INVALID_OPERATION;
- return (*dev->emul_ops->read) (dev->emul_data, reply_port,
- reply_port_type, mode, recnum,
- count, data, bytes_read);
-}
-
-io_return_t
-ds_device_read_inband (device_t dev, ipc_port_t reply_port,
- mach_msg_type_name_t reply_port_type, dev_mode_t mode,
- recnum_t recnum, int count, char *data,
- unsigned *bytes_read)
-{
- if (dev == DEVICE_NULL)
- return D_NO_SUCH_DEVICE;
- if (! dev->emul_ops->read_inband)
- return D_INVALID_OPERATION;
- return (*dev->emul_ops->read_inband) (dev->emul_data, reply_port,
- reply_port_type, mode, recnum,
- count, data, bytes_read);
-}
-
-io_return_t
-ds_device_set_status (device_t dev, dev_flavor_t flavor,
- dev_status_t status, mach_msg_type_number_t status_count)
-{
- if (dev == DEVICE_NULL)
- return D_NO_SUCH_DEVICE;
- if (! dev->emul_ops->set_status)
- return D_INVALID_OPERATION;
-
- return (*dev->emul_ops->set_status) (dev->emul_data, flavor, status,
- status_count);
-}
-
-io_return_t
-ds_device_get_status (device_t dev, dev_flavor_t flavor, dev_status_t status,
- mach_msg_type_number_t *status_count)
-{
- if (dev == DEVICE_NULL)
- return D_NO_SUCH_DEVICE;
- if (! dev->emul_ops->get_status)
- return D_INVALID_OPERATION;
-
- return (*dev->emul_ops->get_status) (dev->emul_data, flavor, status,
- status_count);
-}
-
-io_return_t
-ds_device_set_filter (device_t dev, ipc_port_t receive_port, int priority,
- filter_t *filter, unsigned filter_count)
-{
- if (dev == DEVICE_NULL)
- return D_NO_SUCH_DEVICE;
- if (! dev->emul_ops->set_filter)
- return D_INVALID_OPERATION;
- return (*dev->emul_ops->set_filter) (dev->emul_data, receive_port,
- priority, filter, filter_count);
-}
-
-io_return_t
-ds_device_map (device_t dev, vm_prot_t prot, vm_offset_t offset,
- vm_size_t size, ipc_port_t *pager, boolean_t unmap)
-{
- if (dev == DEVICE_NULL)
- return D_NO_SUCH_DEVICE;
- if (! dev->emul_ops->map)
- return D_INVALID_OPERATION;
- return (*dev->emul_ops->map) (dev->emul_data, prot,
- offset, size, pager, unmap);
-}
-
-boolean_t
-ds_notify (mach_msg_header_t *msg)
-{
- if (msg->msgh_id == MACH_NOTIFY_NO_SENDERS)
- {
- device_t dev;
- mach_no_senders_notification_t *ns;
-
- ns = (mach_no_senders_notification_t *) msg;
- dev = dev_port_lookup((ipc_port_t) ns->not_header.msgh_remote_port);
- assert(dev);
- if (dev->emul_ops->no_senders)
- (*dev->emul_ops->no_senders) (ns);
- return TRUE;
- }
-
- printf ("ds_notify: strange notification %d\n", msg->msgh_id);
- return FALSE;
-}
-
-io_return_t
-ds_device_write_trap (device_t dev, dev_mode_t mode,
- recnum_t recnum, vm_offset_t data, vm_size_t count)
-{
- if (dev == DEVICE_NULL)
- return D_NO_SUCH_DEVICE;
- if (! dev->emul_ops->write_trap)
- return D_INVALID_OPERATION;
- return (*dev->emul_ops->write_trap) (dev->emul_data,
- mode, recnum, data, count);
-}
-
-io_return_t
-ds_device_writev_trap (device_t dev, dev_mode_t mode,
- recnum_t recnum, io_buf_vec_t *iovec, vm_size_t count)
-{
- if (dev == DEVICE_NULL)
- return D_NO_SUCH_DEVICE;
- if (! dev->emul_ops->writev_trap)
- return D_INVALID_OPERATION;
- return (*dev->emul_ops->writev_trap) (dev->emul_data,
- mode, recnum, iovec, count);
-}
-
-void
-device_reference (device_t dev)
-{
- if (dev->emul_ops->reference)
- (*dev->emul_ops->reference) (dev->emul_data);
-}
-
-void
-device_deallocate (device_t dev)
-{
- if (dev == DEVICE_NULL)
- return;
- if (dev->emul_ops->dealloc)
- (*dev->emul_ops->dealloc) (dev->emul_data);
-}
diff --git a/i386/linux/Makefrag.am b/i386/linux/Makefrag.am
index c280309..87b1ae2 100644
--- a/i386/linux/Makefrag.am
+++ b/i386/linux/Makefrag.am
@@ -22,5 +22,4 @@
liblinux_a_SOURCES += \
i386/linux/dev/include/linux/autoconf.h \
- i386/linux/dev/include/linux_emul.h \
linux/src/arch/i386/lib/semaphore.S
diff --git a/i386/linux/dev/include/linux_emul.h b/i386/linux/dev/include/linux_emul.h
deleted file mode 100644
index 50bf73d..0000000
--- a/i386/linux/dev/include/linux_emul.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef _LINUX_EMUL_H_
-#define _LINUX_EMUL_H_
-
-#include <i386at/dev_hdr.h>
-#include <i386at/device_emul.h>
-#include <i386at/disk.h>
-
-#endif
diff --git a/linux/dev/glue/block.c b/linux/dev/glue/block.c
index 48dba7d..c06b5d2 100644
--- a/linux/dev/glue/block.c
+++ b/linux/dev/glue/block.c
@@ -60,8 +60,10 @@
#include <device/device_port.h>
#include <device/disk_status.h>
#include <device/device_reply.user.h>
+#include <device/device_emul.h>
-#include <linux_emul.h>
+/* TODO. This should be fixed to not be i386 specific. */
+#include <i386at/disk.h>
#define MACH_INCLUDE
#include <linux/fs.h>
diff --git a/linux/dev/glue/net.c b/linux/dev/glue/net.c
index 3ba0e0a..1a7a1e6 100644
--- a/linux/dev/glue/net.c
+++ b/linux/dev/glue/net.c
@@ -83,8 +83,7 @@
#include <device/if_hdr.h>
#include <device/net_io.h>
#include <device/device_reply.user.h>
-
-#include <linux_emul.h>
+#include <device/device_emul.h>
#define MACH_INCLUDE
#include <linux/kernel.h>
diff --git a/linux/pcmcia-cs/glue/ds.c b/linux/pcmcia-cs/glue/ds.c
index 0f4e9a2..d0ecac9 100644
--- a/linux/pcmcia-cs/glue/ds.c
+++ b/linux/pcmcia-cs/glue/ds.c
@@ -1,7 +1,7 @@
/*
* pcmcia-socket `device' driver
*
- * Copyright (C) 2006 Free Software Foundation, Inc.
+ * Copyright (C) 2006, 2007 Free Software Foundation, Inc.
* Written by Stefan Siegl <stesie@brokenpipe.de>.
*
* This file is part of GNU Mach.
@@ -49,7 +49,7 @@
#include <device/io_req.h>
#include <device/ds_routines.h>
-#include <i386at/device_emul.h>
+#include <device/device_emul.h>
#include <device/device_reply.user.h>