Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 25 Aug 2017 03:15:18 +0000 (UTC)
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r322872 - head/sys/dev/nvme
Message-ID:  <201708250315.v7P3FID8036183@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: imp
Date: Fri Aug 25 03:15:18 2017
New Revision: 322872
URL: https://svnweb.freebsd.org/changeset/base/322872

Log:
  Enable bus mastering on the device before resetting the device. The
  card has to do PCIe transactions to complete the reset process, but
  can't do them, per the PCIe spec, unless bus mastering is enabled.
  
  Submitted by: Kinjal Patel
  PR: 22166

Modified:
  head/sys/dev/nvme/nvme.c

Modified: head/sys/dev/nvme/nvme.c
==============================================================================
--- head/sys/dev/nvme/nvme.c	Fri Aug 25 02:48:31 2017	(r322871)
+++ head/sys/dev/nvme/nvme.c	Fri Aug 25 03:15:18 2017	(r322872)
@@ -246,6 +246,12 @@ nvme_attach(device_t dev)
 	}
 
 	/*
+	 * Enable busmastering so the completion status messages can
+	 * be busmastered back to the host.
+	 */
+	pci_enable_busmaster(dev);
+
+	/*
 	 * Reset controller twice to ensure we do a transition from cc.en==1
 	 *  to cc.en==0.  This is because we don't really know what status
 	 *  the controller was left in when boot handed off to OS.
@@ -261,8 +267,6 @@ nvme_attach(device_t dev)
 		nvme_ctrlr_destruct(ctrlr, dev);
 		return (status);
 	}
-
-	pci_enable_busmaster(dev);
 
 	ctrlr->config_hook.ich_func = nvme_ctrlr_start_config_hook;
 	ctrlr->config_hook.ich_arg = ctrlr;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201708250315.v7P3FID8036183>