mirror of https://github.com/acidanthera/audk.git
ArmPlatformPkg/PlatformPeim: allow PlatformPeiLib to set the boot mode
The current interdepencies between the PrePeiCore SEC module, the platform PEIM and ArmPlatformLib is a bit awkward: due to the fact that ArmPlatformLib is also used by SEC modules, we cannot use PEI specific facilities in the implementation of ArmPlatformGetBootMode. However, given that we call that library function /after/ invoking PlatformPeiLib, there is no way for that library to set the boot mode other than resorting to tricks like notification callbacks on arbitrary unrelated events. ArmPlatformLib should probably be phased out anyway, given its quirky nature, but for now, let's fix this particular issue by deferring the call to PlatformPeim() to after the point where we set the boot mode by calling ArmPlatformGetBootMode (). While we're at it, clean up the code slightly by using PeiServicesLib instead of doing double pointer dereferencing. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
This commit is contained in:
parent
b1832e16dd
commit
3909c4a193
|
@ -83,21 +83,23 @@ InitializePlatformPeim (
|
|||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINTN BootMode;
|
||||
EFI_BOOT_MODE BootMode;
|
||||
|
||||
DEBUG ((EFI_D_LOAD | EFI_D_INFO, "Platform PEIM Loaded\n"));
|
||||
|
||||
PlatformPeim ();
|
||||
|
||||
BootMode = ArmPlatformGetBootMode ();
|
||||
Status = (**PeiServices).SetBootMode (PeiServices, (UINT8) BootMode);
|
||||
Status = PeiServicesSetBootMode (ArmPlatformGetBootMode ());
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
Status = (**PeiServices).InstallPpi (PeiServices, &mPpiListBootMode);
|
||||
PlatformPeim ();
|
||||
|
||||
Status = PeiServicesGetBootMode (&BootMode);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
Status = PeiServicesInstallPpi (&mPpiListBootMode);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
if (BootMode == BOOT_IN_RECOVERY_MODE) {
|
||||
Status = (**PeiServices).InstallPpi (PeiServices, &mPpiListRecoveryBootMode);
|
||||
Status = PeiServicesInstallPpi (&mPpiListRecoveryBootMode);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
}
|
||||
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
HobLib
|
||||
ArmPlatformLib
|
||||
PlatformPeiLib
|
||||
PeiServicesLib
|
||||
|
||||
[Ppis]
|
||||
gEfiPeiMasterBootModePpiGuid # PPI ALWAYS_PRODUCED
|
||||
|
|
Loading…
Reference in New Issue