diff --git a/sbin/Makefile b/sbin/Makefile index 800de288f749..7798cc70b481 100644 --- a/sbin/Makefile +++ b/sbin/Makefile @@ -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 diff --git a/sbin/Makefile.amd64 b/sbin/Makefile.amd64 index d3cf350ee2cc..2d231b0cb2b0 100644 --- a/sbin/Makefile.amd64 +++ b/sbin/Makefile.amd64 @@ -2,4 +2,3 @@ SUBDIR += bsdlabel SUBDIR += fdisk -SUBDIR += nvmecontrol diff --git a/sbin/Makefile.i386 b/sbin/Makefile.i386 index 0ced312832f8..4135c44082c9 100644 --- a/sbin/Makefile.i386 +++ b/sbin/Makefile.i386 @@ -2,5 +2,4 @@ SUBDIR += bsdlabel SUBDIR += fdisk -SUBDIR += nvmecontrol SUBDIR += sconfig diff --git a/sbin/Makefile.powerpc64 b/sbin/Makefile.powerpc64 index d3cf350ee2cc..2d231b0cb2b0 100644 --- a/sbin/Makefile.powerpc64 +++ b/sbin/Makefile.powerpc64 @@ -2,4 +2,3 @@ SUBDIR += bsdlabel SUBDIR += fdisk -SUBDIR += nvmecontrol diff --git a/sbin/camcontrol/Makefile b/sbin/camcontrol/Makefile index b4e81daeb0e4..a50dc93bd46c 100644 --- a/sbin/camcontrol/Makefile +++ b/sbin/camcontrol/Makefile @@ -1,5 +1,7 @@ # $FreeBSD$ +.include + PACKAGE=runtime PROG= camcontrol SRCS= camcontrol.c util.c @@ -8,11 +10,13 @@ SRCS+= attrib.c epc.c fwdownload.c modeedit.c persist.c progress.c timestamp.c z .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 diff --git a/sbin/camcontrol/camcontrol.c b/sbin/camcontrol/camcontrol.c index 4d1811ffe71e..6feb2804b874 100644 --- a/sbin/camcontrol/camcontrol.c +++ b/sbin/camcontrol/camcontrol.c @@ -63,7 +63,9 @@ __FBSDID("$FreeBSD$"); #include #include #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 *dev_result, char *tmpstr); 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, char *tmpstr) 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, char *tmpstr) cam_close_device(dev); return (0); } +#endif #ifndef MINIMALISTIC static int @@ -2402,6 +2410,7 @@ ataidentify(struct cam_device *device, int retry_count, int timeout) 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_count __unused, int timeout __ 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, int timeout) 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_settings *cts) "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_settings *cts) nvmex->speed, nvmex->max_speed); } } +#endif } /* diff --git a/share/mk/src.opts.mk b/share/mk/src.opts.mk index 19296c0c9330..a2d2a6f19141 100644 --- a/share/mk/src.opts.mk +++ b/share/mk/src.opts.mk @@ -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 #