summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2011-07-05 03:47:56 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2011-07-05 03:47:56 +0000
commitb7a614353534d29eb810a29fcebd617fb281550a (patch)
treefe4cabd43192014da1ef158ae7bfca27ed5e48a7 /sys
parent6e5c24f4d0d98daa27a27a626ea25f0172b916bf (diff)
i forgot to set the sector_count when translating WRITE SAME 16
into DSM/TRIM commands. found by tedu
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/ata/atascsi.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/sys/dev/ata/atascsi.c b/sys/dev/ata/atascsi.c
index ab5e494b08d..8cac2939092 100644
--- a/sys/dev/ata/atascsi.c
+++ b/sys/dev/ata/atascsi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: atascsi.c,v 1.107 2011/06/21 06:03:14 matthew Exp $ */
+/* $OpenBSD: atascsi.c,v 1.108 2011/07/05 03:47:55 dlg Exp $ */
/*
* Copyright (c) 2007 David Gwynne <dlg@openbsd.org>
@@ -886,6 +886,12 @@ atascsi_disk_write_same_16(struct scsi_xfer *xs)
return;
}
+ if (xs->datalen < 512) {
+ /* generate sense data */
+ atascsi_done(xs, XS_DRIVER_STUFFUP);
+ return;
+ }
+
lba = _8btol(cdb->lba);
length = _4btol(cdb->length);
@@ -896,7 +902,7 @@ atascsi_disk_write_same_16(struct scsi_xfer *xs)
}
xa->data = xs->data;
- xa->datalen = xs->datalen;
+ xa->datalen = 512;
xa->flags = ATA_F_WRITE;
xa->pmp_port = ap->ap_pmp_port;
if (xs->flags & SCSI_POLL)
@@ -914,6 +920,7 @@ atascsi_disk_write_same_16(struct scsi_xfer *xs)
fis->flags = ATA_H2D_FLAGS_CMD | ap->ap_pmp_port;
fis->command = ATA_C_DSM;
fis->features = ATA_DSM_TRIM;
+ fis->sector_count = 1;
ata_exec(as, xa);
}