From dcdf40636d0868f8b4336bfeaf4a62bdf6b5aa4c Mon Sep 17 00:00:00 2001 From: chrfranke <chrfranke@4ea69e1a-61f1-4043-bf83-b5c94c648137> Date: Mon, 17 Jun 2019 19:19:29 +0000 Subject: [PATCH] os_win32.cpp: Clear ProtocolDataRequestSubValue for NVMe Get Log Page commands because newer drivers pass this value as CDW12 (LPOL) to the drive. This fixes log page access for NVMe 1.2.1+ drives (#1201). Thanks to Vikram Manja for bug report and testing. git-svn-id: https://svn.code.sf.net/p/smartmontools/code/trunk@4920 4ea69e1a-61f1-4043-bf83-b5c94c648137 --- smartmontools/ChangeLog | 8 ++++++++ smartmontools/os_win32.cpp | 5 ++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/smartmontools/ChangeLog b/smartmontools/ChangeLog index aa2ed2db9..3cc7cba41 100644 --- a/smartmontools/ChangeLog +++ b/smartmontools/ChangeLog @@ -1,5 +1,13 @@ $Id$ +2019-06-17 Christian Franke <franke@computer.org> + + os_win32.cpp: Clear ProtocolDataRequestSubValue for NVMe Get Log Page + commands because newer drivers pass this value as CDW12 (LPOL) to the + drive. This fixes log page access for NVMe 1.2.1+ drives (#1201). + + Thanks to Vikram Manja for bug report and testing. + 2019-06-12 Christian Franke <franke@computer.org> os_netbsd.cpp: Fix device scan crash on empty name list. diff --git a/smartmontools/os_win32.cpp b/smartmontools/os_win32.cpp index 13b1730f6..ab352620f 100644 --- a/smartmontools/os_win32.cpp +++ b/smartmontools/os_win32.cpp @@ -3858,18 +3858,21 @@ bool win10_nvme_device::nvme_pass_through(const nvme_cmd_in & in, nvme_cmd_out & spsq->PropertyQuery.PropertyId = win10::StorageDeviceProtocolSpecificProperty; spsq->ProtocolSpecific.DataType = win10::NVMeDataTypeIdentify; spsq->ProtocolSpecific.ProtocolDataRequestValue = in.cdw10; + spsq->ProtocolSpecific.ProtocolDataRequestSubValue = in.nsid; break; case smartmontools::nvme_admin_get_log_page: spsq->PropertyQuery.PropertyId = win10::StorageDeviceProtocolSpecificProperty; spsq->ProtocolSpecific.DataType = win10::NVMeDataTypeLogPage; spsq->ProtocolSpecific.ProtocolDataRequestValue = in.cdw10 & 0xff; // LID only ? + // Older drivers (Win10 1607) ignore SubValue + // Newer drivers (Win10 1809) pass SubValue to CDW12 (DW aligned) + spsq->ProtocolSpecific.ProtocolDataRequestSubValue = 0; // in.cdw12 (LPOL, NVMe 1.2.1+) ? break; // TODO: nvme_admin_get_features default: return set_err(ENOSYS, "NVMe admin command 0x%02x not supported", in.opcode); } - spsq->ProtocolSpecific.ProtocolDataRequestSubValue = in.nsid; // ? spsq->ProtocolSpecific.ProtocolDataOffset = sizeof(spsq->ProtocolSpecific); spsq->ProtocolSpecific.ProtocolDataLength = in.size; -- GitLab