summaryrefslogtreecommitdiffstats
path: root/sys/dev/ppbus
diff options
context:
space:
mode:
authoriwasaki <iwasaki@FreeBSD.org>2006-04-15 12:31:34 +0000
committeriwasaki <iwasaki@FreeBSD.org>2006-04-15 12:31:34 +0000
commit0613b693d0f3abaab631563bf8317bf448193a01 (patch)
tree57443a0c29eee4bcf962bf261e8f771819778250 /sys/dev/ppbus
parente3ccf599d517db9884169bea0bcb19634b43317a (diff)
downloadFreeBSD-src-0613b693d0f3abaab631563bf8317bf448193a01.zip
FreeBSD-src-0613b693d0f3abaab631563bf8317bf448193a01.tar.gz
Import ACPI Dock Station support. Note that this is still very young.
Additional detach implementaions (or maybe improvement) for other deivce drivers is required. Reviewed by: njl, imp MFC after: 1 week
Diffstat (limited to 'sys/dev/ppbus')
-rw-r--r--sys/dev/ppbus/lpt.c16
-rw-r--r--sys/dev/ppbus/ppbconf.c18
2 files changed, 34 insertions, 0 deletions
diff --git a/sys/dev/ppbus/lpt.c b/sys/dev/ppbus/lpt.c
index 6296da5..e968aa5 100644
--- a/sys/dev/ppbus/lpt.c
+++ b/sys/dev/ppbus/lpt.c
@@ -409,6 +409,21 @@ lpt_attach(device_t dev)
return (0);
}
+static int
+lpt_detach(device_t dev)
+{
+ struct lpt_data *sc = DEVTOSOFTC(dev);
+
+ lpt_release_ppbus(dev);
+ if (sc->intr_resource != 0) {
+ BUS_TEARDOWN_INTR(device_get_parent(dev), dev,
+ sc->intr_resource, sc->intr_cookie);
+ bus_release_resource(dev, SYS_RES_IRQ, 0, sc->intr_resource);
+ }
+
+ return (0);
+}
+
static void
lptout(void *arg)
{
@@ -954,6 +969,7 @@ static device_method_t lpt_methods[] = {
DEVMETHOD(device_identify, lpt_identify),
DEVMETHOD(device_probe, lpt_probe),
DEVMETHOD(device_attach, lpt_attach),
+ DEVMETHOD(device_detach, lpt_detach),
{ 0, 0 }
};
diff --git a/sys/dev/ppbus/ppbconf.c b/sys/dev/ppbus/ppbconf.c
index 1ad27f8..53421a2 100644
--- a/sys/dev/ppbus/ppbconf.c
+++ b/sys/dev/ppbus/ppbconf.c
@@ -399,6 +399,23 @@ ppbus_attach(device_t dev)
}
static int
+ppbus_detach(device_t dev)
+{
+ device_t *children;
+ int nchildren, i;
+
+ /* detach & delete all children */
+ if (!device_get_children(dev, &children, &nchildren)) {
+ for (i = 0; i < nchildren; i++)
+ if (children[i])
+ device_delete_child(dev, children[i]);
+ free(children, M_TEMP);
+ }
+
+ return (0);
+}
+
+static int
ppbus_setup_intr(device_t bus, device_t child, struct resource *r, int flags,
void (*ihand)(void *), void *arg, void **cookiep)
{
@@ -539,6 +556,7 @@ static device_method_t ppbus_methods[] = {
/* device interface */
DEVMETHOD(device_probe, ppbus_probe),
DEVMETHOD(device_attach, ppbus_attach),
+ DEVMETHOD(device_detach, ppbus_detach),
/* bus interface */
DEVMETHOD(bus_add_child, ppbus_add_child),
OpenPOWER on IntegriCloud