diff options
author | Simon Glass <sjg@chromium.org> | 2023-08-14 16:40:37 -0600 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2023-08-25 13:54:33 -0400 |
commit | eb6c71b56282d3054dbffb83793e7d2c6745578e (patch) | |
tree | 0ad2e2b829a5afca3442eb2f58b09a6fb635b582 /test | |
parent | bcf2b7202e960e7fb3df8d5e8ed0d6fa00a5a9fa (diff) | |
download | u-boot-eb6c71b56282d3054dbffb83793e7d2c6745578e.zip u-boot-eb6c71b56282d3054dbffb83793e7d2c6745578e.tar.gz u-boot-eb6c71b56282d3054dbffb83793e7d2c6745578e.tar.bz2 |
expo: cedit: Support writing settings to CMOS RAM
Add a command to write cedit settings to CMOS RAM so that it can be
preserved across a reboot. This uses a simple bit-encoding, where each
field has a 'bit position' and a 'bit length' in the schema.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'test')
-rw-r--r-- | test/boot/cedit.c | 30 | ||||
-rw-r--r-- | test/boot/files/expo_layout.dts | 5 |
2 files changed, 35 insertions, 0 deletions
diff --git a/test/boot/cedit.c b/test/boot/cedit.c index 7cf0c3e..010aae6 100644 --- a/test/boot/cedit.c +++ b/test/boot/cedit.c @@ -155,3 +155,33 @@ static int cedit_env(struct unit_test_state *uts) return 0; } BOOTSTD_TEST(cedit_env, 0); + +/* Check the cedit write_cmos and read_cmos commands */ +static int cedit_cmos(struct unit_test_state *uts) +{ + struct scene_obj_menu *menu, *menu2; + struct video_priv *vid_priv; + extern struct expo *cur_exp; + struct scene *scn; + + console_record_reset_enable(); + ut_assertok(run_command("cedit load hostfs - cedit.dtb", 0)); + + ut_asserteq(ID_SCENE1, cedit_prepare(cur_exp, &vid_priv, &scn)); + + /* get the menus to fiddle with */ + menu = scene_obj_find(scn, ID_CPU_SPEED, SCENEOBJT_MENU); + ut_assertnonnull(menu); + menu->cur_item_id = ID_CPU_SPEED_2; + + menu2 = scene_obj_find(scn, ID_POWER_LOSS, SCENEOBJT_MENU); + ut_assertnonnull(menu2); + menu2->cur_item_id = ID_AC_MEMORY; + + ut_assertok(run_command("cedit write_cmos -v", 0)); + ut_assert_nextlinen("Write 2 bytes from offset 80 to 84"); + ut_assert_console_end(); + + return 0; +} +BOOTSTD_TEST(cedit_cmos, 0); diff --git a/test/boot/files/expo_layout.dts b/test/boot/files/expo_layout.dts index 913140b..cb2a674 100644 --- a/test/boot/files/expo_layout.dts +++ b/test/boot/files/expo_layout.dts @@ -38,6 +38,9 @@ /* IDs for the menu items */ item-id = <ID_CPU_SPEED_1 ID_CPU_SPEED_2 ID_CPU_SPEED_3>; + + start-bit = <0x400>; + bit-length = <2>; }; power-loss { @@ -49,6 +52,8 @@ "Memory"; item-id = <ID_AC_OFF ID_AC_ON ID_AC_MEMORY>; + start-bit = <0x422>; + bit-length = <2>; }; }; }; |