mirror of https://github.com/acidanthera/audk.git
Nt32Pkg: Keep boot behavior using new BDS almost same as that using old BDS
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Cc: Liming Gao <liming.gao@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18306 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
bfb685da6f
commit
703da8b4ec
File diff suppressed because it is too large
Load Diff
|
@ -19,92 +19,47 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
EFI_GUID mUefiShellFileGuid = { 0x7C04A583, 0x9E3E, 0x4f1c, 0xAD, 0x65, 0xE0, 0x52, 0x68, 0xD0, 0xB4, 0xD1 };
|
EFI_GUID mUefiShellFileGuid = { 0x7C04A583, 0x9E3E, 0x4f1c, 0xAD, 0x65, 0xE0, 0x52, 0x68, 0xD0, 0xB4, 0xD1 };
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Perform the memory test base on the memory test intensive level,
|
Perform the platform diagnostic, such like test memory. OEM/IBV also
|
||||||
and update the memory resource.
|
can customize this function to support specific platform diagnostic.
|
||||||
|
|
||||||
@param Level The memory test intensive level.
|
@param MemoryTestLevel The memory test intensive level
|
||||||
|
@param QuietBoot Indicate if need to enable the quiet boot
|
||||||
@retval EFI_STATUS Success test all the system memory and update
|
|
||||||
the memory resource
|
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
VOID
|
||||||
PlatformBootManagerMemoryTest (
|
PlatformBootManagerDiagnostics (
|
||||||
IN EXTENDMEM_COVERAGE_LEVEL Level
|
IN EXTENDMEM_COVERAGE_LEVEL MemoryTestLevel,
|
||||||
|
IN BOOLEAN QuietBoot
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
BOOLEAN RequireSoftECCInit;
|
|
||||||
EFI_GENERIC_MEMORY_TEST_PROTOCOL *GenMemoryTest;
|
|
||||||
UINT64 TestedMemorySize;
|
|
||||||
UINT64 TotalMemorySize;
|
|
||||||
UINTN TestPercent;
|
|
||||||
UINT64 PreviousValue;
|
|
||||||
BOOLEAN ErrorOut;
|
|
||||||
UINT32 TempData;
|
|
||||||
|
|
||||||
TestedMemorySize = 0;
|
//
|
||||||
TotalMemorySize = 0;
|
// Here we can decide if we need to show
|
||||||
PreviousValue = 0;
|
// the diagnostics screen
|
||||||
|
// Notes: this quiet boot code should be remove
|
||||||
|
// from the graphic lib
|
||||||
|
//
|
||||||
|
if (QuietBoot) {
|
||||||
|
PlatformBootManagerEnableQuietBoot (PcdGetPtr(PcdLogoFile));
|
||||||
|
|
||||||
RequireSoftECCInit = FALSE;
|
//
|
||||||
|
// Perform system diagnostic
|
||||||
|
//
|
||||||
|
Status = PlatformBootManagerMemoryTest (MemoryTestLevel);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
PlatformBootManagerDisableQuietBoot ();
|
||||||
|
}
|
||||||
|
|
||||||
Status = gBS->LocateProtocol (
|
return;
|
||||||
&gEfiGenericMemTestProtocolGuid,
|
|
||||||
NULL,
|
|
||||||
(VOID **) &GenMemoryTest
|
|
||||||
);
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
return EFI_SUCCESS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = GenMemoryTest->MemoryTestInit (
|
//
|
||||||
GenMemoryTest,
|
// Perform system diagnostic
|
||||||
Level,
|
//
|
||||||
&RequireSoftECCInit
|
Status = PlatformBootManagerMemoryTest (MemoryTestLevel);
|
||||||
);
|
|
||||||
if (Status == EFI_NO_MEDIA) {
|
|
||||||
//
|
|
||||||
// The PEI codes also have the relevant memory test code to check the memory,
|
|
||||||
// it can select to test some range of the memory or all of them. If PEI code
|
|
||||||
// checks all the memory, this BDS memory test will has no not-test memory to
|
|
||||||
// do the test, and then the status of EFI_NO_MEDIA will be returned by
|
|
||||||
// "MemoryTestInit". So it does not need to test memory again, just return.
|
|
||||||
//
|
|
||||||
return EFI_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
do {
|
|
||||||
Status = GenMemoryTest->PerformMemoryTest (
|
|
||||||
GenMemoryTest,
|
|
||||||
&TestedMemorySize,
|
|
||||||
&TotalMemorySize,
|
|
||||||
&ErrorOut,
|
|
||||||
FALSE
|
|
||||||
);
|
|
||||||
if (ErrorOut && (Status == EFI_DEVICE_ERROR)) {
|
|
||||||
Print (L"System encounters memory errors!");
|
|
||||||
CpuDeadLoop ();
|
|
||||||
}
|
|
||||||
|
|
||||||
TempData = (UINT32) DivU64x32 (TotalMemorySize, 16);
|
|
||||||
TestPercent = (UINTN) DivU64x32 (
|
|
||||||
DivU64x32 (MultU64x32 (TestedMemorySize, 100), 16),
|
|
||||||
TempData
|
|
||||||
);
|
|
||||||
if (TestPercent != PreviousValue) {
|
|
||||||
Print (L"Perform memory test: %d/100", TestPercent);
|
|
||||||
PreviousValue = TestPercent;
|
|
||||||
}
|
|
||||||
} while (Status != EFI_NOT_FOUND);
|
|
||||||
|
|
||||||
Status = GenMemoryTest->Finished (GenMemoryTest);
|
|
||||||
|
|
||||||
Print (L"\r%dM bytes of system memory tested OK\n", (UINT32) DivU64x32 (TotalMemorySize, 1024 * 1024));
|
|
||||||
return EFI_SUCCESS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Return the index of the load option in the load option array.
|
Return the index of the load option in the load option array.
|
||||||
|
|
||||||
|
@ -284,15 +239,19 @@ PlatformBootManagerAfterConsole (
|
||||||
VOID
|
VOID
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
PlatformBootManagerMemoryTest (QUICK);
|
EFI_GRAPHICS_OUTPUT_BLT_PIXEL Black;
|
||||||
|
EFI_GRAPHICS_OUTPUT_BLT_PIXEL White;
|
||||||
|
|
||||||
|
Black.Blue = Black.Green = Black.Red = Black.Reserved = 0;
|
||||||
|
White.Blue = White.Green = White.Red = White.Reserved = 0xFF;
|
||||||
|
|
||||||
EfiBootManagerConnectAll ();
|
EfiBootManagerConnectAll ();
|
||||||
EfiBootManagerRefreshAllBootOption ();
|
EfiBootManagerRefreshAllBootOption ();
|
||||||
Print (
|
|
||||||
L"\n"
|
PlatformBootManagerDiagnostics (QUICK, TRUE);
|
||||||
L"F2 to enter Boot Manager Menu.\n"
|
|
||||||
L"Enter to boot directly.\n"
|
PrintXY (10, 10, &White, &Black, L"F2 to enter Boot Manager Menu. ");
|
||||||
L"\n"
|
PrintXY (10, 30, &White, &Black, L"Enter to boot directly.");
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -306,5 +265,21 @@ PlatformBootManagerWaitCallback (
|
||||||
UINT16 TimeoutRemain
|
UINT16 TimeoutRemain
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
Print (L"\r%-2d seconds remained...", TimeoutRemain);
|
EFI_GRAPHICS_OUTPUT_BLT_PIXEL Black;
|
||||||
|
EFI_GRAPHICS_OUTPUT_BLT_PIXEL White;
|
||||||
|
UINT16 Timeout;
|
||||||
|
|
||||||
|
Timeout = PcdGet16 (PcdPlatformBootTimeOut);
|
||||||
|
|
||||||
|
Black.Blue = Black.Green = Black.Red = Black.Reserved = 0;
|
||||||
|
White.Blue = White.Green = White.Red = White.Reserved = 0xFF;
|
||||||
|
|
||||||
|
PlatformBootManagerShowProgress (
|
||||||
|
White,
|
||||||
|
Black,
|
||||||
|
L"Start boot option",
|
||||||
|
White,
|
||||||
|
(Timeout - TimeoutRemain) * 100 / Timeout,
|
||||||
|
0
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,12 +15,16 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
#define _PLATFORM_BOOT_MANAGER_H
|
#define _PLATFORM_BOOT_MANAGER_H
|
||||||
|
|
||||||
#include <PiDxe.h>
|
#include <PiDxe.h>
|
||||||
|
#include <IndustryStandard/Bmp.h>
|
||||||
#include <Guid/WinNtSystemConfig.h>
|
#include <Guid/WinNtSystemConfig.h>
|
||||||
#include <Protocol/GenericMemoryTest.h>
|
#include <Protocol/GenericMemoryTest.h>
|
||||||
#include <Protocol/WinNtThunk.h>
|
#include <Protocol/WinNtThunk.h>
|
||||||
#include <Protocol/WinNtIo.h>
|
#include <Protocol/WinNtIo.h>
|
||||||
#include <Protocol/LoadedImage.h>
|
#include <Protocol/LoadedImage.h>
|
||||||
|
#include <Protocol/UgaDraw.h>
|
||||||
|
#include <Protocol/GraphicsOutput.h>
|
||||||
|
#include <Protocol/OEMBadging.h>
|
||||||
|
#include <Protocol/BootLogo.h>
|
||||||
|
|
||||||
#include <Library/DebugLib.h>
|
#include <Library/DebugLib.h>
|
||||||
#include <Library/BaseMemoryLib.h>
|
#include <Library/BaseMemoryLib.h>
|
||||||
|
@ -33,6 +37,9 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
#include <Library/UefiBootManagerLib.h>
|
#include <Library/UefiBootManagerLib.h>
|
||||||
#include <Library/PcdLib.h>
|
#include <Library/PcdLib.h>
|
||||||
#include <Library/DevicePathLib.h>
|
#include <Library/DevicePathLib.h>
|
||||||
|
#include <Library/HiiLib.h>
|
||||||
|
#include <Library/PrintLib.h>
|
||||||
|
#include <Library/DxeServicesLib.h>
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -76,4 +83,71 @@ typedef struct {
|
||||||
EFI_DEVICE_PATH_PROTOCOL End;
|
EFI_DEVICE_PATH_PROTOCOL End;
|
||||||
} NT_PLATFORM_GOP_DEVICE_PATH;
|
} NT_PLATFORM_GOP_DEVICE_PATH;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Use SystemTable Conout to stop video based Simple Text Out consoles from going
|
||||||
|
to the video device. Put up LogoFile on every video device that is a console.
|
||||||
|
|
||||||
|
@param[in] LogoFile File name of logo to display on the center of the screen.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS ConsoleControl has been flipped to graphics and logo displayed.
|
||||||
|
@retval EFI_UNSUPPORTED Logo not found
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
PlatformBootManagerEnableQuietBoot (
|
||||||
|
IN EFI_GUID *LogoFile
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Use SystemTable Conout to turn on video based Simple Text Out consoles. The
|
||||||
|
Simple Text Out screens will now be synced up with all non video output devices
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS UGA devices are back in text mode and synced up.
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
PlatformBootManagerDisableQuietBoot (
|
||||||
|
VOID
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Perform the memory test base on the memory test intensive level,
|
||||||
|
and update the memory resource.
|
||||||
|
|
||||||
|
@param Level The memory test intensive level.
|
||||||
|
|
||||||
|
@retval EFI_STATUS Success test all the system memory and update
|
||||||
|
the memory resource
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
PlatformBootManagerMemoryTest (
|
||||||
|
IN EXTENDMEM_COVERAGE_LEVEL Level
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
|
Show progress bar with title above it. It only works in Graphics mode.
|
||||||
|
|
||||||
|
|
||||||
|
@param TitleForeground Foreground color for Title.
|
||||||
|
@param TitleBackground Background color for Title.
|
||||||
|
@param Title Title above progress bar.
|
||||||
|
@param ProgressColor Progress bar color.
|
||||||
|
@param Progress Progress (0-100)
|
||||||
|
@param PreviousValue The previous value of the progress.
|
||||||
|
|
||||||
|
@retval EFI_STATUS Success update the progress bar
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
PlatformBootManagerShowProgress (
|
||||||
|
IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL TitleForeground,
|
||||||
|
IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL TitleBackground,
|
||||||
|
IN CHAR16 *Title,
|
||||||
|
IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL ProgressColor,
|
||||||
|
IN UINTN Progress,
|
||||||
|
IN UINTN PreviousValue
|
||||||
|
);
|
||||||
|
|
||||||
#endif // _PLATFORM_BOOT_MANAGER_H
|
#endif // _PLATFORM_BOOT_MANAGER_H
|
||||||
|
|
|
@ -31,25 +31,43 @@
|
||||||
PlatformData.c
|
PlatformData.c
|
||||||
PlatformBootManager.c
|
PlatformBootManager.c
|
||||||
PlatformBootManager.h
|
PlatformBootManager.h
|
||||||
|
MemoryTest.c
|
||||||
|
Strings.uni
|
||||||
|
|
||||||
[Packages]
|
[Packages]
|
||||||
MdePkg/MdePkg.dec
|
MdePkg/MdePkg.dec
|
||||||
MdeModulePkg/MdeModulePkg.dec
|
MdeModulePkg/MdeModulePkg.dec
|
||||||
|
IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec
|
||||||
Nt32Pkg/Nt32Pkg.dec
|
Nt32Pkg/Nt32Pkg.dec
|
||||||
|
|
||||||
[LibraryClasses]
|
[LibraryClasses]
|
||||||
BaseLib
|
BaseLib
|
||||||
|
UefiBootServicesTableLib
|
||||||
UefiRuntimeServicesTableLib
|
UefiRuntimeServicesTableLib
|
||||||
UefiLib
|
UefiLib
|
||||||
UefiBootManagerLib
|
UefiBootManagerLib
|
||||||
PcdLib
|
PcdLib
|
||||||
|
DxeServicesLib
|
||||||
|
MemoryAllocationLib
|
||||||
|
DevicePathLib
|
||||||
|
HiiLib
|
||||||
|
PrintLib
|
||||||
|
|
||||||
[Guids]
|
[Guids]
|
||||||
gEfiWinNtSystemConfigGuid
|
gEfiWinNtSystemConfigGuid
|
||||||
|
|
||||||
[Protocols]
|
[Protocols]
|
||||||
gEfiGenericMemTestProtocolGuid ## CONSUMES
|
gEfiGenericMemTestProtocolGuid ## CONSUMES
|
||||||
|
gEfiGraphicsOutputProtocolGuid ## CONSUMES
|
||||||
|
gEfiUgaDrawProtocolGuid ## CONSUMES
|
||||||
|
gEfiOEMBadgingProtocolGuid ## CONSUMES
|
||||||
|
gEfiBootLogoProtocolGuid ## CONSUMES
|
||||||
|
|
||||||
[Pcd]
|
[Pcd]
|
||||||
|
gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdConOutRow
|
gEfiMdeModulePkgTokenSpaceGuid.PcdConOutRow
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdConOutColumn
|
gEfiMdeModulePkgTokenSpaceGuid.PcdConOutColumn
|
||||||
|
gEfiMdePkgTokenSpaceGuid.PcdUgaConsumeSupport
|
||||||
|
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdBootlogoOnlyEnable
|
||||||
|
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdLogoFile
|
||||||
|
gEfiMdeModulePkgTokenSpaceGuid.PcdConInConnectOnDemand
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue