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

Commit 0cabfc8

Browse files
vbe0201andre-richter
authored andcommitted
Define the CSSELR_EL1 register
1 parent d402e65 commit 0cabfc8

File tree

2 files changed

+102
-0
lines changed

2 files changed

+102
-0
lines changed

src/registers.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ mod cntv_cval_el0;
1616
mod cntv_tval_el0;
1717
mod cntvct_el0;
1818
mod cntvoff_el2;
19+
mod csselr_el1;
1920
mod currentel;
2021
mod daif;
2122
mod elr_el1;
@@ -67,6 +68,7 @@ pub use cntv_cval_el0::CNTV_CVAL_EL0;
6768
pub use cntv_tval_el0::CNTV_TVAL_EL0;
6869
pub use cntvct_el0::CNTVCT_EL0;
6970
pub use cntvoff_el2::CNTVOFF_EL2;
71+
pub use csselr_el1::CSSELR_EL1;
7072
pub use currentel::CurrentEL;
7173
pub use daif::DAIF;
7274
pub use elr_el1::ELR_EL1;

src/registers/csselr_el1.rs

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
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+
//! Current Cache Size ID Register - EL1
9+
//!
10+
//! Provides information about the architecture of the currently selected cache.
11+
12+
use tock_registers::{
13+
interfaces::{Readable, Writeable},
14+
register_bitfields,
15+
};
16+
17+
register_bitfields! {u64,
18+
pub CSSELR_EL1 [
19+
/// ** When `FEAT_MTE2` is implemented:**
20+
///
21+
/// Allocation Tag not Data bit.
22+
///
23+
/// When [`CSSELR_EL1::InD`] is set, this bit is considered reserved.
24+
///
25+
/// When [`CSSELR_EL1::Level`] is programmed to a cache level that is
26+
/// not implemented, this field's value will be undefined for reads.
27+
///
28+
/// NOTE: On a Warm reset, this field resets to an architecturally
29+
/// undefined value.
30+
///
31+
/// **Otherwise:**
32+
///
33+
/// Reserved.
34+
TnD OFFSET(4) NUMBITS(1) [
35+
/// Data, Instruction or Unified cache.
36+
Data = 0b0,
37+
/// Separate Allocation Tag cache.
38+
AllocationTag = 0b1
39+
],
40+
41+
/// Cache level of required cache.
42+
///
43+
/// Any value other than the pre-defined ones are considered reserved
44+
/// and shall not be written to this field.
45+
///
46+
/// When [`CSSELR_EL1::Level`] is programmed to a cache level that is
47+
/// not implemented, this field's value will be undefined for reads.
48+
///
49+
/// NOTE: On a Warm reset, this field resets to an architecturally
50+
/// undefined value.
51+
Level OFFSET(1) NUMBITS(3) [
52+
/// Level 1 Cache.
53+
L1 = 0b000,
54+
/// Level 2 Cache.
55+
L2 = 0b001,
56+
/// Level 3 Cache.
57+
L3 = 0b010,
58+
/// Level 4 Cache.
59+
L4 = 0b011,
60+
/// Level 5 Cache.
61+
L5 = 0b100,
62+
/// Level 6 Cache.
63+
L6 = 0b101,
64+
/// Level 7 Cache.
65+
L7 = 0b110
66+
],
67+
68+
/// Instruction not Data bit.
69+
///
70+
/// When [`CSSELR_EL1::Level`] is programmed to a cache level that is
71+
/// not implemented, this field's value will be undefined for reads.
72+
///
73+
/// NOTE: On a Warm reset, this field resets to an architecturally
74+
/// undefined value.
75+
InD OFFSET(0) NUMBITS(1) [
76+
/// Data or Unified cache.
77+
Data = 0b0,
78+
/// Instruction cache.
79+
Instruction = 0b1
80+
]
81+
]
82+
}
83+
84+
pub struct Reg;
85+
86+
impl Readable for Reg {
87+
type T = u64;
88+
type R = CSSELR_EL1::Register;
89+
90+
sys_coproc_read_raw!(u64, "CSSELR_EL1", "x");
91+
}
92+
93+
impl Writeable for Reg {
94+
type T = u64;
95+
type R = CSSELR_EL1::Register;
96+
97+
sys_coproc_write_raw!(u64, "CSSELR_EL1", "x");
98+
}
99+
100+
pub const CSSELR_EL1: Reg = Reg;

0 commit comments

Comments
 (0)