[U-Boot] [PATCH 0/4] efi_loader: text protocols

This patch set fixes some problems found via the SCT.
Heinrich Schuchardt (4): efi_loader: set revision in loaded image protocol efi_loader: EFI_SIMPLE_TEXT_INPUT_PROTOCOL.Reset() efi_loader: clear screen has to reset cursor position efi_loader: EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.Reset()
include/efi_api.h | 2 ++ lib/efi_loader/efi_boottime.c | 1 + lib/efi_loader/efi_console.c | 19 +++++++++++++++++-- 3 files changed, 20 insertions(+), 2 deletions(-)

The revision number has to be set in the loaded image protocol.
The problem was detected by running the SCT in Protocol/LoadedImage/BlackBoxTest/LoadedImageBBTestMain.c:890
Signed-off-by: Heinrich Schuchardt xypron.glpk@gmx.de --- include/efi_api.h | 2 ++ lib/efi_loader/efi_boottime.c | 1 + 2 files changed, 3 insertions(+)
diff --git a/include/efi_api.h b/include/efi_api.h index 99ea2c5b69..c98cc34908 100644 --- a/include/efi_api.h +++ b/include/efi_api.h @@ -321,6 +321,8 @@ struct efi_system_table { EFI_GUID(0x5b1b31a1, 0x9562, 0x11d2, \ 0x8e, 0x3f, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b)
+#define EFI_LOADED_IMAGE_PROTOCOL_REVISION 0x1000 + struct efi_loaded_image { u32 revision; void *parent_handle; diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c index 105e80bb52..9ac8e18680 100644 --- a/lib/efi_loader/efi_boottime.c +++ b/lib/efi_loader/efi_boottime.c @@ -1484,6 +1484,7 @@ efi_status_t efi_setup_loaded_image( /* efi_exit() assumes that the handle points to the info */ obj->handle = info;
+ info->revision = EFI_LOADED_IMAGE_PROTOCOL_REVISION; info->file_path = file_path;
if (device_path) {

Implement the reset service of the EFI_SIMPLE_TEXT_INPUT_PROTOCOL.
This should resolve the error reported by the SCT in Protocol/SimpleTextIn/BlackBoxTest/SimpleTextInBBTestFunction.c:193
Signed-off-by: Heinrich Schuchardt xypron.glpk@gmx.de --- lib/efi_loader/efi_console.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/lib/efi_loader/efi_console.c b/lib/efi_loader/efi_console.c index ce66c935ec..1d52753456 100644 --- a/lib/efi_loader/efi_console.c +++ b/lib/efi_loader/efi_console.c @@ -381,7 +381,12 @@ static efi_status_t EFIAPI efi_cin_reset( bool extended_verification) { EFI_ENTRY("%p, %d", this, extended_verification); - return EFI_EXIT(EFI_UNSUPPORTED); + + /* Empty input buffer */ + while (tstc()) + getc(); + + return EFI_EXIT(EFI_SUCCESS); }
/*

After clearing the screen the cursor position is row 0, column 0.
Signed-off-by: Heinrich Schuchardt xypron.glpk@gmx.de --- lib/efi_loader/efi_console.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/lib/efi_loader/efi_console.c b/lib/efi_loader/efi_console.c index 1d52753456..3fd0d2fd51 100644 --- a/lib/efi_loader/efi_console.c +++ b/lib/efi_loader/efi_console.c @@ -335,6 +335,8 @@ static efi_status_t EFIAPI efi_cout_clear_screen( EFI_ENTRY("%p", this);
printf(ESC"[2J"); + efi_con_mode.cursor_column = 0; + efi_con_mode.cursor_row = 0;
return EFI_EXIT(EFI_SUCCESS); }

Implement the reset service of the EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.
This should resolve the error reported by the SCT in Protocol/SimpleTextOut/BlackBoxTest/SimpleTextOutBBTestFunction_uefi.c:639
Signed-off-by: Heinrich Schuchardt xypron.glpk@gmx.de --- lib/efi_loader/efi_console.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/lib/efi_loader/efi_console.c b/lib/efi_loader/efi_console.c index 3fd0d2fd51..17aced86a5 100644 --- a/lib/efi_loader/efi_console.c +++ b/lib/efi_loader/efi_console.c @@ -110,7 +110,15 @@ static efi_status_t EFIAPI efi_cout_reset( char extended_verification) { EFI_ENTRY("%p, %d", this, extended_verification); - return EFI_EXIT(EFI_UNSUPPORTED); + + /* Clear screen */ + printf(ESC "[2J"); + efi_con_mode.cursor_column = 0; + efi_con_mode.cursor_row = 0; + /* Set default colors */ + printf(ESC "[0;37;40m"); + + return EFI_EXIT(EFI_SUCCESS); }
static efi_status_t EFIAPI efi_cout_output_string(

On 07/05/2018 08:18 AM, Heinrich Schuchardt wrote:
Implement the reset service of the EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.
This should resolve the error reported by the SCT in Protocol/SimpleTextOut/BlackBoxTest/SimpleTextOutBBTestFunction_uefi.c:639
Signed-off-by: Heinrich Schuchardt xypron.glpk@gmx.de
lib/efi_loader/efi_console.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/lib/efi_loader/efi_console.c b/lib/efi_loader/efi_console.c index 3fd0d2fd51..17aced86a5 100644 --- a/lib/efi_loader/efi_console.c +++ b/lib/efi_loader/efi_console.c @@ -110,7 +110,15 @@ static efi_status_t EFIAPI efi_cout_reset( char extended_verification) { EFI_ENTRY("%p, %d", this, extended_verification);
- return EFI_EXIT(EFI_UNSUPPORTED);
- /* Clear screen */
- printf(ESC "[2J");
- efi_con_mode.cursor_column = 0;
- efi_con_mode.cursor_row = 0;
Can this just call clear_screen()?
Alex
/* Set default colors */
printf(ESC "[0;37;40m");
return EFI_EXIT(EFI_SUCCESS); }
static efi_status_t EFIAPI efi_cout_output_string(
participants (2)
-
Alexander Graf
-
Heinrich Schuchardt