summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--device/conf.h39
-rw-r--r--device/dev_name.c38
-rw-r--r--device/ds_routines.c2
-rw-r--r--device/kmsg.c3
-rw-r--r--device/kmsg.h2
-rw-r--r--i386/i386at/com.c12
-rw-r--r--i386/i386at/com.h8
-rw-r--r--i386/i386at/conf.c30
-rw-r--r--i386/i386at/kd.c10
-rw-r--r--i386/i386at/kd.h8
-rw-r--r--i386/i386at/kd_event.c3
-rw-r--r--i386/i386at/kd_event.h2
-rw-r--r--i386/i386at/kd_mouse.c3
-rw-r--r--i386/i386at/kd_mouse.h2
-rw-r--r--i386/i386at/lpr.c8
-rw-r--r--i386/i386at/lpr.h8
-rw-r--r--i386/i386at/mem.c2
-rw-r--r--i386/i386at/mem.h2
-rw-r--r--i386/i386at/model_dep.c4
-rw-r--r--i386/i386at/model_dep.h2
-rw-r--r--kern/mach_clock.c6
-rw-r--r--kern/mach_clock.h8
22 files changed, 128 insertions, 74 deletions
diff --git a/device/conf.h b/device/conf.h
index a0d5010..fea1822 100644
--- a/device/conf.h
+++ b/device/conf.h
@@ -32,22 +32,30 @@
#define _DEVICE_CONF_H_
#include <mach/machine/vm_types.h>
+#include <sys/types.h>
+#include <mach/port.h>
+#include <mach/vm_prot.h>
+
+struct io_req;
+typedef struct io_req *io_req_t;
+
+typedef int io_return_t;
/*
* Operations list for major device types.
*/
struct dev_ops {
- char * d_name; /* name for major device */
- int (*d_open)(); /* open device */
- int (*d_close)(); /* close device */
- int (*d_read)(); /* read */
- int (*d_write)(); /* write */
- int (*d_getstat)(); /* get status/control */
- int (*d_setstat)(); /* set status/control */
- vm_offset_t (*d_mmap)(); /* map memory */
- int (*d_async_in)();/* asynchronous input setup */
- int (*d_reset)(); /* reset device */
- int (*d_port_death)();
+ char * d_name; /* name for major device */
+ int (*d_open)(dev_t, int, io_req_t);/* open device */
+ void (*d_close)(dev_t, int); /* close device */
+ int (*d_read)(dev_t, io_req_t); /* read */
+ int (*d_write)(dev_t, io_req_t); /* write */
+ int (*d_getstat)(dev_t, int, int *, natural_t *); /* get status/control */
+ int (*d_setstat)(dev_t, int, int *, natural_t); /* set status/control */
+ int (*d_mmap)(dev_t, vm_offset_t, vm_prot_t); /* map memory */
+ int (*d_async_in)(); /* asynchronous input setup */
+ int (*d_reset)(); /* reset device */
+ int (*d_port_death)(dev_t, mach_port_t);
/* clean up reply ports */
int d_subdev; /* number of sub-devices per
unit */
@@ -59,8 +67,15 @@ typedef struct dev_ops *dev_ops_t;
* Routines for null entries.
*/
extern int nulldev(void); /* no operation - OK */
+extern int nulldev_open(dev_t dev, int flag, io_req_t ior);
+extern void nulldev_close(dev_t dev, int flags);
+extern int nulldev_read(dev_t dev, io_req_t ior);
+extern int nulldev_write(dev_t dev, io_req_t ior);
+extern io_return_t nulldev_getstat(dev_t dev, int flavor, int *data, natural_t *count);
+extern io_return_t nulldev_setstat(dev_t dev, int flavor, int *data, natural_t count);
+extern io_return_t nulldev_portdeath(dev_t dev, mach_port_t port);
extern int nodev(void); /* no operation - error */
-extern vm_offset_t nomap(void); /* no operation - error */
+extern int nomap(dev_t dev, vm_offset_t off, int prot); /* no operation - error */
/*
* Flavor constants for d_dev_info routine
diff --git a/device/dev_name.c b/device/dev_name.c
index 4cc046a..cd3a28a 100644
--- a/device/dev_name.c
+++ b/device/dev_name.c
@@ -44,13 +44,47 @@ int nulldev(void)
return (D_SUCCESS);
}
+int nulldev_open(dev_t dev, int flags, io_req_t ior)
+{
+ return (D_SUCCESS);
+}
+
+void nulldev_close(dev_t dev, int flags)
+{
+}
+
+int nulldev_read(dev_t dev, io_req_t ior)
+{
+ return (D_SUCCESS);
+}
+
+int nulldev_write(dev_t dev, io_req_t ior)
+{
+ return (D_SUCCESS);
+}
+
+io_return_t nulldev_getstat(dev_t dev, int flavor, int *data, natural_t *count)
+{
+ return (D_SUCCESS);
+}
+
+io_return_t nulldev_setstat(dev_t dev, int flavor, int *data, natural_t count)
+{
+ return (D_SUCCESS);
+}
+
+int nulldev_portdeath(dev_t dev, mach_port_t port)
+{
+ return (D_SUCCESS);
+}
+
int nodev(void)
{
return (D_INVALID_OPERATION);
}
-vm_offset_t
-nomap(void)
+int
+nomap(dev_t dev, vm_offset_t off, int prot)
{
return (D_INVALID_OPERATION);
}
diff --git a/device/ds_routines.c b/device/ds_routines.c
index 82b5252..4e04445 100644
--- a/device/ds_routines.c
+++ b/device/ds_routines.c
@@ -639,7 +639,7 @@ device_close(device)
/*
* Close the device
*/
- (*device->dev_ops->d_close)(device->dev_number);
+ (*device->dev_ops->d_close)(device->dev_number, 0);
/*
* Finally mark it closed. If someone else is trying
diff --git a/device/kmsg.c b/device/kmsg.c
index 40956dd..c80775d 100644
--- a/device/kmsg.c
+++ b/device/kmsg.c
@@ -77,14 +77,13 @@ kmsgopen (dev_t dev, int flag, const io_req_t ior)
}
/* Kernel Message Close Handler */
-io_return_t
+void
kmsgclose (dev_t dev, int flag)
{
simple_lock (&kmsg_lock);
kmsg_in_use = FALSE;
simple_unlock (&kmsg_lock);
- return D_SUCCESS;
}
static boolean_t kmsg_read_done (io_req_t ior);
diff --git a/device/kmsg.h b/device/kmsg.h
index b8c1f36..8d907f1 100644
--- a/device/kmsg.h
+++ b/device/kmsg.h
@@ -8,7 +8,7 @@
#include <device/io_req.h>
io_return_t kmsgopen (dev_t dev, int flag, io_req_t ior);
-io_return_t kmsgclose (dev_t dev, int flag);
+void kmsgclose (dev_t dev, int flag);
io_return_t kmsgread (dev_t dev, io_req_t ior);
io_return_t kmsggetstat (dev_t dev, int flavor,
int *data, unsigned int *count);
diff --git a/i386/i386at/com.c b/i386/i386at/com.c
index 6edbca0..07521f9 100644
--- a/i386/i386at/com.c
+++ b/i386/i386at/com.c
@@ -319,7 +319,7 @@ boolean_t com_reprobe(
}
io_return_t comopen(
- int dev,
+ dev_t dev,
int flag,
io_req_t ior)
{
@@ -400,8 +400,8 @@ io_return_t comopen(
return result;
}
-io_return_t comclose(dev, flag)
-int dev;
+void comclose(dev, flag)
+dev_t dev;
int flag;
{
struct tty *tp = &com_tty[minor(dev)];
@@ -416,18 +416,18 @@ int flag;
if (comfifo[minor(dev)] != 0)
outb(INTR_ID(addr), 0x00); /* Disable fifos */
}
- return 0;
+ return;
}
io_return_t comread(dev, ior)
-int dev;
+dev_t dev;
io_req_t ior;
{
return char_read(&com_tty[minor(dev)], ior);
}
io_return_t comwrite(dev, ior)
-int dev;
+dev_t dev;
io_req_t ior;
{
return char_write(&com_tty[minor(dev)], ior);
diff --git a/i386/i386at/com.h b/i386/i386at/com.h
index 81fccfa..95baa45 100644
--- a/i386/i386at/com.h
+++ b/i386/i386at/com.h
@@ -71,10 +71,10 @@ comsetstat(
int *data,
natural_t count);
-extern io_return_t comopen(int dev, int flag, io_req_t ior);
-extern io_return_t comclose(int dev, int flag);
-extern io_return_t comread(int dev, io_req_t ior);
-extern io_return_t comwrite(int dev, io_req_t ior);
+extern io_return_t comopen(dev_t dev, int flag, io_req_t ior);
+extern void comclose(dev_t dev, int flag);
+extern io_return_t comread(dev_t dev, io_req_t ior);
+extern io_return_t comwrite(dev_t dev, io_req_t ior);
extern io_return_t comportdeath(dev_t dev, mach_port_t port);
#endif /* _COM_H_ */
diff --git a/i386/i386at/conf.c b/i386/i386at/conf.c
index 4fcd81e..ab4f680 100644
--- a/i386/i386at/conf.c
+++ b/i386/i386at/conf.c
@@ -81,9 +81,9 @@ struct dev_ops dev_name_list[] =
/* We don't assign a console here, when we find one via
cninit() we stick something appropriate here through the
indirect list */
- { "cn", nulldev, nulldev, nulldev,
- nulldev, nulldev, nulldev, nomap,
- nodev, nulldev, nulldev, 0,
+ { "cn", nulldev_open, nulldev_close, nulldev_read,
+ nulldev_write, nulldev_getstat, nulldev_setstat, nomap,
+ nodev, nulldev, nulldev_portdeath, 0,
nodev },
#ifndef MACH_HYP
@@ -93,9 +93,9 @@ struct dev_ops dev_name_list[] =
nodev },
#endif /* MACH_HYP */
- { timename, timeopen, timeclose, nulldev,
- nulldev, nulldev, nulldev, timemmap,
- nodev, nulldev, nulldev, 0,
+ { timename, timeopen, timeclose, nulldev_read,
+ nulldev_write, nulldev_getstat, nulldev_setstat, timemmap,
+ nodev, nulldev, nulldev_portdeath, 0,
nodev },
#ifndef MACH_HYP
@@ -114,25 +114,25 @@ struct dev_ops dev_name_list[] =
#endif
{ mousename, mouseopen, mouseclose, mouseread,
- nodev, mousegetstat, nulldev, nomap,
- nodev, nulldev, nulldev, 0,
+ nulldev_write, mousegetstat, nulldev_setstat, nomap,
+ nodev, nulldev, nulldev_portdeath, 0,
nodev },
{ kbdname, kbdopen, kbdclose, kbdread,
- nodev, kbdgetstat, kbdsetstat, nomap,
- nodev, nulldev, nulldev, 0,
+ nulldev_write, kbdgetstat, kbdsetstat, nomap,
+ nodev, nulldev, nulldev_portdeath, 0,
nodev },
- { memname, nulldev, nulldev, nodev,
- nodev, nodev, nodev, memmmap,
- nodev, nulldev, nulldev, 0,
+ { memname, nulldev_open, nulldev_close, nulldev_read,
+ nulldev_write, nulldev_getstat, nulldev_setstat, memmmap,
+ nodev, nulldev, nulldev_portdeath, 0,
nodev },
#endif /* MACH_HYP */
#ifdef MACH_KMSG
{ kmsgname, kmsgopen, kmsgclose, kmsgread,
- nodev, kmsggetstat, nodev, nomap,
- nodev, nulldev, nulldev, 0,
+ nulldev_write, kmsggetstat, nulldev_setstat, nomap,
+ nodev, nulldev, nulldev_portdeath, 0,
nodev },
#endif
diff --git a/i386/i386at/kd.c b/i386/i386at/kd.c
index acd69f7..0de1e50 100644
--- a/i386/i386at/kd.c
+++ b/i386/i386at/kd.c
@@ -487,7 +487,7 @@ kdopen(dev, flag, ior)
/*ARGSUSED*/
void
kdclose(dev, flag)
-int dev;
+dev_t dev;
int flag;
{
struct tty *tp;
@@ -519,7 +519,7 @@ int flag;
/*ARGSUSED*/
int
kdread(dev, uio)
-int dev;
+dev_t dev;
io_req_t uio;
{
struct tty *tp;
@@ -544,7 +544,7 @@ io_req_t uio;
/*ARGSUSED*/
int
kdwrite(dev, uio)
-int dev;
+dev_t dev;
io_req_t uio;
{
return((*linesw[kd_tty.t_line].l_write)(&kd_tty, uio));
@@ -558,8 +558,8 @@ io_req_t uio;
int
kdmmap(dev, off, prot)
dev_t dev;
- off_t off;
- int prot;
+ vm_offset_t off;
+ vm_prot_t prot;
{
if (off >= (128*1024))
return(-1);
diff --git a/i386/i386at/kd.h b/i386/i386at/kd.h
index 6c869d6..4ac93c7 100644
--- a/i386/i386at/kd.h
+++ b/i386/i386at/kd.h
@@ -752,9 +752,9 @@ extern void kdb_kintr(void);
#endif /* MACH_KDB */
extern int kdopen(dev_t dev, int flag, io_req_t ior);
-extern void kdclose(int dev, int flag);
-extern int kdread(int dev, io_req_t uio);
-extern int kdwrite(int dev, io_req_t uio);
+extern void kdclose(dev_t dev, int flag);
+extern int kdread(dev_t dev, io_req_t uio);
+extern int kdwrite(dev_t dev, io_req_t uio);
extern io_return_t kdgetstat(
dev_t dev,
@@ -769,7 +769,7 @@ extern io_return_t kdsetstat(
natural_t count);
extern int kdportdeath(dev_t dev, mach_port_t port);
-extern int kdmmap(dev_t dev, off_t off, int prot);
+extern int kdmmap(dev_t dev, vm_offset_t off, vm_prot_t prot);
boolean_t kdcheckmagic(Scancode scancode);
diff --git a/i386/i386at/kd_event.c b/i386/i386at/kd_event.c
index 30a7f77..2a75f95 100644
--- a/i386/i386at/kd_event.c
+++ b/i386/i386at/kd_event.c
@@ -110,9 +110,10 @@ kbdinit(void)
/*ARGSUSED*/
int
-kbdopen(dev, flags)
+kbdopen(dev, flags, ior)
dev_t dev;
int flags;
+ io_req_t ior;
{
spl_t o_pri = spltty();
kdinit();
diff --git a/i386/i386at/kd_event.h b/i386/i386at/kd_event.h
index 9568fa5..8b2d664 100644
--- a/i386/i386at/kd_event.h
+++ b/i386/i386at/kd_event.h
@@ -34,7 +34,7 @@ extern void X_kdb_enter (void);
extern void X_kdb_exit (void);
-extern int kbdopen(dev_t dev, int flags);
+extern int kbdopen(dev_t dev, int flags, io_req_t ior);
extern void kbdclose(dev_t dev, int flags);
extern int kbdread(dev_t dev, io_req_t ior);
diff --git a/i386/i386at/kd_mouse.c b/i386/i386at/kd_mouse.c
index d09d7a7..8b1222d 100644
--- a/i386/i386at/kd_mouse.c
+++ b/i386/i386at/kd_mouse.c
@@ -147,9 +147,10 @@ int track_man[10];
/*ARGSUSED*/
int
-mouseopen(dev, flags)
+mouseopen(dev, flags, ior)
dev_t dev;
int flags;
+ io_req_t ior;
{
if (mouse_in_use)
return (D_ALREADY_OPEN);
diff --git a/i386/i386at/kd_mouse.h b/i386/i386at/kd_mouse.h
index ad07c6c..a8a72a3 100644
--- a/i386/i386at/kd_mouse.h
+++ b/i386/i386at/kd_mouse.h
@@ -54,7 +54,7 @@ extern void mouse_packet_mouse_system_mouse (u_char *mousebuf);
extern void mouse_packet_ibm_ps2_mouse (u_char *mousebuf);
-extern int mouseopen(dev_t dev, int flags);
+extern int mouseopen(dev_t dev, int flags, io_req_t ior);
extern void mouseclose(dev_t dev, int flags);
extern int mouseread(dev_t dev, io_req_t ior);
diff --git a/i386/i386at/lpr.c b/i386/i386at/lpr.c
index 218f20d..1f95a3f 100644
--- a/i386/i386at/lpr.c
+++ b/i386/i386at/lpr.c
@@ -106,7 +106,7 @@ void lprattach(struct bus_device *dev)
int
lpropen(dev, flag, ior)
-int dev;
+dev_t dev;
int flag;
io_req_t ior;
{
@@ -135,7 +135,7 @@ u_short addr;
void
lprclose(dev, flag)
-int dev;
+dev_t dev;
int flag;
{
int unit = minor(dev);
@@ -151,7 +151,7 @@ u_short addr = (u_short) lprinfo[unit]->address;
int
lprread(dev, ior)
-int dev;
+dev_t dev;
io_req_t ior;
{
return char_read(&lpr_tty[minor(dev)], ior);
@@ -159,7 +159,7 @@ io_req_t ior;
int
lprwrite(dev, ior)
-int dev;
+dev_t dev;
io_req_t ior;
{
return char_write(&lpr_tty[minor(dev)], ior);
diff --git a/i386/i386at/lpr.h b/i386/i386at/lpr.h
index d2b9d4b..269fd64 100644
--- a/i386/i386at/lpr.h
+++ b/i386/i386at/lpr.h
@@ -57,10 +57,10 @@ lprsetstat(
void lprpr_addr(unsigned short addr);
-extern int lpropen(int dev, int flag, io_req_t ior);
-extern void lprclose(int dev, int flag);
-extern int lprread(int dev, io_req_t ior);
-extern int lprwrite(int dev, io_req_t ior);
+extern int lpropen(dev_t dev, int flag, io_req_t ior);
+extern void lprclose(dev_t dev, int flag);
+extern int lprread(dev_t dev, io_req_t ior);
+extern int lprwrite(dev_t dev, io_req_t ior);
extern int lprportdeath(dev_t dev, mach_port_t port);
#endif /* _LPRREG_H_ */
diff --git a/i386/i386at/mem.c b/i386/i386at/mem.c
index 5e51676..f239afa 100644
--- a/i386/i386at/mem.c
+++ b/i386/i386at/mem.c
@@ -32,7 +32,7 @@
/*ARGSUSED*/
int
memmmap(dev, off, prot)
-int dev;
+dev_t dev;
vm_offset_t off;
vm_prot_t prot;
{
diff --git a/i386/i386at/mem.h b/i386/i386at/mem.h
index 3d6a96c..0bc85ea 100644
--- a/i386/i386at/mem.h
+++ b/i386/i386at/mem.h
@@ -19,6 +19,6 @@
#ifndef _MEM_H_
#define _MEM_H_
-extern int memmmap(int dev, vm_offset_t off, vm_prot_t prot);
+extern int memmmap(dev_t dev, vm_offset_t off, vm_prot_t prot);
#endif /* _MEM_H_ */
diff --git a/i386/i386at/model_dep.c b/i386/i386at/model_dep.c
index 10c0c41..128f250 100644
--- a/i386/i386at/model_dep.c
+++ b/i386/i386at/model_dep.c
@@ -616,8 +616,8 @@ void c_boot_entry(vm_offset_t bi)
int
timemmap(dev, off, prot)
- int dev;
- int off;
+ dev_t dev;
+ vm_offset_t off;
vm_prot_t prot;
{
extern time_value_t *mtime;
diff --git a/i386/i386at/model_dep.h b/i386/i386at/model_dep.h
index 37cd86c..aa24032 100644
--- a/i386/i386at/model_dep.h
+++ b/i386/i386at/model_dep.h
@@ -21,7 +21,7 @@
#include <mach/vm_prot.h>
-extern int timemmap(int dev, int off, vm_prot_t prot);
+extern int timemmap(dev_t dev, vm_offset_t off, vm_prot_t prot);
void inittodr(void);
diff --git a/kern/mach_clock.c b/kern/mach_clock.c
index c68b460..f4a7714 100644
--- a/kern/mach_clock.c
+++ b/kern/mach_clock.c
@@ -499,13 +499,13 @@ void mapable_time_init(void)
update_mapped_time(&time);
}
-int timeopen(void)
+int timeopen(dev_t dev, int flag, io_req_t ior)
{
return(0);
}
-int timeclose(void)
+void timeclose(dev_t dev, int flag)
{
- return(0);
+ return;
}
/*
diff --git a/kern/mach_clock.h b/kern/mach_clock.h
index 827cf86..89fd335 100644
--- a/kern/mach_clock.h
+++ b/kern/mach_clock.h
@@ -29,6 +29,10 @@
#include <mach/time_value.h>
#include <kern/host.h>
#include <kern/queue.h>
+#include <sys/types.h>
+
+struct io_req;
+typedef struct io_req *io_req_t;
/* Timers in kernel. */
@@ -104,7 +108,7 @@ extern void mapable_time_init (void);
extern void timeout(timer_func_t *fcn, void *param, int interval);
extern boolean_t untimeout(timer_func_t *fcn, const void *param);
-extern int timeopen(void);
-extern int timeclose(void);
+extern int timeopen(dev_t dev, int flag, io_req_t ior);
+extern void timeclose(dev_t dev, int flag);
#endif /* _KERN_MACH_CLOCK_H_ */