2013-07-18 20:07:46 +02:00
|
|
|
/** @file
|
|
|
|
|
|
|
|
Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
|
2014-06-03 18:37:29 +02:00
|
|
|
Portions copyright (c) 2011 - 2014, ARM Ltd. All rights reserved.<BR>
|
2013-07-18 20:07:46 +02:00
|
|
|
|
2019-04-04 01:03:18 +02:00
|
|
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
2013-07-18 20:07:46 +02:00
|
|
|
|
|
|
|
**/
|
|
|
|
|
2020-02-26 13:49:03 +01:00
|
|
|
#include <Base.h>
|
|
|
|
|
2013-07-18 20:07:46 +02:00
|
|
|
#include <Library/ArmLib.h>
|
2020-02-26 14:07:32 +01:00
|
|
|
#include <Library/DebugLib.h>
|
2020-02-26 13:49:03 +01:00
|
|
|
|
|
|
|
#include <Chipset/AArch64.h>
|
|
|
|
|
2013-07-18 20:07:46 +02:00
|
|
|
#include "AArch64Lib.h"
|
|
|
|
#include "ArmLibPrivate.h"
|
|
|
|
|
|
|
|
VOID
|
|
|
|
AArch64DataCacheOperation (
|
|
|
|
IN AARCH64_CACHE_OPERATION DataCacheOperation
|
|
|
|
)
|
|
|
|
{
|
|
|
|
UINTN SavedInterruptState;
|
|
|
|
|
|
|
|
SavedInterruptState = ArmGetInterruptState ();
|
|
|
|
ArmDisableInterrupts();
|
|
|
|
|
|
|
|
AArch64AllDataCachesOperation (DataCacheOperation);
|
|
|
|
|
2015-11-20 14:14:59 +01:00
|
|
|
ArmDataSynchronizationBarrier ();
|
2013-07-18 20:07:46 +02:00
|
|
|
|
|
|
|
if (SavedInterruptState) {
|
|
|
|
ArmEnableInterrupts ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
VOID
|
|
|
|
EFIAPI
|
|
|
|
ArmInvalidateDataCache (
|
|
|
|
VOID
|
|
|
|
)
|
|
|
|
{
|
2020-02-26 14:07:32 +01:00
|
|
|
ASSERT (!ArmMmuEnabled ());
|
|
|
|
|
2015-11-20 14:14:59 +01:00
|
|
|
ArmDataSynchronizationBarrier ();
|
2013-07-18 20:07:46 +02:00
|
|
|
AArch64DataCacheOperation (ArmInvalidateDataCacheEntryBySetWay);
|
|
|
|
}
|
|
|
|
|
|
|
|
VOID
|
|
|
|
EFIAPI
|
|
|
|
ArmCleanInvalidateDataCache (
|
|
|
|
VOID
|
|
|
|
)
|
|
|
|
{
|
2020-02-26 14:07:32 +01:00
|
|
|
ASSERT (!ArmMmuEnabled ());
|
|
|
|
|
2015-11-20 14:14:59 +01:00
|
|
|
ArmDataSynchronizationBarrier ();
|
2013-07-18 20:07:46 +02:00
|
|
|
AArch64DataCacheOperation (ArmCleanInvalidateDataCacheEntryBySetWay);
|
|
|
|
}
|
|
|
|
|
|
|
|
VOID
|
|
|
|
EFIAPI
|
|
|
|
ArmCleanDataCache (
|
|
|
|
VOID
|
|
|
|
)
|
|
|
|
{
|
2020-02-26 14:07:32 +01:00
|
|
|
ASSERT (!ArmMmuEnabled ());
|
|
|
|
|
2015-11-20 14:14:59 +01:00
|
|
|
ArmDataSynchronizationBarrier ();
|
2013-07-18 20:07:46 +02:00
|
|
|
AArch64DataCacheOperation (ArmCleanDataCacheEntryBySetWay);
|
|
|
|
}
|