X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=ArmPkg%2FLibrary%2FArmLib%2FArmV7%2FArmV7Support.S;h=c9dbce3e1248e9ba4c48904fc5d2b601cded4ca2;hp=b4ec9b5122e5eee7f92ca7ff47aa590fb14f176a;hb=7800c283e0f64417c7d537a99859324ded7eaa7f;hpb=026c3d34ee83b4df623cc80761450a53e9f7622b diff --git a/ArmPkg/Library/ArmLib/ArmV7/ArmV7Support.S b/ArmPkg/Library/ArmLib/ArmV7/ArmV7Support.S index b4ec9b5122..c9dbce3e12 100644 --- a/ArmPkg/Library/ArmLib/ArmV7/ArmV7Support.S +++ b/ArmPkg/Library/ArmLib/ArmV7/ArmV7Support.S @@ -12,8 +12,6 @@ # #------------------------------------------------------------------------------ -.text -.align 2 .globl ASM_PFX(ArmInvalidateInstructionCache) .globl ASM_PFX(ArmInvalidateDataCacheEntryByMVA) .globl ASM_PFX(ArmCleanDataCacheEntryByMVA) @@ -29,8 +27,6 @@ .globl ASM_PFX(ArmDisableDataCache) .globl ASM_PFX(ArmEnableInstructionCache) .globl ASM_PFX(ArmDisableInstructionCache) -.globl ASM_PFX(ArmEnableExtendPTConfig) -.globl ASM_PFX(ArmDisableExtendPTConfig) .globl ASM_PFX(ArmEnableBranchPrediction) .globl ASM_PFX(ArmDisableBranchPrediction) .globl ASM_PFX(ArmV7AllDataCachesOperation) @@ -38,11 +34,14 @@ .globl ASM_PFX(ArmDataSyncronizationBarrier) .globl ASM_PFX(ArmInstructionSynchronizationBarrier) +.text +.align 2 .set DC_ON, (0x1<<2) .set IC_ON, (0x1<<12) + ASM_PFX(ArmInvalidateDataCacheEntryByMVA): mcr p15, 0, r0, c7, c6, 1 @invalidate single data cache line dsb @@ -85,17 +84,8 @@ ASM_PFX(ArmCleanDataCacheEntryBySetWay): bx lr -ASM_PFX(ArmDrainWriteBuffer): - mcr p15, 0, r0, c7, c10, 4 @ Drain write buffer for sync - dsb - isb - bx lr - - ASM_PFX(ArmInvalidateInstructionCache): - mov R0,#0 mcr p15,0,R0,c7,c5,0 @Invalidate entire instruction cache - mov R0,#0 dsb isb bx LR @@ -104,6 +94,8 @@ ASM_PFX(ArmEnableMmu): mrc p15,0,R0,c1,c0,0 orr R0,R0,#1 mcr p15,0,R0,c1,c0,0 + dsb + isb bx LR ASM_PFX(ArmMmuEnabled): @@ -111,14 +103,13 @@ ASM_PFX(ArmMmuEnabled): and R0,R0,#1 bx LR - ASM_PFX(ArmDisableMmu): - mov R0,#0 - mcr p15,0,R0,c13,c0,0 @FCSE PID register must be cleared before disabling MMU mrc p15,0,R0,c1,c0,0 bic R0,R0,#1 mcr p15,0,R0,c1,c0,0 @Disable MMU - mov R0,#0 + + mcr p15,0,R0,c8,c7,0 @Invalidate TLB + mcr p15,0,R0,c7,c5,6 @Invalidate Branch predictor array dsb isb bx LR @@ -192,14 +183,16 @@ Loop1: cmp R12, #2 blt L_Skip @ no cache or only instruction cache at this level mcr p15, 2, R10, c0, c0, 0 @ write the Cache Size selection register (CSSELR) // OR in 1 for Instruction - isb @ ISB to sync the change to the CacheSizeID reg - mcr p15, 1, R12, c0, c0, 0 @ reads current Cache Size ID register (CCSIDR) + isb @ isb to sync the change to the CacheSizeID reg + mrc p15, 1, R12, c0, c0, 0 @ reads current Cache Size ID register (CCSIDR) and R2, R12, #0x7 @ extract the line length field - and R2, R2, #4 @ add 4 for the line length offset (log2 16 bytes) + add R2, R2, #4 @ add 4 for the line length offset (log2 16 bytes) +@ ldr R4, =0x3FF mov R4, #0x400 sub R4, R4, #1 ands R4, R4, R12, LSR #3 @ R4 is the max number on the way size (right aligned) clz R5, R4 @ R5 is the bit position of the way size increment +@ ldr R7, =0x00007FFF mov R7, #0x00008000 sub R7, R7, #1 ands R7, R7, R12, LSR #13 @ R7 is the max number of the index size (right aligned) @@ -223,6 +216,7 @@ L_Skip: bgt Loop1 L_Finished: + dsb ldmfd SP!, {r4-r12, lr} bx LR @@ -231,6 +225,7 @@ ASM_PFX(ArmDataMemoryBarrier): bx LR ASM_PFX(ArmDataSyncronizationBarrier): +ASM_PFX(ArmDrainWriteBuffer): dsb bx LR