summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorSean Anderson <[email protected]>2023-10-14 16:48:03 -0400
committerTom Rini <[email protected]>2023-10-17 20:50:52 -0400
commit53d8bf8f9cff89dabf3c6461a1edeeddd49bccc6 (patch)
treec24471df064d8184b5b6d818fc232a89ca663275 /arch
parent6ba8ecaa96cc4ede483a353b18c19715b27ba19a (diff)
test: spl: Add a test for the NET load method
Add a test for loading U-Boot over TFTP. As with other sandbox net routines, we need to initialize our packets manually since things like net_set_ether and net_set_udp_header always use "our" addresses. We use BOOTP instead of DHCP, since DHCP has a tag/length-based format which is harder to parse. Our TFTP implementation doesn't define as many constants as I'd like, so I create some here. Note that the TFTP block size is one-based, but offsets are zero-based. In order to avoid address errors, we need to set up/define some additional address information settings. dram_init_banksize would be a good candidate for settig up bi_dram, but it gets called too late in board_init_r. Signed-off-by: Sean Anderson <[email protected]> Reviewed-by: Simon Glass <[email protected]>
Diffstat (limited to 'arch')
-rw-r--r--arch/sandbox/cpu/spl.c4
-rw-r--r--arch/sandbox/include/asm/spl.h1
2 files changed, 5 insertions, 0 deletions
diff --git a/arch/sandbox/cpu/spl.c b/arch/sandbox/cpu/spl.c
index 7590f1b80a6..16b76627983 100644
--- a/arch/sandbox/cpu/spl.c
+++ b/arch/sandbox/cpu/spl.c
@@ -129,6 +129,10 @@ void spl_board_init(void)
if (!CONFIG_IS_ENABLED(UNIT_TEST))
return;
+ /* These are necessary so TFTP can use LMBs to check its load address */
+ gd->bd->bi_dram[0].start = gd->ram_base;
+ gd->bd->bi_dram[0].size = get_effective_memsize();
+
if (state->run_unittests) {
struct unit_test *tests = UNIT_TEST_ALL_START();
const int count = UNIT_TEST_ALL_COUNT();
diff --git a/arch/sandbox/include/asm/spl.h b/arch/sandbox/include/asm/spl.h
index 2f8b5fcfcfe..ab9475567e0 100644
--- a/arch/sandbox/include/asm/spl.h
+++ b/arch/sandbox/include/asm/spl.h
@@ -12,6 +12,7 @@ enum {
BOOT_DEVICE_MMC2_2,
BOOT_DEVICE_BOARD,
BOOT_DEVICE_VBE,
+ BOOT_DEVICE_CPGMAC,
};
/**