blob: fea7315de14f5c92c23b86bb68c57a83347e949e [file] [log] [blame]
Jakub Czapigaa01138b2020-10-05 10:20:29 +02001#ifndef _IMD_PRIVATE_H_
2#define _IMD_PRIVATE_H_
3
Elyes HAOUAS26a69212021-02-08 10:02:56 +01004#include <cbmem.h>
Jakub Czapigaa01138b2020-10-05 10:20:29 +02005#include <commonlib/bsd/helpers.h>
6
7/* In-memory data structures. */
8struct imd_root_pointer {
9 uint32_t magic;
10 /* Relative to upper limit/offset. */
11 int32_t root_offset;
12} __packed;
13
14struct imd_entry {
15 uint32_t magic;
16 /* start is located relative to imd_root */
17 int32_t start_offset;
18 uint32_t size;
19 uint32_t id;
20} __packed;
21
22struct imd_root {
23 uint32_t max_entries;
24 uint32_t num_entries;
25 uint32_t flags;
26 uint32_t entry_align;
27 /* Used for fixing the size of an imd. Relative to the root. */
28 int32_t max_offset;
29 struct imd_entry entries[0];
30} __packed;
31
32#define IMD_ROOT_PTR_MAGIC 0xc0389481
33#define IMD_ENTRY_MAGIC (~0xc0389481)
34#define SMALL_REGION_ID CBMEM_ID_IMD_SMALL
35#define LIMIT_ALIGN 4096
36
37#define IMD_FLAG_LOCKED 1
38
39#endif /* _IMD_PRIVATE_H */