diff options
author | 2010-08-04 19:43:52 +0000 | |
---|---|---|
committer | 2010-08-04 19:43:52 +0000 | |
commit | 9a379db146fc07da26653d954a5ca656da5c129b (patch) | |
tree | a11ebfc2f744ba55df9b1fcf7301312621321d1b | |
parent | In .Bd -literal, break the output line after the last element of each (diff) | |
download | wireguard-openbsd-9a379db146fc07da26653d954a5ca656da5c129b.tar.xz wireguard-openbsd-9a379db146fc07da26653d954a5ca656da5c129b.zip |
Wake up cdroms attached to pciide; same as in wd.c 1.86
tested by phessler
-rw-r--r-- | sys/dev/atapiscsi/atapiscsi.c | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/sys/dev/atapiscsi/atapiscsi.c b/sys/dev/atapiscsi/atapiscsi.c index a3649a480b6..164e5d8e7c7 100644 --- a/sys/dev/atapiscsi/atapiscsi.c +++ b/sys/dev/atapiscsi/atapiscsi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: atapiscsi.c,v 1.93 2010/07/23 07:47:13 jsg Exp $ */ +/* $OpenBSD: atapiscsi.c,v 1.94 2010/08/04 19:43:52 deraadt Exp $ */ /* * This code is derived from code with the copyright below. @@ -144,6 +144,7 @@ struct atapiscsi_xfer; int atapiscsi_match(struct device *, void *, void *); void atapiscsi_attach(struct device *, struct device *, void *); +int atapiscsi_activate(struct device *, int); int atapiscsi_detach(struct device *, int); int atapi_to_scsi_sense(struct scsi_xfer *, u_int8_t); @@ -176,7 +177,7 @@ static struct scsi_adapter atapiscsi_switch = struct cfattach atapiscsi_ca = { sizeof(struct atapiscsi_softc), atapiscsi_match, atapiscsi_attach, - atapiscsi_detach + atapiscsi_detach, atapiscsi_activate }; struct cfdriver atapiscsi_cd = { @@ -296,6 +297,32 @@ atapiscsi_attach(parent, self, aux) } int +atapiscsi_activate(struct device *self, int act) +{ + struct atapiscsi_softc *as = (void *)self; + struct channel_softc *chp = as->chp; + struct ata_drive_datas *drvp = &chp->ch_drive[as->drive]; + + switch (act) { + case DVACT_SUSPEND: + break; + case DVACT_RESUME: + /* + * Do two resets separated by a small delay. The + * first wakes the controller, the second resets + * the channel + */ + wdc_disable_intr(chp); + wdc_reset_channel(drvp); + delay(10000); + wdc_reset_channel(drvp); + wdc_enable_intr(chp); + break; + } + return (0); +} + +int atapiscsi_detach(dev, flags) struct device *dev; int flags; |