diff options
author | iwasaki <iwasaki@FreeBSD.org> | 2006-04-15 12:31:34 +0000 |
---|---|---|
committer | iwasaki <iwasaki@FreeBSD.org> | 2006-04-15 12:31:34 +0000 |
commit | 0613b693d0f3abaab631563bf8317bf448193a01 (patch) | |
tree | 57443a0c29eee4bcf962bf261e8f771819778250 /sys/dev/ppc/ppc.c | |
parent | e3ccf599d517db9884169bea0bcb19634b43317a (diff) | |
download | FreeBSD-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/ppc/ppc.c')
-rw-r--r-- | sys/dev/ppc/ppc.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/sys/dev/ppc/ppc.c b/sys/dev/ppc/ppc.c index c6bc9cf..7e1ed40 100644 --- a/sys/dev/ppc/ppc.c +++ b/sys/dev/ppc/ppc.c @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include <sys/module.h> #include <sys/bus.h> #include <sys/malloc.h> +#include <sys/kdb.h> #include <vm/vm.h> #include <vm/pmap.h> @@ -72,6 +73,7 @@ static device_method_t ppc_methods[] = { /* device interface */ DEVMETHOD(device_probe, ppc_isa_probe), DEVMETHOD(device_attach, ppc_attach), + DEVMETHOD(device_detach, ppc_detach), /* bus interface */ DEVMETHOD(bus_read_ivar, ppc_read_ivar), @@ -2007,6 +2009,46 @@ ppc_attach(device_t dev) return (0); } +int +ppc_detach(device_t dev) +{ + struct ppc_data *ppc = DEVTOSOFTC(dev); + device_t *children; + int nchildren, i; + + if (ppc->res_irq == 0) { + return (ENXIO); + } + + /* 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); + } + + if (ppc->res_irq != 0) { + bus_teardown_intr(dev, ppc->res_irq, ppc->intr_cookie); + bus_release_resource(dev, SYS_RES_IRQ, ppc->rid_irq, + ppc->res_irq); + } + if (ppc->res_ioport != 0) { + bus_deactivate_resource(dev, SYS_RES_IOPORT, ppc->rid_ioport, + ppc->res_ioport); + bus_release_resource(dev, SYS_RES_IOPORT, ppc->rid_ioport, + ppc->res_ioport); + } + if (ppc->res_drq != 0) { + bus_deactivate_resource(dev, SYS_RES_DRQ, ppc->rid_drq, + ppc->res_drq); + bus_release_resource(dev, SYS_RES_DRQ, ppc->rid_drq, + ppc->res_drq); + } + + return (0); +} + u_char ppc_io(device_t ppcdev, int iop, u_char *addr, int cnt, u_char byte) { |