blob: f53a6724e27fae5e200e774a58c1b81158b91ea1 [file] [log] [blame]
Sean Anderson430e4aa2023-10-14 16:48:04 -04001// SPDX-License-Identifier: GPL-2.0+
2/*
3 * Copyright (C) 2023 Sean Anderson <seanga2@gmail.com>
4 */
5
Sean Anderson430e4aa2023-10-14 16:48:04 -04006#include <dm.h>
7#include <spl.h>
8#include <asm/io.h>
9#include <test/spl.h>
10#include <test/ut.h>
11
12static void *spl_test_nor_base;
13
14unsigned long spl_nor_get_uboot_base(void)
15{
16 return virt_to_phys(spl_test_nor_base);
17}
18
19static 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
26static 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}
34SPL_IMG_TEST(spl_test_nor, LEGACY, 0);
35SPL_IMG_TEST(spl_test_nor, LEGACY_LZMA, 0);
36SPL_IMG_TEST(spl_test_nor, IMX8, 0);
37SPL_IMG_TEST(spl_test_nor, FIT_INTERNAL, 0);
Sean Anderson2a5d23f2023-11-08 11:48:53 -050038#if !IS_ENABLED(CONFIG_SPL_LOAD_FIT_FULL)
Sean Anderson430e4aa2023-10-14 16:48:04 -040039SPL_IMG_TEST(spl_test_nor, FIT_EXTERNAL, 0);
Sean Anderson2a5d23f2023-11-08 11:48:53 -050040#endif