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