Simon Glass | 3cfa57d | 2024-08-07 16:47:35 -0600 | [diff] [blame] | 1 | # SPDX-License-Identifier: GPL-2.0+ |
| 2 | # Copyright 2024 Google LLC |
| 3 | # |
| 4 | # Test addition of Universal Payload |
| 5 | |
| 6 | import os |
| 7 | |
| 8 | import pytest |
| 9 | import u_boot_utils |
| 10 | |
| 11 | @pytest.mark.boardspec('sandbox_vpl') |
| 12 | def test_upl_handoff(u_boot_console): |
Simon Glass | bb5541a | 2024-08-07 16:47:39 -0600 | [diff] [blame^] | 13 | """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 Glass | 3cfa57d | 2024-08-07 16:47:35 -0600 | [diff] [blame] | 22 | 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 Glass | bb5541a | 2024-08-07 16:47:39 -0600 | [diff] [blame^] | 29 | flags = ['-m', ram, '-d', fdt, '--upl'] |
Simon Glass | 3cfa57d | 2024-08-07 16:47:35 -0600 | [diff] [blame] | 30 | 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 Glass | bb5541a | 2024-08-07 16:47:39 -0600 | [diff] [blame^] | 34 | 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 |