TianoCore EDK2 master
Loading...
Searching...
No Matches
ClearCache.c
Go to the documentation of this file.
1
14#include <Library/DebugLib.h>
16#include <Ppi/MpServices.h>
17
18#include "Platform.h"
19
29VOID
30EFIAPI
32 IN OUT VOID *WorkSpace
33 )
34{
37}
38
52EFIAPI
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 //
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//
92STATIC CONST EFI_PEI_NOTIFY_DESCRIPTOR mMpServicesNotify = {
93 EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | // Flags
94 EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST,
95 &gEfiPeiMpServicesPpiGuid, // Guid
97};
98
99VOID
100InstallClearCacheCallback (
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}
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