bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gnumach, new device


From: Alfred M. Szmidt
Subject: gnumach, new device
Date: Sun, 08 Jan 2006 18:06:37 +0100

Once again, explanation behind the patch.  We are a bit lazy, so such
things help alot. :-)

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

        * 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));
+               }
 }
 
 /*





reply via email to

[Prev in Thread] Current Thread [Next in Thread]