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 set NCQ priority field to 'high' for BPRI...
details: https://anonhg.NetBSD.org/src/rev/6ce1ada20469
branches: jdolecek-ncq
changeset: 352661:6ce1ada20469
user: jdolecek <jdolecek%NetBSD.org@localhost>
date: Mon Apr 24 22:20:23 2017 +0000
description:
set NCQ priority field to 'high' for BPRIO_TIMECRITICAL transfers if drive
supports it
diffstat:
sys/dev/ata/TODO.ncq | 8 --------
sys/dev/ata/ata.c | 22 ++++++++++++++++------
sys/dev/ata/atareg.h | 15 +++++++++++----
sys/dev/ata/atavar.h | 6 ++++--
sys/dev/ata/wd.c | 8 ++++++--
5 files changed, 37 insertions(+), 22 deletions(-)
diffs (167 lines):
diff -r 4770c856df5c -r 6ce1ada20469 sys/dev/ata/TODO.ncq
--- a/sys/dev/ata/TODO.ncq Mon Apr 24 21:19:21 2017 +0000
+++ b/sys/dev/ata/TODO.ncq Mon Apr 24 22:20:23 2017 +0000
@@ -8,14 +8,6 @@
is ata_exec_xfer() + POLL safe wrt. more outstanding I/Os? why is it waiting
until xfer is head of queue? also layer violation with the ata_xfer_free() call
-NCQ PRIO/ICC handling
----------------------
-fix handling of ATA 'devices' value to be full 16-bit value, to prepare for
-the ICC/AUXILIARY support
-
-set PRIO/ICC for NCQ transfers for BPRIO_TIMECRITICAL/BPRIO_TIMELIMITED
-NCQ ICC - investigate and set/get the behaviour with timeouts (WDNC, RDNC)
-
Other random notes (maybe do outside the NCQ branch):
-----------------------------------------------------
add support for the NCQ TRIM if supported by device?
diff -r 4770c856df5c -r 6ce1ada20469 sys/dev/ata/ata.c
--- a/sys/dev/ata/ata.c Mon Apr 24 21:19:21 2017 +0000
+++ b/sys/dev/ata/ata.c Mon Apr 24 22:20:23 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ata.c,v 1.132.8.7 2017/04/23 01:30:30 jakllsch Exp $ */
+/* $NetBSD: ata.c,v 1.132.8.8 2017/04/24 22:20:23 jdolecek Exp $ */
/*
* Copyright (c) 1998, 2001 Manuel Bouyer. All rights reserved.
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.132.8.7 2017/04/23 01:30:30 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.132.8.8 2017/04/24 22:20:23 jdolecek Exp $");
#include "opt_ata.h"
@@ -1421,10 +1421,12 @@
)
aprint_verbose(" (using DMA)");
- if (drvp->drive_flags & ATA_DRIVE_NCQ)
- aprint_verbose(", NCQ (%d tags)",
- chp->ch_queue->queue_openings);
- else if (drvp->drive_flags & ATA_DRIVE_WFUA)
+ if (drvp->drive_flags & ATA_DRIVE_NCQ) {
+ aprint_verbose(", NCQ (%d tags)%s",
+ chp->ch_queue->queue_openings,
+ (drvp->drive_flags & ATA_DRIVE_NCQ_PRIO)
+ ? " w/PRIO" : "");
+ } else if (drvp->drive_flags & ATA_DRIVE_WFUA)
aprint_verbose(", WRITE DMA FUA EXT");
#endif /* NATA_DMA || NATA_PIOBM */
@@ -1748,6 +1750,11 @@
(params.atap_queuedepth & WDC_QUEUE_DEPTH_MASK) + 1;
aprint_verbose("%s NCQ (%d tags)", sep, drvp->drv_openings);
sep = ",";
+
+ if (params.atap_sata_caps & SATA_NCQ_PRIO) {
+ drvp->drive_flags |= ATA_DRIVE_NCQ_PRIO;
+ aprint_verbose(" w/PRIO");
+ }
}
if (drvp->drv_openings < chp->ch_queue->queue_openings)
ata_queue_downsize(chp->ch_queue, drvp->drv_openings);
@@ -1999,6 +2006,9 @@
/* NCQ tag */
*count = (xfer->c_slot << 3);
+ if (xfer->c_bio.flags & ATA_PRIO_HIGH)
+ *count |= WDSC_PRIO_HIGH;
+
/* other device flags */
if (xfer->c_bio.flags & ATA_FUA)
*device |= WDSD_FUA;
diff -r 4770c856df5c -r 6ce1ada20469 sys/dev/ata/atareg.h
--- a/sys/dev/ata/atareg.h Mon Apr 24 21:19:21 2017 +0000
+++ b/sys/dev/ata/atareg.h Mon Apr 24 22:20:23 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: atareg.h,v 1.43.18.1 2017/04/19 21:42:39 jdolecek Exp $ */
+/* $NetBSD: atareg.h,v 1.43.18.2 2017/04/24 22:20:23 jdolecek Exp $ */
/*
* Copyright (c) 1998, 2001 Manuel Bouyer.
@@ -245,6 +245,11 @@
#define WDSMART_CYL 0xc24f
+/* parameters uploaded to count register for NCQ */
+#define WDSC_PRIO_HIGH __BIT(15)
+#define WDSC_PRIO_ISOCHRONOUS __BIT(14)
+#define WDSC_PRIO_NORMAL 0x0000
+
/* parameters uploaded to device/heads register */
#define WDSD_IBM 0xa0 /* forced to 512 byte sector, ecc */
#define WDSD_CHS 0x00 /* cylinder/head/sector addressing */
@@ -377,9 +382,11 @@
#define SATA_SIGNAL_GEN1 0x02
#define SATA_SIGNAL_GEN2 0x04
#define SATA_SIGNAL_GEN3 0x08
-#define SATA_NATIVE_CMDQ 0x0100
-#define SATA_HOST_PWR_MGMT 0x0200
-#define SATA_PHY_EVNT_CNT 0x0400
+#define SATA_NATIVE_CMDQ 0x0100 /* supp. NCQ feature set */
+#define SATA_HOST_PWR_MGMT 0x0200 /* supp. host-init. pwr mngmt reqs */
+#define SATA_PHY_EVNT_CNT 0x0400 /* supp. SATA Phy Event Counters log */
+#define SATA_UNLOAD_W_NCQ 0x0800 /* supp. unload w/ NCQ commands act */
+#define SATA_NCQ_PRIO 0x1000 /* supp. NCQ priority information */
uint16_t atap_sata_reserved; /* 77: */
uint16_t atap_sata_features_supp; /* 78: */
#define SATA_NONZERO_OFFSETS 0x02
diff -r 4770c856df5c -r 6ce1ada20469 sys/dev/ata/atavar.h
--- a/sys/dev/ata/atavar.h Mon Apr 24 21:19:21 2017 +0000
+++ b/sys/dev/ata/atavar.h Mon Apr 24 22:20:23 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: atavar.h,v 1.92.8.7 2017/04/20 20:14:42 jdolecek Exp $ */
+/* $NetBSD: atavar.h,v 1.92.8.8 2017/04/24 22:20:23 jdolecek Exp $ */
/*
* Copyright (c) 1998, 2001 Manuel Bouyer.
@@ -50,6 +50,7 @@
#define ATA_CORR 0x0040 /* transfer had a corrected error */
#define ATA_LBA48 0x0080 /* transfer uses 48-bit LBA addressing */
#define ATA_FUA 0x0100 /* transfer uses FUA */
+#define ATA_PRIO_HIGH 0x0200 /* transfer has high priority */
daddr_t blkno; /* block addr */
daddr_t blkdone;/* number of blks transferred */
daddr_t nblks; /* number of block currently transferring */
@@ -232,7 +233,8 @@
#define ATA_DRIVE_NOSTREAM 0x0040 /* no stream methods on this drive */
#define ATA_DRIVE_ATAPIDSCW 0x0080 /* needs to wait for DSC in phase_complete */
#define ATA_DRIVE_WFUA 0x0100 /* drive supports WRITE DMA FUA EXT */
-#define ATA_DRIVE_NCQ 0x0200 /* drive supports NCQ */
+#define ATA_DRIVE_NCQ 0x0200 /* drive supports NCQ feature set */
+#define ATA_DRIVE_NCQ_PRIO 0x0400 /* drive supports NCQ PRIO field */
uint8_t drive_type;
#define ATA_DRIVET_NONE 0
diff -r 4770c856df5c -r 6ce1ada20469 sys/dev/ata/wd.c
--- a/sys/dev/ata/wd.c Mon Apr 24 21:19:21 2017 +0000
+++ b/sys/dev/ata/wd.c Mon Apr 24 22:20:23 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: wd.c,v 1.428.2.13 2017/04/24 14:07:29 jdolecek Exp $ */
+/* $NetBSD: wd.c,v 1.428.2.14 2017/04/24 22:20:23 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.13 2017/04/24 14:07:29 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.428.2.14 2017/04/24 22:20:23 jdolecek Exp $");
#include "opt_ata.h"
@@ -689,6 +689,10 @@
if (wd->drvp->drive_flags & ATA_DRIVE_NCQ) {
xfer->c_bio.flags |= ATA_LBA48;
xfer->c_flags |= C_NCQ;
+
+ if ((wd->drvp->drive_flags & ATA_DRIVE_NCQ_PRIO) &&
+ BIO_GETPRIO(bp) == BPRIO_TIMECRITICAL)
+ xfer->c_bio.flags |= ATA_PRIO_HIGH;
}
if (wd->sc_flags & WDF_LBA)
Home |
Main Index |
Thread Index |
Old Index