Skip to content

Commit

Permalink
UefiCpuPkg: Add cache operations support for Arch proto
Browse files Browse the repository at this point in the history
With CMO operations available for RISC-V, utilize them in CPU
Architecture protocol.

Signed-off-by: Dhaval Sharma <[email protected]>
Cc: Gerd Hoffmann <[email protected]>
Cc: Laszlo Ersek <[email protected]>
Cc: Rahul Kumar <[email protected]>
Cc: Ray Ni <[email protected]>
Cc: Sunil VL <[email protected]>
Cc: Andrei Warkentin <[email protected]>
Reviewed-by: Sunil V L <[email protected]>
  • Loading branch information
dhaval-rivos authored and mergify[bot] committed Feb 4, 2024
1 parent cd6f215 commit 141dcae
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
14 changes: 14 additions & 0 deletions UefiCpuPkg/CpuDxeRiscV64/CpuDxe.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,20 @@ CpuFlushCpuDataCache (
IN EFI_CPU_FLUSH_TYPE FlushType
)
{
switch (FlushType) {
case EfiCpuFlushTypeWriteBack:
WriteBackDataCacheRange ((VOID *)(UINTN)Start, (UINTN)Length);
break;
case EfiCpuFlushTypeInvalidate:
InvalidateDataCacheRange ((VOID *)(UINTN)Start, (UINTN)Length);
break;
case EfiCpuFlushTypeWriteBackInvalidate:
WriteBackInvalidateDataCacheRange ((VOID *)(UINTN)Start, (UINTN)Length);
break;
default:
return EFI_INVALID_PARAMETER;
}

return EFI_SUCCESS;
}

Expand Down
1 change: 1 addition & 0 deletions UefiCpuPkg/CpuDxeRiscV64/CpuDxe.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <Library/BaseRiscVSbiLib.h>
#include <Library/BaseRiscVMmuLib.h>
#include <Library/BaseLib.h>
#include <Library/CacheMaintenanceLib.h>
#include <Library/CpuExceptionHandlerLib.h>
#include <Library/DebugLib.h>
#include <Library/UefiBootServicesTableLib.h>
Expand Down

0 comments on commit 141dcae

Please sign in to comment.