summaryrefslogtreecommitdiff
path: root/device
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2019-11-11 23:54:14 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2019-11-11 23:54:14 +0100
commitca9c75b234fea9a4fb0ed9f7d6a3f11df4ca11e0 (patch)
treeccfdaf0e68cfa94c4479208f2850326dc1790437 /device
parentb0d9e31f9a1ee8fa0283f082f01467666d92a1f6 (diff)
parent74a84a56f24c17e98bc06eaa8b49195fbd5c0541 (diff)
Merge branch 'master' into master-user_level_drivers
Diffstat (limited to 'device')
-rw-r--r--device/blkio.c2
-rw-r--r--device/blkio.h2
-rw-r--r--device/conf.h13
-rw-r--r--device/dev_forward.defs44
-rw-r--r--device/dev_hdr.h2
-rw-r--r--device/dev_name.c8
-rw-r--r--device/dev_pager.c1
-rw-r--r--device/kmsg.c2
-rw-r--r--device/kmsg.h4
-rw-r--r--device/net_io.c2
-rw-r--r--device/net_io.h2
-rw-r--r--device/tty.h4
12 files changed, 22 insertions, 64 deletions
diff --git a/device/blkio.c b/device/blkio.c
index e5b4d09f..7ec1f2cf 100644
--- a/device/blkio.c
+++ b/device/blkio.c
@@ -101,7 +101,7 @@ void minphys(io_req_t ior)
* Dummy routine placed in device switch entries to indicate that
* block device may be mapped.
*/
-int block_io_mmap(dev_t dev, vm_offset_t off, int prot)
+vm_offset_t block_io_mmap(dev_t dev, vm_offset_t off, int prot)
{
return (0);
}
diff --git a/device/blkio.h b/device/blkio.h
index 77eb105a..aaff9f8a 100644
--- a/device/blkio.h
+++ b/device/blkio.h
@@ -19,6 +19,6 @@
#ifndef _DEVICE_BLKIO_H_
#define _DEVICE_BLKIO_H_
-extern int block_io_mmap(dev_t dev, vm_offset_t off, int prot);
+extern vm_offset_t block_io_mmap(dev_t dev, vm_offset_t off, int prot);
#endif /* _DEVICE_BLKIO_H_ */
diff --git a/device/conf.h b/device/conf.h
index fea18223..1af00285 100644
--- a/device/conf.h
+++ b/device/conf.h
@@ -35,6 +35,7 @@
#include <sys/types.h>
#include <mach/port.h>
#include <mach/vm_prot.h>
+#include <device/device_types.h>
struct io_req;
typedef struct io_req *io_req_t;
@@ -50,9 +51,9 @@ struct dev_ops {
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_getstat)(dev_t, dev_flavor_t, dev_status_t, mach_msg_type_number_t *); /* get status/control */
+ int (*d_setstat)(dev_t, dev_flavor_t, dev_status_t, mach_msg_type_number_t); /* set status/control */
+ vm_offset_t (*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);
@@ -71,11 +72,11 @@ 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_getstat(dev_t dev, dev_flavor_t flavor, dev_status_t data, mach_msg_type_number_t *count);
+extern io_return_t nulldev_setstat(dev_t dev, dev_flavor_t flavor, dev_status_t data, mach_msg_type_number_t count);
extern io_return_t nulldev_portdeath(dev_t dev, mach_port_t port);
extern int nodev(void); /* no operation - error */
-extern int nomap(dev_t dev, vm_offset_t off, int prot); /* no operation - error */
+extern vm_offset_t 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_forward.defs b/device/dev_forward.defs
deleted file mode 100644
index a237bb86..00000000
--- a/device/dev_forward.defs
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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: Joseph S. Barrera, Carnegie Mellon University
- * Date: 12/90
- */
-
-subsystem KernelUser dev_forward 2800;
-
-#include <mach/std_types.defs>
-#include <mach/mach_types.defs>
-#include <device/device_types.defs>
-
-type reply_port_t = MACH_MSG_TYPE_MOVE_SEND_ONCE | polymorphic
- ctype: mach_port_t;
-
-simpleroutine forward_device_open_send(
- master_port : mach_port_t;
- ureplyport reply_port : reply_port_t;
- mode : dev_mode_t;
- name : dev_name_t);
diff --git a/device/dev_hdr.h b/device/dev_hdr.h
index ff7d2ef5..ad98e0bb 100644
--- a/device/dev_hdr.h
+++ b/device/dev_hdr.h
@@ -61,7 +61,7 @@
#include <kern/lock.h>
#include <kern/queue.h>
-#include <device/conf.h>
+typedef struct dev_ops *dev_ops_t;
/* This structure is associated with each open device port.
The port representing the device points to this structure. */
diff --git a/device/dev_name.c b/device/dev_name.c
index 175e3890..f6133679 100644
--- a/device/dev_name.c
+++ b/device/dev_name.c
@@ -63,12 +63,12 @@ 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)
+io_return_t nulldev_getstat(dev_t dev, dev_flavor_t flavor, dev_status_t data, mach_msg_type_number_t *count)
{
return (D_SUCCESS);
}
-io_return_t nulldev_setstat(dev_t dev, int flavor, int *data, natural_t count)
+io_return_t nulldev_setstat(dev_t dev, dev_flavor_t flavor, dev_status_t data, mach_msg_type_number_t count)
{
return (D_SUCCESS);
}
@@ -83,10 +83,10 @@ int nodev(void)
return (D_INVALID_OPERATION);
}
-int
+vm_offset_t
nomap(dev_t dev, vm_offset_t off, int prot)
{
- return (D_INVALID_OPERATION);
+ return -1;
}
/*
diff --git a/device/dev_pager.c b/device/dev_pager.c
index 7130229b..0680b5aa 100644
--- a/device/dev_pager.c
+++ b/device/dev_pager.c
@@ -57,6 +57,7 @@
#include <device/memory_object_reply.user.h>
#include <device/dev_pager.h>
#include <device/blkio.h>
+#include <device/conf.h>
/*
* The device pager routines are called directly from the message
diff --git a/device/kmsg.c b/device/kmsg.c
index c80775d9..e49eb3d3 100644
--- a/device/kmsg.c
+++ b/device/kmsg.c
@@ -195,7 +195,7 @@ kmsg_read_done (io_req_t ior)
}
io_return_t
-kmsggetstat (dev_t dev, int flavor, int *data, unsigned int *count)
+kmsggetstat (dev_t dev, dev_flavor_t flavor, dev_status_t data, mach_msg_type_number_t *count)
{
switch (flavor)
{
diff --git a/device/kmsg.h b/device/kmsg.h
index 8d907f1b..00a35050 100644
--- a/device/kmsg.h
+++ b/device/kmsg.h
@@ -10,8 +10,8 @@
io_return_t kmsgopen (dev_t dev, int flag, io_req_t ior);
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);
+io_return_t kmsggetstat (dev_t dev, dev_flavor_t flavor,
+ dev_status_t data, mach_msg_type_number_t *count);
void kmsg_putchar (int c);
diff --git a/device/net_io.c b/device/net_io.c
index 99af0b29..72b040a0 100644
--- a/device/net_io.c
+++ b/device/net_io.c
@@ -1374,7 +1374,7 @@ net_getstat(
struct ifnet *ifp,
dev_flavor_t flavor,
dev_status_t status, /* pointer to OUT array */
- natural_t *count) /* OUT */
+ mach_msg_type_number_t *count) /* OUT */
{
switch (flavor) {
case NET_STATUS:
diff --git a/device/net_io.h b/device/net_io.h
index d4e24d41..5baf0678 100644
--- a/device/net_io.h
+++ b/device/net_io.h
@@ -78,7 +78,7 @@ extern void net_ast(void);
extern void net_packet(struct ifnet *, ipc_kmsg_t, unsigned int, boolean_t);
extern void net_filter(ipc_kmsg_t, ipc_kmsg_queue_t);
extern io_return_t net_getstat(struct ifnet *, dev_flavor_t, dev_status_t,
- natural_t *);
+ mach_msg_type_number_t *);
extern io_return_t net_write(struct ifnet *, int (*)(), io_req_t);
/*
diff --git a/device/tty.h b/device/tty.h
index d7aa2add..ea6f4404 100644
--- a/device/tty.h
+++ b/device/tty.h
@@ -72,8 +72,8 @@ struct tty {
* Items beyond this point should be removed to device-specific
* extension structures.
*/
- io_return_t (*t_getstat)(dev_t, int, int *, natural_t *); /* routine to get status */
- io_return_t (*t_setstat)(dev_t, int, int *, natural_t); /* routine to set status */
+ io_return_t (*t_getstat)(dev_t, dev_flavor_t, dev_status_t, mach_msg_type_number_t *); /* routine to get status */
+ io_return_t (*t_setstat)(dev_t, dev_flavor_t, dev_status_t, mach_msg_type_number_t); /* routine to set status */
dev_ops_t t_tops; /* another device to possibly
push through */
};