diff options
author | edisonhello <edisonhello@google.com> | 2021-07-29 17:52:49 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-09-14 08:02:58 +0000 |
commit | 3d7ad1b873803a2be9dd358c6313aa59a2c9b3bc (patch) | |
tree | 55c3f03d7214f7ca25dbc716c02219c0dcc73426 /firmware | |
parent | c5a482edd53d705c8eb78eb1472eae2105d4c68f (diff) | |
download | vboot-3d7ad1b873803a2be9dd358c6313aa59a2c9b3bc.tar.gz |
vboot/ui: Rename UI functions
Prepare for copying UI functions to depthcharge.
Rename UI functions which will be copied to depthcharge in vboot
in order to avoid linking time error after copying the functions.
BUG=b:172339016
TEST=export CC=x86_64-pc-linux-gnu-clang DEBUG=1 DETACHABLE=0; \
make -j test_setup && make -j runtests
TEST=export CC=x86_64-pc-linux-gnu-clang DEBUG=1 DETACHABLE=1; \
make -j test_setup && make -j runtests
TEST=Hayato booted into developer mode
BRANCH=none
Change-Id: I840de3121dc2ccd8f6d05ec8a1538c3761f806da
Signed-off-by: edisonhello <edisonhello@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3060558
Reviewed-by: Julius Werner <jwerner@chromium.org>
Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/2lib/2ui.c | 36 | ||||
-rw-r--r-- | firmware/2lib/2ui_screens.c | 12 | ||||
-rw-r--r-- | firmware/2lib/include/2ui.h | 2 | ||||
-rw-r--r-- | firmware/2lib/include/2ui_private.h | 17 |
4 files changed, 35 insertions, 32 deletions
diff --git a/firmware/2lib/2ui.c b/firmware/2lib/2ui.c index 9b8a9225..83dcde07 100644 --- a/firmware/2lib/2ui.c +++ b/firmware/2lib/2ui.c @@ -25,7 +25,7 @@ * @param ui UI context pointer * @return VB2_REQUEST_SHUTDOWN if shutdown needed, or VB2_SUCCESS */ -vb2_error_t check_shutdown_request(struct vb2_ui_context *ui) +vb2_error_t vb2_check_shutdown_request(struct vb2_ui_context *ui) { uint32_t shutdown_request = VbExIsShutdownRequested(); @@ -68,7 +68,7 @@ vb2_error_t check_shutdown_request(struct vb2_ui_context *ui) /*****************************************************************************/ /* Error action functions */ -vb2_error_t error_exit_action(struct vb2_ui_context *ui) +vb2_error_t vb2_error_exit_action(struct vb2_ui_context *ui) { /* * If an error message is currently shown on the screen, any @@ -85,7 +85,7 @@ vb2_error_t error_exit_action(struct vb2_ui_context *ui) /*****************************************************************************/ /* Menu navigation functions */ -const struct vb2_menu *get_menu(struct vb2_ui_context *ui) +const struct vb2_menu *vb2_get_menu(struct vb2_ui_context *ui) { const struct vb2_menu *menu; static const struct vb2_menu empty_menu = { @@ -100,7 +100,7 @@ const struct vb2_menu *get_menu(struct vb2_ui_context *ui) } } -vb2_error_t menu_navigation_action(struct vb2_ui_context *ui) +vb2_error_t vb2_menu_navigation_action(struct vb2_ui_context *ui) { uint32_t key = ui->key; @@ -157,7 +157,7 @@ vb2_error_t vb2_ui_menu_next(struct vb2_ui_context *ui) if (!DETACHABLE && ui->key == VB_BUTTON_VOL_DOWN_SHORT_PRESS) return VB2_SUCCESS; - menu = get_menu(ui); + menu = vb2_get_menu(ui); item = ui->state->selected_item + 1; while (item < menu->num_items && VB2_GET_BIT(ui->state->hidden_item_mask, item)) @@ -177,7 +177,7 @@ vb2_error_t vb2_ui_menu_select(struct vb2_ui_context *ui) if (!DETACHABLE && ui->key == VB_BUTTON_POWER_SHORT_PRESS) return VB2_SUCCESS; - menu = get_menu(ui); + menu = vb2_get_menu(ui); if (menu->num_items == 0) return VB2_SUCCESS; @@ -227,7 +227,7 @@ vb2_error_t vb2_ui_screen_back(struct vb2_ui_context *ui) static vb2_error_t default_screen_init(struct vb2_ui_context *ui) { - const struct vb2_menu *menu = get_menu(ui); + const struct vb2_menu *menu = vb2_get_menu(ui); ui->state->selected_item = 0; if (menu->num_items > 1 && menu->items[0].is_language_select) ui->state->selected_item = 1; @@ -331,7 +331,7 @@ static vb2_error_t ui_loop_impl( /* Redraw on a screen request to refresh. */ ui.force_display) { - menu = get_menu(&ui); + menu = vb2_get_menu(&ui); VB2_DEBUG("<%s> menu item <%s>\n", ui.state->screen->name, menu->num_items ? @@ -365,14 +365,14 @@ static vb2_error_t ui_loop_impl( ui.key_trusted = !!(key_flags & VB_KEY_FLAG_TRUSTED_KEYBOARD); /* Check for shutdown request. */ - rv = check_shutdown_request(&ui); + rv = vb2_check_shutdown_request(&ui); if (rv && rv != VB2_REQUEST_UI_CONTINUE) { VB2_DEBUG("Shutdown requested!\n"); return rv; } /* Check if we need to exit an error box. */ - rv = error_exit_action(&ui); + rv = vb2_error_exit_action(&ui); if (rv && rv != VB2_REQUEST_UI_CONTINUE) return rv; @@ -384,7 +384,7 @@ static vb2_error_t ui_loop_impl( } /* Run menu navigation action. */ - rv = menu_navigation_action(&ui); + rv = vb2_menu_navigation_action(&ui); if (rv && rv != VB2_REQUEST_UI_CONTINUE) return rv; @@ -404,8 +404,8 @@ static vb2_error_t ui_loop_impl( return VB2_SUCCESS; } -vb2_error_t ui_loop(struct vb2_context *ctx, enum vb2_screen root_screen_id, - vb2_error_t (*global_action)(struct vb2_ui_context *ui)) +vb2_error_t vb2_ui_loop(struct vb2_context *ctx, enum vb2_screen root_screen_id, + vb2_error_t (*global_action)(struct vb2_ui_context *ui)) { vb2_error_t rv = ui_loop_impl(ctx, root_screen_id, global_action); if (rv == VB2_REQUEST_UI_EXIT) @@ -423,7 +423,7 @@ vb2_error_t vb2_developer_menu(struct vb2_context *ctx) VB2_DEBUG("WARNING: Dev boot not allowed; forcing to-norm\n"); root_screen_id = VB2_SCREEN_DEVELOPER_TO_NORM; } - return ui_loop(ctx, root_screen_id, developer_action); + return vb2_ui_loop(ctx, root_screen_id, developer_action); } vb2_error_t developer_action(struct vb2_ui_context *ui) @@ -455,7 +455,8 @@ vb2_error_t developer_action(struct vb2_ui_context *ui) vb2_error_t vb2_broken_recovery_menu(struct vb2_context *ctx) { - return ui_loop(ctx, VB2_SCREEN_RECOVERY_BROKEN, broken_recovery_action); + return vb2_ui_loop(ctx, VB2_SCREEN_RECOVERY_BROKEN, + broken_recovery_action); } vb2_error_t broken_recovery_action(struct vb2_ui_context *ui) @@ -472,7 +473,8 @@ vb2_error_t broken_recovery_action(struct vb2_ui_context *ui) vb2_error_t vb2_manual_recovery_menu(struct vb2_context *ctx) { - return ui_loop(ctx, VB2_SCREEN_RECOVERY_SELECT, manual_recovery_action); + return vb2_ui_loop(ctx, VB2_SCREEN_RECOVERY_SELECT, + manual_recovery_action); } vb2_error_t manual_recovery_action(struct vb2_ui_context *ui) @@ -509,5 +511,5 @@ vb2_error_t manual_recovery_action(struct vb2_ui_context *ui) vb2_error_t vb2_diagnostic_menu(struct vb2_context *ctx) { - return ui_loop(ctx, VB2_SCREEN_DIAGNOSTICS, NULL); + return vb2_ui_loop(ctx, VB2_SCREEN_DIAGNOSTICS, NULL); } diff --git a/firmware/2lib/2ui_screens.c b/firmware/2lib/2ui_screens.c index d6ee6839..af273d12 100644 --- a/firmware/2lib/2ui_screens.c +++ b/firmware/2lib/2ui_screens.c @@ -195,7 +195,7 @@ static vb2_error_t language_select_action(struct vb2_ui_context *ui) return vb2_ui_screen_back(ui); } -const struct vb2_menu *get_language_menu(struct vb2_ui_context *ui) +const struct vb2_menu *vb2_get_language_menu(struct vb2_ui_context *ui) { int i; uint32_t num_locales; @@ -228,7 +228,7 @@ const struct vb2_menu *get_language_menu(struct vb2_ui_context *ui) static vb2_error_t language_select_init(struct vb2_ui_context *ui) { - const struct vb2_menu *menu = get_menu(ui); + const struct vb2_menu *menu = vb2_get_menu(ui); if (menu->num_items == 0) { VB2_DEBUG("ERROR: No menu items found; " "rejecting entering language selection screen\n"); @@ -248,7 +248,7 @@ static const struct vb2_screen_info language_select_screen = { .id = VB2_SCREEN_LANGUAGE_SELECT, .name = "Language selection screen", .init = language_select_init, - .get_menu = get_language_menu, + .get_menu = vb2_get_language_menu, }; /******************************************************************************/ @@ -272,7 +272,7 @@ static const struct vb2_screen_info recovery_broken_screen = { #define ADVANCED_OPTIONS_ITEM_DEVELOPER_MODE 1 #define ADVANCED_OPTIONS_ITEM_DEBUG_INFO 2 -vb2_error_t advanced_options_init(struct vb2_ui_context *ui) +vb2_error_t vb2_advanced_options_init(struct vb2_ui_context *ui) { ui->state->selected_item = ADVANCED_OPTIONS_ITEM_DEVELOPER_MODE; if (vb2_get_sd(ui->ctx)->flags & VB2_SD_FLAG_DEV_MODE_ENABLED || @@ -306,7 +306,7 @@ static const struct vb2_menu_item advanced_options_items[] = { static const struct vb2_screen_info advanced_options_screen = { .id = VB2_SCREEN_ADVANCED_OPTIONS, .name = "Advanced options", - .init = advanced_options_init, + .init = vb2_advanced_options_init, .menu = MENU_ITEMS(advanced_options_items), }; @@ -943,7 +943,7 @@ static const struct vb2_menu_item developer_select_bootloader_items_after[] = { static vb2_error_t developer_select_bootloader_init(struct vb2_ui_context *ui) { - if (get_menu(ui)->num_items == 0) + if (vb2_get_menu(ui)->num_items == 0) return set_ui_error_and_go_back(ui, VB2_UI_ERROR_ALTFW_EMPTY); /* Select the first bootloader. */ ui->state->selected_item = diff --git a/firmware/2lib/include/2ui.h b/firmware/2lib/include/2ui.h index bfb2b8b7..55ff5749 100644 --- a/firmware/2lib/include/2ui.h +++ b/firmware/2lib/include/2ui.h @@ -98,7 +98,7 @@ struct vb2_ui_context { uint32_t key; int key_trusted; - /* For check_shutdown_request. */ + /* For vb2_check_shutdown_request. */ enum vb2_power_button power_button; /* For developer mode. */ diff --git a/firmware/2lib/include/2ui_private.h b/firmware/2lib/include/2ui_private.h index 6ce6cf80..79cdd1b7 100644 --- a/firmware/2lib/include/2ui_private.h +++ b/firmware/2lib/include/2ui_private.h @@ -19,19 +19,20 @@ #define DEV_DELAY_BEEP2_MS (20 * VB2_MSEC_PER_SEC + 500) /* 20.5 seconds */ /* From 2ui.c */ -vb2_error_t check_shutdown_request(struct vb2_ui_context *ui); -const struct vb2_menu *get_menu(struct vb2_ui_context *ui); -vb2_error_t error_exit_action(struct vb2_ui_context *ui); -vb2_error_t menu_navigation_action(struct vb2_ui_context *ui); -vb2_error_t ui_loop(struct vb2_context *ctx, enum vb2_screen root_screen_id, - vb2_error_t (*global_action)(struct vb2_ui_context *ui)); +vb2_error_t vb2_check_shutdown_request(struct vb2_ui_context *ui); +const struct vb2_menu *vb2_get_menu(struct vb2_ui_context *ui); +vb2_error_t vb2_error_exit_action(struct vb2_ui_context *ui); +vb2_error_t vb2_menu_navigation_action(struct vb2_ui_context *ui); +vb2_error_t +vb2_ui_loop(struct vb2_context *ctx, enum vb2_screen root_screen_id, + vb2_error_t (*global_action)(struct vb2_ui_context *ui)); vb2_error_t developer_action(struct vb2_ui_context *ui); vb2_error_t broken_recovery_action(struct vb2_ui_context *ui); vb2_error_t manual_recovery_action(struct vb2_ui_context *ui); /* From 2ui_screens.c */ -const struct vb2_menu *get_language_menu(struct vb2_ui_context *ui); -vb2_error_t advanced_options_init(struct vb2_ui_context *ui); +const struct vb2_menu *vb2_get_language_menu(struct vb2_ui_context *ui); +vb2_error_t vb2_advanced_options_init(struct vb2_ui_context *ui); vb2_error_t recovery_select_init(struct vb2_ui_context *ui); vb2_error_t recovery_to_dev_init(struct vb2_ui_context *ui); vb2_error_t recovery_to_dev_confirm_action(struct vb2_ui_context *ui); |