Sean Anderson | 430e4aa | 2023-10-14 16:48:04 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
| 2 | /* |
| 3 | * Copyright (C) 2023 Sean Anderson <seanga2@gmail.com> |
| 4 | */ |
| 5 | |
| 6 | #include <common.h> |
| 7 | #include <dm.h> |
| 8 | #include <spl.h> |
| 9 | #include <asm/io.h> |
| 10 | #include <test/spl.h> |
| 11 | #include <test/ut.h> |
| 12 | |
| 13 | static void *spl_test_nor_base; |
| 14 | |
| 15 | unsigned long spl_nor_get_uboot_base(void) |
| 16 | { |
| 17 | return virt_to_phys(spl_test_nor_base); |
| 18 | } |
| 19 | |
| 20 | static int spl_test_nor_write_image(struct unit_test_state *uts, void *img, |
| 21 | size_t img_size) |
| 22 | { |
| 23 | spl_test_nor_base = img; |
| 24 | return 0; |
| 25 | } |
| 26 | |
| 27 | static int spl_test_nor(struct unit_test_state *uts, const char *test_name, |
| 28 | enum spl_test_image type) |
| 29 | { |
| 30 | return do_spl_test_load(uts, test_name, type, |
| 31 | SPL_LOAD_IMAGE_GET(0, BOOT_DEVICE_NOR, |
| 32 | spl_nor_load_image), |
| 33 | spl_test_nor_write_image); |
| 34 | } |
| 35 | SPL_IMG_TEST(spl_test_nor, LEGACY, 0); |
| 36 | SPL_IMG_TEST(spl_test_nor, LEGACY_LZMA, 0); |
| 37 | SPL_IMG_TEST(spl_test_nor, IMX8, 0); |
| 38 | SPL_IMG_TEST(spl_test_nor, FIT_INTERNAL, 0); |
Sean Anderson | 2a5d23f | 2023-11-08 11:48:53 -0500 | [diff] [blame] | 39 | #if !IS_ENABLED(CONFIG_SPL_LOAD_FIT_FULL) |
Sean Anderson | 430e4aa | 2023-10-14 16:48:04 -0400 | [diff] [blame] | 40 | SPL_IMG_TEST(spl_test_nor, FIT_EXTERNAL, 0); |
Sean Anderson | 2a5d23f | 2023-11-08 11:48:53 -0500 | [diff] [blame] | 41 | #endif |