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 probe for NCQ and WRITE DMA FUA EXT support
details: https://anonhg.NetBSD.org/src/rev/88ca4e799f60
branches: jdolecek-ncq
changeset: 352626:88ca4e799f60
user: jdolecek <jdolecek%NetBSD.org@localhost>
date: Sat Apr 15 18:02:09 2017 +0000
description:
probe for NCQ and WRITE DMA FUA EXT support
diffstat:
sys/dev/ata/wd.c | 31 +++++++++++++++++++++++++++++--
sys/dev/ata/wdvar.h | 4 +++-
2 files changed, 32 insertions(+), 3 deletions(-)
diffs (70 lines):
diff -r f066562aba11 -r 88ca4e799f60 sys/dev/ata/wd.c
--- a/sys/dev/ata/wd.c Sat Apr 15 17:14:11 2017 +0000
+++ b/sys/dev/ata/wd.c Sat Apr 15 18:02:09 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: wd.c,v 1.428.2.4 2017/04/15 17:14:11 jdolecek Exp $ */
+/* $NetBSD: wd.c,v 1.428.2.5 2017/04/15 18:02:09 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.4 2017/04/15 17:14:11 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.428.2.5 2017/04/15 18:02:09 jdolecek Exp $");
#include "opt_ata.h"
@@ -425,6 +425,33 @@
aprint_normal_dev(self, "WARNING: block size %u "
"might not actually work\n", wd->sc_blksize);
}
+
+ /*
+ * Probe WRITE DMA FUA EXT. Support is mandatory for devices
+ * supporting LBA48, but nevertheless confirm with the feature flag.
+ */
+ if (wd->sc_flags & WDF_LBA48
+ && (wd->sc_params.atap_cmd_def & ATA_CMDE_WFE)) {
+ wd->sc_flags |= WDF_WFUA;
+ }
+
+ /* Probe NCQ support - READ/WRITE FPDMA QUEUED command support */
+ uint8_t max_depth = 1;
+ if (wd->sc_params.atap_sata_caps & SATA_NATIVE_CMDQ) {
+ wd->sc_flags |= WDF_NCQ;
+
+ max_depth = (wd->sc_params.atap_queuedepth & 0x0f) + 1;
+
+ /* XXX adjust adev_openings */
+ }
+
+ aprint_verbose_dev(self,
+ "drive supports %sFUA, %sNCQ (queue depth max %d, used %u)\n",
+ (wd->sc_flags & (WDF_WFUA|WDF_NCQ)) ? "" : "no ",
+ (wd->sc_flags & WDF_NCQ) ? "" : "no ",
+ max_depth, adev->adev_openings);
+
+
out:
/*
* Initialize and attach the disk structure.
diff -r f066562aba11 -r 88ca4e799f60 sys/dev/ata/wdvar.h
--- a/sys/dev/ata/wdvar.h Sat Apr 15 17:14:11 2017 +0000
+++ b/sys/dev/ata/wdvar.h Sat Apr 15 18:02:09 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: wdvar.h,v 1.43.4.2 2017/04/15 12:01:23 jdolecek Exp $ */
+/* $NetBSD: wdvar.h,v 1.43.4.3 2017/04/15 18:02:09 jdolecek Exp $ */
/*
* Copyright (c) 1998, 2001 Manuel Bouyer.
@@ -58,6 +58,8 @@
#define WDF_LBA 0x040 /* using LBA mode */
#define WDF_KLABEL 0x080 /* retain label after 'full' close */
#define WDF_LBA48 0x100 /* using 48-bit LBA mode */
+#define WDF_WFUA 0x200 /* supports FUA via WRITE DMA FUA EXT */
+#define WDF_NCQ 0x400 /* supports NCQ feature set */
uint64_t sc_capacity; /* full capacity of the device */
uint64_t sc_capacity512; /* ... in DEV_BSIZE blocks */
uint32_t sc_capacity28; /* capacity accessible with LBA28 commands */
Home |
Main Index |
Thread Index |
Old Index