blk: Introduce IF_TYPE_VIRTIO
authorTuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
Mon, 15 Oct 2018 09:21:10 +0000 (02:21 -0700)
committerSimon Glass <sjg@chromium.org>
Wed, 14 Nov 2018 17:16:27 +0000 (09:16 -0800)
This adds a new block interface type for VirtIO block devices.

Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
disk/part.c
drivers/block/blk-uclass.c
include/blk.h

index 9e457a6e72ef0c5af095a7f4e1a1b8b2ba0adedf..f30f9e9187d7e679d5aa5faa225bb199388cac80 100644 (file)
@@ -150,6 +150,9 @@ void dev_print (struct blk_desc *dev_desc)
                        dev_desc->revision,
                        dev_desc->product);
                break;
+       case IF_TYPE_VIRTIO:
+               printf("%s VirtIO Block Device\n", dev_desc->vendor);
+               break;
        case IF_TYPE_DOC:
                puts("device type DOC\n");
                return;
@@ -281,6 +284,9 @@ static void print_part_header(const char *type, struct blk_desc *dev_desc)
        case IF_TYPE_NVME:
                puts ("NVMe");
                break;
+       case IF_TYPE_VIRTIO:
+               puts("VirtIO");
+               break;
        default:
                puts ("UNKNOWN");
                break;
index 76ee3db80c487ea334eeb6086b126df00aaed63f..65a766e586d610d78fd6bad56757fb32dab0823d 100644 (file)
@@ -23,6 +23,7 @@ static const char *if_typename_str[IF_TYPE_COUNT] = {
        [IF_TYPE_HOST]          = "host",
        [IF_TYPE_NVME]          = "nvme",
        [IF_TYPE_EFI]           = "efi",
+       [IF_TYPE_VIRTIO]        = "virtio",
 };
 
 static enum uclass_id if_type_uclass_id[IF_TYPE_COUNT] = {
@@ -37,6 +38,7 @@ static enum uclass_id if_type_uclass_id[IF_TYPE_COUNT] = {
        [IF_TYPE_HOST]          = UCLASS_ROOT,
        [IF_TYPE_NVME]          = UCLASS_NVME,
        [IF_TYPE_EFI]           = UCLASS_EFI,
+       [IF_TYPE_VIRTIO]        = UCLASS_VIRTIO,
 };
 
 static enum if_type if_typename_to_iftype(const char *if_typename)
index 5e94f0e096b86046f85829999d221b652c8bb616..d0c033aece0fb7986a614cef5a9176dc6bca2f44 100644 (file)
@@ -33,6 +33,7 @@ enum if_type {
        IF_TYPE_HOST,
        IF_TYPE_NVME,
        IF_TYPE_EFI,
+       IF_TYPE_VIRTIO,
 
        IF_TYPE_COUNT,                  /* Number of interface types */
 };