From 722bc5b5d901eafb96e8530cc7cf3036bff398a4 Mon Sep 17 00:00:00 2001 From: Anastasiia Lukianenko Date: Thu, 6 Aug 2020 12:42:55 +0300 Subject: xen: pvblock: Add initial support for para-virtualized block driver Add initial infrastructure for Xen para-virtualized block device. This includes compile-time configuration and the skeleton for the future driver implementation. Add new class UCLASS_PVBLOCK which is going to be a parent for virtual block devices. Add new interface type IF_TYPE_PVBLOCK. Implement basic driver setup by reading XenStore configuration. Signed-off-by: Andrii Anisov Signed-off-by: Anastasiia Lukianenko Signed-off-by: Oleksandr Andrushchenko --- cmd/Kconfig | 7 +++++++ cmd/Makefile | 1 + cmd/pvblock.c | 30 ++++++++++++++++++++++++++++++ 3 files changed, 38 insertions(+) create mode 100644 cmd/pvblock.c (limited to 'cmd') diff --git a/cmd/Kconfig b/cmd/Kconfig index 23d7e27..9ad511a 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -1370,6 +1370,13 @@ config CMD_USB_MASS_STORAGE help USB mass storage support +config CMD_PVBLOCK + bool "Xen para-virtualized block device" + depends on XEN + select PVBLOCK + help + Xen para-virtualized block device support + config CMD_VIRTIO bool "virtio" depends on VIRTIO diff --git a/cmd/Makefile b/cmd/Makefile index ef2a22f..3a9c974 100644 --- a/cmd/Makefile +++ b/cmd/Makefile @@ -174,6 +174,7 @@ obj-$(CONFIG_CMD_DFU) += dfu.o obj-$(CONFIG_CMD_GPT) += gpt.o obj-$(CONFIG_CMD_ETHSW) += ethsw.o obj-$(CONFIG_CMD_AXI) += axi.o +obj-$(CONFIG_CMD_PVBLOCK) += pvblock.o # Power obj-$(CONFIG_CMD_PMIC) += pmic.o diff --git a/cmd/pvblock.c b/cmd/pvblock.c new file mode 100644 index 0000000..4e99b06 --- /dev/null +++ b/cmd/pvblock.c @@ -0,0 +1,30 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * (C) Copyright 2020 EPAM Systems Inc. + * + * XEN para-virtualized block device support + */ + +#include +#include +#include + +/* Current I/O Device */ +static int pvblock_curr_device; + +int do_pvblock(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) +{ + return blk_common_cmd(argc, argv, IF_TYPE_PVBLOCK, + &pvblock_curr_device); +} + +U_BOOT_CMD(pvblock, 5, 1, do_pvblock, + "Xen para-virtualized block device", + "info - show available block devices\n" + "pvblock device [dev] - show or set current device\n" + "pvblock part [dev] - print partition table of one or all devices\n" + "pvblock read addr blk# cnt\n" + "pvblock write addr blk# cnt - read/write `cnt'" + " blocks starting at block `blk#'\n" + " to/from memory address `addr'"); + -- cgit v1.1