2006-01-07 Samuel Thibault * i386/i386/iopb.c: Include 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 2006-11-14 04:16:29.000000000 +0200 +++ i386/i386/iopb.c 2006-11-14 04:21:48.000000000 +0200 @@ -40,6 +40,7 @@ #include #include +#include #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 2006-10-15 20:39:23.000000000 +0300 +++ i386/i386at/conf.c 2006-11-14 04:21:48.000000000 +0200 @@ -64,6 +64,9 @@ extern int ioplopen(), ioplclose(); extern vm_offset_t ioplmmap(); #define ioplname "iopl" +extern int ioopen(), ioclose(); +#define ioname "io" + extern int kmsgopen(), kmsgclose(), kmsgread(), kmsggetstat(); #define kmsgname "kmsg" @@ -95,6 +98,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,