[gnumach]/Changelog
2006-01-08  Samuel Thibault  <[EMAIL PROTECTED]>

        Add an "io" device that represents all IO ports.

        * Makefile.in: Added io.c to device-files and objfiles.
        * device/io.c: New file.
        (iodevice): New variable
        (ioopen): New function.
        (ioclose): Likewise.
        * i386/i386/iopb.c (io_bitmap_set): Treat special (-1) bit list
        as "all ports".
        (io_bitmap_clear): Likewise.
        * conf.c (ioopen, ioclose): Extern declaration.
        (ioname): New macro.
        (dev_name_list): Added member entry for `io'.

Index: Makefile.in
===================================================================
RCS file: /cvsroot/hurd/gnumach/Makefile.in,v
retrieving revision 1.31.2.2
diff -u -r1.31.2.2 Makefile.in
--- gnumach-mine-5-io_per_task/Makefile.in      12 Jul 2005 23:01:06 -0000      
1.31.2.2
+++ gnumach-mine-6-io_device/Makefile.in        8 Jan 2006 18:17:24 -0000
@@ -120,7 +120,7 @@
        buf.h cirbuf.h conf.h cons.h dev_hdr.h dev_master.h device_port.h \
        device_types_kernel.h ds_routines.h errno.h if_ether.h if_hdr.h \
        io_req.h kmsg.c kmsg.h net_io.h param.h tty.h memory_object_reply.cli \
-       dev_forward.defs device_pager.srv device_reply.cli device.srv
+       dev_forward.defs device_pager.srv device_reply.cli device.srv io.c
 
 # IPC implementation
 ipc-cfiles = $(addprefix ipc_,$(ipc-names)) \
@@ -183,7 +183,7 @@
 # if particular drivers want the routines.
 # XXX functions in device/subrs.c should each be moved elsewhere
 objfiles += cons.o dev_lookup.o dev_name.o dev_pager.o device_init.o \
-       ds_routines.o subrs.o net_io.o blkio.o chario.o
+       ds_routines.o subrs.o net_io.o blkio.o chario.o io.o
 ifeq ($(enable_kmsg),yes)
 objfiles += kmsg.o
 endif
Index: device/io.c
===================================================================
RCS file: device/io.c
diff -N device/io.c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ gnumach-mine-6-io_device/device/io.c        8 Jan 2006 18:45:05 -0000
@@ -0,0 +1,47 @@
+/*
+ *  Copyright (C) 2006 Samuel Thibault <[EMAIL PROTECTED]>
+ *
+ * This program is free software ; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation ; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY ; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with the program ; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <device/io_req.h>
+
+#include <machine/io_port.h>
+
+/*
+ * Special "all I/O ports" device.
+ */
+
+static mach_device_t iodevice = 0;
+
+int ioopen(dev, flag, ior)
+       int dev;
+       int flag;
+       io_req_t ior;
+{
+       iodevice = ior->io_device;
+
+       io_port_create(iodevice, (io_reg_t *)(-1));
+       return (0);
+}
+
+int ioclose(dev, flags)
+       int dev;
+       int flags;
+{
+       io_port_destroy(iodevice);
+       iodevice = 0;
+       return 0;
+}
Index: i386/i386/iopb.c
===================================================================
RCS file: /cvsroot/hurd/gnumach/i386/i386/Attic/iopb.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 iopb.c
--- gnumach-mine-5-io_per_task/i386/i386/iopb.c 25 Feb 1997 21:27:09 -0000      
1.1.1.1
+++ gnumach-mine-6-io_device/i386/i386/iopb.c   8 Jan 2006 18:17:24 -0000
@@ -129,9 +129,12 @@
 {
        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));
+               }
 }
 
 /*
@@ -144,9 +147,12 @@
 {
        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
===================================================================
RCS file: /cvsroot/hurd/gnumach/i386/i386at/Attic/conf.c,v
retrieving revision 1.4
diff -u -r1.4 conf.c
--- gnumach-mine-5-io_per_task/i386/i386at/conf.c       5 Apr 2001 06:39:21 
-0000       1.4
+++ gnumach-mine-6-io_device/i386/i386at/conf.c 8 Jan 2006 18:17:25 -0000
@@ -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 @@
          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,
_______________________________________________
Bug-hurd mailing list
Bug-hurd@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-hurd

Reply via email to