summaryrefslogtreecommitdiffstats
path: root/sys/i386
diff options
context:
space:
mode:
authorattilio <attilio@FreeBSD.org>2010-04-28 15:38:01 +0000
committerattilio <attilio@FreeBSD.org>2010-04-28 15:38:01 +0000
commit6dfd3f303086ff8e0db146c2e70c33de1a239696 (patch)
treefa18924d920e93a232bbaba63497b39499a9b76b /sys/i386
parent60e1354e61b43b340b1c25761d1b3d5fbc35b000 (diff)
downloadFreeBSD-src-6dfd3f303086ff8e0db146c2e70c33de1a239696.zip
FreeBSD-src-6dfd3f303086ff8e0db146c2e70c33de1a239696.tar.gz
- Extract the IODEV_PIO interface from ia64 and make it MI.
In the end, it does help fixing /dev/io usage from multithreaded processes. - On i386 and amd64 the old behaviour is kept but multithreaded processes must use the new interface in order to work well. - Support for the other architectures is greatly improved, where necessary, by the necessity to define very small things now. Manpage update will happen shortly. Sponsored by: Sandvine Incorporated PR: threads/116181 Reviewed by: emaste, marcel MFC after: 3 weeks
Diffstat (limited to 'sys/i386')
-rw-r--r--sys/i386/i386/io.c40
-rw-r--r--sys/i386/include/iodev.h21
2 files changed, 24 insertions, 37 deletions
diff --git a/sys/i386/i386/io.c b/sys/i386/i386/io.c
index c392af5..152f6b1 100644
--- a/sys/i386/i386/io.c
+++ b/sys/i386/i386/io.c
@@ -28,60 +28,32 @@
__FBSDID("$FreeBSD$");
#include <sys/param.h>
-#include <sys/conf.h>
-#include <sys/fcntl.h>
-#include <sys/lock.h>
-#include <sys/malloc.h>
-#include <sys/mutex.h>
-#include <sys/priv.h>
#include <sys/proc.h>
-#include <sys/signalvar.h>
-#include <sys/systm.h>
-#include <machine/db_machdep.h>
#include <machine/frame.h>
-#include <machine/psl.h>
-#include <machine/specialreg.h>
-
-#include <vm/vm.h>
-#include <vm/pmap.h>
-
#include <machine/iodev.h>
+#include <machine/psl.h>
-/* ARGSUSED */
int
-ioopen(struct cdev *dev __unused, int flags __unused, int fmt __unused,
- struct thread *td)
+iodev_open(struct thread *td)
{
- int error;
-
- error = priv_check(td, PRIV_IO);
- if (error != 0)
- return (error);
- error = securelevel_gt(td->td_ucred, 0);
- if (error != 0)
- return (error);
td->td_frame->tf_eflags |= PSL_IOPL;
-
return (0);
}
-/* ARGSUSED */
int
-ioclose(struct cdev *dev __unused, int flags __unused, int fmt __unused,
- struct thread *td)
+iodev_close(struct thread *td)
{
- td->td_frame->tf_eflags &= ~PSL_IOPL;
+ td->td_frame->tf_eflags &= ~PSL_IOPL;
return (0);
}
/* ARGSUSED */
int
-ioioctl(struct cdev *dev __unused, u_long cmd __unused, caddr_t data __unused,
- int fflag __unused, struct thread *td __unused)
+iodev_ioctl(u_long cmd __unused, caddr_t data __unused)
{
- return (ENXIO);
+ return (ENOIOCTL);
}
diff --git a/sys/i386/include/iodev.h b/sys/i386/include/iodev.h
index 1a0a17a..9f53cac 100644
--- a/sys/i386/include/iodev.h
+++ b/sys/i386/include/iodev.h
@@ -25,7 +25,22 @@
*
* $FreeBSD$
*/
+#ifndef _MACHINE_IODEV_H_
+#define _MACHINE_IODEV_H_
-d_open_t ioopen;
-d_close_t ioclose;
-d_ioctl_t ioioctl;
+#ifdef _KERNEL
+#include <machine/cpufunc.h>
+
+#define iodev_read_1 inb
+#define iodev_read_2 inw
+#define iodev_read_4 inl
+#define iodev_write_1 outb
+#define iodev_write_2 outw
+#define iodev_write_4 outl
+
+int iodev_open(struct thread *td);
+int iodev_close(struct thread *td);
+int iodev_ioctl(u_long cmd, caddr_t data);
+
+#endif /* _KERNEL */
+#endif /* _MACHINE_IODEV_H_ */
OpenPOWER on IntegriCloud