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