Skip to content

Commit

Permalink
Merge e2d0674 into b673c31
Browse files Browse the repository at this point in the history
  • Loading branch information
kuqin12 authored Feb 21, 2024
2 parents b673c31 + e2d0674 commit c004be5
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
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;
}

0 comments on commit c004be5

Please sign in to comment.