2014-08-19 15:29:52 +02:00
|
|
|
//------------------------------------------------------------------------------
|
2011-09-27 18:31:20 +02:00
|
|
|
//
|
|
|
|
// Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
|
2016-03-02 22:08:46 +01:00
|
|
|
// Copyright (c) 2011 - 2016, ARM Limited. All rights reserved.
|
2011-09-27 18:31:20 +02:00
|
|
|
//
|
|
|
|
// This program and the accompanying materials
|
|
|
|
// are licensed and made available under the terms and conditions of the BSD License
|
|
|
|
// which accompanies this distribution. The full text of the license may be found at
|
|
|
|
// http://opensource.org/licenses/bsd-license.php
|
|
|
|
//
|
|
|
|
// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#include <AsmMacroIoLib.h>
|
2014-08-19 15:29:52 +02:00
|
|
|
|
2011-09-27 18:31:20 +02:00
|
|
|
INCLUDE AsmMacroIoLib.inc
|
|
|
|
|
2015-12-03 21:28:02 +01:00
|
|
|
|
|
|
|
INCLUDE AsmMacroExport.inc
|
|
|
|
|
|
|
|
RVCT_ASM_EXPORT ArmReadMidr
|
2011-09-27 18:31:20 +02:00
|
|
|
mrc p15,0,R0,c0,c0,0
|
|
|
|
bx LR
|
|
|
|
|
2015-12-03 21:28:02 +01:00
|
|
|
RVCT_ASM_EXPORT ArmCacheInfo
|
2011-09-27 18:31:20 +02:00
|
|
|
mrc p15,0,R0,c0,c0,1
|
|
|
|
bx LR
|
|
|
|
|
2015-12-03 21:28:02 +01:00
|
|
|
RVCT_ASM_EXPORT ArmGetInterruptState
|
2011-09-27 18:31:20 +02:00
|
|
|
mrs R0,CPSR
|
|
|
|
tst R0,#0x80 // Check if IRQ is enabled.
|
|
|
|
moveq R0,#1
|
|
|
|
movne R0,#0
|
|
|
|
bx LR
|
|
|
|
|
2015-12-03 21:28:02 +01:00
|
|
|
RVCT_ASM_EXPORT ArmGetFiqState
|
2011-09-27 18:31:20 +02:00
|
|
|
mrs R0,CPSR
|
|
|
|
tst R0,#0x40 // Check if FIQ is enabled.
|
|
|
|
moveq R0,#1
|
|
|
|
movne R0,#0
|
|
|
|
bx LR
|
|
|
|
|
2015-12-03 21:28:02 +01:00
|
|
|
RVCT_ASM_EXPORT ArmSetDomainAccessControl
|
2011-09-27 18:31:20 +02:00
|
|
|
mcr p15,0,r0,c3,c0,0
|
|
|
|
bx lr
|
|
|
|
|
2015-12-03 21:28:02 +01:00
|
|
|
RVCT_ASM_EXPORT CPSRMaskInsert
|
2011-09-27 18:31:20 +02:00
|
|
|
stmfd sp!, {r4-r12, lr} // save all the banked registers
|
|
|
|
mov r3, sp // copy the stack pointer into a non-banked register
|
|
|
|
mrs r2, cpsr // read the cpsr
|
|
|
|
bic r2, r2, r0 // clear mask in the cpsr
|
|
|
|
and r1, r1, r0 // clear bits outside the mask in the input
|
|
|
|
orr r2, r2, r1 // set field
|
|
|
|
msr cpsr_cxsf, r2 // write back cpsr (may have caused a mode switch)
|
|
|
|
isb
|
|
|
|
mov sp, r3 // restore stack pointer
|
|
|
|
ldmfd sp!, {r4-r12, lr} // restore registers
|
|
|
|
bx lr // return (hopefully thumb-safe!) // return (hopefully thumb-safe!)
|
|
|
|
|
2015-12-03 21:28:02 +01:00
|
|
|
RVCT_ASM_EXPORT CPSRRead
|
2011-09-27 18:31:20 +02:00
|
|
|
mrs r0, cpsr
|
|
|
|
bx lr
|
|
|
|
|
2015-12-03 21:28:02 +01:00
|
|
|
RVCT_ASM_EXPORT ArmReadCpacr
|
2012-05-02 22:02:39 +02:00
|
|
|
mrc p15, 0, r0, c1, c0, 2
|
|
|
|
bx lr
|
|
|
|
|
2015-12-03 21:28:02 +01:00
|
|
|
RVCT_ASM_EXPORT ArmWriteCpacr
|
2011-09-27 18:31:20 +02:00
|
|
|
mcr p15, 0, r0, c1, c0, 2
|
2012-03-26 13:01:21 +02:00
|
|
|
isb
|
2011-09-27 18:31:20 +02:00
|
|
|
bx lr
|
|
|
|
|
2015-12-03 21:28:02 +01:00
|
|
|
RVCT_ASM_EXPORT ArmWriteAuxCr
|
2011-09-27 18:31:20 +02:00
|
|
|
mcr p15, 0, r0, c1, c0, 1
|
|
|
|
bx lr
|
|
|
|
|
2015-12-03 21:28:02 +01:00
|
|
|
RVCT_ASM_EXPORT ArmReadAuxCr
|
2011-09-27 18:31:20 +02:00
|
|
|
mrc p15, 0, r0, c1, c0, 1
|
2014-08-19 15:29:52 +02:00
|
|
|
bx lr
|
2011-09-27 18:31:20 +02:00
|
|
|
|
2015-12-03 21:28:02 +01:00
|
|
|
RVCT_ASM_EXPORT ArmSetTTBR0
|
2011-09-27 18:31:20 +02:00
|
|
|
mcr p15,0,r0,c2,c0,0
|
|
|
|
isb
|
|
|
|
bx lr
|
|
|
|
|
2016-03-02 22:08:46 +01:00
|
|
|
RVCT_ASM_EXPORT ArmSetTTBCR
|
|
|
|
mcr p15, 0, r0, c2, c0, 2
|
|
|
|
isb
|
|
|
|
bx lr
|
|
|
|
|
2015-12-03 21:28:02 +01:00
|
|
|
RVCT_ASM_EXPORT ArmGetTTBR0BaseAddress
|
2011-09-27 18:31:20 +02:00
|
|
|
mrc p15,0,r0,c2,c0,0
|
|
|
|
LoadConstantToReg(0xFFFFC000, r1)
|
|
|
|
and r0, r0, r1
|
|
|
|
isb
|
|
|
|
bx lr
|
|
|
|
|
|
|
|
//
|
|
|
|
//VOID
|
|
|
|
//ArmUpdateTranslationTableEntry (
|
|
|
|
// IN VOID *TranslationTableEntry // R0
|
|
|
|
// IN VOID *MVA // R1
|
|
|
|
// );
|
2015-12-03 21:28:02 +01:00
|
|
|
RVCT_ASM_EXPORT ArmUpdateTranslationTableEntry
|
2011-09-27 18:31:20 +02:00
|
|
|
mcr p15,0,R0,c7,c14,1 // DCCIMVAC Clean data cache by MVA
|
|
|
|
dsb
|
|
|
|
mcr p15,0,R1,c8,c7,1 // TLBIMVA TLB Invalidate MVA
|
|
|
|
mcr p15,0,R9,c7,c5,6 // BPIALL Invalidate Branch predictor array. R9 == NoOp
|
|
|
|
dsb
|
|
|
|
isb
|
|
|
|
bx lr
|
|
|
|
|
2015-12-03 21:28:02 +01:00
|
|
|
RVCT_ASM_EXPORT ArmInvalidateTlb
|
2011-09-27 18:31:20 +02:00
|
|
|
mov r0,#0
|
|
|
|
mcr p15,0,r0,c8,c7,0
|
|
|
|
mcr p15,0,R9,c7,c5,6 // BPIALL Invalidate Branch predictor array. R9 == NoOp
|
|
|
|
dsb
|
|
|
|
isb
|
|
|
|
bx lr
|
|
|
|
|
2015-12-03 21:28:02 +01:00
|
|
|
RVCT_ASM_EXPORT ArmReadScr
|
2012-05-02 22:02:39 +02:00
|
|
|
mrc p15, 0, r0, c1, c1, 0
|
|
|
|
bx lr
|
|
|
|
|
2015-12-03 21:28:02 +01:00
|
|
|
RVCT_ASM_EXPORT ArmWriteScr
|
2011-09-27 18:31:20 +02:00
|
|
|
mcr p15, 0, r0, c1, c1, 0
|
2016-02-03 18:07:47 +01:00
|
|
|
isb
|
2011-09-27 18:31:20 +02:00
|
|
|
bx lr
|
|
|
|
|
2015-12-03 21:28:02 +01:00
|
|
|
RVCT_ASM_EXPORT ArmReadHVBar
|
2013-03-12 01:59:46 +01:00
|
|
|
mrc p15, 4, r0, c12, c0, 0
|
|
|
|
bx lr
|
|
|
|
|
2015-12-03 21:28:02 +01:00
|
|
|
RVCT_ASM_EXPORT ArmWriteHVBar
|
2013-03-12 01:59:46 +01:00
|
|
|
mcr p15, 4, r0, c12, c0, 0
|
|
|
|
bx lr
|
|
|
|
|
2015-12-03 21:28:02 +01:00
|
|
|
RVCT_ASM_EXPORT ArmReadMVBar
|
2012-05-02 22:02:39 +02:00
|
|
|
mrc p15, 0, r0, c12, c0, 1
|
|
|
|
bx lr
|
|
|
|
|
2015-12-03 21:28:02 +01:00
|
|
|
RVCT_ASM_EXPORT ArmWriteMVBar
|
2011-09-27 18:31:20 +02:00
|
|
|
mcr p15, 0, r0, c12, c0, 1
|
|
|
|
bx lr
|
2014-08-19 15:29:52 +02:00
|
|
|
|
2015-12-03 21:28:02 +01:00
|
|
|
RVCT_ASM_EXPORT ArmCallWFE
|
2012-05-02 21:55:32 +02:00
|
|
|
wfe
|
2014-03-01 12:01:00 +01:00
|
|
|
bx lr
|
2012-05-02 21:55:32 +02:00
|
|
|
|
2015-12-03 21:28:02 +01:00
|
|
|
RVCT_ASM_EXPORT ArmCallSEV
|
2012-05-02 21:55:32 +02:00
|
|
|
sev
|
2014-03-01 12:01:00 +01:00
|
|
|
bx lr
|
2012-05-02 21:55:32 +02:00
|
|
|
|
2015-12-03 21:28:02 +01:00
|
|
|
RVCT_ASM_EXPORT ArmReadSctlr
|
2014-03-01 12:01:00 +01:00
|
|
|
mrc p15, 0, r0, c1, c0, 0 // Read SCTLR into R0 (Read control register configuration data)
|
ARM Packages: Replace tabs by spaces for indentation
Replace tabs by spaces for indentation to comply to EDK2 coding standards.
Done in files with extension ".S", ".c", ".h", ".asm", ".dsc", ".inc", "*.inf",
"*.dec" or ".fdf" and located in ArmPkg, ArmPlatformPkg, EmbeddedPkg,
BeagleBoardPkg or Omap35xxPkg.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
Reviewed-By: Olivier Martin <olivier.martin@arm.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15901 6f19259b-4bc3-4df7-8a09-765794883524
2014-08-26 12:14:17 +02:00
|
|
|
bx lr
|
2014-03-26 20:31:01 +01:00
|
|
|
|
|
|
|
|
2015-12-03 21:28:02 +01:00
|
|
|
RVCT_ASM_EXPORT ArmReadCpuActlr
|
2014-03-26 20:31:01 +01:00
|
|
|
mrc p15, 0, r0, c1, c0, 1
|
|
|
|
bx lr
|
|
|
|
|
2015-12-03 21:28:02 +01:00
|
|
|
RVCT_ASM_EXPORT ArmWriteCpuActlr
|
2014-03-26 20:31:01 +01:00
|
|
|
mcr p15, 0, r0, c1, c0, 1
|
|
|
|
dsb
|
|
|
|
isb
|
|
|
|
bx lr
|
2012-05-02 22:02:39 +02:00
|
|
|
|
2011-09-27 18:31:20 +02:00
|
|
|
END
|