]>
Commit | Line | Data |
---|---|---|
78e12901 TT |
1 | // SPDX-License-Identifier: GPL-2.0+ |
2 | /* | |
3 | * Copyright (C) 2018, Tuomas Tynkkynen <[email protected]> | |
4 | * Copyright (C) 2018, Bin Meng <[email protected]> | |
5 | */ | |
6 | ||
7 | #include <common.h> | |
e6f6f9e6 | 8 | #include <blk.h> |
78e12901 TT |
9 | #include <command.h> |
10 | #include <dm.h> | |
11 | #include <virtio_types.h> | |
12 | #include <virtio.h> | |
13 | ||
14 | static int virtio_curr_dev; | |
15 | ||
09140113 SG |
16 | static int do_virtio(struct cmd_tbl *cmdtp, int flag, int argc, |
17 | char *const argv[]) | |
78e12901 TT |
18 | { |
19 | if (argc == 2 && !strcmp(argv[1], "scan")) { | |
20 | /* make sure all virtio devices are enumerated */ | |
21 | virtio_init(); | |
22 | ||
23 | return CMD_RET_SUCCESS; | |
24 | } | |
25 | ||
26 | return blk_common_cmd(argc, argv, IF_TYPE_VIRTIO, &virtio_curr_dev); | |
27 | } | |
28 | ||
29 | U_BOOT_CMD( | |
30 | virtio, 8, 1, do_virtio, | |
31 | "virtio block devices sub-system", | |
32 | "scan - initialize virtio bus\n" | |
33 | "virtio info - show all available virtio block devices\n" | |
34 | "virtio device [dev] - show or set current virtio block device\n" | |
35 | "virtio part [dev] - print partition table of one or all virtio block devices\n" | |
36 | "virtio read addr blk# cnt - read `cnt' blocks starting at block\n" | |
37 | " `blk#' to memory address `addr'\n" | |
38 | "virtio write addr blk# cnt - write `cnt' blocks starting at block\n" | |
39 | " `blk#' from memory address `addr'" | |
40 | ); |