|
| 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