Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 14 Jun 2018 01:15:19 +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: r335101 - in head: sbin sbin/camcontrol share/mk
Message-ID:  <201806140115.w5E1FJH6099583@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: imp
Date: Thu Jun 14 01:15:19 2018
New Revision: 335101
URL: https://svnweb.freebsd.org/changeset/base/335101

Log:
  NVME support is only for x86 and powerpc64.
  
  Implement MK_NVME now that the expression for where NVMe is
  complicated. Default it to "yes" for x86 and powerpc64 and
  no everywhere else. Use it in camcontrol to define WITH_NVME
  for those platforms where we support nvme.
  
  This should fix the newly introduced nvme files to camcontrol
  which were building everywhere.
  
  Pointy Hat To: imp
  Sponsored by: Netflix

Modified:
  head/sbin/Makefile
  head/sbin/Makefile.amd64
  head/sbin/Makefile.i386
  head/sbin/Makefile.powerpc64
  head/sbin/camcontrol/Makefile
  head/sbin/camcontrol/camcontrol.c
  head/share/mk/src.opts.mk

Modified: head/sbin/Makefile
==============================================================================
--- head/sbin/Makefile	Thu Jun 14 00:20:55 2018	(r335100)
+++ head/sbin/Makefile	Thu Jun 14 01:15:19 2018	(r335101)
@@ -82,6 +82,7 @@ SUBDIR.${MK_IPFW}+=	natd
 SUBDIR.${MK_ISCSI}+=	iscontrol
 SUBDIR.${MK_NAND}+=	nandfs
 SUBDIR.${MK_NAND}+=	newfs_nandfs
+SUBDIR.${MK_NVME}+=	nvmecontrol
 SUBDIR.${MK_OPENSSL}+=	decryptcore
 SUBDIR.${MK_PF}+=	pfctl
 SUBDIR.${MK_PF}+=	pflogd

Modified: head/sbin/Makefile.amd64
==============================================================================
--- head/sbin/Makefile.amd64	Thu Jun 14 00:20:55 2018	(r335100)
+++ head/sbin/Makefile.amd64	Thu Jun 14 01:15:19 2018	(r335101)
@@ -2,4 +2,3 @@
 
 SUBDIR += bsdlabel
 SUBDIR += fdisk
-SUBDIR += nvmecontrol

Modified: head/sbin/Makefile.i386
==============================================================================
--- head/sbin/Makefile.i386	Thu Jun 14 00:20:55 2018	(r335100)
+++ head/sbin/Makefile.i386	Thu Jun 14 01:15:19 2018	(r335101)
@@ -2,5 +2,4 @@
 
 SUBDIR += bsdlabel
 SUBDIR += fdisk
-SUBDIR += nvmecontrol
 SUBDIR += sconfig

Modified: head/sbin/Makefile.powerpc64
==============================================================================
--- head/sbin/Makefile.powerpc64	Thu Jun 14 00:20:55 2018	(r335100)
+++ head/sbin/Makefile.powerpc64	Thu Jun 14 01:15:19 2018	(r335101)
@@ -2,4 +2,3 @@
 
 SUBDIR += bsdlabel
 SUBDIR += fdisk
-SUBDIR += nvmecontrol

Modified: head/sbin/camcontrol/Makefile
==============================================================================
--- head/sbin/camcontrol/Makefile	Thu Jun 14 00:20:55 2018	(r335100)
+++ head/sbin/camcontrol/Makefile	Thu Jun 14 01:15:19 2018	(r335101)
@@ -1,5 +1,7 @@
 # $FreeBSD$
 
+.include <src.opts.mk>
+
 PACKAGE=runtime
 PROG=	camcontrol
 SRCS=	camcontrol.c util.c
@@ -8,11 +10,13 @@ SRCS+=	attrib.c epc.c fwdownload.c modeedit.c persist.
 .else
 CFLAGS+= -DMINIMALISTIC
 .endif
+.if ${MK_NVME} != "no"
 .PATH:	${SRCTOP}/sbin/nvmecontrol
-CFLAGS+= -I${SRCTOP}/sbin/nvmecontrol
+CFLAGS+= -I${SRCTOP}/sbin/nvmecontrol -DWITH_NVME
 SRCS+=	identify_ext.c nc_util.c
 .PATH:	${SRCTOP}/sys/dev/nvme
 SRCS+=	nvme_util.c
+.endif
 # This is verboten
 .if ${MACHINE_CPUARCH} == "arm"
 WARNS?= 3

