-/* $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.
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);
struct cfattach atapiscsi_ca = {
sizeof(struct atapiscsi_softc), atapiscsi_match, atapiscsi_attach,
- atapiscsi_detach
+ atapiscsi_detach, atapiscsi_activate
};
struct cfdriver atapiscsi_cd = {
#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;