]> git.proxmox.com Git - mirror_edk2.git/blob - ArmPkg/Library/ArmLib/Common/ArmLib.c
ArmPkg/ArmLib: Clean ArmV7Lib
[mirror_edk2.git] / ArmPkg / Library / ArmLib / Common / ArmLib.c
1 /** @file
2
3 Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
4
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
9
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.
12
13 **/
14
15 #include <Base.h>
16
17 #include <Library/ArmLib.h>
18 #include <Library/DebugLib.h>
19 #include <Library/PcdLib.h>
20
21 #include "ArmLibPrivate.h"
22
23 VOID
24 EFIAPI
25 ArmCacheInformation (
26 OUT ARM_CACHE_INFO *CacheInfo
27 )
28 {
29 if (CacheInfo != NULL) {
30 CacheInfo->Type = ArmCacheType();
31 CacheInfo->Architecture = ArmCacheArchitecture();
32 CacheInfo->DataCachePresent = ArmDataCachePresent();
33 CacheInfo->DataCacheSize = ArmDataCacheSize();
34 CacheInfo->DataCacheAssociativity = ArmDataCacheAssociativity();
35 CacheInfo->DataCacheLineLength = ArmDataCacheLineLength();
36 CacheInfo->InstructionCachePresent = ArmInstructionCachePresent();
37 CacheInfo->InstructionCacheSize = ArmInstructionCacheSize();
38 CacheInfo->InstructionCacheAssociativity = ArmInstructionCacheAssociativity();
39 CacheInfo->InstructionCacheLineLength = ArmInstructionCacheLineLength();
40 }
41 }
42
43 VOID
44 EFIAPI
45 ArmSwitchProcessorMode (
46 IN ARM_PROCESSOR_MODE Mode
47 )
48 {
49 CPSRMaskInsert(ARM_PROCESSOR_MODE_MASK, Mode);
50 }
51
52
53 ARM_PROCESSOR_MODE
54 EFIAPI
55 ArmProcessorMode (
56 VOID
57 )
58 {
59 return (ARM_PROCESSOR_MODE)(CPSRRead() & (UINT32)ARM_PROCESSOR_MODE_MASK);
60 }
61
62 VOID
63 EFIAPI
64 ArmSetAuxCrBit (
65 IN UINT32 Bits
66 )
67 {
68 UINT32 val = ArmReadAuxCr();
69 val |= Bits;
70 ArmWriteAuxCr(val);
71 }
72