VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/Firmware/UefiCpuPkg/CpuFeatures/CpuFeaturesPei.c@ 86513

Last change on this file since 86513 was 80721, checked in by vboxsync, 5 years ago

Devices/EFI/FirmwareNew: Start upgrade process to edk2-stable201908 (compiles on Windows and works to some extent), bugref:4643

  • Property svn:eol-style set to native
File size: 1.8 KB
Line 
1/** @file
2 CPU Features PEIM driver to initialize CPU features.
3
4 Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6
7**/
8
9#include <PiPei.h>
10
11#include <Library/BaseLib.h>
12#include <Library/DebugLib.h>
13#include <Library/PeiServicesLib.h>
14#include <Library/RegisterCpuFeaturesLib.h>
15#include <Library/HobLib.h>
16
17#include <Guid/CpuFeaturesInitDone.h>
18
19EFI_PEI_PPI_DESCRIPTOR mPeiCpuFeaturesInitDonePpiDesc = {
20 (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
21 &gEdkiiCpuFeaturesInitDoneGuid,
22 NULL
23};
24
25/**
26 CPU Features driver entry point function.
27
28 It will perform CPU features initialization, except for
29 PcdCpuFeaturesInitOnS3Resume is FALSE on S3 resume.
30
31 @param FileHandle Handle of the file being invoked.
32 @param PeiServices Describes the list of possible PEI Services.
33
34 @retval EFI_SUCCESS CPU Features is initialized successfully.
35**/
36EFI_STATUS
37EFIAPI
38CpuFeaturesPeimInitialize (
39 IN EFI_PEI_FILE_HANDLE FileHandle,
40 IN CONST EFI_PEI_SERVICES **PeiServices
41 )
42{
43 EFI_STATUS Status;
44 EFI_BOOT_MODE BootMode;
45
46 Status = PeiServicesGetBootMode (&BootMode);
47 ASSERT_EFI_ERROR (Status);
48
49 if (BootMode == BOOT_ON_S3_RESUME &&
50 !PcdGetBool (PcdCpuFeaturesInitOnS3Resume)) {
51 //
52 // Does nothing when if PcdCpuFeaturesInitOnS3Resume is FLASE
53 // on S3 boot mode
54 //
55 return EFI_SUCCESS;
56 }
57
58 CpuFeaturesDetect ();
59
60 CpuFeaturesInitialize ();
61
62 //
63 // Install CPU Features Init Done PPI
64 //
65 Status = PeiServicesInstallPpi(&mPeiCpuFeaturesInitDonePpiDesc);
66 ASSERT_EFI_ERROR (Status);
67
68 //
69 // Build HOB to let CpuFeatureDxe driver skip the initialization process.
70 //
71 BuildGuidHob (&gEdkiiCpuFeaturesInitDoneGuid, 0);
72
73 return EFI_SUCCESS;
74}
75
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette