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

Commit 7148851

Browse files
committed
Define the CPUECTRL_EL1 register
1 parent f44bee8 commit 7148851

File tree

2 files changed

+165
-0
lines changed

2 files changed

+165
-0
lines changed

src/registers.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ mod cntv_cval_el0;
1919
mod cntv_tval_el0;
2020
mod cntvct_el0;
2121
mod cntvoff_el2;
22+
mod cpuectrl_el1;
2223
mod dacr32_el2;
2324
mod currentel;
2425
mod daif;
@@ -74,6 +75,7 @@ pub use cntv_cval_el0::CNTV_CVAL_EL0;
7475
pub use cntv_tval_el0::CNTV_TVAL_EL0;
7576
pub use cntvct_el0::CNTVCT_EL0;
7677
pub use cntvoff_el2::CNTVOFF_EL2;
78+
pub use cpuectrl_el1::CPUECTRL_EL1;
7779
pub use dacr32_el2::DACR32_EL2;
7880
pub use currentel::CurrentEL;
7981
pub use daif::DAIF;

src/registers/cpuectrl_el1.rs

Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
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+
//! CPU Extended Control Register - EL1
9+
//!
10+
//! Provides additional implementation-defined configuration and control options
11+
//! for the core.
12+
13+
use tock_registers::{
14+
interfaces::{Readable, Writeable},
15+
register_bitfields,
16+
};
17+
18+
register_bitfields! {u64,
19+
pub CPUECTRL_EL1 [
20+
/// Branch prediction structure invalidation.
21+
///
22+
/// Software must write 1 to this bit to invalidate all entries from branch
23+
/// predictors. Writes have no effect on the value that is read on this bit,
24+
/// which is always 0.
25+
///
26+
/// This feature can be used to mitigate attacks using branch injection
27+
/// vulnerability.
28+
GBPP OFFSET(63) NUMBITS(1) [],
29+
30+
/// Threshold for direct stream to L4 cache on store.
31+
L4_STREAM OFFSET(22) NUMBITS(2) [
32+
/// 512KB threshold.
33+
///
34+
/// NOTE: This is also the reset value.
35+
_512KB = 0b00,
36+
///1024KB threshold.
37+
_1024KB = 0b01,
38+
/// 2048KB threshold.
39+
_2048KB = 0b10,
40+
/// Stream disabled.
41+
Disabled = 0b11
42+
],
43+
44+
/// Threshold for direct stream to L3 cache on store.
45+
L3_STREAM OFFSET(20) NUMBITS(2) [
46+
/// 64KB threshold.
47+
///
48+
/// NOTE: This is also the reset value.
49+
_64KB = 0b00,
50+
/// 256KB threshold.
51+
_256KB = 0b01,
52+
/// 512KB threshold.
53+
_512KB = 0b10,
54+
/// Stream disabled.
55+
Disabled = 0b11
56+
],
57+
58+
/// Threshold for direct stream to L2 cache on store.
59+
L2_STREAM OFFSET(18) NUMBITS(2) [
60+
/// 16KB threshold.
61+
///
62+
/// NOTE: This is also the reset value.
63+
_16KB = 0b00,
64+
/// 64KB threshold.
65+
_64KB = 0b01,
66+
/// 128KB threshold.
67+
_128KB = 0b10,
68+
/// Stream disabled.
69+
Disabled = 0b11
70+
],
71+
72+
/// Enables L3 prefetch requests sent by the stride prefetcher.
73+
L3PF OFFSET(10) NUMBITS(1) [
74+
/// L3 prefetch requests are disabled.
75+
Disable = 0,
76+
/// L3 prefetch requests are enabled.
77+
///
78+
/// NOTE: This is also the reset value.
79+
Enable = 1
80+
],
81+
82+
/// Enables L2 prefetch requests sent by the stride prefetcher.
83+
L2PF OFFSET(9) NUMBITS(1) [
84+
/// L2 prefetch requests are disabled.
85+
Disable = 0,
86+
/// L2 prefetch requests are enabled.
87+
///
88+
/// NOTE: This is also the reset value.
89+
Enable = 1
90+
],
91+
92+
/// Enables L1 prefetch requests sent by the stride prefetcher.
93+
L1PF OFFSET(8) NUMBITS(1) [
94+
/// L1 prefetch requests are disabled.
95+
Disable = 0,
96+
/// L1 prefetch requests are enabled.
97+
///
98+
/// NOTE: This is also the reset value.
99+
Enable = 1
100+
],
101+
102+
/// Enables L2 region prefetch requests.
103+
RPF OFFSET(7) NUMBITS(1) [
104+
/// L2 region prefetch requests are disabled.
105+
Disable = 0,
106+
/// L2 region prefetch requests are enabled.
107+
///
108+
/// NOTE: This is also the reset value.
109+
Enable = 1
110+
],
111+
112+
/// Enables MMU prefetch requests.
113+
MMUPF OFFSET(6) NUMBITS(1) [
114+
/// MMU prefetch requests are disabled.
115+
Disable = 0,
116+
/// MMU prefetch requests are enabled.
117+
///
118+
/// NOTE: This is also the reset value.
119+
Enable = 1
120+
],
121+
122+
/// L2 region prefetcher aggressibility.
123+
RPF_AGGRO OFFSET(5) NUMBITS(1) [
124+
/// The L2 region prefetcher is less aggressive, with a longer learning phase.
125+
LessAggro = 0,
126+
/// The L2 region prefetcher is more aggressive, with a shorter learning phase.
127+
///
128+
/// NOTE: This is also the reset value.
129+
MoreAggro = 1
130+
],
131+
132+
/// Enables signaling of Cacheable Exclusive Loads on the internal interface between the
133+
/// core and the DSU.
134+
RNSD_EXCL OFFSET(1) NUMBITS(1) [
135+
/// Cacheable Exclusive Loads do not use the Exclusive attribute on the internal
136+
/// interface between the core and the DSU.
137+
NoExclusive = 0,
138+
/// Cacheable Exclusive Loads use the Exclusive attribute on the internal interface
139+
/// between the core and the DSU.
140+
Exclusive = 1
141+
],
142+
143+
EXTLLC OFFSET(0) NUMBITS(1) []
144+
]
145+
}
146+
147+
pub struct Reg;
148+
149+
impl Readable for Reg {
150+
type T = u64;
151+
type R = ();
152+
153+
sys_coproc_read_raw!(u64, "S3_0_C15_C1_4", "x");
154+
}
155+
156+
impl Writeable for Reg {
157+
type T = u64;
158+
type R = ();
159+
160+
sys_coproc_write_raw!(u64, "S3_0_C15_C1_4", "x");
161+
}
162+
163+
pub const CPUECTRL_EL1: Reg = Reg;

0 commit comments

Comments
 (0)