Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/jdolecek-ncq]: src/sys/dev/ata up to 65536 sectors can be transferred fo...
details: https://anonhg.NetBSD.org/src/rev/1d78775a1de6
branches: jdolecek-ncq
changeset: 352632:1d78775a1de6
user: jdolecek <jdolecek%NetBSD.org@localhost>
date: Wed Apr 19 21:02:43 2017 +0000
description:
up to 65536 sectors can be transferred for LBA48 commands; adjust wdminphys()
and wdstart1() accordingly
diffstat:
sys/dev/ata/TODO.ncq | 2 --
sys/dev/ata/wd.c | 26 +++++++++++++++++++-------
2 files changed, 19 insertions(+), 9 deletions(-)
diffs (68 lines):
diff -r 1435bcff1c41 -r 1d78775a1de6 sys/dev/ata/TODO.ncq
--- a/sys/dev/ata/TODO.ncq Wed Apr 19 20:49:58 2017 +0000
+++ b/sys/dev/ata/TODO.ncq Wed Apr 19 21:02:43 2017 +0000
@@ -5,8 +5,6 @@
protect more of wddone() with mutex?
-wdminphys() - LBA48 has maximum 65536 sectors
-
refactor mvsata to reuse (more of) ata_wdc.c?
NCQ ICC - investigate and set/get the behaviour with timeouts
diff -r 1435bcff1c41 -r 1d78775a1de6 sys/dev/ata/wd.c
--- a/sys/dev/ata/wd.c Wed Apr 19 20:49:58 2017 +0000
+++ b/sys/dev/ata/wd.c Wed Apr 19 21:02:43 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: wd.c,v 1.428.2.7 2017/04/19 20:49:17 jdolecek Exp $ */
+/* $NetBSD: wd.c,v 1.428.2.8 2017/04/19 21:02:43 jdolecek Exp $ */
/*
* Copyright (c) 1998, 2001 Manuel Bouyer. All rights reserved.
@@ -54,7 +54,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.428.2.7 2017/04/19 20:49:17 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.428.2.8 2017/04/19 21:02:43 jdolecek Exp $");
#include "opt_ata.h"
@@ -793,9 +793,10 @@
else
xfer->c_bio.flags = 0;
if (wd->sc_flags & WDF_LBA48 &&
- (xfer->c_bio.blkno +
+ (((xfer->c_bio.blkno +
xfer->c_bio.bcount / wd->sc_dk.dk_label->d_secsize) >
- wd->sc_capacity28)
+ wd->sc_capacity28) ||
+ ((xfer->c_bio.bcount / wd->sc_dk.dk_label->d_secsize) > 128)))
xfer->c_bio.flags |= ATA_LBA48;
/* If NCQ was negotiated, always use it */
@@ -977,10 +978,21 @@
{
const struct wd_softc * const wd =
device_lookup_private(&wd_cd, WDUNIT(bp->b_dev));
+ uint32_t maxsectors;
- if (bp->b_bcount > (wd->sc_blksize * 128)) {
- bp->b_bcount = (wd->sc_blksize * 128);
- }
+ /*
+ * The limit is actually 65536 for LBA48 and 256 for non-LBA48,
+ * but that requires to pass set the count for the ATA command
+ * to 0, which is somewhat error prone, so better stay safe.
+ */
+ if (wd->sc_flags & WDF_LBA48)
+ maxsectors = 65535;
+ else
+ maxsectors = 128;
+
+ if (bp->b_bcount > (wd->sc_blksize * maxsectors))
+ bp->b_bcount = (wd->sc_blksize * maxsectors);
+
minphys(bp);
}
Home |
Main Index |
Thread Index |
Old Index