blob: 8bf16cfcac62b9414145bd545a4a22e32312e0b2 [file] [log] [blame]
Harrison Mutai6e011642023-09-22 17:17:35 +01001/*
2 * Copyright (c) 2023, Linaro Limited and Contributors. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#ifndef __TRANSFER_LIST_H
8#define __TRANSFER_LIST_H
9
10#include <stdbool.h>
11#include <stdint.h>
12
13#include <lib/utils_def.h>
14
Harrison Mutaie15bc802023-12-18 15:21:13 +000015#define TRANSFER_LIST_SIGNATURE U(0x4a0fb10b)
Harrison Mutai6e011642023-09-22 17:17:35 +010016#define TRANSFER_LIST_VERSION U(0x0001)
17
18// Init value of maximum alignment required by any TE data in the TL
19// specified as a power of two
20#define TRANSFER_LIST_INIT_MAX_ALIGN U(3)
21
22// alignment required by TE header start address, in bytes
23#define TRANSFER_LIST_GRANULE U(8)
24
25// version of the register convention used.
26// Set to 1 for both AArch64 and AArch32 according to fw handoff spec v0.9
27#define REGISTER_CONVENTION_VERSION_MASK (1 << 24)
28
29#ifndef __ASSEMBLER__
30
31enum transfer_list_tag_id {
32 TL_TAG_EMPTY = 0,
33 TL_TAG_FDT = 1,
34 TL_TAG_HOB_BLOCK = 2,
35 TL_TAG_HOB_LIST = 3,
36 TL_TAG_ACPI_TABLE_AGGREGATE = 4,
37};
38
39enum transfer_list_ops {
40 TL_OPS_NON, // invalid for any operation
41 TL_OPS_ALL, // valid for all operations
42};
43
44struct transfer_list_header {
45 uint32_t signature;
46 uint8_t checksum;
47 uint8_t version;
48 uint8_t hdr_size;
49 uint8_t alignment; // max alignment of TE data
50 uint32_t size; // TL header + all TEs
51 uint32_t max_size;
52 /*
53 * Commented out element used to visualize dynamic part of the
54 * data structure.
55 *
56 * Note that struct transfer_list_entry also is dynamic in size
57 * so the elements can't be indexed directly but instead must be
58 * traversed in order
59 *
60 * struct transfer_list_entry entries[];
61 */
62};
63
64struct transfer_list_entry {
65 uint16_t tag_id;
66 uint8_t reserved0; // place holder
67 uint8_t hdr_size;
68 uint32_t data_size;
69 /*
70 * Commented out element used to visualize dynamic part of the
71 * data structure.
72 *
73 * Note that padding is added at the end of @data to make to reach
74 * a 8-byte boundary.
75 *
76 * uint8_t data[ROUNDUP(data_size, 8)];
77 */
78};
79
80bool transfer_list_verify_checksum(const struct transfer_list_header *tl);
81
82void *transfer_list_entry_data(struct transfer_list_entry *entry);
83
84struct transfer_list_entry *transfer_list_find(struct transfer_list_header *tl,
85 uint16_t tag_id);
86
87enum transfer_list_ops
88transfer_list_check_header(const struct transfer_list_header *tl);
89
90#endif /*__ASSEMBLER__*/
91#endif /*__TRANSFER_LIST_H*/