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;
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to