summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorAlexander Yurchenko <grange@cvs.openbsd.org>2006-11-28 00:11:45 +0000
committerAlexander Yurchenko <grange@cvs.openbsd.org>2006-11-28 00:11:45 +0000
commitb8f3ca258865949788f8c9bc6e8cda425d1b2bc2 (patch)
tree69dadcf3d36b7f5df7ac7dcab2bf155d4dca053a /sys/dev
parentf91ba944568cce251ef36e5436be6f0217dbd3b9 (diff)
Pretend to implement SCSI SYNCHRONIZE_CACHE command.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/pci/ips.c31
1 files changed, 29 insertions, 2 deletions
diff --git a/sys/dev/pci/ips.c b/sys/dev/pci/ips.c
index ed76e60e1d7..26c86a5b068 100644
--- a/sys/dev/pci/ips.c
+++ b/sys/dev/pci/ips.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ips.c,v 1.3 2006/11/27 23:56:38 grange Exp $ */
+/* $OpenBSD: ips.c,v 1.4 2006/11/28 00:11:44 grange Exp $ */
/*
* Copyright (c) 2006 Alexander Yurchenko <grange@openbsd.org>
@@ -51,9 +51,10 @@
/* Commands */
#define IPS_CMD_READ 0x02
#define IPS_CMD_WRITE 0x03
+#define IPS_CMD_ADAPTERINFO 0x05
+#define IPS_CMD_FLUSHCACHE 0x0a
#define IPS_CMD_READ_SG 0x82
#define IPS_CMD_WRITE_SG 0x83
-#define IPS_CMD_ADAPTERINFO 0x05
#define IPS_CMD_DRIVEINFO 0x19
#define IPS_MAXCMDSZ 256 /* XXX: for now */
@@ -89,6 +90,16 @@ struct ips_cmd_driveinfo {
u_int32_t reserve3;
} __packed;
+struct ips_cmd_generic {
+ u_int8_t command;
+ u_int8_t id;
+ u_int8_t drivenum;
+ u_int8_t reserve2;
+ u_int32_t lba;
+ u_int32_t buffaddr;
+ u_int32_t reserve3;
+} __packed;
+
struct ips_cmd_io {
u_int8_t command;
u_int8_t id;
@@ -196,6 +207,7 @@ int ips_scsi_ioctl(struct scsi_link *, u_long, caddr_t, int,
struct proc *);
void ips_scsi_minphys(struct buf *);
+void ips_flushcache(struct ips_softc *);
int ips_getadapterinfo(struct ips_softc *, struct ips_adapterinfo *);
int ips_getdriveinfo(struct ips_softc *, struct ips_driveinfo *);
@@ -404,6 +416,9 @@ ips_scsi_cmd(struct scsi_xfer *xs)
sns->error_code = 0x70;
sns->flags = SKEY_NO_SENSE;
goto done;
+ case SYNCHRONIZE_CACHE:
+ ips_flushcache(sc);
+ goto done;
case PREVENT_ALLOW:
case START_STOP:
case TEST_UNIT_READY:
@@ -494,6 +509,18 @@ ips_scsi_minphys(struct buf *bp)
minphys(bp);
}
+void
+ips_flushcache(struct ips_softc *sc)
+{
+ struct ips_cmd_generic *cmd;
+
+ cmd = sc->sc_cmdm->dm_kva;
+ cmd->command = IPS_CMD_FLUSHCACHE;
+
+ (*sc->sc_exec)(sc);
+ DELAY(1000);
+}
+
int
ips_getadapterinfo(struct ips_softc *sc, struct ips_adapterinfo *ai)
{