Skip to content
This repository was archived by the owner on Nov 7, 2022. It is now read-only.

Commit d6dfc21

Browse files
vbe0201andre-richter
authored andcommitted
Define the ID_AA64MMFR2_EL1 register
1 parent 62ca065 commit d6dfc21

File tree

2 files changed

+111
-1
lines changed

2 files changed

+111
-1
lines changed

src/registers.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ mod fp;
3232
mod hcr_el2;
3333
mod id_aa64mmfr0_el1;
3434
mod id_aa64isar0_el1;
35+
mod id_aa64mmfr2_el1;
3536
mod lr;
3637
mod mair_el1;
3738
mod mair_el2;
@@ -60,7 +61,7 @@ mod ttbr1_el1;
6061
mod vbar_el1;
6162
mod vbar_el2;
6263

63-
pub use ccsidr_el1::{CCSIDR_EL1, CSSIDR_EL1_WITH_FEAT_CCIDX};
64+
pub use ccsidr_el1::{CCSIDR_EL1, CCSIDR_EL1_WITH_FEAT_CCIDX};
6465
pub use clidr_el1::CLIDR_EL1;
6566
pub use cntfrq_el0::CNTFRQ_EL0;
6667
pub use cnthctl_el2::CNTHCTL_EL2;
@@ -86,6 +87,7 @@ pub use fp::FP;
8687
pub use hcr_el2::HCR_EL2;
8788
pub use id_aa64mmfr0_el1::ID_AA64MMFR0_EL1;
8889
pub use id_aa64isar0_el1::ID_AA64ISAR0_EL1;
90+
pub use id_aa64mmfr2_el1::ID_AA64MMFR2_EL1;
8991
pub use lr::LR;
9092
pub use mair_el1::MAIR_EL1;
9193
pub use mair_el2::MAIR_EL2;

src/registers/id_aa64mmfr2_el1.rs

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
// SPDX-License-Identifier: Apache-2.0 OR MIT
2+
//
3+
// Copyright (c) 2018-2022 by the author(s)
4+
//
5+
// Author(s):
6+
// - Valentin B. <valentin.be@protonmail.com>
7+
8+
//! AArch64 Memory Model Feature Register 2 - EL1
9+
//!
10+
//! Provides information about the implemented memory model and memory
11+
//! management support in AArch64 state.
12+
13+
use tock_registers::{interfaces::Readable, register_bitfields};
14+
15+
register_bitfields! {u64,
16+
pub ID_AA64MMFR2_EL1 [
17+
/// Indicates support for the E0PD mechanism.
18+
E0PD OFFSET(60) NUMBITS(4) [],
19+
20+
/// Enhanced Virtualization Traps.
21+
///
22+
/// If EL2 is implemented, indicates support for the
23+
/// HCR_EL2.{TTLBOS, TTLBIS, TOCU, TICAB, TID4} traps.
24+
EVT OFFSET(56) NUMBITS(4) [
25+
/// None of the aforementioned traps are supported.
26+
Nothing = 0b0000,
27+
/// All aforementioned traps but the HCR_EL2.{TTLBOS, TTLBBIS}
28+
/// ones are supported.
29+
NoTtl = 0b0001,
30+
/// All the aforementioned HCR_EL2 traps are supported.
31+
Everything = 0b0010
32+
],
33+
34+
/// Allows identification of the requirements of the hardware to have
35+
/// break-before-make sequences when changing block size for a translation.
36+
BBM OFFSET(52) NUMBITS(4) [
37+
/// Level 0 support for changing block size is supported.
38+
Level0 = 0b0000,
39+
/// Level 1 support for changing block size is supported.
40+
Level1 = 0b0001,
41+
/// Level 2 support for changing block size is supported.
42+
Level2 = 0b0010
43+
],
44+
45+
/// Indicates support for TTL field in address operations.
46+
TTL OFFSET(48) NUMBITS(4) [],
47+
48+
/// Indicates support for HCR_EL2.FWB.
49+
FWB OFFSET(40) NUMBITS(4) [],
50+
51+
/// Indicates the value of ESR_ELx.EC that reports an exception generated by
52+
/// a read access to the feature ID space.
53+
///
54+
/// - When reading 0, only read access exceptions other than HCR_EL2.TIDx,
55+
/// SCTLR_EL1.UCT, or SCTLR_EL2.UCT traps are reported by ESR_ELx.EC == 0.
56+
///
57+
/// - When reading 1, all read access exceptions are reported by ESR_ELx.EC == 0x18.
58+
IDS OFFSET(36) NUMBITS(4) [],
59+
60+
/// Identifies support for unaligned single-copy atomicity and atomic functions.
61+
AT OFFSET(32) NUMBITS(4) [],
62+
63+
/// Identifies support for small translation tables.
64+
ST OFFSET(28) NUMBITS(4) [],
65+
66+
/// If EL2 is implemented, indicates support for the use of nested virtualization.
67+
NV OFFSET(24) NUMBITS(4) [
68+
/// Nested virtualization is not supported.
69+
Unsupported = 0b0000,
70+
/// The HCR_EL2.{AT, NV1, NV} bits are implemented.
71+
Partial = 0b001,
72+
/// The VNCR_EL2 register and the HCR_EL2.{NV2, AT, NV1, NV} bits are implemented.
73+
Full = 0b0010
74+
],
75+
76+
/// Support for the use of revised `CCSIDR_EL1` register format.
77+
CCIDX OFFSET(20) NUMBITS(4) [],
78+
79+
/// Indicates support for a larger virtual address.
80+
///
81+
/// When this reads 1, 52-bit VAs when using the 64KB translation granule are
82+
/// supported along with the standard 48-bit VAs.
83+
VARange OFFSET(16) NUMBITS(4) [],
84+
85+
/// Indicates support for the IESB bit in the SCTLR_ELx registers.
86+
IESB OFFSET(12) NUMBITS(4) [],
87+
88+
/// Indicates support for LSMAOE and nTLSMD bits in SCTLR_EL1 and SCTLR_EL2.
89+
LSM OFFSET(8) NUMBITS(4) [],
90+
91+
/// Indicates support for User Access Overrides.
92+
UAO OFFSET(4) NUMBITS(4) [],
93+
94+
/// Indicates support for Common not Private translations.
95+
CnP OFFSET(0) NUMBITS(4) []
96+
]
97+
}
98+
99+
pub struct Reg;
100+
101+
impl Readable for Reg {
102+
type T = u64;
103+
type R = ID_AA64MMFR2_EL1::Register;
104+
105+
sys_coproc_read_raw!(u64, "ID_AA64MMFR2_EL1", "x");
106+
}
107+
108+
pub const ID_AA64MMFR2_EL1: Reg = Reg;

0 commit comments

Comments
 (0)