From: deraadt Date: Wed, 4 Aug 2010 19:43:52 +0000 (+0000) Subject: Wake up cdroms attached to pciide; same as in wd.c 1.86 X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=9a379db146fc07da26653d954a5ca656da5c129b;p=openbsd Wake up cdroms attached to pciide; same as in wd.c 1.86 tested by phessler --- 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 = { @@ -295,6 +296,32 @@ atapiscsi_attach(parent, self, aux) #endif } +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;