aboutsummaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2018-11-16 08:37:50 -0500
committerTom Rini <trini@konsulko.com>2018-11-16 08:37:50 -0500
commit1d6edcbfed2af33c748f2beb399810a0441888da (patch)
treefe88d63e5ef1dbe1915f90e02429e8b6934859da /cmd
parentf6206f8587fc7ec82a57dbbeb5de0f94b3c2ef49 (diff)
parent4c6e27f63c88d065a98f438085dfc36af47d3a23 (diff)
downloadu-boot-1d6edcbfed2af33c748f2beb399810a0441888da.zip
u-boot-1d6edcbfed2af33c748f2beb399810a0441888da.tar.gz
u-boot-1d6edcbfed2af33c748f2beb399810a0441888da.tar.bz2
Merge tag 'pull-14nov18' of git://git.denx.de/u-boot-dm
- virtio implementation and supporting patches - DM_FLAG_PRE_RELOC fixes - regmap improvements - minor buildman and sandbox things
Diffstat (limited to 'cmd')
-rw-r--r--cmd/Kconfig7
-rw-r--r--cmd/Makefile1
-rw-r--r--cmd/sata.c9
-rw-r--r--cmd/virtio.c38
4 files changed, 46 insertions, 9 deletions
diff --git a/cmd/Kconfig b/cmd/Kconfig
index ad14c9c..d609f9d 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -1065,6 +1065,13 @@ config CMD_USB_MASS_STORAGE
help
USB mass storage support
+config CMD_VIRTIO
+ bool "virtio"
+ depends on VIRTIO
+ default y if VIRTIO
+ help
+ VirtIO block device support
+
config CMD_AXI
bool "axi"
depends on AXI
diff --git a/cmd/Makefile b/cmd/Makefile
index ac4830a..12a1330 100644
--- a/cmd/Makefile
+++ b/cmd/Makefile
@@ -135,6 +135,7 @@ obj-$(CONFIG_CMD_UBI) += ubi.o
obj-$(CONFIG_CMD_UBIFS) += ubifs.o
obj-$(CONFIG_CMD_UNIVERSE) += universe.o
obj-$(CONFIG_CMD_UNZIP) += unzip.o
+obj-$(CONFIG_CMD_VIRTIO) += virtio.o
obj-$(CONFIG_CMD_LZMADEC) += lzmadec.o
obj-$(CONFIG_CMD_USB) += usb.o disk.o
diff --git a/cmd/sata.c b/cmd/sata.c
index 4f0c6e0..6d62ba8 100644
--- a/cmd/sata.c
+++ b/cmd/sata.c
@@ -51,7 +51,6 @@ int sata_probe(int devnum)
{
#ifdef CONFIG_AHCI
struct udevice *dev;
- struct udevice *blk;
int rc;
rc = uclass_get_device(UCLASS_AHCI, devnum, &dev);
@@ -67,14 +66,6 @@ int sata_probe(int devnum)
return CMD_RET_FAILURE;
}
- rc = blk_get_from_parent(dev, &blk);
- if (!rc) {
- struct blk_desc *desc = dev_get_uclass_platdata(blk);
-
- if (desc->lba > 0 && desc->blksz > 0)
- part_init(desc);
- }
-
return 0;
#else
return sata_initialize() < 0 ? CMD_RET_FAILURE : CMD_RET_SUCCESS;
diff --git a/cmd/virtio.c b/cmd/virtio.c
new file mode 100644
index 0000000..b7082bc
--- /dev/null
+++ b/cmd/virtio.c
@@ -0,0 +1,38 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2018, Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
+ * Copyright (C) 2018, Bin Meng <bmeng.cn@gmail.com>
+ */
+
+#include <common.h>
+#include <command.h>
+#include <dm.h>
+#include <virtio_types.h>
+#include <virtio.h>
+
+static int virtio_curr_dev;
+
+static int do_virtio(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+ if (argc == 2 && !strcmp(argv[1], "scan")) {
+ /* make sure all virtio devices are enumerated */
+ virtio_init();
+
+ return CMD_RET_SUCCESS;
+ }
+
+ return blk_common_cmd(argc, argv, IF_TYPE_VIRTIO, &virtio_curr_dev);
+}
+
+U_BOOT_CMD(
+ virtio, 8, 1, do_virtio,
+ "virtio block devices sub-system",
+ "scan - initialize virtio bus\n"
+ "virtio info - show all available virtio block devices\n"
+ "virtio device [dev] - show or set current virtio block device\n"
+ "virtio part [dev] - print partition table of one or all virtio block devices\n"
+ "virtio read addr blk# cnt - read `cnt' blocks starting at block\n"
+ " `blk#' to memory address `addr'\n"
+ "virtio write addr blk# cnt - write `cnt' blocks starting at block\n"
+ " `blk#' from memory address `addr'"
+);