]> git.ipfire.org Git - thirdparty/u-boot.git/blobdiff - common/spl/spl_ext.c
part: Drop disk_partition_t typedef
[thirdparty/u-boot.git] / common / spl / spl_ext.c
index 1b8e15e37d6af1e0b06767a9780cf602c02a4ca9..954133ba84e9841b2646810f19dfe275603895f4 100644 (file)
@@ -1,15 +1,13 @@
-/*
- * SPDX-License-Identifier:    GPL-2.0+
- */
+// SPDX-License-Identifier: GPL-2.0+
 
 #include <common.h>
+#include <env.h>
 #include <spl.h>
 #include <asm/u-boot.h>
 #include <ext4fs.h>
 #include <errno.h>
 #include <image.h>
 
-#ifdef CONFIG_SPL_EXT_SUPPORT
 int spl_load_image_ext(struct spl_image_info *spl_image,
                       struct blk_desc *block_dev, int partition,
                       const char *filename)
@@ -17,10 +15,9 @@ int spl_load_image_ext(struct spl_image_info *spl_image,
        s32 err;
        struct image_header *header;
        loff_t filelen, actlen;
-       disk_partition_t part_info = {};
+       struct disk_partition part_info = {};
 
-       header = (struct image_header *)(CONFIG_SYS_TEXT_BASE -
-                                               sizeof(struct image_header));
+       header = spl_get_load_buffer(-sizeof(*header), sizeof(*header));
 
        if (part_get_info(block_dev, partition, &part_info)) {
                printf("spl: no partition table found\n");
@@ -72,7 +69,7 @@ int spl_load_image_ext_os(struct spl_image_info *spl_image,
 {
        int err;
        __maybe_unused loff_t filelen, actlen;
-       disk_partition_t part_info = {};
+       struct disk_partition part_info = {};
        __maybe_unused char *file;
 
        if (part_get_info(block_dev, partition, &part_info)) {
@@ -90,7 +87,7 @@ int spl_load_image_ext_os(struct spl_image_info *spl_image,
                return -1;
        }
 #if defined(CONFIG_SPL_ENV_SUPPORT)
-       file = getenv("falcon_args_file");
+       file = env_get("falcon_args_file");
        if (file) {
                err = ext4fs_open(file, &filelen);
                if (err < 0) {
@@ -103,7 +100,7 @@ int spl_load_image_ext_os(struct spl_image_info *spl_image,
                               file, err);
                        goto defaults;
                }
-               file = getenv("falcon_image_file");
+               file = env_get("falcon_image_file");
                if (file) {
                        err = spl_load_image_ext(spl_image, block_dev,
                                                 partition, file);
@@ -146,4 +143,3 @@ int spl_load_image_ext_os(struct spl_image_info *spl_image,
        return -ENOSYS;
 }
 #endif
-#endif