Skip to content

Commit 81e6008

Browse files
authored
Merge pull request #85 from rust-embedded/update-pmuserenr-el0-flag-names
Update PMUSERENR_EL0 flag names
2 parents 3453cf9 + 80ae164 commit 81e6008

1 file changed

Lines changed: 60 additions & 14 deletions

File tree

‎packages/aarch64-cpu/src/registers/pmuserenr_el0.rs‎

Lines changed: 60 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,18 @@
44
//
55
// Author(s):
66
// - Callum Thomson <callumthom11@gmail.com>
7+
// - Berkus Decker <berkus+github@metta.systems>
78

8-
//! Performance Monitors User Enable Register - EL1
9+
//! Performance Monitors User Enable Register - EL0
10+
//!
11+
//! Enables or disables EL0 access to the Performance Monitors. Readable at EL0, writable only at
12+
//! EL1 or higher.
13+
//!
14+
//! When EL0 access is not enabled, an EL0 access to a Performance Monitors register is trapped
15+
//! to EL1, or to EL2 when it is implemented and enabled for the current Security state and
16+
//! HCR_EL2.TGE is 1, and reported using EC syndrome value 0x18.
917
10-
use tock_registers::interfaces::Readable;
18+
use tock_registers::interfaces::{Readable, Writeable};
1119
use tock_registers::register_bitfields;
1220

1321
pub struct Reg;
@@ -26,37 +34,75 @@ register_bitfields! {u64,
2634
Enabled = 1,
2735
],
2836

29-
/// Event counters Read enable or Read-only
37+
/// Event counter Read when FEAT_PMUv3p9 is implemented. Traps EL0 reads of the event counters to EL1.
38+
///
39+
/// 0b0 EL0 reads of PMXEVCNTR_EL0 and PMEVCNTR<n>_EL0, and EL0 read/write accesses
40+
/// to PMSELR_EL0, are trapped, unless PMUSERENR_EL0.EN is 1.
41+
///
42+
/// 0b1 EL0 reads of the event counters, and read/write accesses to PMSELR_EL0, are
43+
/// not trapped.
44+
///
45+
/// The reset behavior of this field is:
46+
/// - On a Warm reset, this field resets to an architecturally UNKNOWN value.
3047
ER OFFSET(3) NUMBITS(1) [
31-
Disabled = 0,
32-
Enabled = 1,
48+
TrappedUnlessEnabled = 0,
49+
NotTrapped = 1
3350
],
3451

35-
/// Cycle counter Read enable or Read-only
52+
/// Cycle counter Read. Traps EL0 reads of the cycle counter to EL1.
53+
///
54+
/// 0b0 EL0 reads of PMCCNTR_EL0 are trapped, unless PMUSERENR_EL0.EN is 1.
55+
///
56+
/// 0b1 EL0 reads of PMCCNTR_EL0 are not trapped.
57+
///
58+
/// The reset behavior of this field is:
59+
/// - On a Warm reset, this field resets to an architecturally UNKNOWN value.
3660
CR OFFSET(2) NUMBITS(1) [
37-
Disabled = 0,
38-
Enabled = 1,
61+
TrappedUnlessEnabled = 0,
62+
NotTrapped = 1,
3963
],
4064

41-
/// Software increment register Write enable.
65+
/// Software Increment register Write enable. Traps EL0 writes to the software increment register to EL1.
66+
///
67+
/// 0b0 EL0 writes to PMSWINC_EL0 are trapped, unless PMUSERENR_EL0.EN is 1.
68+
///
69+
/// 0b1 EL0 writes to PMSWINC_EL0 are not trapped.
70+
///
71+
/// The reset behavior of this field is:
72+
/// - On a Warm reset, this field resets to an architecturally UNKNOWN value.
4273
SW OFFSET(1) NUMBITS(1) [
43-
El0Enabled = 0,
44-
El1Enabled = 1,
74+
TrappedUnlessEnabled = 0,
75+
NotTrapped = 1,
4576
],
4677

47-
/// Enable
78+
/// Traps EL0 accesses to the Performance Monitors registers to EL1.
79+
///
80+
/// 0b0 EL0 accesses to the Performance Monitors registers are trapped, except where
81+
/// enabled by PMUSERENR_EL0.{SW, CR, ER}.
82+
///
83+
/// 0b1 EL0 accesses to the Performance Monitors registers are not trapped.
84+
///
85+
/// The reset behavior of this field is:
86+
/// - On a Warm reset, this field resets to an architecturally UNKNOWN value.
4887
EN OFFSET(0) NUMBITS(1) [
4988
TrappedUnlessEnabled = 0,
50-
Enabled = 1,
89+
NotTrapped = 1
5190
],
5291
]
5392
}
5493

5594
impl Readable for Reg {
5695
type T = u64;
57-
type R = ();
96+
type R = PMUSERENR_EL0::Register;
5897

5998
sys_coproc_read_raw!(u64, "PMUSERENR_EL0", "x");
6099
}
61100

101+
impl Writeable for Reg {
102+
type T = u64;
103+
type R = PMUSERENR_EL0::Register;
104+
105+
sys_coproc_write_raw!(u64, "PMUSERENR_EL0", "x");
106+
}
107+
62108
pub const PMUSERENR_EL0: Reg = Reg;

0 commit comments

Comments
 (0)