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
This commit is contained in:
imp 2018-06-14 01:15:19 +00:00
parent bfddf1a931
commit 25c0b2e09a
7 changed files with 27 additions and 4 deletions

View File

@ -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

View File

@ -2,4 +2,3 @@
SUBDIR += bsdlabel
SUBDIR += fdisk
SUBDIR += nvmecontrol

View File

@ -2,5 +2,4 @@
SUBDIR += bsdlabel
SUBDIR += fdisk
SUBDIR += nvmecontrol
SUBDIR += sconfig

View File

@ -2,4 +2,3 @@
SUBDIR += bsdlabel
SUBDIR += fdisk
SUBDIR += nvmecontrol

View File

@ -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.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

View File

@ -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 *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
}
/*

View File

@ -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>
#