summaryrefslogtreecommitdiff
path: root/debian/patches/46_io_device.patch
blob: 731d30f15c7769874940ddd3f3b3df50009e3b7e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
2006-01-07  Samuel Thibault  <samuel.thibault@ens-lyon.org>

	* i386/i386/iopb.c: Include <device/io_req.h> for io_req_t.  New "io"
	device.
	(ioopen): New function.
	(ioclose): Likewise.
	(io_bitmap_set): Treat special (-1) bit list as "all ports".
	(io_bitmap_clear): Likewise.


diff -urp gnumach-mine-5-io_per_task/i386/i386/iopb.c gnumach-mine-6-io_device/i386/i386/iopb.c
--- gnumach-mine-5-io_per_task/i386/i386/iopb.c	2005-12-29 23:42:34.000000000 +0100
+++ gnumach-mine-6-io_device/i386/i386/iopb.c	2006-01-07 00:19:24.000000000 +0100
@@ -38,6 +38,7 @@
 #include <kern/thread.h>
 
 #include <device/dev_hdr.h>
+#include <device/io_req.h>
 
 #include "io_port.h"
 #include "iopb.h"
@@ -82,6 +83,32 @@
 decl_simple_lock_data(, iopb_lock)
 
 /*
+ * Special "all I/O ports" device.
+ */
+mach_device_t	io_device = 0;
+
+int ioopen(dev, flag, ior)
+	int dev;
+	int flag;
+	io_req_t ior;
+{
+	io_device = ior->io_device;
+
+	io_port_create(io_device, (io_reg_t *)(-1));
+	return (0);
+}
+
+int
+ioclose(dev, flags)
+	int dev;
+	int flags;
+{
+	io_port_destroy(io_device);
+	io_device = 0;
+	return 0;
+}
+
+/*
  * Initialize the package.
  */
 void
@@ -130,9 +157,12 @@ io_bitmap_set(
 {
 	io_reg_t	io_bit;
 
-	while ((io_bit = *bit_list++) != IO_REG_NULL) {
-	    bp[io_bit>>3] &= ~(1 << (io_bit & 0x7));
-	}
+	if (bit_list == (io_reg_t *)(-1))
+		memset(bp, 0, IOPB_BYTES);
+	else
+		while ((io_bit = *bit_list++) != IO_REG_NULL) {
+		    bp[io_bit>>3] &= ~(1 << (io_bit & 0x7));
+		}
 }
 
 /*
@@ -145,9 +175,12 @@ io_bitmap_clear(
 {
 	io_reg_t	io_bit;
 
-	while ((io_bit = *bit_list++) != IO_REG_NULL) {
-	    bp[io_bit>>3] |= (1 << (io_bit & 0x7));
-	}
+	if (bit_list == (io_reg_t *)(-1))
+		memset(bp, ~0, IOPB_BYTES);
+	else
+		while ((io_bit = *bit_list++) != IO_REG_NULL) {
+		    bp[io_bit>>3] |= (1 << (io_bit & 0x7));
+		}
 }
 
 /*

2006-01-07  Samuel Thibault  <samuel.thibault@ens-lyon.org>

	* conf.c: New "io" device.
	(dev_name_list): Added "io" device.

diff -urp gnumach-mine-5-io_per_task/i386/i386at/conf.c gnumach-mine-6-io_device/i386/i386at/conf.c
--- gnumach-mine-5-io_per_task/i386/i386at/conf.c	2006-01-06 23:43:24.000000000 +0100
+++ gnumach-mine-6-io_device/i386/i386at/conf.c	2006-01-06 23:43:44.000000000 +0100
@@ -182,6 +182,9 @@
 extern vm_offset_t ioplmmap();
 #define	ioplname		"iopl"
 
+extern int	ioopen(), ioclose();
+#define ioname			"io"
+
 extern int	kmsgopen(), kmsgclose(), kmsgread(), kmsggetstat();
 #define kmsgname		"kmsg"
 
@@ -367,6 +370,11 @@ struct dev_ops	dev_name_list[] =
 	  nodev,	nulldev,	nulldev,	0,
 	  nodev },
 
+	{ ioname,	ioopen,		ioclose,	nodev,
+	  nodev,	nodev,		nodev,		nodev,
+	  nodev,	nulldev,	nulldev,	0,
+	  nodev },
+
 #if 0
 #if	NHD > 0
 	{ pchdname,     pchdopen,      	hdclose,	pchdread,