Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 19 Sep 2012 16:21:24 +0000 (UTC)
From:      Jim Harris <jimharris@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r240697 - head/sys/dev/nvme
Message-ID:  <201209191621.q8JGLOaR024645@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jimharris
Date: Wed Sep 19 16:21:23 2012
New Revision: 240697
URL: http://svn.freebsd.org/changeset/base/240697

Log:
  Report nvme(4) as a generic driver for NVMe devices if PCI class, subclass
  and programming interface codes match.
  
  Sponsored by:	Intel

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

Modified: head/sys/dev/nvme/nvme.c
==============================================================================
--- head/sys/dev/nvme/nvme.c	Wed Sep 19 16:20:49 2012	(r240696)
+++ head/sys/dev/nvme/nvme.c	Wed Sep 19 16:21:23 2012	(r240697)
@@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/conf.h>
 #include <sys/module.h>
 
+#include <dev/pci/pcireg.h>
 #include <dev/pci/pcivar.h>
 
 #include "nvme_private.h"
@@ -82,17 +83,29 @@ static struct _pcsid
 static int
 nvme_probe (device_t device)
 {
-	u_int32_t type = pci_get_devid(device);
-	struct _pcsid *ep = pci_ids;
+	struct _pcsid	*ep;
+	int		probe_val = ENXIO;
+	u_int32_t	type;
+
+	type = pci_get_devid(device);
+	ep = pci_ids;
+
+#if defined(PCIS_STORAGE_NVM)
+	if (pci_get_class(device)    == PCIC_STORAGE &&
+	    pci_get_subclass(device) == PCIS_STORAGE_NVM &&
+	    pci_get_progif(device)   == PCIP_STORAGE_NVM_ENTERPRISE_NVMHCI_1_0)
+		probe_val = BUS_PROBE_GENERIC;
+#endif
 
 	while (ep->type && ep->type != type)
 		++ep;
 
 	if (ep->desc) {
 		device_set_desc(device, ep->desc);
-		return (BUS_PROBE_DEFAULT);
-	} else
-		return (ENXIO);
+		probe_val = BUS_PROBE_DEFAULT;
+	}
+
+	return (probe_val);
 }
 
 static void



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