2017-04-05 10:33:16 +02:00
|
|
|
/** @file
|
|
|
|
CPU Features PEIM driver to initialize CPU features.
|
|
|
|
|
|
|
|
Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
|
2019-04-04 01:07:22 +02:00
|
|
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
2017-04-05 10:33:16 +02:00
|
|
|
|
|
|
|
**/
|
|
|
|
|
|
|
|
#include <PiPei.h>
|
|
|
|
|
|
|
|
#include <Library/BaseLib.h>
|
|
|
|
#include <Library/DebugLib.h>
|
|
|
|
#include <Library/PeiServicesLib.h>
|
|
|
|
#include <Library/RegisterCpuFeaturesLib.h>
|
2017-10-26 04:28:23 +02:00
|
|
|
#include <Library/HobLib.h>
|
2017-04-05 10:33:16 +02:00
|
|
|
|
|
|
|
#include <Guid/CpuFeaturesInitDone.h>
|
|
|
|
|
|
|
|
EFI_PEI_PPI_DESCRIPTOR mPeiCpuFeaturesInitDonePpiDesc = {
|
|
|
|
(EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
|
|
|
|
&gEdkiiCpuFeaturesInitDoneGuid,
|
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
CPU Features driver entry point function.
|
|
|
|
|
|
|
|
It will perform CPU features initialization, except for
|
|
|
|
PcdCpuFeaturesInitOnS3Resume is FALSE on S3 resume.
|
|
|
|
|
|
|
|
@param FileHandle Handle of the file being invoked.
|
|
|
|
@param PeiServices Describes the list of possible PEI Services.
|
|
|
|
|
|
|
|
@retval EFI_SUCCESS CPU Features is initialized successfully.
|
|
|
|
**/
|
|
|
|
EFI_STATUS
|
|
|
|
EFIAPI
|
|
|
|
CpuFeaturesPeimInitialize (
|
|
|
|
IN EFI_PEI_FILE_HANDLE FileHandle,
|
|
|
|
IN CONST EFI_PEI_SERVICES **PeiServices
|
|
|
|
)
|
|
|
|
{
|
|
|
|
EFI_STATUS Status;
|
|
|
|
EFI_BOOT_MODE BootMode;
|
|
|
|
|
|
|
|
Status = PeiServicesGetBootMode (&BootMode);
|
|
|
|
ASSERT_EFI_ERROR (Status);
|
|
|
|
|
|
|
|
if (BootMode == BOOT_ON_S3_RESUME &&
|
|
|
|
!PcdGetBool (PcdCpuFeaturesInitOnS3Resume)) {
|
|
|
|
//
|
|
|
|
// Does nothing when if PcdCpuFeaturesInitOnS3Resume is FLASE
|
|
|
|
// on S3 boot mode
|
|
|
|
//
|
|
|
|
return EFI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
CpuFeaturesDetect ();
|
|
|
|
|
|
|
|
CpuFeaturesInitialize ();
|
|
|
|
|
|
|
|
//
|
|
|
|
// Install CPU Features Init Done PPI
|
|
|
|
//
|
|
|
|
Status = PeiServicesInstallPpi(&mPeiCpuFeaturesInitDonePpiDesc);
|
|
|
|
ASSERT_EFI_ERROR (Status);
|
|
|
|
|
2017-10-26 04:28:23 +02:00
|
|
|
//
|
|
|
|
// Build HOB to let CpuFeatureDxe driver skip the initialization process.
|
|
|
|
//
|
|
|
|
BuildGuidHob (&gEdkiiCpuFeaturesInitDoneGuid, 0);
|
|
|
|
|
2017-04-05 10:33:16 +02:00
|
|
|
return EFI_SUCCESS;
|
|
|
|
}
|
|
|
|
|