Enable Grahpics Console during firmware update
This patch enables graphics console when entering FWU payload. FWU progress will show on both graphics console and serial port. Signed-off-by: kokweich <kok.wei.chan@intel.com>
This commit is contained in:
parent
b64aa3f51f
commit
dabb3143d1
|
@ -414,6 +414,7 @@
|
|||
PayloadPkg/FirmwareUpdate/FirmwareUpdate.inf {
|
||||
<PcdsFixedAtBuild>
|
||||
gPlatformCommonLibTokenSpaceGuid.PcdDebugOutputDeviceMask | $(DEBUG_OUTPUT_DEVICE_MASK)
|
||||
gPlatformCommonLibTokenSpaceGuid.PcdConsoleOutDeviceMask | ($(CONSOLE_OUT_DEVICE_MASK) + 0x02)
|
||||
<LibraryClasses>
|
||||
MemoryAllocationLib | BootloaderCommonPkg/Library/FullMemoryAllocationLib/FullMemoryAllocationLib.inf
|
||||
PayloadEntryLib | PayloadPkg/Library/PayloadEntryLib/PayloadEntryLib.inf
|
||||
|
|
|
@ -26,6 +26,9 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||
#include <Library/BootloaderCommonLib.h>
|
||||
#include <Library/FirmwareUpdateLib.h>
|
||||
#include <Guid/SystemResourceTable.h>
|
||||
#include <Library/GraphicsLib.h>
|
||||
#include <Library/ConsoleOutLib.h>
|
||||
#include <Guid/OsBootOptionGuid.h>
|
||||
#include "FirmwareUpdateHelper.h"
|
||||
|
||||
UINT32 mSblImageBiosRgnOffset;
|
||||
|
@ -1205,6 +1208,47 @@ EndFirmwareUpdate (
|
|||
return Status;
|
||||
}
|
||||
|
||||
/**
|
||||
Initialize platform console.
|
||||
|
||||
@retval EFI_NOT_FOUND No additional console was found.
|
||||
@retval EFI_SUCCESS Console has been initialized successfully.
|
||||
@retval Others There is error during console initialization.
|
||||
**/
|
||||
EFI_STATUS
|
||||
InitConsole (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINT32 Height;
|
||||
UINT32 Width;
|
||||
UINT32 OffX;
|
||||
UINT32 OffY;
|
||||
EFI_PEI_GRAPHICS_INFO_HOB *GfxInfoHob;
|
||||
|
||||
Status = EFI_NOT_FOUND;
|
||||
|
||||
if (PcdGet32 (PcdConsoleOutDeviceMask) & ConsoleOutFrameBuffer) {
|
||||
GfxInfoHob = (EFI_PEI_GRAPHICS_INFO_HOB *)GetGuidHobData (NULL, NULL, &gEfiGraphicsInfoHobGuid);
|
||||
if (GfxInfoHob != NULL) {
|
||||
Width = GfxInfoHob->GraphicsMode.HorizontalResolution;
|
||||
Height = GfxInfoHob->GraphicsMode.VerticalResolution;
|
||||
if ((PcdGet32 (PcdFrameBufferMaxConsoleWidth) > 0) && (Width > PcdGet32 (PcdFrameBufferMaxConsoleWidth))) {
|
||||
Width = PcdGet32 (PcdFrameBufferMaxConsoleWidth);
|
||||
}
|
||||
if ((PcdGet32 (PcdFrameBufferMaxConsoleHeight) > 0) && (Height > PcdGet32 (PcdFrameBufferMaxConsoleHeight))) {
|
||||
Height = PcdGet32 (PcdFrameBufferMaxConsoleHeight);
|
||||
}
|
||||
OffX = (GfxInfoHob->GraphicsMode.HorizontalResolution - Width) / 2;
|
||||
OffY = (GfxInfoHob->GraphicsMode.VerticalResolution - Height) / 2;
|
||||
Status = InitFrameBufferConsole (GfxInfoHob, Width, Height, OffX, OffY);
|
||||
}
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
/**
|
||||
Payload main entry.
|
||||
|
||||
|
@ -1227,7 +1271,12 @@ PayloadMain (
|
|||
EFI_STATUS Status;
|
||||
UINT32 BiosRgnSize;
|
||||
|
||||
DEBUG ((DEBUG_INFO, "Starting Firmware Update\n"));
|
||||
//
|
||||
// Prepare Console Print
|
||||
//
|
||||
InitConsole ();
|
||||
ConsolePrint ("Starting Firmware Update\n");
|
||||
|
||||
//
|
||||
// Initialize boot media to look for the capsule image
|
||||
//
|
||||
|
@ -1239,6 +1288,7 @@ PayloadMain (
|
|||
FlashMap = GetFlashMapPtr();
|
||||
if (FlashMap == NULL) {
|
||||
DEBUG((DEBUG_ERROR, "Could not get flash map\n"));
|
||||
Status = EFI_NO_MAPPING;
|
||||
goto EndOfFwu;
|
||||
}
|
||||
|
||||
|
@ -1248,6 +1298,7 @@ PayloadMain (
|
|||
Status = GetComponentInfoByPartition (FLASH_MAP_SIG_BLRESERVED, FALSE, &RsvdBase, &RsvdSize);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG((DEBUG_ERROR, "Could not get component information for bootloader reserved region\n"));
|
||||
Status = EFI_NO_MAPPING;
|
||||
goto EndOfFwu;
|
||||
}
|
||||
|
||||
|
@ -1296,10 +1347,8 @@ EndOfFwu:
|
|||
//
|
||||
// Terminate firmware update
|
||||
//
|
||||
Status = EndFirmwareUpdate ();
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG((DEBUG_ERROR, "EndFirmwareUpdate, Status = 0x%x\n", Status));
|
||||
}
|
||||
ConsolePrint ("Exiting Firmware Update (Status: %r)\n", Status);
|
||||
EndFirmwareUpdate ();
|
||||
|
||||
Reboot (EfiResetCold);
|
||||
}
|
||||
|
|
|
@ -50,6 +50,7 @@
|
|||
ContainerLib
|
||||
StringSupportLib
|
||||
BootOptionLib
|
||||
TimerLib
|
||||
|
||||
[Guids]
|
||||
gLoaderMemoryMapInfoGuid
|
||||
|
@ -60,6 +61,7 @@
|
|||
gFlashMapInfoGuid
|
||||
gBootLoaderVersionFileGuid
|
||||
gBootLoaderVersionGuid
|
||||
gEfiGraphicsInfoHobGuid
|
||||
|
||||
[Pcd]
|
||||
gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress
|
||||
|
@ -69,6 +71,9 @@
|
|||
gPlatformCommonLibTokenSpaceGuid.PcdLowestSupportedFwVer
|
||||
gPayloadTokenSpaceGuid.PcdCsmeUpdateEnabled
|
||||
gPlatformCommonLibTokenSpaceGuid.PcdCompSignHashAlg
|
||||
gPlatformCommonLibTokenSpaceGuid.PcdConsoleOutDeviceMask
|
||||
gPlatformCommonLibTokenSpaceGuid.PcdFrameBufferMaxConsoleWidth
|
||||
gPlatformCommonLibTokenSpaceGuid.PcdFrameBufferMaxConsoleHeight
|
||||
|
||||
[Depex]
|
||||
TRUE
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
#include <Library/DecompressLib.h>
|
||||
#include <Library/ConfigDataLib.h>
|
||||
#include <Library/LiteFvLib.h>
|
||||
#include <Library/ConsoleOutLib.h>
|
||||
#include <Library/TimerLib.h>
|
||||
#include "FirmwareUpdateHelper.h"
|
||||
#include <Service/SpiFlashService.h>
|
||||
|
||||
|
@ -425,16 +427,16 @@ UpdateBootRegion (
|
|||
UpdateBlockSize = SIZE_64KB;
|
||||
}
|
||||
}
|
||||
DEBUG ((DEBUG_INIT, "Updating 0x%08llx, Size:0x%05x\n", UpdateAddress, UpdateBlockSize));
|
||||
ConsolePrint ("Updating 0x%08llx, Size:0x%06x\n", UpdateAddress, UpdateBlockSize);
|
||||
Status = UpdateRegionBlock (UpdateAddress, Buffer, UpdateBlockSize);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_ERROR, "\nFailed! Address=0x%08llx, Status = %r\n", UpdateAddress, Status));
|
||||
ConsolePrint ("\nFailed at address 0x%08llx, status: %r\n", UpdateAddress, Status);
|
||||
return Status;
|
||||
}
|
||||
UpdateAddress += UpdateBlockSize;
|
||||
Buffer += UpdateBlockSize;
|
||||
UpdatedSize += UpdateBlockSize;
|
||||
DEBUG ((DEBUG_INIT, "\nFinished %3d%%\n", (WrittenSize + UpdatedSize) * 100 / TotalSize));
|
||||
ConsolePrint ("\nFinished %3d%%\n", (WrittenSize + UpdatedSize) * 100 / TotalSize);
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
|
@ -1052,7 +1054,8 @@ Reboot (
|
|||
IN EFI_RESET_TYPE ResetType
|
||||
)
|
||||
{
|
||||
DEBUG ((DEBUG_INFO, "Reset required to proceed with the firmware update.\n\n"));
|
||||
ConsolePrint("Reset required to proceed.\n\n");
|
||||
MicroSecondDelay (3000000);
|
||||
ResetSystem (ResetType);
|
||||
CpuDeadLoop ();
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ def get_check_lines (bp = 0, mode = 0):
|
|||
"===========Read Capsule Image============",
|
||||
"Boot from partition %s, update partition %s" % (bp_ab[0], bp_ab[1]),
|
||||
"Finished 100%",
|
||||
"Reset required to proceed with the firmware update"
|
||||
"Reset required to proceed"
|
||||
])
|
||||
return lines
|
||||
|
||||
|
|
Loading…
Reference in New Issue