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
|
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.
Index: i386/i386/iopb.c
===================================================================
--- i386/i386/iopb.c.orig 2007-04-05 07:31:26.000000000 +0300
+++ i386/i386/iopb.c 2007-04-05 07:31:31.000000000 +0300
@@ -40,6 +40,7 @@
#include <kern/thread.h>
#include <device/dev_hdr.h>
+#include <device/io_req.h>
#include "io_port.h"
#include "iopb.h"
@@ -84,6 +85,32 @@ typedef struct io_use *io_use_t;
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
@@ -132,9 +159,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));
+ }
}
/*
@@ -147,9 +177,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));
+ }
}
/*
Index: i386/i386at/conf.c
===================================================================
--- i386/i386at/conf.c.orig 2007-04-05 06:37:23.000000000 +0300
+++ i386/i386at/conf.c 2007-04-05 07:31:31.000000000 +0300
@@ -58,6 +58,9 @@ extern int kbdgetstat(), kbdsetstat();
extern int mouseopen(), mouseclose(), mouseread(), mousegetstat();
#define mousename "mouse"
+extern int ioopen(), ioclose();
+#define ioname "io"
+
extern int kmsgopen(), kmsgclose(), kmsgread(), kmsggetstat();
#define kmsgname "kmsg"
@@ -89,6 +92,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 NCOM > 0
{ comname, comopen, comclose, comread,
comwrite, comgetstat, comsetstat, nomap,
|