3 Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
19 ARM_CACHE_TYPE_WRITE_BACK
,
20 ARM_CACHE_TYPE_UNKNOWN
24 ARM_CACHE_ARCHITECTURE_UNIFIED
,
25 ARM_CACHE_ARCHITECTURE_SEPARATE
,
26 ARM_CACHE_ARCHITECTURE_UNKNOWN
27 } ARM_CACHE_ARCHITECTURE
;
31 ARM_CACHE_ARCHITECTURE Architecture
;
32 BOOLEAN DataCachePresent
;
34 UINTN DataCacheAssociativity
;
35 UINTN DataCacheLineLength
;
36 BOOLEAN InstructionCachePresent
;
37 UINTN InstructionCacheSize
;
38 UINTN InstructionCacheAssociativity
;
39 UINTN InstructionCacheLineLength
;
43 ARM_MEMORY_REGION_ATTRIBUTE_UNCACHED_UNBUFFERED
= 0,
44 ARM_MEMORY_REGION_ATTRIBUTE_SECURE_UNCACHED_UNBUFFERED
,
45 ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK
,
46 ARM_MEMORY_REGION_ATTRIBUTE_SECURE_WRITE_BACK
,
47 ARM_MEMORY_REGION_ATTRIBUTE_WRITE_THROUGH
,
48 ARM_MEMORY_REGION_ATTRIBUTE_SECURE_WRITE_THROUGH
,
49 ARM_MEMORY_REGION_ATTRIBUTE_DEVICE
,
50 ARM_MEMORY_REGION_ATTRIBUTE_SECURE_DEVICE
51 } ARM_MEMORY_REGION_ATTRIBUTES
;
53 #define IS_ARM_MEMORY_REGION_ATTRIBUTES_SECURE(attr) ((UINT32)(attr) & 1)
59 ARM_MEMORY_REGION_ATTRIBUTES Attributes
;
60 } ARM_MEMORY_REGION_DESCRIPTOR
;
62 typedef VOID (*CACHE_OPERATION
)(VOID
);
63 typedef VOID (*LINE_OPERATION
)(UINTN
);
66 ARM_PROCESSOR_MODE_USER
= 0x10,
67 ARM_PROCESSOR_MODE_FIQ
= 0x11,
68 ARM_PROCESSOR_MODE_IRQ
= 0x12,
69 ARM_PROCESSOR_MODE_SUPERVISOR
= 0x13,
70 ARM_PROCESSOR_MODE_ABORT
= 0x17,
71 ARM_PROCESSOR_MODE_UNDEFINED
= 0x1B,
72 ARM_PROCESSOR_MODE_SYSTEM
= 0x1F,
73 ARM_PROCESSOR_MODE_MASK
= 0x1F
76 #define IS_PRIMARY_CORE(MpId) (((MpId) & PcdGet32(PcdArmPrimaryCoreMask)) == PcdGet32(PcdArmPrimaryCore))
77 #define GET_CORE_ID(MpId) ((MpId) & 0x3)
78 #define GET_CLUSTER_ID(MpId) (((MpId) >> 6) & 0x3C)
79 // Get the position of the core for the Stack Offset (4 Core per Cluster)
80 // Position = (ClusterId * 4) + CoreId
81 #define GET_CORE_POS(MpId) ((((MpId) >> 6) & 0x3C) + ((MpId) & 0x3))
82 #define PRIMARY_CORE_ID (PcdGet32(PcdArmPrimaryCore) & 0x3)
90 ARM_CACHE_ARCHITECTURE
92 ArmCacheArchitecture (
99 OUT ARM_CACHE_INFO
*CacheInfo
104 ArmDataCachePresent (
116 ArmDataCacheAssociativity (
122 ArmDataCacheLineLength (
128 ArmInstructionCachePresent (
134 ArmInstructionCacheSize (
140 ArmInstructionCacheAssociativity (
146 ArmInstructionCacheLineLength (
170 ArmInvalidateDataCache (
177 ArmCleanInvalidateDataCache (
189 ArmInvalidateInstructionCache (
195 ArmInvalidateDataCacheEntryByMVA (
201 ArmCleanDataCacheEntryByMVA (
207 ArmCleanInvalidateDataCacheEntryByMVA (
219 ArmDisableDataCache (
225 ArmEnableInstructionCache (
231 ArmDisableInstructionCache (
249 ArmDisableCachesAndMmu (
255 ArmEnableInterrupts (
261 ArmDisableInterrupts (
267 ArmGetInterruptState (
297 ArmUpdateTranslationTableEntry (
298 IN VOID
*TranslationTableEntry
,
304 ArmSetDomainAccessControl (
311 IN VOID
*TranslationTableBase
316 ArmGetTTBR0BaseAddress (
323 IN ARM_MEMORY_REGION_DESCRIPTOR
*MemoryTable
,
324 OUT VOID
**TranslationTableBase OPTIONAL
,
325 OUT UINTN
*TranslationTableSize OPTIONAL
336 ArmSwitchProcessorMode (
337 IN ARM_PROCESSOR_MODE Mode
348 ArmEnableBranchPrediction (
354 ArmDisableBranchPrediction (
372 ArmDataMemoryBarrier (
378 ArmDataSyncronizationBarrier (
384 ArmInstructionSynchronizationBarrier (
389 #endif // __ARM_LIB__