diff --git a/SetupDataPkg/ConfApp/ConfApp.c b/SetupDataPkg/ConfApp/ConfApp.c index 9039fcdf..50c25480 100644 --- a/SetupDataPkg/ConfApp/ConfApp.c +++ b/SetupDataPkg/ConfApp/ConfApp.c @@ -357,6 +357,12 @@ ConfAppEntry ( goto Exit; } + // This will be the serial ConIn, which could have some potential noise on the line, reset it before reading + Status = mSimpleTextInEx->Reset (mSimpleTextInEx, FALSE); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "Unable to reset SimpleTextIn on ConIn. Code = %r.\n", Status)); + } + Status = GetPlatformKeyStore (&mSecureBootKeys, &mSecureBootKeysCount); if (EFI_ERROR (Status)) { DEBUG ((DEBUG_ERROR, "Failed to get platform secure boot keys. Code = %r.\n", Status)); diff --git a/SetupDataPkg/ConfApp/UnitTest/ConInConOut.c b/SetupDataPkg/ConfApp/UnitTest/ConInConOut.c index 67e19131..378aaca0 100644 --- a/SetupDataPkg/ConfApp/UnitTest/ConInConOut.c +++ b/SetupDataPkg/ConfApp/UnitTest/ConInConOut.c @@ -52,6 +52,13 @@ MockReadKey ( OUT EFI_KEY_DATA *KeyData ); +EFI_STATUS +EFIAPI +MockReset ( + IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This, + IN BOOLEAN ExtendedVerification + ); + EFI_SIMPLE_TEXT_OUTPUT_MODE MockMode = { .CursorColumn = 5, .CursorRow = 5, @@ -120,6 +127,7 @@ EFI_SYSTEM_TABLE MockSys = { }; EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL MockSimpleInput = { + .Reset = MockReset, .ReadKeyStrokeEx = MockReadKey, .WaitForKeyEx = (EFI_EVENT)(UINTN)0xDEADBEEF, }; @@ -144,3 +152,25 @@ MockReadKey ( CopyMem (KeyData, MockKey, sizeof (EFI_KEY_DATA)); return EFI_SUCCESS; } + +/** + Mock instance of Reset function. + + @param This Protocol instance pointer. + @param ExtendedVerification Driver may perform diagnostics on reset. + + @retval EFI_SUCCESS The device was reset. + @retval EFI_DEVICE_ERROR The device is not functioning properly and could not be reset. + +**/ +EFI_STATUS +EFIAPI +MockReset ( + IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This, + IN BOOLEAN ExtendedVerification + ) +{ + assert_ptr_equal (This, &MockSimpleInput); + + return EFI_SUCCESS; +}