blob: 3164bda6b717b7fea682df7898e9e07e2d207d8c [file] [log] [blame]
Simon Glass3cfa57d2024-08-07 16:47:35 -06001# SPDX-License-Identifier: GPL-2.0+
2# Copyright 2024 Google LLC
3#
4# Test addition of Universal Payload
5
6import os
7
8import pytest
9import u_boot_utils
10
11@pytest.mark.boardspec('sandbox_vpl')
12def test_upl_handoff(u_boot_console):
Simon Glassbb5541a2024-08-07 16:47:39 -060013 """Test of UPL handoff
14
15 This works by starting up U-Boot VPL, which gets to SPL and then sets up a
16 UPL handoff using the FIT containing U-Boot proper. It then jumps to U-Boot
17 proper and runs a test to check that the parameters are correct.
18
19 The entire FIT is loaded into memory in SPL (in upl_load_from_image()) so
20 that it can be inpected in upl_test_info_norun
21 """
Simon Glass3cfa57d2024-08-07 16:47:35 -060022 cons = u_boot_console
23 ram = os.path.join(cons.config.build_dir, 'ram.bin')
24 fdt = os.path.join(cons.config.build_dir, 'u-boot.dtb')
25
26 # Remove any existing RAM file, so we don't have old data present
27 if os.path.exists(ram):
28 os.remove(ram)
Simon Glassbb5541a2024-08-07 16:47:39 -060029 flags = ['-m', ram, '-d', fdt, '--upl']
Simon Glass3cfa57d2024-08-07 16:47:35 -060030 cons.restart_uboot_with_flags(flags, use_dtb=False)
31
32 # Make sure that Universal Payload is detected in U-Boot proper
33 output = cons.run_command('upl info')
Simon Glassbb5541a2024-08-07 16:47:39 -060034 assert 'UPL state: active' == output
35
36 # Check the FIT offsets look correct
37 output = cons.run_command('ut upl -f upl_test_info_norun')
38 assert 'Failures: 0' in output