1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
// SPDX-FileCopyrightText: Copyright 2025 Arm Limited and/or its affiliates <open-source-office@arm.com>
// SPDX-License-Identifier: MIT OR Apache-2.0
#![allow(non_camel_case_types)]
use zerocopy_derive::*;
/// Table 5.8: Boot information descriptor
#[derive(Default, FromBytes, IntoBytes, KnownLayout, Immutable)]
#[repr(C, packed)]
pub(crate) struct boot_info_descriptor {
/// Offset 0, length 16: Name of boot information passed to the consumer.
pub(crate) name: [u8; 16],
/// Offset 16, length 1: Type of boot information passed to the consumer.
/// - Bit\[7\]: Boot information type.
/// + b’0: Standard boot information.
/// + b’1: Implementation defined boot information.
/// - Bits\[6:0\]: Boot information identifier.
/// + Standard boot information (bit\[7\] = b’0).
/// * 0: Flattened device tree (FDT).
/// * 1: Hand-Off Block (HOB) List.
/// * All other identifiers are reserved.
/// + Implementation defined identifiers (bit\[7\] = b’ 1).
/// * Identifier is defined by the implementation.
pub(crate) typ: u8,
/// Offset 17, length 1: Reserved (MBZ)
pub(crate) reserved: u8,
/// Offset 18, length 2: Flags to describe properties of boot information associated with this
/// descriptor.
/// - Bits\[15:4\]: Reserved (MBZ).
/// - Bits\[3:2\]: Format of Contents field.
/// + b’0: Address of boot information identified by the Name and Type fields.
/// + b’1: Value of boot information identified by the Name and Type fields.
/// + All other bit encodings are reserved for future use.
/// - Bits\[1:0\]: Format of Name field.
/// + b’0: Null terminated string.
/// + b’1: UUID encoded in little-endian byte order.
/// + All other bit encodings are reserved for future use.
pub(crate) flags: u16,
/// Offset 20, length 4: Size (in bytes) of boot information identified by the Name and Type
/// fields
pub(crate) size: u32,
/// Offset 24, length 8: Value or address of boot information identified by the Name and Type
/// fields.
///
/// If in the Flags field, bit\[3:2\] = b'0,
/// * The address has the same attributes as the boot information blob address described in
/// 5.4.3 Boot information address.
/// * Size field contains the length (in bytes) of boot information at the specified address.
///
/// If in the Flags field, bit\[3:2\] = b’1,
/// * Size field contains the exact size of the value specified in this field.
/// * Size is >=1 bytes and <= 8 bytes.
pub(crate) contents: u64,
}
/// Table 5.9: Boot information header
#[derive(Default, FromBytes, IntoBytes, KnownLayout, Immutable)]
#[repr(C, packed)]
pub(crate) struct boot_info_header {
/// Offset 0, length 4: Hexadecimal value 0x0FFA to identify the header
pub(crate) signature: u32,
/// Offset 4, length 4: Version of the boot information blob encoded as in FFA_VERSION_GET
pub(crate) version: u32,
/// Offset 8, length 4: Size of boot information blob spanning contiguous memory
pub(crate) boot_info_blob_size: u32,
/// Offset 12, length 4: Size of each boot information descriptor in the array
pub(crate) boot_info_desc_size: u32,
/// Offset 16, length 4: Count of boot information descriptors in the array
pub(crate) boot_info_desc_count: u32,
/// Offset 20, length 4: Offset to array of boot information descriptors
pub(crate) boot_info_array_offset: u32,
/// Offset 24, length 8: Reserved (MBZ)
pub(crate) reserved: u64,
}
/// Table 13.37: Partition information descriptor
#[derive(Default, FromBytes, IntoBytes, KnownLayout, Immutable)]
#[repr(C, packed)]
pub(crate) struct partition_info_descriptor {
/// Offset 0, length 2: 16-bit ID of the partition, stream or auxiliary endpoint.
pub(crate) partition_id: u16,
/// Offset 2, length 2:
/// - Number of execution contexts implemented by this partition if Bit\[5:4\] = b’00 in the
/// Partition properties field.
/// - ID of the proxy endpoint for a dependent peripheral device if Bit\[5:4\] = b’10 in the
/// Partition properties field.
/// - Reserved and MBZ for all other encodings of the Partition properties field.
pub(crate) exec_ctx_count_or_proxy_id: u16,
/// Offset 4, length 4: Flags to determine partition properties.
/// - Bit\[3:0\] has the following encoding if Bit\[5:4\] = b’00. It is Reserved and MBZ otherwise.
/// + Bit\[0\] has the following encoding:
/// * b’0: Does not support receipt of direct requests
/// * b’1: Supports receipt of direct requests. Count of execution contexts must be either 1
/// or equal to the number of PEs in the system.
/// + bit\[1\] has the following encoding:
/// * b’0: Cannot send direct requests.
/// * b’1: Can send direct requests.
/// + bit\[2\] has the following encoding:
/// * b’0: Cannot send and receive indirect messages.
/// * b’1: Can send and receive indirect messages.
/// + bit\[3\] has the following encoding:
/// * b’0: Does not support receipt of notifications.
/// * b’1: Supports receipt of notifications.
/// - bit\[5:4\] has the following encoding:
/// + b’00: Partition ID is a PE endpoint ID.
/// + b’01: Partition ID is a SEPID for an independent peripheral device.
/// + b’10: Partition ID is a SEPID for an dependent peripheral device.
/// + b’11: Partition ID is an auxiliary ID.
/// - bit\[6\] has the following encoding:
/// + b’0: Partition must not be informed about each VM that is created by the Hypervisor.
/// + b’1: Partition must be informed about each VM that is created by the Hypervisor.
/// + bit\[6\] is used only if the following conditions are true. It is Reserved (MBZ) in all
/// other scenarios.
/// * This ABI is invoked at the Non-secure physical FF-A instance.
/// * The partition is an SP that supports receipt of direct requests i.e. Bit\[0\] = b’1.
/// - bit\[7\] has the following encoding:
/// + b’0: Partition must not be informed about each VM that is destroyed by the Hypervisor.
/// + b’1: Partition must be informed about each VM that is destroyed by the Hypervisor.
/// + bit\[7\] is used only if the following conditions are true. It is Reserved (MBZ) in all
/// other scenarios.
/// * This ABI is invoked at the Non-secure physical FF-A instance.
/// * The partition is an SP that supports receipt of direct requests i.e. Bit\[0\] = b’1.
/// - bit\[8\] has the following encoding:
/// + b’0: Partition runs in the AArch32 execution state.
/// + b’1: Partition runs in the AArch64 execution state.
/// - bit\[31:9\]: Reserved (MBZ).
pub(crate) partition_props: u32,
/// Offset 8, length 16:
/// - UUID of the partition, stream or auxiliary endpoint if the Nil UUID was specified in w1-w4
/// as an input parameter.
/// - This field is reserved and MBZ if a non-Nil UUID was was specified in w1-w4 as an input
/// parameter.
pub(crate) uuid: [u8; 16],
}
/// Table 10.13: Composite memory region descriptor
#[derive(Default, FromBytes, IntoBytes, KnownLayout, Immutable)]
#[repr(C, packed)]
pub(crate) struct composite_memory_region_descriptor {
/// Offset 0, length 4: Size of the memory region described as the count of 4K pages. Must be
/// equal to the sum of page counts specified in each constituent memory region descriptor.
pub(crate) total_page_count: u32,
/// Offset 4, length 4: Count of address ranges specified using constituent memory region
/// descriptors
pub(crate) address_range_count: u32,
/// Offset 8, length 8: Reserved (MBZ)
pub(crate) reserved: u64,
}
/// Table 10.14: Constituent memory region descriptor
#[derive(Default, FromBytes, IntoBytes, KnownLayout, Immutable)]
#[repr(C, packed)]
pub(crate) struct constituent_memory_region_descriptor {
/// Offset 0, length 8: Base VA, PA or IPA of constituent memory region aligned to the page size
/// (4K) granularity
pub(crate) address: u64,
/// Offset 8, length 4: Number of 4K pages in constituent memory region
pub(crate) page_count: u32,
/// Offset 12, length 4: Reserved (MBZ)
pub(crate) reserved: u32,
}
/// Table 10.15: Memory access permissions descriptor
#[derive(Default, FromBytes, IntoBytes, KnownLayout, Immutable)]
#[repr(C, packed)]
pub(crate) struct memory_access_permission_descriptor {
/// Offset 0, length 2: 16-bit ID of endpoint to which the memory access permissions apply
pub(crate) endpoint_id: u16,
/// Offset 2, length 1: Permissions used to access a memory region
pub(crate) memory_access_permissions: u8,
/// Offset 3, length 1: ABI specific flags
pub(crate) flags: u8,
}
/// Table 10.16: Endpoint memory access descriptor
#[derive(Default, FromBytes, IntoBytes, KnownLayout, Immutable)]
#[repr(C, packed)]
pub(crate) struct endpoint_memory_access_descriptor {
/// Offset 0, length 4: Memory access permissions descriptor as specified in Table 10.15
pub(crate) access_perm_desc: memory_access_permission_descriptor,
/// Offset 4, length 4: Offset to the composite memory region descriptor to which the endpoint
/// access permissions apply. Offset must be calculated from the base address of the data
/// structure this descriptor is included in. An offset value of 0 indicates that the endpoint
/// access permissions apply to a memory region description identified by the Handle parameter
/// specified in the data structure that includes this one.
pub(crate) composite_offset: u32,
/// Offset 8, length 8: Reserved (MBZ)
pub(crate) reserved: u64,
}
/// Table 10.20: Memory transaction descriptor
#[derive(Default, FromBytes, IntoBytes, KnownLayout, Immutable)]
#[repr(C, packed)]
pub(crate) struct memory_transaction_descriptor {
/// Offset 0, length 2: ID of the Owner endpoint
pub(crate) sender_endpoint_id: u16,
/// Offset 2, length 2: Memory region attributes
pub(crate) memory_region_attributes: u16,
/// Offset 4, length 4: Flags
pub(crate) flags: u32,
/// Offset 8, length 8: Globally unique Handle to identify a memory region
pub(crate) handle: u64,
/// Offset 16, length 8: Tag
pub(crate) tag: u64,
/// Offset 24, length 4: Size of each endpoint memory access descriptor in the array
pub(crate) endpoint_mem_access_desc_size: u32,
/// Offset 28, length 4: Count of endpoint memory access descriptors
pub(crate) endpoint_mem_access_desc_count: u32,
/// Offset 32, length 4: 16-byte aligned offset from the base address of this descriptor to the
/// first element of the Endpoint memory access descriptor array
pub(crate) endpoint_mem_access_desc_array_offset: u32,
/// Offset 36, length 12: Reserved (MBZ)
pub(crate) reserved1: u32,
pub(crate) reserved2: u64,
}
/// Table 16.25: Descriptor to relinquish a memory region
#[derive(Default, FromBytes, IntoBytes, KnownLayout, Immutable)]
#[repr(C, packed)]
pub(crate) struct memory_relinquish_descriptor {
/// Offset 0, length 8: Globally unique Handle to identify a memory region
pub(crate) handle: u64,
/// Offset 8, length 4: Flags
pub(crate) flags: u32,
/// Offset 12, length 4: Count of endpoint ID entries in the Endpoint array
pub(crate) endpoint_count: u32,
}