]> Git Repo - J-u-boot.git/blame - cmd/nvme.c
command: Remove the cmd_tbl_t typedef
[J-u-boot.git] / cmd / nvme.c
CommitLineData
83d290c5 1// SPDX-License-Identifier: GPL-2.0+
0adc38be
ZZ
2/*
3 * Copyright (C) 2017 NXP Semiconductors
4 * Copyright (C) 2017 Bin Meng <[email protected]>
0adc38be
ZZ
5 */
6
7#include <common.h>
e6f6f9e6 8#include <blk.h>
0adc38be
ZZ
9#include <command.h>
10#include <dm.h>
11#include <nvme.h>
0adc38be 12
fceadc14 13static int nvme_curr_dev;
0adc38be 14
09140113
SG
15static int do_nvme(struct cmd_tbl *cmdtp, int flag, int argc,
16 char *const argv[])
0adc38be
ZZ
17{
18 int ret;
19
fceadc14
BM
20 if (argc == 2) {
21 if (strncmp(argv[1], "scan", 4) == 0) {
22 ret = nvme_scan_namespace();
23 if (ret)
24 return CMD_RET_FAILURE;
0adc38be 25
fceadc14 26 return ret;
0adc38be 27 }
fceadc14
BM
28 if (strncmp(argv[1], "deta", 4) == 0) {
29 struct udevice *udev;
0adc38be 30
fceadc14
BM
31 ret = blk_get_device(IF_TYPE_NVME, nvme_curr_dev,
32 &udev);
33 if (ret < 0)
34 return CMD_RET_FAILURE;
0adc38be 35
fceadc14 36 nvme_print_info(udev);
0adc38be 37
fceadc14 38 return ret;
0adc38be 39 }
0adc38be 40 }
0adc38be 41
fceadc14 42 return blk_common_cmd(argc, argv, IF_TYPE_NVME, &nvme_curr_dev);
0adc38be
ZZ
43}
44
45U_BOOT_CMD(
fceadc14 46 nvme, 8, 1, do_nvme,
0adc38be 47 "NVM Express sub-system",
fceadc14
BM
48 "scan - scan NVMe devices\n"
49 "nvme detail - show details of current NVMe device\n"
50 "nvme info - show all available NVMe devices\n"
51 "nvme device [dev] - show or set current NVMe device\n"
52 "nvme part [dev] - print partition table of one or all NVMe devices\n"
53 "nvme read addr blk# cnt - read `cnt' blocks starting at block\n"
54 " `blk#' to memory address `addr'\n"
55 "nvme write addr blk# cnt - write `cnt' blocks starting at block\n"
56 " `blk#' from memory address `addr'"
0adc38be 57);
This page took 0.145995 seconds and 4 git commands to generate.