blob: e16ec0616db71948e4fb40fac0a9da646e54a2b3 [file] [log] [blame]
Balint Dobszayb2ff2bc2024-12-19 18:59:38 +01001// SPDX-FileCopyrightText: Copyright 2025 Arm Limited and/or its affiliates <open-source-office@arm.com>
2// SPDX-License-Identifier: MIT OR Apache-2.0
3
4#![allow(non_camel_case_types)]
5
6use zerocopy_derive::*;
7
8/// Table 5.8: Boot information descriptor
9#[derive(Default, FromBytes, IntoBytes, KnownLayout, Immutable)]
10#[repr(C, packed)]
11pub(crate) struct boot_info_descriptor {
12 /// Offset 0, length 16: Name of boot information passed to the consumer.
13 pub(crate) name: [u8; 16],
14 /// Offset 16, length 1: Type of boot information passed to the consumer.
15 /// - Bit\[7\]: Boot information type.
16 /// + b’0: Standard boot information.
17 /// + b’1: Implementation defined boot information.
18 /// - Bits\[6:0\]: Boot information identifier.
19 /// + Standard boot information (bit\[7\] = b’0).
20 /// * 0: Flattened device tree (FDT).
21 /// * 1: Hand-Off Block (HOB) List.
22 /// * All other identifiers are reserved.
23 /// + Implementation defined identifiers (bit\[7\] = b’ 1).
24 /// * Identifier is defined by the implementation.
25 pub(crate) typ: u8,
26 /// Offset 17, length 1: Reserved (MBZ)
27 pub(crate) reserved: u8,
28 /// Offset 18, length 2: Flags to describe properties of boot information associated with this
29 /// descriptor.
30 /// - Bits\[15:4\]: Reserved (MBZ).
31 /// - Bits\[3:2\]: Format of Contents field.
32 /// + b’0: Address of boot information identified by the Name and Type fields.
33 /// + b’1: Value of boot information identified by the Name and Type fields.
34 /// + All other bit encodings are reserved for future use.
35 /// - Bits\[1:0\]: Format of Name field.
36 /// + b’0: Null terminated string.
37 /// + b’1: UUID encoded in little-endian byte order.
38 /// + All other bit encodings are reserved for future use.
39 pub(crate) flags: u16,
40 /// Offset 20, length 4: Size (in bytes) of boot information identified by the Name and Type
41 /// fields
42 pub(crate) size: u32,
43 /// Offset 24, length 8: Value or address of boot information identified by the Name and Type
44 /// fields.
45 ///
46 /// If in the Flags field, bit\[3:2\] = b'0,
47 /// * The address has the same attributes as the boot information blob address described in
48 /// 5.4.3 Boot information address.
49 /// * Size field contains the length (in bytes) of boot information at the specified address.
50 ///
51 /// If in the Flags field, bit\[3:2\] = b’1,
52 /// * Size field contains the exact size of the value specified in this field.
53 /// * Size is >=1 bytes and <= 8 bytes.
54 pub(crate) contents: u64,
55}
56
57/// Table 5.9: Boot information header
58#[derive(Default, FromBytes, IntoBytes, KnownLayout, Immutable)]
59#[repr(C, packed)]
60pub(crate) struct boot_info_header {
61 /// Offset 0, length 4: Hexadecimal value 0x0FFA to identify the header
62 pub(crate) signature: u32,
63 /// Offset 4, length 4: Version of the boot information blob encoded as in FFA_VERSION_GET
64 pub(crate) version: u32,
65 /// Offset 8, length 4: Size of boot information blob spanning contiguous memory
66 pub(crate) boot_info_blob_size: u32,
67 /// Offset 12, length 4: Size of each boot information descriptor in the array
68 pub(crate) boot_info_desc_size: u32,
69 /// Offset 16, length 4: Count of boot information descriptors in the array
70 pub(crate) boot_info_desc_count: u32,
71 /// Offset 20, length 4: Offset to array of boot information descriptors
72 pub(crate) boot_info_array_offset: u32,
73 /// Offset 24, length 8: Reserved (MBZ)
74 pub(crate) reserved: u64,
75}