TianoCore EDK2
master
Loading...
Searching...
No Matches
ClearCache.c
Go to the documentation of this file.
1
13
#include <
Library/CacheMaintenanceLib.h
>
14
#include <
Library/DebugLib.h
>
15
#include <
Library/PeiServicesLib.h
>
16
#include <
Ppi/MpServices.h
>
17
18
#include "
Platform.h
"
19
28
STATIC
29
VOID
30
EFIAPI
31
ClearCache
(
32
IN
OUT
VOID *WorkSpace
33
)
34
{
35
WriteBackInvalidateDataCache
();
36
InvalidateInstructionCache
();
37
}
38
50
STATIC
51
EFI_STATUS
52
EFIAPI
53
ClearCacheOnMpServicesAvailable
(
54
IN
EFI_PEI_SERVICES
**PeiServices,
55
IN
EFI_PEI_NOTIFY_DESCRIPTOR
*NotifyDescriptor,
56
IN
VOID *Ppi
57
)
58
{
59
EFI_PEI_MP_SERVICES_PPI
*MpServices;
60
EFI_STATUS
Status;
61
62
DEBUG
((DEBUG_INFO,
"%a: %a\n"
, gEfiCallerBaseName, __func__));
63
64
//
65
// Clear cache on all the APs in parallel.
66
//
67
MpServices = Ppi;
68
Status = MpServices->StartupAllAPs (
69
(
CONST
EFI_PEI_SERVICES
**)PeiServices,
70
MpServices,
71
ClearCache
,
// Procedure
72
FALSE
,
// SingleThread
73
0,
// TimeoutInMicroSeconds: inf.
74
NULL
// ProcedureArgument
75
);
76
if
(EFI_ERROR (Status) && (Status != EFI_NOT_STARTED)) {
77
DEBUG
((DEBUG_ERROR,
"%a: StartupAllAps(): %r\n"
, __func__, Status));
78
return
Status;
79
}
80
81
//
82
// Now clear cache on the BSP too.
83
//
84
ClearCache
(
NULL
);
85
return
EFI_SUCCESS
;
86
}
87
88
//
89
// Notification object for registering the callback, for when
90
// EFI_PEI_MP_SERVICES_PPI becomes available.
91
//
92
STATIC
CONST
EFI_PEI_NOTIFY_DESCRIPTOR
mMpServicesNotify = {
93
EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK |
// Flags
94
EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST,
95
&gEfiPeiMpServicesPpiGuid,
// Guid
96
ClearCacheOnMpServicesAvailable
// Notify
97
};
98
99
VOID
100
InstallClearCacheCallback (
101
VOID
102
)
103
{
104
EFI_STATUS
Status;
105
106
Status =
PeiServicesNotifyPpi
(&mMpServicesNotify);
107
if
(EFI_ERROR (Status)) {
108
DEBUG
((
109
DEBUG_ERROR,
110
"%a: failed to set up MP Services callback: %r\n"
,
111
__func__,
112
Status
113
));
114
}
115
}
InvalidateInstructionCache
VOID EFIAPI InvalidateInstructionCache(VOID)
Definition:
ArmCacheMaintenanceLib.c:43
WriteBackInvalidateDataCache
VOID EFIAPI WriteBackInvalidateDataCache(VOID)
Definition:
ArmCacheMaintenanceLib.c:86
ClearCacheOnMpServicesAvailable
STATIC EFI_STATUS EFIAPI ClearCacheOnMpServicesAvailable(IN EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor, IN VOID *Ppi)
Definition:
ClearCache.c:53
ClearCache
STATIC VOID EFIAPI ClearCache(IN OUT VOID *WorkSpace)
Definition:
ClearCache.c:31
CacheMaintenanceLib.h
PeiServicesNotifyPpi
EFI_STATUS EFIAPI PeiServicesNotifyPpi(IN CONST EFI_PEI_NOTIFY_DESCRIPTOR *NotifyList)
Definition:
PeiServicesLib.c:146
NULL
#define NULL
Definition:
Base.h:319
CONST
#define CONST
Definition:
Base.h:259
STATIC
#define STATIC
Definition:
Base.h:264
FALSE
#define FALSE
Definition:
Base.h:307
IN
#define IN
Definition:
Base.h:279
OUT
#define OUT
Definition:
Base.h:284
DebugLib.h
DEBUG
#define DEBUG(Expression)
Definition:
DebugLib.h:434
MpServices.h
Platform.h
PeiServicesLib.h
EFI_STATUS
RETURN_STATUS EFI_STATUS
Definition:
UefiBaseType.h:29
EFI_SUCCESS
#define EFI_SUCCESS
Definition:
UefiBaseType.h:112
_EFI_PEI_MP_SERVICES_PPI
Definition:
MpServices.h:265
_EFI_PEI_NOTIFY_DESCRIPTOR
Definition:
PiPeiCis.h:110
_EFI_PEI_SERVICES
Definition:
PiPeiCis.h:877
OvmfPkg
Bhyve
PlatformPei
ClearCache.c
Generated on Fri Nov 15 2024 18:01:22 for TianoCore EDK2 by
1.9.6