Jakub Czapiga | a01138b | 2020-10-05 10:20:29 +0200 | [diff] [blame] | 1 | #ifndef _IMD_PRIVATE_H_ |
| 2 | #define _IMD_PRIVATE_H_ |
| 3 | |
Elyes HAOUAS | 26a6921 | 2021-02-08 10:02:56 +0100 | [diff] [blame] | 4 | #include <cbmem.h> |
Jakub Czapiga | a01138b | 2020-10-05 10:20:29 +0200 | [diff] [blame] | 5 | #include <commonlib/bsd/helpers.h> |
| 6 | |
| 7 | /* In-memory data structures. */ |
| 8 | struct imd_root_pointer { |
| 9 | uint32_t magic; |
| 10 | /* Relative to upper limit/offset. */ |
| 11 | int32_t root_offset; |
| 12 | } __packed; |
| 13 | |
| 14 | struct 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 | |
| 22 | struct 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 */ |