[PATCH 21/23] video: Support virtio devices with the splash screen

Jaehoon Chung jh80.chung at samsung.com
Tue Nov 23 03:08:05 CET 2021


On 11/20/21 5:24 AM, Simon Glass wrote:
> This is useful for showing a logo when booting from qemu.
> 
> Signed-off-by: Simon Glass <sjg at chromium.org>
> ---
> 
>  common/splash_source.c | 14 ++++++++++++++
>  include/splash.h       |  1 +
>  include/virtio.h       |  1 +
>  3 files changed, 16 insertions(+)
> 
> diff --git a/common/splash_source.c b/common/splash_source.c
> index d05670f5ee8..2c03cbdf928 100644
> --- a/common/splash_source.c
> +++ b/common/splash_source.c
> @@ -20,6 +20,7 @@
>  #include <spi_flash.h>
>  #include <splash.h>
>  #include <usb.h>
> +#include <virtio.h>
>  #include <asm/global_data.h>
>  
>  DECLARE_GLOBAL_DATA_PTR;
> @@ -179,6 +180,16 @@ static inline int splash_init_sata(void)
>  }
>  #endif
>  
> +static int splash_init_virtio(void)
> +{
> +	if (!IS_ENABLED(CONFIG_VIRTIO)) {
> +		printf("Cannot load splash image: no virtio support\n");
> +		return -ENOSYS;
> +	} else {
> +		return virtio_init();
> +	}

Doesn't need to add "else" ?

Best Regards,
Jaehoon Chung

> +}
> +
>  #ifdef CONFIG_CMD_UBIFS
>  static int splash_mount_ubifs(struct splash_location *location)
>  {
> @@ -233,6 +244,9 @@ static int splash_load_fs(struct splash_location *location, u32 bmp_load_addr)
>  	if (location->storage == SPLASH_STORAGE_SATA)
>  		res = splash_init_sata();
>  
> +	if (location->storage == SPLASH_STORAGE_VIRTIO)
> +		res = splash_init_virtio();
> +
>  	if (location->ubivol != NULL)
>  		res = splash_mount_ubifs(location);
>  
> diff --git a/include/splash.h b/include/splash.h
> index 7fd2de8fea1..33e45e69416 100644
> --- a/include/splash.h
> +++ b/include/splash.h
> @@ -30,6 +30,7 @@ enum splash_storage {
>  	SPLASH_STORAGE_MMC,
>  	SPLASH_STORAGE_USB,
>  	SPLASH_STORAGE_SATA,
> +	SPLASH_STORAGE_VIRTIO,
>  };
>  
>  enum splash_flags {
> diff --git a/include/virtio.h b/include/virtio.h
> index a42bdad6b87..34e2bfdcdd3 100644
> --- a/include/virtio.h
> +++ b/include/virtio.h
> @@ -20,6 +20,7 @@
>  #ifndef __VIRTIO_H__
>  #define __VIRTIO_H__
>  
> +#include <virtio_types.h>
>  #include <linux/bitops.h>
>  #include <linux/bug.h>
>  #define VIRTIO_ID_NET		1 /* virtio net */
> 



More information about the U-Boot mailing list