Skip to content

Commit

Permalink
CapsuleSplashDxe/CapsuleSplashDxe.c: move text on the screen, ignore …
Browse files Browse the repository at this point in the history
…errors

Reasoning for ignoring errors is that this driver gives only
informational output, and failure to do so shouldn't abort
the update process.

Signed-off-by: Krystian Hebel <[email protected]>
  • Loading branch information
krystian-hebel authored and SergiiDmytruk committed Sep 27, 2024
1 parent 985f143 commit d73ef59
Showing 1 changed file with 19 additions and 21 deletions.
40 changes: 19 additions & 21 deletions DasharoPayloadPkg/CapsuleSplashDxe/CapsuleSplashDxe.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,10 @@ SetDummyLogo (

// Note: this is horizontal baseline (aka ascender), not line height.
#define FONT_SIZE_PERCENT 5
#define FONT_SIZE(Mode) (Mode->VerticalResolution * FONT_SIZE_PERCENT / 100)
#define FONT_SIZE(Mode) ( \
(Mode->VerticalResolution * FONT_SIZE_PERCENT / 100) < SSFN_SIZE_MAX ? \
(Mode->VerticalResolution * FONT_SIZE_PERCENT / 100) : SSFN_SIZE_MAX \
)

EFI_STATUS
InitSsfn (
Expand Down Expand Up @@ -266,9 +269,10 @@ RenderTextCenteredAt (
@param[in] ImageHandle The firmware allocated handle for the EFI image.
@param[in] SystemTable A pointer to the EFI System Table.
@retval EFI_SUCCESS The entry point is executed successfully.
@retval other Some error occurs when executing this entry point.
@retval EFI_SUCCESS This is the only returned value, even in case of
errors. Reasoning is that this driver gives only
informational output, and failure to do so shouldn't
abort the update process.
**/
EFI_STATUS
EFIAPI
Expand All @@ -289,14 +293,14 @@ CapsuleSplashEntry (
(VOID **)&GraphicsOutput);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "Couldn't find GOP\n"));
return Status;
return EFI_SUCCESS;
}

ModeInfo = GraphicsOutput->Mode->Info;
if (ModeInfo->PixelFormat != PixelRedGreenBlueReserved8BitPerColor &&
ModeInfo->PixelFormat != PixelBlueGreenRedReserved8BitPerColor) {
DEBUG ((DEBUG_ERROR, "Wrong pixel format\n"));
return EFI_UNSUPPORTED;
return EFI_SUCCESS;
}

//
Expand All @@ -305,7 +309,7 @@ CapsuleSplashEntry (
Status = SetDummyLogo (ModeInfo);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "Couldn't set dummy logo\n"));
return Status;
return EFI_SUCCESS;
}

//
Expand All @@ -314,32 +318,26 @@ CapsuleSplashEntry (
Status = InitSsfn (GraphicsOutput->Mode->FrameBufferBase, ModeInfo);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "Couldn't init font renderer\n"));
return Status;
return EFI_SUCCESS;
}

//
// Clear the background. We don't know what logo was shown there, if any.
//
SetMem ((VOID *)GraphicsOutput->Mode->FrameBufferBase,
GraphicsOutput->Mode->FrameBufferSize,
0x00);
ZeroMem ((VOID *)GraphicsOutput->Mode->FrameBufferBase,
GraphicsOutput->Mode->FrameBufferSize);

//
// Print some warnings.
// Print some warnings. Ignore the result, we still want to try printing even
// if one of the earlier lines fails.
//
Status = RenderTextCenteredAt("Firmware update in progress",
ModeInfo->HorizontalResolution / 2,
ModeInfo->VerticalResolution * 20 / 100);
if (EFI_ERROR (Status)) {
return Status;
}
ModeInfo->VerticalResolution * 37 / 100);

Status = RenderTextCenteredAt("Don't turn off your platform!",
ModeInfo->HorizontalResolution / 2,
ModeInfo->VerticalResolution * 90 / 100);
if (EFI_ERROR (Status)) {
return Status;
}
ModeInfo->VerticalResolution * 88 / 100);

return Status;
return EFI_SUCCESS;
}

0 comments on commit d73ef59

Please sign in to comment.