blob: 3ff6a518aa97dec3c4f5e1c7fa93d0caa621eb2c [file] [log] [blame]
Martin Roth239b5df2022-07-26 22:18:26 -06001/* SPDX-License-Identifier: GPL-2.0-only */
2
Jakub Czapigaa01138b2020-10-05 10:20:29 +02003#ifndef _IMD_PRIVATE_H_
4#define _IMD_PRIVATE_H_
5
Elyes HAOUAS26a69212021-02-08 10:02:56 +01006#include <cbmem.h>
Jakub Czapigaa01138b2020-10-05 10:20:29 +02007#include <commonlib/bsd/helpers.h>
8
9/* In-memory data structures. */
10struct imd_root_pointer {
11 uint32_t magic;
12 /* Relative to upper limit/offset. */
13 int32_t root_offset;
14} __packed;
15
16struct imd_entry {
17 uint32_t magic;
18 /* start is located relative to imd_root */
19 int32_t start_offset;
20 uint32_t size;
21 uint32_t id;
22} __packed;
23
24struct imd_root {
25 uint32_t max_entries;
26 uint32_t num_entries;
27 uint32_t flags;
28 uint32_t entry_align;
29 /* Used for fixing the size of an imd. Relative to the root. */
30 int32_t max_offset;
Elyes Haouas19b534d2023-07-28 06:04:46 +020031 struct imd_entry entries[];
Jakub Czapigaa01138b2020-10-05 10:20:29 +020032} __packed;
33
34#define IMD_ROOT_PTR_MAGIC 0xc0389481
35#define IMD_ENTRY_MAGIC (~0xc0389481)
36#define SMALL_REGION_ID CBMEM_ID_IMD_SMALL
37#define LIMIT_ALIGN 4096
38
39#define IMD_FLAG_LOCKED 1
40
41#endif /* _IMD_PRIVATE_H */