2 CPU Features DXE 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/UefiLib.h>
20 #include <Library/UefiBootServicesTableLib.h>
21 #include <Library/RegisterCpuFeaturesLib.h>
23 #include <Protocol/SmmConfiguration.h>
24 #include <Guid/CpuFeaturesInitDone.h>
28 Worker function to perform CPU feature initialization.
32 CpuFeaturesInitializeWorker (
41 CpuFeaturesInitialize ();
44 // Install CPU Features Init Done Protocol
47 Status
= gBS
->InstallProtocolInterface (
49 &gEdkiiCpuFeaturesInitDoneGuid
,
53 ASSERT_EFI_ERROR (Status
);
57 Event notification that initialize CPU features when gEfiSmmConfigurationProtocol installs.
59 @param[in] Event The Event that is being processed, not used.
60 @param[in] Context Event Context, not used.
64 SmmConfigurationEventNotify (
70 EFI_SMM_CONFIGURATION_PROTOCOL
*SmmConfiguration
;
73 // Make sure this notification is for this handler
75 Status
= gBS
->LocateProtocol (&gEfiSmmConfigurationProtocolGuid
, NULL
, (VOID
**)&SmmConfiguration
);
76 if (EFI_ERROR (Status
)) {
80 CpuFeaturesInitializeWorker ();
84 CPU Features driver entry point function.
86 If PcdCpuFeaturesInitAfterSmmRelocation is TRUE, it will register one
87 SMM Configuration Protocol notify function to perform CPU features
88 initialization. Otherwise, it will perform CPU features initialization
91 @param ImageHandle Image handle this driver.
92 @param SystemTable Pointer to the System Table.
94 @retval EFI_SUCCESS CPU Features is initialized successfully.
98 CpuFeaturesDxeInitialize (
99 IN EFI_HANDLE ImageHandle
,
100 IN EFI_SYSTEM_TABLE
*SystemTable
105 if (PcdGetBool (PcdCpuFeaturesInitAfterSmmRelocation
)) {
107 // Install notification callback on SMM Configuration Protocol
109 EfiCreateProtocolNotifyEvent (
110 &gEfiSmmConfigurationProtocolGuid
,
112 SmmConfigurationEventNotify
,
117 CpuFeaturesInitializeWorker ();