summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2019-09-20 07:57:01 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2019-11-13 13:04:09 +0100
commite6acc15bc94ea35f40e50b42692584c456ba9722 (patch)
treea42ff1052af35a2aadf9d5cb46f400127b07a500
parentNVMECONTROL(8): Add to build (diff)
downloadrtems-libbsd-e6acc15bc94ea35f40e50b42692584c456ba9722.tar.bz2
NVMECONTROL(8): Port to RTEMS
Update #3821.
-rw-r--r--freebsd/sbin/nvmecontrol/comnd.c20
-rw-r--r--freebsd/sbin/nvmecontrol/comnd.h36
-rw-r--r--freebsd/sbin/nvmecontrol/devlist.c3
-rw-r--r--freebsd/sbin/nvmecontrol/firmware.c3
-rw-r--r--freebsd/sbin/nvmecontrol/format.c3
-rw-r--r--freebsd/sbin/nvmecontrol/identify.c3
-rw-r--r--freebsd/sbin/nvmecontrol/identify_ext.c3
-rw-r--r--freebsd/sbin/nvmecontrol/logpage.c3
-rw-r--r--freebsd/sbin/nvmecontrol/modules/intel/intel.c5
-rw-r--r--freebsd/sbin/nvmecontrol/modules/wdc/wdc.c5
-rw-r--r--freebsd/sbin/nvmecontrol/nc_util.c3
-rw-r--r--freebsd/sbin/nvmecontrol/ns.c7
-rw-r--r--freebsd/sbin/nvmecontrol/nsid.c3
-rw-r--r--freebsd/sbin/nvmecontrol/nvmecontrol.c59
-rw-r--r--freebsd/sbin/nvmecontrol/nvmecontrol.h21
-rw-r--r--freebsd/sbin/nvmecontrol/passthru.c3
-rw-r--r--freebsd/sbin/nvmecontrol/perftest.c3
-rw-r--r--freebsd/sbin/nvmecontrol/power.c3
-rw-r--r--freebsd/sbin/nvmecontrol/reset.c3
-rw-r--r--freebsd/sbin/nvmecontrol/resv.c3
-rw-r--r--freebsd/sbin/nvmecontrol/sanitize.c3
-rw-r--r--libbsd.py1
-rw-r--r--rtemsbsd/include/machine/rtems-bsd-commands.h2
-rw-r--r--rtemsbsd/include/rtems/netcmds-config.h3
-rw-r--r--rtemsbsd/rtems/rtems-bsd-shell-nvmecontrol.c34
25 files changed, 231 insertions, 4 deletions
diff --git a/freebsd/sbin/nvmecontrol/comnd.c b/freebsd/sbin/nvmecontrol/comnd.c
index 47572401..0b74574b 100644
--- a/freebsd/sbin/nvmecontrol/comnd.c
+++ b/freebsd/sbin/nvmecontrol/comnd.c
@@ -27,6 +27,11 @@
* SUCH DAMAGE.
*/
+#ifdef __rtems__
+#define __need_getopt_newlib
+#include <getopt.h>
+#include <machine/rtems-bsd-program.h>
+#endif /* __rtems__ */
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
@@ -182,6 +187,16 @@ arg_parse(int argc, char * const * argv, const struct cmd *f)
char *shortopts, *p;
const struct opts *opts = f->opts;
const struct args *args = f->args;
+#ifdef __rtems__
+ struct getopt_data getopt_data;
+ memset(&getopt_data, 0, sizeof(getopt_data));
+#define optind getopt_data.optind
+#define optarg getopt_data.optarg
+#define opterr getopt_data.opterr
+#define optopt getopt_data.optopt
+#define getopt_long(argc, argv, shortopts, longopts, longind) \
+ getopt_long_r(argc, argv, shortopts, longopts, longind, &getopt_data)
+#endif /* __rtems__ */
if (opts == NULL)
n = 0;
@@ -194,6 +209,9 @@ arg_parse(int argc, char * const * argv, const struct cmd *f)
p = shortopts = malloc((2 * n + 3) * sizeof(char));
if (shortopts == NULL)
err(1, "shortopts memory");
+#ifdef __rtems__
+ *p++ = '+';
+#endif /* __rtems__ */
idx = 0;
for (i = 0; i < n; i++) {
lopts[i].name = opts[i].long_arg;
@@ -284,6 +302,7 @@ bad_arg:
exit(1);
}
+#ifndef __rtems__
/*
* Loads all the .so's from the specified directory.
*/
@@ -315,6 +334,7 @@ cmd_load_dir(const char *dir __unused, cmd_load_cb_t cb __unused, void *argp __u
}
closedir(d);
}
+#endif /* __rtems__ */
void
cmd_register(struct cmd *up, struct cmd *cmd)
diff --git a/freebsd/sbin/nvmecontrol/comnd.h b/freebsd/sbin/nvmecontrol/comnd.h
index 91c97d4a..0f06cd29 100644
--- a/freebsd/sbin/nvmecontrol/comnd.h
+++ b/freebsd/sbin/nvmecontrol/comnd.h
@@ -86,12 +86,48 @@ struct cmd {
};
void cmd_register(struct cmd *, struct cmd *);
+#ifndef __rtems__
#define CMD_COMMAND(c) \
static void cmd_register_##c(void) __attribute__((constructor)); \
static void cmd_register_##c(void) { cmd_register(NULL, &c); }
#define CMD_SUBCOMMAND(c,sc) \
static void cmd_register_##c_##sc(void) __attribute__((constructor)); \
static void cmd_register_##c_##sc(void) { cmd_register(&c, &sc); }
+#else /* __rtems__ */
+#define CMD_COMMAND(c) \
+ void cmd_register_##c(void) { cmd_register(NULL, &c); }
+#define CMD_SUBCOMMAND(c,sc) \
+ void cmd_register_##c##_##sc(void) { cmd_register(&c, &sc); }
+void cmd_register_admin_pass_cmd(void);
+void cmd_register_devlist_cmd(void);
+void cmd_register_firmware_cmd(void);
+void cmd_register_format_cmd(void);
+void cmd_register_identify_cmd(void);
+void cmd_register_io_pass_cmd(void);
+void cmd_register_logpage_cmd(void);
+void cmd_register_ns_cmd(void);
+void cmd_register_ns_cmd_active_cmd(void);
+void cmd_register_ns_cmd_allocated_cmd(void);
+void cmd_register_ns_cmd_attach_cmd(void);
+void cmd_register_ns_cmd_attached_cmd(void);
+void cmd_register_ns_cmd_controllers_cmd(void);
+void cmd_register_ns_cmd_create_cmd(void);
+void cmd_register_ns_cmd_delete_cmd(void);
+void cmd_register_ns_cmd_detach_cmd(void);
+void cmd_register_ns_cmd_identify_cmd(void);
+void cmd_register_nsid_cmd(void);
+void cmd_register_perftest_cmd(void);
+void cmd_register_power_cmd(void);
+void cmd_register_reset_cmd(void);
+void cmd_register_resv_cmd(void);
+void cmd_register_resv_cmd_acquire_cmd(void);
+void cmd_register_resv_cmd_register_cmd(void);
+void cmd_register_resv_cmd_release_cmd(void);
+void cmd_register_resv_cmd_report_cmd(void);
+void cmd_register_sanitize_cmd(void);
+void cmd_register_wdc_cmd(void);
+void cmd_register_wdc_cmd_cap_diag_cmd(void);
+#endif /* __rtems__ */
int arg_parse(int argc, char * const *argv, const struct cmd *f);
void arg_help(int argc, char * const *argv, const struct cmd *f);
diff --git a/freebsd/sbin/nvmecontrol/devlist.c b/freebsd/sbin/nvmecontrol/devlist.c
index 58e1153b..543c358f 100644
--- a/freebsd/sbin/nvmecontrol/devlist.c
+++ b/freebsd/sbin/nvmecontrol/devlist.c
@@ -28,6 +28,9 @@
* SUCH DAMAGE.
*/
+#ifdef __rtems__
+#include <machine/rtems-bsd-program.h>
+#endif /* __rtems__ */
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
diff --git a/freebsd/sbin/nvmecontrol/firmware.c b/freebsd/sbin/nvmecontrol/firmware.c
index 482ceb3c..0c4a264e 100644
--- a/freebsd/sbin/nvmecontrol/firmware.c
+++ b/freebsd/sbin/nvmecontrol/firmware.c
@@ -31,6 +31,9 @@
* SUCH DAMAGE.
*/
+#ifdef __rtems__
+#include <machine/rtems-bsd-program.h>
+#endif /* __rtems__ */
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
diff --git a/freebsd/sbin/nvmecontrol/format.c b/freebsd/sbin/nvmecontrol/format.c
index 95b57cb4..0ed693f9 100644
--- a/freebsd/sbin/nvmecontrol/format.c
+++ b/freebsd/sbin/nvmecontrol/format.c
@@ -27,6 +27,9 @@
* SUCH DAMAGE.
*/
+#ifdef __rtems__
+#include <machine/rtems-bsd-program.h>
+#endif /* __rtems__ */
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
diff --git a/freebsd/sbin/nvmecontrol/identify.c b/freebsd/sbin/nvmecontrol/identify.c
index 37c88c92..452494ef 100644
--- a/freebsd/sbin/nvmecontrol/identify.c
+++ b/freebsd/sbin/nvmecontrol/identify.c
@@ -29,6 +29,9 @@
* SUCH DAMAGE.
*/
+#ifdef __rtems__
+#include <machine/rtems-bsd-program.h>
+#endif /* __rtems__ */
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
diff --git a/freebsd/sbin/nvmecontrol/identify_ext.c b/freebsd/sbin/nvmecontrol/identify_ext.c
index 3f22cdf5..32156050 100644
--- a/freebsd/sbin/nvmecontrol/identify_ext.c
+++ b/freebsd/sbin/nvmecontrol/identify_ext.c
@@ -29,6 +29,9 @@
* SUCH DAMAGE.
*/
+#ifdef __rtems__
+#include <machine/rtems-bsd-program.h>
+#endif /* __rtems__ */
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
diff --git a/freebsd/sbin/nvmecontrol/logpage.c b/freebsd/sbin/nvmecontrol/logpage.c
index 1d85cfaa..6765efdd 100644
--- a/freebsd/sbin/nvmecontrol/logpage.c
+++ b/freebsd/sbin/nvmecontrol/logpage.c
@@ -32,6 +32,9 @@
* SUCH DAMAGE.
*/
+#ifdef __rtems__
+#include <machine/rtems-bsd-program.h>
+#endif /* __rtems__ */
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
diff --git a/freebsd/sbin/nvmecontrol/modules/intel/intel.c b/freebsd/sbin/nvmecontrol/modules/intel/intel.c
index 8c6c2564..1dcd3a09 100644
--- a/freebsd/sbin/nvmecontrol/modules/intel/intel.c
+++ b/freebsd/sbin/nvmecontrol/modules/intel/intel.c
@@ -31,6 +31,9 @@
* SUCH DAMAGE.
*/
+#ifdef __rtems__
+#include <machine/rtems-bsd-program.h>
+#endif /* __rtems__ */
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
@@ -48,7 +51,7 @@ __FBSDID("$FreeBSD$");
#include <unistd.h>
#include <sys/endian.h>
-#include "nvmecontrol.h"
+#include "../../nvmecontrol.h"
/*
* Intel specific log pages from
diff --git a/freebsd/sbin/nvmecontrol/modules/wdc/wdc.c b/freebsd/sbin/nvmecontrol/modules/wdc/wdc.c
index 3e8be385..81546676 100644
--- a/freebsd/sbin/nvmecontrol/modules/wdc/wdc.c
+++ b/freebsd/sbin/nvmecontrol/modules/wdc/wdc.c
@@ -25,6 +25,9 @@
* SUCH DAMAGE.
*/
+#ifdef __rtems__
+#include <machine/rtems-bsd-program.h>
+#endif /* __rtems__ */
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
@@ -41,7 +44,7 @@ __FBSDID("$FreeBSD$");
#include <string.h>
#include <unistd.h>
-#include "nvmecontrol.h"
+#include "../../nvmecontrol.h"
/* Tables for command line parsing */
diff --git a/freebsd/sbin/nvmecontrol/nc_util.c b/freebsd/sbin/nvmecontrol/nc_util.c
index 7dd5d68e..f6bf64aa 100644
--- a/freebsd/sbin/nvmecontrol/nc_util.c
+++ b/freebsd/sbin/nvmecontrol/nc_util.c
@@ -27,6 +27,9 @@
* SUCH DAMAGE.
*/
+#ifdef __rtems__
+#include <machine/rtems-bsd-program.h>
+#endif /* __rtems__ */
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
diff --git a/freebsd/sbin/nvmecontrol/ns.c b/freebsd/sbin/nvmecontrol/ns.c
index 9705706b..f01d3213 100644
--- a/freebsd/sbin/nvmecontrol/ns.c
+++ b/freebsd/sbin/nvmecontrol/ns.c
@@ -28,6 +28,9 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#ifdef __rtems__
+#include <machine/rtems-bsd-program.h>
+#endif /* __rtems__ */
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
@@ -368,7 +371,7 @@ struct ns_result_str {
const char * str;
};
-static struct ns_result_str ns_result[] = {
+static const struct ns_result_str ns_result[] = {
{ 0x2, "Invalid Field"},
{ 0xa, "Invalid Format"},
{ 0xb, "Invalid Namespace or format"},
@@ -387,7 +390,7 @@ static struct ns_result_str ns_result[] = {
static const char *
get_res_str(uint16_t res)
{
- struct ns_result_str *t = ns_result;
+ const struct ns_result_str *t = ns_result;
while (t->res != 0xFFFF) {
if (t->res == res)
diff --git a/freebsd/sbin/nvmecontrol/nsid.c b/freebsd/sbin/nvmecontrol/nsid.c
index 74ed06c8..f12b78ea 100644
--- a/freebsd/sbin/nvmecontrol/nsid.c
+++ b/freebsd/sbin/nvmecontrol/nsid.c
@@ -27,6 +27,9 @@
* SUCH DAMAGE.
*/
+#ifdef __rtems__
+#include <machine/rtems-bsd-program.h>
+#endif /* __rtems__ */
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
diff --git a/freebsd/sbin/nvmecontrol/nvmecontrol.c b/freebsd/sbin/nvmecontrol/nvmecontrol.c
index 683ce838..4fcef3b5 100644
--- a/freebsd/sbin/nvmecontrol/nvmecontrol.c
+++ b/freebsd/sbin/nvmecontrol/nvmecontrol.c
@@ -28,6 +28,11 @@
* SUCH DAMAGE.
*/
+#ifdef __rtems__
+#include <machine/rtems-bsd-program.h>
+#include <machine/rtems-bsd-commands.h>
+#include <pthread.h>
+#endif /* __rtems__ */
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
@@ -175,14 +180,68 @@ get_nsid(int fd, char **ctrlr_str, uint32_t *nsid)
*nsid = gnsid.nsid;
}
+#ifdef __rtems__
+static int main(int argc, char *argv[]);
+
+static pthread_once_t nvmecontrol_once = PTHREAD_ONCE_INIT;
+
+static void
+nvmecontrol_cmd_register(void)
+{
+
+ cmd_register_admin_pass_cmd();
+ cmd_register_devlist_cmd();
+ cmd_register_firmware_cmd();
+ cmd_register_format_cmd();
+ cmd_register_identify_cmd();
+ cmd_register_io_pass_cmd();
+ cmd_register_logpage_cmd();
+ cmd_register_ns_cmd();
+ cmd_register_ns_cmd_active_cmd();
+ cmd_register_ns_cmd_allocated_cmd();
+ cmd_register_ns_cmd_attach_cmd();
+ cmd_register_ns_cmd_attached_cmd();
+ cmd_register_ns_cmd_controllers_cmd();
+ cmd_register_ns_cmd_create_cmd();
+ cmd_register_ns_cmd_delete_cmd();
+ cmd_register_ns_cmd_detach_cmd();
+ cmd_register_ns_cmd_identify_cmd();
+ cmd_register_nsid_cmd();
+ cmd_register_power_cmd();
+ cmd_register_reset_cmd();
+ cmd_register_resv_cmd();
+ cmd_register_resv_cmd_acquire_cmd();
+ cmd_register_resv_cmd_register_cmd();
+ cmd_register_resv_cmd_release_cmd();
+ cmd_register_resv_cmd_report_cmd();
+ cmd_register_sanitize_cmd();
+}
+
+int
+rtems_bsd_command_nvmecontrol(int argc, char *argv[])
+{
+ int exit_code;
+
+ pthread_once(&nvmecontrol_once, nvmecontrol_cmd_register);
+
+ rtems_bsd_program_lock();
+ exit_code = rtems_bsd_program_call_main("nvmecontrol", main, argc,
+ argv);
+ rtems_bsd_program_unlock();
+
+ return exit_code;
+}
+#endif /* __rtems__ */
int
main(int argc, char *argv[])
{
cmd_init();
+#ifndef __rtems__
cmd_load_dir("/lib/nvmecontrol", NULL, NULL);
cmd_load_dir("/usr/local/lib/nvmecontrol", NULL, NULL);
+#endif /* __rtems__ */
cmd_dispatch(argc, argv, NULL);
diff --git a/freebsd/sbin/nvmecontrol/nvmecontrol.h b/freebsd/sbin/nvmecontrol/nvmecontrol.h
index f5dc61f2..138ca80c 100644
--- a/freebsd/sbin/nvmecontrol/nvmecontrol.h
+++ b/freebsd/sbin/nvmecontrol/nvmecontrol.h
@@ -33,6 +33,9 @@
#include <dev/nvme/nvme.h>
#include "comnd.h"
+#ifdef __rtems__
+#include <sys/ioctl.h>
+#endif /* __rtems__ */
typedef void (*print_fn_t)(const struct nvme_controller_data *cdata, void *buf, uint32_t size);
@@ -87,6 +90,7 @@ void print_intel_add_smart(const struct nvme_controller_data *cdata __unused, vo
* ints in sofware.
*/
#define UINT128_DIG 39
+#ifndef __rtems__
#ifdef __i386__
typedef uint64_t uint128_t;
#else
@@ -98,6 +102,23 @@ to128(void *p)
{
return *(uint128_t *)p;
}
+#else /* __rtems__ */
+#if __SIZEOF_LONG__ < 8
+typedef uint64_t uint128_t;
+#else
+typedef unsigned __int128 uint128_t;
+#endif
+
+static __inline uint128_t
+to128(void *p)
+{
+#if __SIZEOF_LONG__ < 8 && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
+ return *(uint128_t *)(char *)(p + 8);
+#else
+ return *(uint128_t *)p;
+#endif
+}
+#endif /* __rtems__ */
uint64_t le48dec(const void *pp);
char * uint128_to_str(uint128_t u, char *buf, size_t buflen);
diff --git a/freebsd/sbin/nvmecontrol/passthru.c b/freebsd/sbin/nvmecontrol/passthru.c
index 979cc873..5705ec1f 100644
--- a/freebsd/sbin/nvmecontrol/passthru.c
+++ b/freebsd/sbin/nvmecontrol/passthru.c
@@ -28,6 +28,9 @@
* SUCH DAMAGE.
*/
+#ifdef __rtems__
+#include <machine/rtems-bsd-program.h>
+#endif /* __rtems__ */
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
diff --git a/freebsd/sbin/nvmecontrol/perftest.c b/freebsd/sbin/nvmecontrol/perftest.c
index 6f6bacbf..5d135400 100644
--- a/freebsd/sbin/nvmecontrol/perftest.c
+++ b/freebsd/sbin/nvmecontrol/perftest.c
@@ -28,6 +28,9 @@
* SUCH DAMAGE.
*/
+#ifdef __rtems__
+#include <machine/rtems-bsd-program.h>
+#endif /* __rtems__ */
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
diff --git a/freebsd/sbin/nvmecontrol/power.c b/freebsd/sbin/nvmecontrol/power.c
index 7a02aefc..2194d9f6 100644
--- a/freebsd/sbin/nvmecontrol/power.c
+++ b/freebsd/sbin/nvmecontrol/power.c
@@ -25,6 +25,9 @@
* SUCH DAMAGE.
*/
+#ifdef __rtems__
+#include <machine/rtems-bsd-program.h>
+#endif /* __rtems__ */
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
diff --git a/freebsd/sbin/nvmecontrol/reset.c b/freebsd/sbin/nvmecontrol/reset.c
index 519594e3..ad5cfc6a 100644
--- a/freebsd/sbin/nvmecontrol/reset.c
+++ b/freebsd/sbin/nvmecontrol/reset.c
@@ -28,6 +28,9 @@
* SUCH DAMAGE.
*/
+#ifdef __rtems__
+#include <machine/rtems-bsd-program.h>
+#endif /* __rtems__ */
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
diff --git a/freebsd/sbin/nvmecontrol/resv.c b/freebsd/sbin/nvmecontrol/resv.c
index 5f615941..b22b390a 100644
--- a/freebsd/sbin/nvmecontrol/resv.c
+++ b/freebsd/sbin/nvmecontrol/resv.c
@@ -27,6 +27,9 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#ifdef __rtems__
+#include <machine/rtems-bsd-program.h>
+#endif /* __rtems__ */
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
diff --git a/freebsd/sbin/nvmecontrol/sanitize.c b/freebsd/sbin/nvmecontrol/sanitize.c
index cc8e2417..21b6927a 100644
--- a/freebsd/sbin/nvmecontrol/sanitize.c
+++ b/freebsd/sbin/nvmecontrol/sanitize.c
@@ -27,6 +27,9 @@
* SUCH DAMAGE.
*/
+#ifdef __rtems__
+#include <machine/rtems-bsd-program.h>
+#endif /* __rtems__ */
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
diff --git a/libbsd.py b/libbsd.py
index dac12d7b..d3a1174c 100644
--- a/libbsd.py
+++ b/libbsd.py
@@ -181,6 +181,7 @@ class rtems(builder.Module):
'rtems/rtems-bsd-shell-i2c.c',
'rtems/rtems-bsd-shell-ifconfig.c',
'rtems/rtems-bsd-shell-netstat.c',
+ 'rtems/rtems-bsd-shell-nvmecontrol.c',
'rtems/rtems-bsd-shell-pfctl.c',
'rtems/rtems-bsd-shell-ping.c',
'rtems/rtems-bsd-shell-route.c',
diff --git a/rtemsbsd/include/machine/rtems-bsd-commands.h b/rtemsbsd/include/machine/rtems-bsd-commands.h
index f5f2955a..c471d283 100644
--- a/rtemsbsd/include/machine/rtems-bsd-commands.h
+++ b/rtemsbsd/include/machine/rtems-bsd-commands.h
@@ -52,6 +52,8 @@ int rtems_bsd_command_ifconfig(int argc, char **argv);
int rtems_bsd_command_netstat(int argc, char **argv);
+int rtems_bsd_command_nvmecontrol(int argc, char **argv);
+
int rtems_bsd_command_pfctl(int argc, char **argv);
int rtems_bsd_command_i2c(int argc, char **argv);
diff --git a/rtemsbsd/include/rtems/netcmds-config.h b/rtemsbsd/include/rtems/netcmds-config.h
index 4d72a4fa..81f6c92e 100644
--- a/rtemsbsd/include/rtems/netcmds-config.h
+++ b/rtemsbsd/include/rtems/netcmds-config.h
@@ -57,6 +57,9 @@ extern rtems_shell_cmd_t rtems_shell_RACOON_Command;
extern rtems_shell_cmd_t rtems_shell_SETKEY_Command;
extern rtems_shell_cmd_t rtems_shell_OPENSSL_Command;
+
+extern rtems_shell_cmd_t rtems_shell_NVMECONTROL_Command;
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
diff --git a/rtemsbsd/rtems/rtems-bsd-shell-nvmecontrol.c b/rtemsbsd/rtems/rtems-bsd-shell-nvmecontrol.c
new file mode 100644
index 00000000..56ae8c41
--- /dev/null
+++ b/rtemsbsd/rtems/rtems-bsd-shell-nvmecontrol.c
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2019 embedded brains GmbH
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <rtems/netcmds-config.h>
+#include <machine/rtems-bsd-commands.h>
+
+rtems_shell_cmd_t rtems_shell_NVMECONTROL_Command = {
+ .name = "nvmecontrol",
+ .usage = "nvmecontrol [args]",
+ .topic = "net",
+ .command = rtems_bsd_command_nvmecontrol
+};