summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/arch/alpha/alpha/conf.c4
-rw-r--r--sys/arch/alpha/conf/GENERIC3
-rw-r--r--sys/arch/amd64/amd64/conf.c4
-rw-r--r--sys/arch/amd64/conf/GENERIC3
-rw-r--r--sys/arch/i386/conf/GENERIC3
-rw-r--r--sys/arch/i386/i386/conf.c4
-rw-r--r--sys/arch/macppc/conf/GENERIC3
-rw-r--r--sys/arch/macppc/macppc/conf.c4
-rw-r--r--sys/arch/sparc64/conf/GENERIC4
-rw-r--r--sys/arch/sparc64/sparc64/conf.c4
-rw-r--r--sys/conf/files5
-rw-r--r--sys/dev/hotplug.c233
-rw-r--r--sys/kern/subr_autoconf.c19
-rw-r--r--sys/sys/conf.h13
-rw-r--r--sys/sys/hotplug.h40
15 files changed, 332 insertions, 14 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]);
diff --git a/sys/conf/files b/sys/conf/files
index 86304631d5a..d4dffc50925 100644
--- a/sys/conf/files
+++ b/sys/conf/files
@@ -1,4 +1,4 @@
-# $OpenBSD: files,v 1.301 2004/05/27 23:20:27 deraadt Exp $
+# $OpenBSD: files,v 1.302 2004/05/30 08:11:26 grange Exp $
# $NetBSD: files,v 1.87 1996/05/19 17:17:50 jonathan Exp $
# @(#)files.newconf 7.5 (Berkeley) 5/10/93
@@ -411,6 +411,9 @@ file net/if_pfsync.c pfsync needs-flag
pseudo-device bio
file dev/bio.c bio needs-flag
+pseudo-device hotplug
+file dev/hotplug.c hotplug needs-flag
+
# XXX machine-independent SCSI files should live somewhere here, maybe
# kernel sources
diff --git a/sys/dev/hotplug.c b/sys/dev/hotplug.c
new file mode 100644
index 00000000000..425cc4462af
--- /dev/null
+++ b/sys/dev/hotplug.c
@@ -0,0 +1,233 @@
+/* $OpenBSD: hotplug.c,v 1.1 2004/05/30 08:11:26 grange Exp $ */
+/*
+ * Copyright (c) 2004 Alexander Yurchenko <grange@openbsd.org>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * Device attachment and detachment notifications.
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/conf.h>
+#include <sys/device.h>
+#include <sys/fcntl.h>
+#include <sys/hotplug.h>
+#include <sys/ioctl.h>
+#include <sys/poll.h>
+#include <sys/vnode.h>
+
+#define HOTPLUG_MAXEVENTS 16
+
+static int opened;
+static struct hotplug_event evqueue[HOTPLUG_MAXEVENTS];
+static int evqueue_head, evqueue_tail, evqueue_count;
+static struct selinfo hotplug_sel;
+
+void filt_hotplugrdetach(struct knote *);
+int filt_hotplugread(struct knote *, long);
+
+struct filterops hotplugread_filtops =
+ { 1, NULL, filt_hotplugrdetach, filt_hotplugread};
+
+#define EVQUEUE_NEXT(p) (p == HOTPLUG_MAXEVENTS - 1 ? 0 : p + 1)
+
+
+int hotplug_put_event(struct hotplug_event *);
+int hotplug_get_event(struct hotplug_event *);
+
+void hotplugattach(int);
+
+void
+hotplugattach(int count)
+{
+ opened = 0;
+ evqueue_head = 0;
+ evqueue_tail = 0;
+ evqueue_count = 0;
+}
+
+void
+hotplug_device_attach(enum devclass class, char *name)
+{
+ struct hotplug_event he;
+
+ he.he_type = HOTPLUG_DEVAT;
+ he.he_devclass = class;
+ strlcpy(he.he_devname, name, sizeof(he.he_devname));
+
+ hotplug_put_event(&he);
+}
+
+void
+hotplug_device_detach(enum devclass class, char *name)
+{
+ struct hotplug_event he;
+
+ he.he_type = HOTPLUG_DEVDT;
+ he.he_devclass = class;
+ strlcpy(he.he_devname, name, sizeof(he.he_devname));
+
+ hotplug_put_event(&he);
+}
+
+int
+hotplug_put_event(struct hotplug_event *he)
+{
+ if (evqueue_count == HOTPLUG_MAXEVENTS) {
+ printf("hotplug: event lost, queue full\n");
+ return (1);
+ }
+
+ evqueue[evqueue_head] = *he;
+ evqueue_head = EVQUEUE_NEXT(evqueue_head);
+ evqueue_count++;
+ wakeup(&evqueue);
+ selwakeup(&hotplug_sel);
+ KNOTE(&hotplug_sel.si_note, 0);
+
+ return (0);
+}
+
+int
+hotplug_get_event(struct hotplug_event *he)
+{
+ if (evqueue_count == 0)
+ return (1);
+
+ *he = evqueue[evqueue_tail];
+ evqueue_tail = EVQUEUE_NEXT(evqueue_tail);
+ evqueue_count--;
+
+ return (0);
+}
+
+int
+hotplugopen(dev_t dev, int flag, int mode, struct proc *p)
+{
+ if (minor(dev) != 0)
+ return (ENXIO);
+ if ((flag & FWRITE))
+ return (EPERM);
+ if (opened)
+ return (EBUSY);
+ opened = 1;
+
+ return (0);
+}
+
+int
+hotplugclose(dev_t dev, int flag, int mode, struct proc *p)
+{
+ opened = 0;
+
+ return (0);
+}
+
+int
+hotplugread(dev_t dev, struct uio *uio, int flags)
+{
+ struct hotplug_event he;
+ int error;
+
+ if (uio->uio_resid != sizeof(he))
+ return (EINVAL);
+
+again:
+ if (hotplug_get_event(&he) == 0) {
+ return (uiomove(&he, sizeof(he), uio));
+ }
+
+ if (flags & IO_NDELAY) {
+ return (EAGAIN);
+ }
+
+ error = tsleep(evqueue, PRIBIO | PCATCH, "htplev", 0);
+ if (error) {
+ return (error);
+ }
+ goto again;
+}
+
+int
+hotplugioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
+{
+ switch (cmd) {
+ case FIOASYNC:
+ /* ignore */
+ case FIONBIO:
+ /* handled in the upper fs layer */
+ break;
+ default:
+ return (ENOTTY);
+ }
+
+ return (0);
+}
+
+int
+hotplugpoll(dev_t dev, int events, struct proc *p)
+{
+ int revents = 0;
+
+ if (events & (POLLIN | POLLRDNORM)) {
+ if (evqueue_count > 0)
+ revents |= events & (POLLIN | POLLRDNORM);
+ else
+ selrecord(p, &hotplug_sel);
+ }
+
+ return (revents);
+}
+
+int
+hotplugkqfilter(dev_t dev, struct knote *kn)
+{
+ struct klist *klist;
+ int s;
+
+ switch (kn->kn_filter) {
+ case EVFILT_READ:
+ klist = &hotplug_sel.si_note;
+ kn->kn_fop = &hotplugread_filtops;
+ break;
+ default:
+ return (1);
+ }
+
+ s = splbio();
+ SLIST_INSERT_HEAD(klist, kn, kn_selnext);
+ splx(s);
+
+ return (0);
+}
+
+void
+filt_hotplugrdetach(struct knote *kn)
+{
+ int s;
+
+ s = splbio();
+ SLIST_REMOVE(&hotplug_sel.si_note, kn, knote, kn_selnext);
+ splx(s);
+}
+
+int
+filt_hotplugread(struct knote *kn, long hint)
+{
+ kn->kn_data = evqueue_count;
+
+ return (evqueue_count > 0);
+}
diff --git a/sys/kern/subr_autoconf.c b/sys/kern/subr_autoconf.c
index 6034798b62b..a5795091672 100644
--- a/sys/kern/subr_autoconf.c
+++ b/sys/kern/subr_autoconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: subr_autoconf.c,v 1.36 2003/06/02 23:28:06 millert Exp $ */
+/* $OpenBSD: subr_autoconf.c,v 1.37 2004/05/30 08:11:26 grange Exp $ */
/* $NetBSD: subr_autoconf.c,v 1.21 1996/04/04 06:06:18 cgd Exp $ */
/*
@@ -45,12 +45,15 @@
#include <sys/param.h>
#include <sys/device.h>
+#include <sys/hotplug.h>
#include <sys/limits.h>
#include <sys/malloc.h>
#include <sys/systm.h>
/* Extra stuff from Matthias Drochner <drochner@zelux6.zel.kfa-juelich.de> */
#include <sys/queue.h>
+#include "hotplug.h"
+
/*
* Autoconfiguration subroutines.
*/
@@ -404,6 +407,10 @@ config_attach(parent, match, aux, print)
#endif
(*ca->ca_attach)(parent, dev, aux);
config_process_deferred_children(dev);
+#if NHOTPLUG > 0
+ if (!cold)
+ hotplug_device_attach(cd->cd_class, dev->dv_xname);
+#endif
return (dev);
}
@@ -501,6 +508,11 @@ config_detach(dev, flags)
struct device *d;
#endif
int rv = 0, i;
+#if NHOTPLUG > 0
+ char devname[16];
+
+ strlcpy(devname, dev->dv_xname, sizeof(devname));
+#endif
cf = dev->dv_cfdata;
#ifdef DIAGNOSTIC
@@ -598,6 +610,11 @@ config_detach(dev, flags)
cd->cd_ndevs = 0;
}
+#if NHOTPLUG > 0
+ if (!cold)
+ hotplug_device_detach(cd->cd_class, devname);
+#endif
+
/*
* Return success.
*/
diff --git a/sys/sys/conf.h b/sys/sys/conf.h
index 00f95e9d09e..e85c75f04f1 100644
--- a/sys/sys/conf.h
+++ b/sys/sys/conf.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: conf.h,v 1.73 2004/02/10 01:31:21 millert Exp $ */
+/* $OpenBSD: conf.h,v 1.74 2004/05/30 08:11:27 grange Exp $ */
/* $NetBSD: conf.h,v 1.33 1996/05/03 20:03:32 christos Exp $ */
/*-
@@ -465,7 +465,14 @@ void randomattach(void);
(dev_type_write((*))) enodev, dev_init(c,n,ioctl), \
(dev_type_stop((*))) enodev, 0, seltrue, \
dev_init(c,n,mmap) }
-
+
+/* open, close, read, ioctl, poll, kqfilter */
+#define cdev_hotplug_init(c,n) { \
+ dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \
+ (dev_type_write((*))) enodev, dev_init(c,n,ioctl), \
+ (dev_type_stop((*))) enodev, 0, dev_init(c,n,poll), \
+ (dev_type_mmap((*))) enodev, D_KQFILTER, dev_init(c,n,kqfilter) }
+
/* symbolic sleep message strings */
extern char devopn[], devio[], devwait[], devin[], devout[];
extern char devioc[], devcls[];
@@ -623,6 +630,8 @@ cdev_decl(ulpt);
cdev_decl(uscanner);
cdev_decl(urio);
+cdev_decl(hotplug);
+
#endif
#endif /* _SYS_CONF_H_ */
diff --git a/sys/sys/hotplug.h b/sys/sys/hotplug.h
new file mode 100644
index 00000000000..20147c20d87
--- /dev/null
+++ b/sys/sys/hotplug.h
@@ -0,0 +1,40 @@
+/* $OpenBSD: hotplug.h,v 1.1 2004/05/30 08:11:27 grange Exp $ */
+/*
+ * Copyright (c) 2004 Alexander Yurchenko <grange@openbsd.org>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _SYS_HOTPLUG_H_
+#define _SYS_HOTPLUG_H_
+
+/*
+ * Public interface for enqueuing and dequeueing device
+ * attachment and detachment notifications.
+ */
+
+#define HOTPLUG_DEVAT 0x01 /* device attached */
+#define HOTPLUG_DEVDT 0x02 /* device detached */
+
+struct hotplug_event {
+ int he_type; /* event type */
+ enum devclass he_devclass; /* device class */
+ char he_devname[16]; /* device name */
+};
+
+#ifdef _KERNEL
+void hotplug_device_attach(enum devclass, char *);
+void hotplug_device_detach(enum devclass, char *);
+#endif
+
+#endif /* _SYS_HOTPLUG_H_ */