Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reset ConIn on ConfApp entrypoint #317

Merged
merged 5 commits into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions SetupDataPkg/ConfApp/ConfApp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
30 changes: 30 additions & 0 deletions SetupDataPkg/ConfApp/UnitTest/ConInConOut.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -120,6 +127,7 @@ EFI_SYSTEM_TABLE MockSys = {
};

EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL MockSimpleInput = {
.Reset = MockReset,
.ReadKeyStrokeEx = MockReadKey,
.WaitForKeyEx = (EFI_EVENT)(UINTN)0xDEADBEEF,
};
Expand All @@ -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;
}
Loading