Add a SPLASH_STORAGE_SCSI location type that scans the SCSI bus and
loads the splash image from a file system on it, and add a matching
scsi_fs entry to default_splash_locations so that it is available
without any board code.

Signed-off-by: David Lechner <[email protected]>
---
 common/splash.c        |  6 ++++++
 common/splash_source.c | 17 +++++++++++++++++
 doc/develop/splash.rst |  1 +
 include/splash.h       |  1 +
 4 files changed, 25 insertions(+)

diff --git a/common/splash.c b/common/splash.c
index 8cc9e28ccdf..8a65ae59777 100644
--- a/common/splash.c
+++ b/common/splash.c
@@ -58,6 +58,12 @@ static struct splash_location default_splash_locations[] = {
                .flags = SPLASH_STORAGE_FS,
                .devpart = "0:1",
        },
+       {
+               .name = "scsi_fs",
+               .storage = SPLASH_STORAGE_SCSI,
+               .flags = SPLASH_STORAGE_FS,
+               .devpart = "0:1",
+       },
 };
 
 #ifdef CONFIG_VIDEO_LOGO
diff --git a/common/splash_source.c b/common/splash_source.c
index 767e4a44f28..a41b7155b8d 100644
--- a/common/splash_source.c
+++ b/common/splash_source.c
@@ -15,6 +15,7 @@
 #include <log.h>
 #include <nand.h>
 #include <sata.h>
+#include <scsi.h>
 #include <spi.h>
 #include <spi_flash.h>
 #include <splash.h>
@@ -152,6 +153,9 @@ static int splash_select_fs_dev(struct splash_location 
*location)
        case SPLASH_STORAGE_SATA:
                res = fs_set_blk_dev("sata", location->devpart, FS_TYPE_ANY);
                break;
+       case SPLASH_STORAGE_SCSI:
+               res = fs_set_blk_dev("scsi", location->devpart, FS_TYPE_ANY);
+               break;
        case SPLASH_STORAGE_NAND:
                if (location->ubivol != NULL)
                        res = fs_set_blk_dev("ubi", NULL, FS_TYPE_UBIFS);
@@ -205,6 +209,16 @@ static inline int splash_init_sata(void)
 }
 #endif
 
+static int splash_init_scsi(void)
+{
+       if (!IS_ENABLED(CONFIG_SCSI)) {
+               printf("Cannot load splash image: no SCSI support\n");
+               return -ENOSYS;
+       } else {
+               return scsi_scan(false);
+       }
+}
+
 static int splash_init_virtio(void)
 {
        if (!IS_ENABLED(CONFIG_VIRTIO)) {
@@ -269,6 +283,9 @@ static int splash_load_fs(struct splash_location *location, 
ulong bmp_load_addr)
        if (location->storage == SPLASH_STORAGE_SATA)
                res = splash_init_sata();
 
+       if (location->storage == SPLASH_STORAGE_SCSI)
+               res = splash_init_scsi();
+
        if (location->storage == SPLASH_STORAGE_VIRTIO)
                res = splash_init_virtio();
 
diff --git a/doc/develop/splash.rst b/doc/develop/splash.rst
index fe58dbf4418..50d9531a256 100644
--- a/doc/develop/splash.rst
+++ b/doc/develop/splash.rst
@@ -92,6 +92,7 @@ mmc_fs   MMC          file system        ``0:1``
 mmc_raw  MMC          raw                ``0:1``
 usb_fs   USB          file system        ``0:1``
 sata_fs  SATA         file system        ``0:1``
+scsi_fs  SCSI         file system        ``0:1``
 ======== ============ ================== ===============
 
 A board that needs different locations, other storage backends (e.g. NAND,
diff --git a/include/splash.h b/include/splash.h
index 83c6fa9767f..7671bd7e9c4 100644
--- a/include/splash.h
+++ b/include/splash.h
@@ -32,6 +32,7 @@ enum splash_storage {
        SPLASH_STORAGE_USB,
        SPLASH_STORAGE_SATA,
        SPLASH_STORAGE_VIRTIO,
+       SPLASH_STORAGE_SCSI,
 };
 
 enum splash_flags {

-- 
2.43.0

Reply via email to