diff options
author | David Gwynne <dlg@cvs.openbsd.org> | 2007-11-23 18:21:56 +0000 |
---|---|---|
committer | David Gwynne <dlg@cvs.openbsd.org> | 2007-11-23 18:21:56 +0000 |
commit | 11193c8305abc0f04801b9de03641d1d631fce7a (patch) | |
tree | 962fe8681470c641e2b06608ecd6e43d4275f6ef /sys/dev/ata/atascsi.c | |
parent | 5a9127f088e3735e2e9bfd36e35fef9ad9fef596 (diff) |
starting bits to implement hotplug of sili controllers. this adds the code
to clean up the atascsi stuff, and has sili call it when its going away.
tested on an expresscard sili variant by kettenis@
Diffstat (limited to 'sys/dev/ata/atascsi.c')
-rw-r--r-- | sys/dev/ata/atascsi.c | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/sys/dev/ata/atascsi.c b/sys/dev/ata/atascsi.c index 3e692b696fc..c7875568060 100644 --- a/sys/dev/ata/atascsi.c +++ b/sys/dev/ata/atascsi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: atascsi.c,v 1.46 2007/11/23 16:01:47 dlg Exp $ */ +/* $OpenBSD: atascsi.c,v 1.47 2007/11/23 18:21:55 dlg Exp $ */ /* * Copyright (c) 2007 David Gwynne <dlg@openbsd.org> @@ -65,6 +65,7 @@ struct scsi_device atascsi_device = { }; int atascsi_probe(struct atascsi *, int); +void atascsi_unprobe(struct atascsi *, int); struct ata_xfer *ata_setup_identify(struct ata_port *, int); void ata_free_identify(struct ata_xfer *); @@ -144,8 +145,20 @@ atascsi_attach(struct device *self, struct atascsi_attach_args *aaa) } int -atascsi_detach(struct atascsi *as) +atascsi_detach(struct atascsi *as, int flags) { + int rv; + int i; + + rv = config_detach((struct device *)as->as_scsibus, flags); + if (rv != 0) + return (rv); + + for (i = 0; i < as->as_link.adapter_buswidth; i++) + atascsi_unprobe(as, i); + + free(as, M_DEVBUF); + return (0); } @@ -201,6 +214,22 @@ atascsi_probe(struct atascsi *as, int port) return (0); } +void +atascsi_unprobe(struct atascsi *as, int port) +{ + struct ata_port *ap; + + if (port > as->as_link.adapter_buswidth) + return; + + ap = as->as_ports[port]; + if (ap == NULL) + return; + + free(ap, M_DEVBUF); + as->as_ports[port] = NULL; +} + struct ata_xfer * ata_setup_identify(struct ata_port *ap, int nosleep) { |