Simon Glass | f1eba35 | 2022-10-20 18:23:20 -0600 | [diff] [blame] | 1 | # SPDX-License-Identifier: GPL-2.0+ |
| 2 | # Copyright 2022 Google LLC |
| 3 | # |
| 4 | # Test addition of VBE |
| 5 | |
| 6 | import os |
| 7 | |
| 8 | import pytest |
Simon Glass | fb91637 | 2025-02-09 09:07:15 -0700 | [diff] [blame] | 9 | import utils |
Simon Glass | f1eba35 | 2022-10-20 18:23:20 -0600 | [diff] [blame] | 10 | |
| 11 | @pytest.mark.boardspec('sandbox_vpl') |
| 12 | @pytest.mark.requiredtool('dtc') |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame] | 13 | def test_vbe_vpl(ubman): |
Simon Glass | 3270111 | 2025-02-09 09:07:17 -0700 | [diff] [blame] | 14 | #cmd = [ubman.config.build_dir + fname, '-v'] |
| 15 | ram = os.path.join(ubman.config.build_dir, 'ram.bin') |
| 16 | fdt = os.path.join(ubman.config.build_dir, 'arch/sandbox/dts/test.dtb') |
| 17 | image_fname = os.path.join(ubman.config.build_dir, 'image.bin') |
Simon Glass | f1eba35 | 2022-10-20 18:23:20 -0600 | [diff] [blame] | 18 | |
| 19 | # Enable firmware1 and the mmc that it uses. These are needed for the full |
| 20 | # VBE flow. |
Simon Glass | fb91637 | 2025-02-09 09:07:15 -0700 | [diff] [blame] | 21 | utils.run_and_log( |
Simon Glass | 3270111 | 2025-02-09 09:07:17 -0700 | [diff] [blame] | 22 | ubman, f'fdtput -t s {fdt} /bootstd/firmware0 status disabled') |
Simon Glass | fb91637 | 2025-02-09 09:07:15 -0700 | [diff] [blame] | 23 | utils.run_and_log( |
Simon Glass | 3270111 | 2025-02-09 09:07:17 -0700 | [diff] [blame] | 24 | ubman, f'fdtput -t s {fdt} /bootstd/firmware1 status okay') |
Simon Glass | fb91637 | 2025-02-09 09:07:15 -0700 | [diff] [blame] | 25 | utils.run_and_log( |
Simon Glass | 3270111 | 2025-02-09 09:07:17 -0700 | [diff] [blame] | 26 | ubman, f'fdtput -t s {fdt} /mmc3 status okay') |
Simon Glass | fb91637 | 2025-02-09 09:07:15 -0700 | [diff] [blame] | 27 | utils.run_and_log( |
Simon Glass | 3270111 | 2025-02-09 09:07:17 -0700 | [diff] [blame] | 28 | ubman, f'fdtput -t s {fdt} /mmc3 filename {image_fname}') |
Simon Glass | f1eba35 | 2022-10-20 18:23:20 -0600 | [diff] [blame] | 29 | |
| 30 | # Remove any existing RAM file, so we don't have old data present |
| 31 | if os.path.exists(ram): |
| 32 | os.remove(ram) |
Simon Glass | da0ed9d | 2023-04-02 14:01:25 +1200 | [diff] [blame] | 33 | flags = ['-p', image_fname, '-w', '-s', 'state.dtb'] |
Simon Glass | 3270111 | 2025-02-09 09:07:17 -0700 | [diff] [blame] | 34 | ubman.restart_uboot_with_flags(flags) |
Simon Glass | f1eba35 | 2022-10-20 18:23:20 -0600 | [diff] [blame] | 35 | |
| 36 | # Make sure that VBE was used in both VPL (to load SPL) and SPL (to load |
| 37 | # U-Boot |
Simon Glass | 3270111 | 2025-02-09 09:07:17 -0700 | [diff] [blame] | 38 | output = ubman.run_command('vbe state') |
Simon Glass | f1eba35 | 2022-10-20 18:23:20 -0600 | [diff] [blame] | 39 | assert output == 'Phases: VPL SPL' |