acpi_spec/
gtdt.rs

1// Copyright (c) Microsoft Corporation.
2// Licensed under the MIT License.
3
4use super::Table;
5use core::mem::size_of;
6use static_assertions::const_assert_eq;
7use zerocopy::FromBytes;
8use zerocopy::Immutable;
9use zerocopy::IntoBytes;
10use zerocopy::KnownLayout;
11use zerocopy::Unaligned;
12
13/// ACPI 6.5 Generic Timer Description Table (Table 5-128).
14#[repr(C, packed)]
15#[derive(Copy, Clone, Debug, Default, IntoBytes, Immutable, KnownLayout, FromBytes, Unaligned)]
16pub struct Gtdt {
17    pub cnt_control_base: u64,
18    pub reserved: u32,
19    pub secure_el1_timer_gsiv: u32,
20    pub secure_el1_timer_flags: u32,
21    pub non_secure_el1_timer_gsiv: u32,
22    pub non_secure_el1_timer_flags: u32,
23    pub virtual_el1_timer_gsiv: u32,
24    pub virtual_el1_timer_flags: u32,
25    pub el2_timer_gsiv: u32,
26    pub el2_timer_flags: u32,
27    pub cnt_read_base: u64,
28    pub platform_timer_count: u32,
29    pub platform_timer_offset: u32,
30    pub virtual_el2_timer_gsiv: u32,
31    pub virtual_el2_timer_flags: u32,
32}
33
34const_assert_eq!(size_of::<Gtdt>(), 68);
35
36impl Table for Gtdt {
37    const SIGNATURE: [u8; 4] = *b"GTDT";
38}
39
40pub const GTDT_TIMER_EDGE_TRIGGERED: u32 = 1 << 0;
41pub const GTDT_TIMER_ACTIVE_LOW: u32 = 1 << 1;
42pub const GTDT_TIMER_ALWAYS_ON: u32 = 1 << 2;