2 CPU Features PEIM driver to initialize CPU features.
4 Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
17 #include <Library/BaseLib.h>
18 #include <Library/DebugLib.h>
19 #include <Library/PeiServicesLib.h>
20 #include <Library/RegisterCpuFeaturesLib.h>
21 #include <Library/HobLib.h>
23 #include <Guid/CpuFeaturesInitDone.h>
25 EFI_PEI_PPI_DESCRIPTOR mPeiCpuFeaturesInitDonePpiDesc
= {
26 (EFI_PEI_PPI_DESCRIPTOR_PPI
| EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST
),
27 &gEdkiiCpuFeaturesInitDoneGuid
,
32 CPU Features driver entry point function.
34 It will perform CPU features initialization, except for
35 PcdCpuFeaturesInitOnS3Resume is FALSE on S3 resume.
37 @param FileHandle Handle of the file being invoked.
38 @param PeiServices Describes the list of possible PEI Services.
40 @retval EFI_SUCCESS CPU Features is initialized successfully.
44 CpuFeaturesPeimInitialize (
45 IN EFI_PEI_FILE_HANDLE FileHandle
,
46 IN CONST EFI_PEI_SERVICES
**PeiServices
50 EFI_BOOT_MODE BootMode
;
52 Status
= PeiServicesGetBootMode (&BootMode
);
53 ASSERT_EFI_ERROR (Status
);
55 if (BootMode
== BOOT_ON_S3_RESUME
&&
56 !PcdGetBool (PcdCpuFeaturesInitOnS3Resume
)) {
58 // Does nothing when if PcdCpuFeaturesInitOnS3Resume is FLASE
66 CpuFeaturesInitialize ();
69 // Install CPU Features Init Done PPI
71 Status
= PeiServicesInstallPpi(&mPeiCpuFeaturesInitDonePpiDesc
);
72 ASSERT_EFI_ERROR (Status
);
75 // Build HOB to let CpuFeatureDxe driver skip the initialization process.
77 BuildGuidHob (&gEdkiiCpuFeaturesInitDoneGuid
, 0);