Skip to main content

consortium_cfg_common/database/
schema.rs

1use super::HardwareDoorbellPeripheral;
2use crate::config::VisibleCore;
3
4#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
5pub struct ChipDatabase {
6    pub name: String,
7    pub trm: String,
8    pub ap: String,
9    /// Device-tree label of this chip's primary interrupt controller (the GIC):
10    /// `intc` on STM32MP2, `gic` on i.MX 9. Emitted as `interrupt-parent = <&…>`
11    /// on the register-backed (doorbell) UIO nodes so their GIC SPI resolves —
12    /// the STM32MP2 root sets no default interrupt-parent, so a doorbell node at
13    /// `/` would otherwise bind with no IRQ.
14    pub interrupt_parent: String,
15    pub cp: Vec<Coprocessor>,
16    pub memory: MemoryDatabase,
17    pub peripheral: PeripheralDatabase,
18}
19
20#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
21pub struct Coprocessor {
22    pub name: String,
23    pub count: Option<u8>,
24    pub variant: CoprocessorVariant,
25}
26
27#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
28#[serde(rename_all = "lowercase")]
29pub enum CoprocessorVariant {
30    Remote,
31    Manager,
32}
33
34#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
35pub struct MemoryDatabase {
36    pub trm_page: Vec<u32>,
37    pub aliases: Vec<MemoryAlias>,
38    pub regions: Vec<MemoryRegion>,
39}
40
41#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
42pub struct MemoryAlias {
43    pub offset: u32,
44    pub secure: bool,
45}
46
47#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
48pub struct MemoryRegion {
49    pub name: String,
50    pub r#type: MemoryRegionType,
51    pub base: u32,
52    pub length: u32,
53    pub visible: Vec<VisibleCore>,
54}
55
56#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
57#[serde(rename_all = "lowercase")]
58pub enum MemoryRegionType {
59    Sram,
60}
61
62#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
63pub struct PeripheralDatabase {
64    pub aliases: Vec<PeripheralAlias>,
65    pub doorbells: Vec<HardwareDoorbellPeripheral>,
66}
67
68#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
69pub struct PeripheralAlias {
70    pub address: u32,
71    pub secure: bool,
72}