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