From 3c2cdb6e570b7c8f05880b12dd7bc179858f6e1f Mon Sep 17 00:00:00 2001 From: Hsuan Ting Chen Date: Tue, 2 May 2023 17:55:50 +0800 Subject: lib: Support localized text of memory_training_desc in ux_locales.c To support the localized text, we need to get the locale id by vboot APIs and read raw string content file: preram_locales located at either RO or RW. The preram_locales file follows the format: [string_name_1] [\x00] [locale_id_1] [\x00] [localized_string_1] [\x00] [locale_id_2] [\x00] [localized_string_2] ... [string_name_2] [\x00] ... This code will search for the correct localized string that its string name is `memory_training_desc` and its locale ID matches the ID vb2api returns. If no valid string found, we will try to display in English (locale ID 0). BUG=b:264666392 BRANCH=brya TEST=emerge-brya coreboot chromeos-bmpblk chromeos-bootimage Change-Id: I7e3c8d103c938a11b397c32c9228e44e31c3f01d Signed-off-by: Hsuan Ting Chen Reviewed-on: https://review.coreboot.org/c/coreboot/+/75330 Tested-by: build bot (Jenkins) Reviewed-by: Julius Werner --- src/soc/intel/alderlake/romstage/ux.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'src/soc') diff --git a/src/soc/intel/alderlake/romstage/ux.c b/src/soc/intel/alderlake/romstage/ux.c index 23fd0fef7e..af8c7832ac 100644 --- a/src/soc/intel/alderlake/romstage/ux.c +++ b/src/soc/intel/alderlake/romstage/ux.c @@ -3,9 +3,12 @@ #include #include #include +#include #include "ux.h" +#define UX_MEMORY_TRAINING_DESC "memory_training_desc" + bool ux_inform_user_of_update_operation(const char *name) { if (!CONFIG(MAINBOARD_HAS_EARLY_LIBGFXINIT) || @@ -13,10 +16,15 @@ bool ux_inform_user_of_update_operation(const char *name) return false; printk(BIOS_INFO, "Informing user on-display of %s.\n", name); - vga_write_text(VGA_TEXT_CENTER, VGA_TEXT_HORIZONTAL_MIDDLE, - (const unsigned char *) - "Your device is finishing an update. " + + const char *text = ux_locales_get_text(UX_MEMORY_TRAINING_DESC); + /* No localized text found; fallback to built-in English. */ + if (!text) + text = "Your device is finishing an update. " "This may take 1-2 minutes.\n" - "Please do not turn off your device."); + "Please do not turn off your device."; + vga_write_text(VGA_TEXT_CENTER, VGA_TEXT_HORIZONTAL_MIDDLE, + (const unsigned char *)text); + ux_locales_unmap(); return true; } -- cgit v1.2.3