diff options
author | Alexander Yurchenko <grange@cvs.openbsd.org> | 2004-05-30 08:11:28 +0000 |
---|---|---|
committer | Alexander Yurchenko <grange@cvs.openbsd.org> | 2004-05-30 08:11:28 +0000 |
commit | ee4c27a21204dc338aaa232a20bd428030a48d3d (patch) | |
tree | 840e68e2359cdf9c1bbaad6e69d14061129b1642 /sys/arch | |
parent | 4d42d43a9db899b5548292fb2cef4513407a3971 (diff) |
Devices hot plugging support.
The hotplug pseudo-device passes device attachment and detachment events
to userland. When a device attaches or detaches, the corresponding event
is queued. The events can then be obtained from the queue through the
read(2) call on the /dev/hotplug device file. Each event consists of
event type (attach/detach), device class (DV_*) and device name (sd1 e.g.).
We have hotplug pseudo-device on alpha, amd64, i386, macppc and sparc64.
Since it was tested only on i386 other archs has it commented out
in GENERIC until tested.
The idea liked peter@ tedu@ drahn@ millert@ marco@ henning@.
Ok deraadt@.
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/alpha/alpha/conf.c | 4 | ||||
-rw-r--r-- | sys/arch/alpha/conf/GENERIC | 3 | ||||
-rw-r--r-- | sys/arch/amd64/amd64/conf.c | 4 | ||||
-rw-r--r-- | sys/arch/amd64/conf/GENERIC | 3 | ||||
-rw-r--r-- | sys/arch/i386/conf/GENERIC | 3 | ||||
-rw-r--r-- | sys/arch/i386/i386/conf.c | 4 | ||||
-rw-r--r-- | sys/arch/macppc/conf/GENERIC | 3 | ||||
-rw-r--r-- | sys/arch/macppc/macppc/conf.c | 4 | ||||
-rw-r--r-- | sys/arch/sparc64/conf/GENERIC | 4 | ||||
-rw-r--r-- | sys/arch/sparc64/sparc64/conf.c | 4 |
10 files changed, 26 insertions, 10 deletions
diff --git a/sys/arch/alpha/alpha/conf.c b/sys/arch/alpha/alpha/conf.c index 72b28e754a7..b03cb6a16fa 100644 --- a/sys/arch/alpha/alpha/conf.c +++ b/sys/arch/alpha/alpha/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.48 2004/02/10 01:31:20 millert Exp $ */ +/* $OpenBSD: conf.c,v 1.49 2004/05/30 08:11:25 grange Exp $ */ /* $NetBSD: conf.c,v 1.16 1996/10/18 21:26:57 cgd Exp $ */ /*- @@ -126,6 +126,7 @@ cdev_decl(pci); #endif #include "systrace.h" +#include "hotplug.h" struct cdevsw cdevsw[] = { @@ -193,6 +194,7 @@ struct cdevsw cdevsw[] = cdev_notdef(), /* 53: ALTQ (deprecated) */ cdev_iop_init(NIOP, iop), /* 54: I2O IOP control interface */ cdev_ptm_init(NPTY,ptm), /* 55: pseudo-tty ptm device */ + cdev_hotplug_init(NHOTPLUG,hotplug), /* 56: devices hot plugging */ }; int nchrdev = sizeof (cdevsw) / sizeof (cdevsw[0]); diff --git a/sys/arch/alpha/conf/GENERIC b/sys/arch/alpha/conf/GENERIC index df4ac00f58b..f6b20746d82 100644 --- a/sys/arch/alpha/conf/GENERIC +++ b/sys/arch/alpha/conf/GENERIC @@ -1,4 +1,4 @@ -# $OpenBSD: GENERIC,v 1.122 2004/04/18 02:26:42 pvalchev Exp $ +# $OpenBSD: GENERIC,v 1.123 2004/05/30 08:11:26 grange Exp $ # $NetBSD: GENERIC,v 1.31 1996/12/03 17:25:29 cgd Exp $ machine alpha @@ -341,3 +341,4 @@ hifn* at pci? dev ? function ? # Hi/fn 7751 crypto card #pseudo-device raid 4 # RAIDframe disk driver pseudo-device crypto 1 pseudo-device sequencer 1 +#pseudo-device hotplug 1 # devices hot plugging diff --git a/sys/arch/amd64/amd64/conf.c b/sys/arch/amd64/amd64/conf.c index 886bfe96ec7..ffa6fb787c9 100644 --- a/sys/arch/amd64/amd64/conf.c +++ b/sys/arch/amd64/amd64/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.5 2004/04/15 00:15:32 pvalchev Exp $ */ +/* $OpenBSD: conf.c,v 1.6 2004/05/30 08:11:26 grange Exp $ */ /* * Copyright (c) 1994, 1995 Charles M. Hannum. All rights reserved. @@ -190,6 +190,7 @@ cdev_decl(pci); #endif #include "pf.h" +#include "hotplug.h" struct cdevsw cdevsw[] = { @@ -295,6 +296,7 @@ struct cdevsw cdevsw[] = cdev_oci_init(NBIO,bio), /* 79: ioctl tunnel */ cdev_notdef(), /* 80: gpr? XXX */ cdev_ptm_init(NPTY,ptm), /* 81: pseudo-tty ptm device */ + cdev_hotplug_init(NHOTPLUG,hotplug), /* 82: devices hot plugging */ }; int nchrdev = sizeof(cdevsw) / sizeof(cdevsw[0]); diff --git a/sys/arch/amd64/conf/GENERIC b/sys/arch/amd64/conf/GENERIC index 572b6679f29..65c0c13caa5 100644 --- a/sys/arch/amd64/conf/GENERIC +++ b/sys/arch/amd64/conf/GENERIC @@ -1,4 +1,4 @@ -# $OpenBSD: GENERIC,v 1.18 2004/05/29 22:12:22 tom Exp $ +# $OpenBSD: GENERIC,v 1.19 2004/05/30 08:11:26 grange Exp $ # # GENERIC -- everything that's currently supported # @@ -488,6 +488,7 @@ ises* at pci? dev ? function ? # Pijnenburg PCC-ISES #pseudo-device sequencer 1 #pseudo-device raid 4 # RAIDframe disk driver #pseudo-device bio 1 # ioctl multiplexing device +#pseudo-device hotplug 1 # devices hot plugging # mouse & keyboard multiplexor pseudo-devices pseudo-device wsmux 2 diff --git a/sys/arch/i386/conf/GENERIC b/sys/arch/i386/conf/GENERIC index 1d6972480d8..3b84018218e 100644 --- a/sys/arch/i386/conf/GENERIC +++ b/sys/arch/i386/conf/GENERIC @@ -1,4 +1,4 @@ -# $OpenBSD: GENERIC,v 1.364 2004/05/28 02:32:19 deraadt Exp $ +# $OpenBSD: GENERIC,v 1.365 2004/05/30 08:11:26 grange Exp $ # # GENERIC -- everything that's currently supported # @@ -558,6 +558,7 @@ pseudo-device mtrr 1 # Memory range attributes control pseudo-device sequencer 1 #pseudo-device raid 4 # RAIDframe disk driver pseudo-device bio 1 # ioctl multiplexing device +pseudo-device hotplug 1 # devices hot plugging # mouse & keyboard multiplexor pseudo-devices pseudo-device wsmux 2 diff --git a/sys/arch/i386/i386/conf.c b/sys/arch/i386/i386/conf.c index 25198bf2ebb..ec8657441bd 100644 --- a/sys/arch/i386/i386/conf.c +++ b/sys/arch/i386/i386/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.106 2004/02/10 01:31:21 millert Exp $ */ +/* $OpenBSD: conf.c,v 1.107 2004/05/30 08:11:26 grange Exp $ */ /* $NetBSD: conf.c,v 1.75 1996/05/03 19:40:20 christos Exp $ */ /* @@ -201,6 +201,7 @@ cdev_decl(pci); #endif #include "pf.h" +#include "hotplug.h" struct cdevsw cdevsw[] = { @@ -310,6 +311,7 @@ struct cdevsw cdevsw[] = cdev_oci_init(NBIO,bio), /* 79: ioctl tunnel */ cdev_ch_init(NGPR,gpr), /* 80: GPR400 SmartCard reader */ cdev_ptm_init(NPTY,ptm), /* 81: pseudo-tty ptm device */ + cdev_hotplug_init(NHOTPLUG,hotplug), /* 82: devices hot plugging */ }; int nchrdev = sizeof(cdevsw) / sizeof(cdevsw[0]); diff --git a/sys/arch/macppc/conf/GENERIC b/sys/arch/macppc/conf/GENERIC index 055f501277f..86431edc4cf 100644 --- a/sys/arch/macppc/conf/GENERIC +++ b/sys/arch/macppc/conf/GENERIC @@ -1,4 +1,4 @@ -# $OpenBSD: GENERIC,v 1.53 2004/05/10 21:29:53 drahn Exp $g +# $OpenBSD: GENERIC,v 1.54 2004/05/30 08:11:26 grange Exp $g # # PPC GENERIC config file # @@ -247,4 +247,5 @@ ch* at scsibus? target ? lun ? ss* at scsibus? target ? lun ? uk* at scsibus? target ? lun ? +#pseudo-device hotplug 1 # devices hot plugging pseudo-device wsmux 2 # mouse & keyboard multiplexor diff --git a/sys/arch/macppc/macppc/conf.c b/sys/arch/macppc/macppc/conf.c index a4d7efd644a..a04b3bc1cbc 100644 --- a/sys/arch/macppc/macppc/conf.c +++ b/sys/arch/macppc/macppc/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.25 2004/02/10 01:31:21 millert Exp $ */ +/* $OpenBSD: conf.c,v 1.26 2004/05/30 08:11:26 grange Exp $ */ /* * Copyright (c) 1997 Per Fogelstrom @@ -144,6 +144,7 @@ cdev_decl(pci); #include "radio.h" #include "bktr.h" +#include "hotplug.h" struct cdevsw cdevsw[] = { cdev_cn_init(1,cn), /* 0: virtual console */ @@ -236,6 +237,7 @@ struct cdevsw cdevsw[] = { cdev_bktr_init(NBKTR,bktr), /* 75: Bt848 video capture device */ cdev_radio_init(NRADIO, radio), /* 76: generic radio I/O */ cdev_ptm_init(NPTY,ptm), /* 77: pseudo-tty ptm device */ + cdev_hotplug_init(NHOTPLUG,hotplug), /* 78: devices hot plugging */ }; int nchrdev = sizeof cdevsw / sizeof cdevsw[0]; diff --git a/sys/arch/sparc64/conf/GENERIC b/sys/arch/sparc64/conf/GENERIC index 043f7071c18..68f903bc9b5 100644 --- a/sys/arch/sparc64/conf/GENERIC +++ b/sys/arch/sparc64/conf/GENERIC @@ -1,4 +1,4 @@ -# $OpenBSD: GENERIC,v 1.91 2004/04/18 02:26:43 pvalchev Exp $ +# $OpenBSD: GENERIC,v 1.92 2004/05/30 08:11:26 grange Exp $ # $NetBSD: GENERIC32,v 1.18 2001/07/20 00:07:12 eeh Exp $ machine sparc64 @@ -284,5 +284,7 @@ creator* at mainbus0 creator* at upa0 wsdisplay* at creator? +#pseudo-device hotplug 1 # devices hot plugging + # mouse & keyboard multiplexor pseudo-devices #pseudo-device wsmux 2 diff --git a/sys/arch/sparc64/sparc64/conf.c b/sys/arch/sparc64/sparc64/conf.c index 6a839aabadf..60a905c1f63 100644 --- a/sys/arch/sparc64/sparc64/conf.c +++ b/sys/arch/sparc64/sparc64/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.37 2004/02/10 01:31:21 millert Exp $ */ +/* $OpenBSD: conf.c,v 1.38 2004/05/30 08:11:26 grange Exp $ */ /* $NetBSD: conf.c,v 1.17 2001/03/26 12:33:26 lukem Exp $ */ /* @@ -121,6 +121,7 @@ cdev_decl(xfs_dev); #include "inet.h" #include "systrace.h" +#include "hotplug.h" struct bdevsw bdevsw[] = { @@ -292,6 +293,7 @@ struct cdevsw cdevsw[] = cdev_disk_init(NRAID,raid), /* 121: RAIDframe disk driver */ cdev_tty_init(NPCONS,pcons), /* 122: PROM console */ cdev_ptm_init(NPTY,ptm), /* 123: pseudo-tty ptm device */ + cdev_hotplug_init(NHOTPLUG,hotplug), /* 124: devices hot plugging */ }; int nchrdev = sizeof(cdevsw) / sizeof(cdevsw[0]); |