[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: gnumach, new device
From: |
Samuel Thibault |
Subject: |
Re: gnumach, new device |
Date: |
Sun, 8 Jan 2006 19:45:44 +0100 |
User-agent: |
Mutt/1.5.9i-nntp |
Gianluca Guida, le Sun 08 Jan 2006 19:39:14 +0100, a écrit :
> I guess you should put a proper copyright comment. Included the real
> GPL comment.
Like this?
gnumach/ChangeLog
2006-01-08 Samuel Thibault <samuel.thibault@ens-lyon.org>
* Makefile.in: Always compile-in new io.c file.
* device/io.c: New file, implements a new "io" device that
represents i/o access to any port.
(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: New "io" device.
(dev_name_list): Added "io" device.
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
--- Makefile.in 12 Jul 2005 23:01:06 -0000 1.31.2.2
+++ 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
+++ device/io.c 8 Jan 2006 18:45:05 -0000
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2006 Samuel Thibault <samuel.thibault@ens-lyon.org>
+ *
+ * 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
--- i386/i386/iopb.c 25 Feb 1997 21:27:09 -0000 1.1.1.1
+++ 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
--- i386/i386at/conf.c 5 Apr 2001 06:39:21 -0000 1.4
+++ 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,