TianoCore EDK2 master
Loading...
Searching...
No Matches
CpuFeaturesDxe.c
Go to the documentation of this file.
1
9#include <PiDxe.h>
10
11#include <Library/BaseLib.h>
12#include <Library/DebugLib.h>
13#include <Library/UefiLib.h>
16#include <Library/HobLib.h>
17
20
25VOID
27 VOID
28 )
29{
30 EFI_STATUS Status;
31 EFI_HANDLE Handle;
32
34
36
37 //
38 // Install CPU Features Init Done Protocol
39 //
40 Handle = NULL;
41 Status = gBS->InstallProtocolInterface (
42 &Handle,
43 &gEdkiiCpuFeaturesInitDoneGuid,
45 NULL
46 );
47 ASSERT_EFI_ERROR (Status);
48}
49
56VOID
57EFIAPI
59 IN EFI_EVENT Event,
60 IN VOID *Context
61 )
62{
63 EFI_STATUS Status;
64 EFI_SMM_CONFIGURATION_PROTOCOL *SmmConfiguration;
65
66 //
67 // Make sure this notification is for this handler
68 //
69 Status = gBS->LocateProtocol (&gEfiSmmConfigurationProtocolGuid, NULL, (VOID **)&SmmConfiguration);
70 if (EFI_ERROR (Status)) {
71 return;
72 }
73
75}
76
91EFIAPI
93 IN EFI_HANDLE ImageHandle,
94 IN EFI_SYSTEM_TABLE *SystemTable
95 )
96{
97 VOID *Registration;
98 EFI_STATUS Status;
99 EFI_HANDLE Handle;
100
101 if (GetFirstGuidHob (&gEdkiiCpuFeaturesInitDoneGuid) != NULL) {
102 //
103 // Try to find HOB first. This HOB exist means CPU features have
104 // been initialized by CpuFeaturesPei driver, just install
105 // gEdkiiCpuFeaturesInitDoneGuid.
106 //
107 Handle = NULL;
108 Status = gBS->InstallProtocolInterface (
109 &Handle,
110 &gEdkiiCpuFeaturesInitDoneGuid,
112 NULL
113 );
114 ASSERT_EFI_ERROR (Status);
115 return Status;
116 }
117
118 if (PcdGetBool (PcdCpuFeaturesInitAfterSmmRelocation)) {
119 //
120 // Install notification callback on SMM Configuration Protocol
121 //
123 &gEfiSmmConfigurationProtocolGuid,
124 TPL_CALLBACK,
126 NULL,
127 &Registration
128 );
129 } else {
131 }
132
133 return EFI_SUCCESS;
134}
VOID *EFIAPI GetFirstGuidHob(IN CONST EFI_GUID *Guid)
Definition: HobLib.c:215
EFI_STATUS EFIAPI CpuFeaturesDxeInitialize(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
VOID CpuFeaturesInitializeWorker(VOID)
VOID EFIAPI SmmConfigurationEventNotify(IN EFI_EVENT Event, IN VOID *Context)
#define NULL
Definition: Base.h:319
#define IN
Definition: Base.h:279
#define ASSERT_EFI_ERROR(StatusParameter)
Definition: DebugLib.h:462
#define PcdGetBool(TokenName)
Definition: PcdLib.h:401
VOID EFIAPI CpuFeaturesDetect(VOID)
VOID EFIAPI CpuFeaturesInitialize(VOID)
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
VOID * EFI_EVENT
Definition: UefiBaseType.h:37
VOID * EFI_HANDLE
Definition: UefiBaseType.h:33
#define EFI_SUCCESS
Definition: UefiBaseType.h:112
EFI_BOOT_SERVICES * gBS
EFI_EVENT EFIAPI EfiCreateProtocolNotifyEvent(IN EFI_GUID *ProtocolGuid, IN EFI_TPL NotifyTpl, IN EFI_EVENT_NOTIFY NotifyFunction, IN VOID *NotifyContext OPTIONAL, OUT VOID **Registration)
Definition: UefiLib.c:134
@ EFI_NATIVE_INTERFACE
Definition: UefiSpec.h:1193