2013-01-25 12:28:06 +01:00
|
|
|
/** @file
|
|
|
|
|
|
|
|
Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
|
2014-06-03 18:37:29 +02:00
|
|
|
Copyright (c) 2011 - 2014, ARM Limited. All rights reserved.
|
2014-08-19 15:29:52 +02:00
|
|
|
|
2019-04-04 01:03:18 +02:00
|
|
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
2013-01-25 12:28:06 +01:00
|
|
|
|
|
|
|
**/
|
2020-02-26 13:49:03 +01:00
|
|
|
|
|
|
|
#include <Base.h>
|
|
|
|
|
2013-01-25 12:28:06 +01: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/ArmV7.h>
|
|
|
|
|
2013-01-25 12:28:06 +01:00
|
|
|
#include "ArmV7Lib.h"
|
|
|
|
#include "ArmLibPrivate.h"
|
|
|
|
|
|
|
|
VOID
|
|
|
|
ArmV7DataCacheOperation (
|
|
|
|
IN ARM_V7_CACHE_OPERATION DataCacheOperation
|
|
|
|
)
|
|
|
|
{
|
|
|
|
UINTN SavedInterruptState;
|
|
|
|
|
|
|
|
SavedInterruptState = ArmGetInterruptState ();
|
|
|
|
ArmDisableInterrupts ();
|
2014-08-19 15:29:52 +02:00
|
|
|
|
2013-01-25 12:28:06 +01:00
|
|
|
ArmV7AllDataCachesOperation (DataCacheOperation);
|
2014-08-19 15:29:52 +02:00
|
|
|
|
2015-11-20 14:14:59 +01:00
|
|
|
ArmDataSynchronizationBarrier ();
|
2014-08-19 15:29:52 +02:00
|
|
|
|
2013-01-25 12:28:06 +01: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-01-25 12:28:06 +01:00
|
|
|
ArmV7DataCacheOperation (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-01-25 12:28:06 +01:00
|
|
|
ArmV7DataCacheOperation (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-01-25 12:28:06 +01:00
|
|
|
ArmV7DataCacheOperation (ArmCleanDataCacheEntryBySetWay);
|
|
|
|
}
|