2011-02-01 06:41:42 +01:00
|
|
|
/** @file
|
|
|
|
*
|
|
|
|
* Copyright (c) 2011, ARM Limited. All rights reserved.
|
|
|
|
*
|
2014-08-19 15:29:52 +02:00
|
|
|
* This program and the accompanying materials
|
|
|
|
* are licensed and made available under the terms and conditions of the BSD License
|
|
|
|
* which accompanies this distribution. The full text of the license may be found at
|
|
|
|
* http://opensource.org/licenses/bsd-license.php
|
|
|
|
*
|
|
|
|
* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
2011-02-01 06:41:42 +01:00
|
|
|
*
|
|
|
|
**/
|
|
|
|
|
|
|
|
#include <PiPei.h>
|
2011-07-01 13:45:32 +02:00
|
|
|
|
2011-02-01 06:41:42 +01:00
|
|
|
//
|
|
|
|
// The protocols, PPI and GUID defintions for this module
|
|
|
|
//
|
|
|
|
#include <Ppi/MasterBootMode.h>
|
|
|
|
#include <Ppi/BootInRecoveryMode.h>
|
2011-09-23 01:11:03 +02:00
|
|
|
#include <Ppi/GuidedSectionExtraction.h>
|
2011-02-01 06:41:42 +01:00
|
|
|
//
|
|
|
|
// The Library classes this module consumes
|
|
|
|
//
|
2011-09-23 01:11:03 +02:00
|
|
|
#include <Library/ArmPlatformLib.h>
|
|
|
|
#include <Library/BaseMemoryLib.h>
|
|
|
|
#include <Library/DebugLib.h>
|
|
|
|
#include <Library/HobLib.h>
|
2011-02-01 06:41:42 +01:00
|
|
|
#include <Library/PeimEntryPoint.h>
|
2011-09-23 01:11:03 +02:00
|
|
|
#include <Library/PeiServicesLib.h>
|
2011-02-01 06:41:42 +01:00
|
|
|
#include <Library/PcdLib.h>
|
2011-09-23 01:11:03 +02:00
|
|
|
|
2011-07-01 13:45:32 +02:00
|
|
|
EFI_STATUS
|
|
|
|
EFIAPI
|
|
|
|
InitializePlatformPeim (
|
|
|
|
IN EFI_PEI_FILE_HANDLE FileHandle,
|
|
|
|
IN CONST EFI_PEI_SERVICES **PeiServices
|
|
|
|
);
|
2014-08-19 15:29:52 +02:00
|
|
|
|
2011-07-01 21:51:48 +02:00
|
|
|
EFI_STATUS
|
|
|
|
EFIAPI
|
|
|
|
PlatformPeim (
|
|
|
|
VOID
|
|
|
|
);
|
2011-02-01 06:41:42 +01:00
|
|
|
|
|
|
|
//
|
|
|
|
// Module globals
|
|
|
|
//
|
2015-08-07 19:27:33 +02:00
|
|
|
CONST EFI_PEI_PPI_DESCRIPTOR mPpiListBootMode = {
|
2011-02-01 06:41:42 +01:00
|
|
|
(EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
|
|
|
|
&gEfiPeiMasterBootModePpiGuid,
|
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
2015-08-07 19:27:33 +02:00
|
|
|
CONST EFI_PEI_PPI_DESCRIPTOR mPpiListRecoveryBootMode = {
|
2011-02-01 06:41:42 +01:00
|
|
|
(EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
|
|
|
|
&gEfiPeiBootInRecoveryModePpiGuid,
|
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
|
|
|
/*++
|
|
|
|
|
|
|
|
Routine Description:
|
|
|
|
|
2014-08-19 15:29:52 +02:00
|
|
|
|
2011-02-01 06:41:42 +01:00
|
|
|
|
|
|
|
Arguments:
|
|
|
|
|
|
|
|
FileHandle - Handle of the file being invoked.
|
|
|
|
PeiServices - Describes the list of possible PEI Services.
|
2014-08-19 15:29:52 +02:00
|
|
|
|
2011-02-01 06:41:42 +01:00
|
|
|
Returns:
|
|
|
|
|
|
|
|
Status - EFI_SUCCESS if the boot mode could be set
|
|
|
|
|
|
|
|
--*/
|
2011-07-01 13:45:32 +02:00
|
|
|
EFI_STATUS
|
|
|
|
EFIAPI
|
|
|
|
InitializePlatformPeim (
|
|
|
|
IN EFI_PEI_FILE_HANDLE FileHandle,
|
|
|
|
IN CONST EFI_PEI_SERVICES **PeiServices
|
|
|
|
)
|
2011-02-01 06:41:42 +01:00
|
|
|
{
|
|
|
|
EFI_STATUS Status;
|
2017-11-01 13:57:26 +01:00
|
|
|
EFI_BOOT_MODE BootMode;
|
2011-02-01 06:41:42 +01:00
|
|
|
|
2015-03-02 17:19:32 +01:00
|
|
|
DEBUG ((EFI_D_LOAD | EFI_D_INFO, "Platform PEIM Loaded\n"));
|
2011-02-01 06:41:42 +01:00
|
|
|
|
2017-11-01 13:57:26 +01:00
|
|
|
Status = PeiServicesSetBootMode (ArmPlatformGetBootMode ());
|
|
|
|
ASSERT_EFI_ERROR (Status);
|
|
|
|
|
2011-07-01 13:45:32 +02:00
|
|
|
PlatformPeim ();
|
2014-08-19 15:29:52 +02:00
|
|
|
|
2017-11-01 13:57:26 +01:00
|
|
|
Status = PeiServicesGetBootMode (&BootMode);
|
2011-02-01 06:41:42 +01:00
|
|
|
ASSERT_EFI_ERROR (Status);
|
|
|
|
|
2017-11-01 13:57:26 +01:00
|
|
|
Status = PeiServicesInstallPpi (&mPpiListBootMode);
|
2011-02-01 06:41:42 +01:00
|
|
|
ASSERT_EFI_ERROR (Status);
|
|
|
|
|
|
|
|
if (BootMode == BOOT_IN_RECOVERY_MODE) {
|
2017-11-01 13:57:26 +01:00
|
|
|
Status = PeiServicesInstallPpi (&mPpiListRecoveryBootMode);
|
2011-02-01 06:41:42 +01:00
|
|
|
ASSERT_EFI_ERROR (Status);
|
|
|
|
}
|
|
|
|
|
|
|
|
return Status;
|
|
|
|
}
|