Modified: head/sbin/camcontrol/camcontrol.c
==============================================================================
--- head/sbin/camcontrol/camcontrol.c	Thu Jun 14 00:20:55 2018	(r335100)
+++ head/sbin/camcontrol/camcontrol.c	Thu Jun 14 01:15:19 2018	(r335101)
@@ -63,7 +63,9 @@ __FBSDID("$FreeBSD$");
 #include <cam/mmc/mmc_all.h>
 #include <camlib.h>
 #include "camcontrol.h"
+#ifdef WITH_NVME
 #include "nvmecontrol_ext.h"
+#endif
 
 typedef enum {
 	CAM_CMD_NONE		= 0x00000000,
@@ -281,7 +283,9 @@ static int print_dev_ata(struct device_match_result *d
 static int print_dev_semb(struct device_match_result *dev_result, char *tmpstr);
 static int print_dev_mmcsd(struct device_match_result *dev_result,
     char *tmpstr);
+#ifdef WITH_NVME
 static int print_dev_nvme(struct device_match_result *dev_result, char *tmpstr);
+#endif
 #ifndef MINIMALISTIC
 static int testunitready(struct cam_device *device, int task_attr,
 			 int retry_count, int timeout, int quiet);
@@ -602,12 +606,14 @@ getdevtree(int argc, char **argv, char *combinedopt)
 						skip_device = 1;
 						break;
 					}
+#ifdef WITH_NVME
 				} else if (dev_result->protocol == PROTO_NVME) {
 					if (print_dev_nvme(dev_result,
 					    &tmpstr[0]) != 0) {
 						skip_device = 1;
 						break;
 					}
+#endif
 				} else {
 				    sprintf(tmpstr, "<>");
 				}
@@ -763,6 +769,7 @@ print_dev_mmcsd(struct device_match_result *dev_result
 	return (0);
 }
 
+#ifdef WITH_NVME
 static int
 nvme_get_cdata(struct cam_device *dev, struct nvme_controller_data *cdata)
 {
@@ -824,6 +831,7 @@ print_dev_nvme(struct device_match_result *dev_result,
 	cam_close_device(dev);
 	return (0);
 }
+#endif
 
 #ifndef MINIMALISTIC
 static int
@@ -2402,6 +2410,7 @@ ataidentify(struct cam_device *device, int retry_count
 	return (0);
 }
 
+#ifdef WITH_NVME
 static int
 nvmeidentify(struct cam_device *device, int retry_count __unused, int timeout __unused)
 {
@@ -2413,10 +2422,12 @@ nvmeidentify(struct cam_device *device, int retry_coun
 
 	return (0);
 }
+#endif
 
 static int
 identify(struct cam_device *device, int retry_count, int timeout)
 {
+#ifdef WITH_NVME
 	struct ccb_pathinq cpi;
 
 	if (get_cpi(device, &cpi) != 0) {
@@ -2427,6 +2438,7 @@ identify(struct cam_device *device, int retry_count, i
 	if (cpi.protocol == PROTO_NVME) {
 		return (nvmeidentify(device, retry_count, timeout));
 	}
+#endif
 	return (ataidentify(device, retry_count, timeout));
 }
 #endif /* MINIMALISTIC */
@@ -5206,6 +5218,7 @@ cts_print(struct cam_device *device, struct ccb_trans_
 				"enabled" : "disabled");
 		}
 	}
+#ifdef WITH_NVME
 	if (cts->protocol == PROTO_NVME) {
 		struct ccb_trans_settings_nvme *nvmex =
 		    &cts->xport_specific.nvme;
@@ -5222,6 +5235,7 @@ cts_print(struct cam_device *device, struct ccb_trans_
 			    nvmex->speed, nvmex->max_speed);
 		}
 	}
+#endif
 }
 
 /*

Modified: head/share/mk/src.opts.mk
==============================================================================
--- head/share/mk/src.opts.mk	Thu Jun 14 00:20:55 2018	(r335100)
+++ head/share/mk/src.opts.mk	Thu Jun 14 01:15:19 2018	(r335101)
@@ -322,6 +322,13 @@ __DEFAULT_NO_OPTIONS+=CXGBETOOL
 __DEFAULT_NO_OPTIONS+=MLX5TOOL
 .endif
 
+# NVME is only x86 and powerpc64
+.if ${__T} == "amd64" || ${__T} == "i386" || ${__T} == "powerpc64"
+__DEFAULT_YES_OPTIONS+=NVME
+.else
+__DEFAULT_NO_OPTIONS+=NVME
+.endif
+
 .include <bsd.mkopt.mk>
 
 #



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