VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/FirmwareNew/ArmPkg/Library/ArmLib/ArmLib.c@ 108793

Last change on this file since 108793 was 99464, checked in by vboxsync, 2 years ago

Devices/EFI/Firmware: Restore ArmPkg, ArmVirtPkg, ArmPlatformPkg in order to be able to build Aarch64 and Aarch32 firmware images for the virt platform, bugref:10400

  • Property svn:eol-style set to native
File size: 1.1 KB
Line 
1/** @file
2
3 Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
4 Copyright (c) 2011 - 2021, ARM Ltd. All rights reserved.<BR>
5
6 SPDX-License-Identifier: BSD-2-Clause-Patent
7
8**/
9
10#include <Base.h>
11
12#include <Library/ArmLib.h>
13
14#include "ArmLibPrivate.h"
15
16VOID
17EFIAPI
18ArmSetAuxCrBit (
19 IN UINT32 Bits
20 )
21{
22 ArmWriteAuxCr (ArmReadAuxCr () | Bits);
23}
24
25VOID
26EFIAPI
27ArmUnsetAuxCrBit (
28 IN UINT32 Bits
29 )
30{
31 ArmWriteAuxCr (ArmReadAuxCr () & ~Bits);
32}
33
34//
35// Helper functions for accessing CPUACTLR
36//
37
38VOID
39EFIAPI
40ArmSetCpuActlrBit (
41 IN UINTN Bits
42 )
43{
44 ArmWriteCpuActlr (ArmReadCpuActlr () | Bits);
45}
46
47VOID
48EFIAPI
49ArmUnsetCpuActlrBit (
50 IN UINTN Bits
51 )
52{
53 ArmWriteCpuActlr (ArmReadCpuActlr () & ~Bits);
54}
55
56UINTN
57EFIAPI
58ArmDataCacheLineLength (
59 VOID
60 )
61{
62 return 4 << ((ArmCacheInfo () >> 16) & 0xf); // CTR_EL0.DminLine
63}
64
65UINTN
66EFIAPI
67ArmInstructionCacheLineLength (
68 VOID
69 )
70{
71 return 4 << (ArmCacheInfo () & 0xf); // CTR_EL0.IminLine
72}
73
74UINTN
75EFIAPI
76ArmCacheWritebackGranule (
77 VOID
78 )
79{
80 UINTN CWG;
81
82 CWG = (ArmCacheInfo () >> 24) & 0xf; // CTR_EL0.CWG
83
84 if (CWG == 0) {
85 return SIZE_2KB;
86 }
87
88 return 4 << CWG;
89}
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette