Martin Roth | 239b5df | 2022-07-26 22:18:26 -0600 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | |
Jakub Czapiga | a01138b | 2020-10-05 10:20:29 +0200 | [diff] [blame] | 3 | #ifndef _IMD_PRIVATE_H_ |
| 4 | #define _IMD_PRIVATE_H_ |
| 5 | |
Elyes HAOUAS | 26a6921 | 2021-02-08 10:02:56 +0100 | [diff] [blame] | 6 | #include <cbmem.h> |
Jakub Czapiga | a01138b | 2020-10-05 10:20:29 +0200 | [diff] [blame] | 7 | #include <commonlib/bsd/helpers.h> |
| 8 | |
| 9 | /* In-memory data structures. */ |
| 10 | struct imd_root_pointer { |
| 11 | uint32_t magic; |
| 12 | /* Relative to upper limit/offset. */ |
| 13 | int32_t root_offset; |
| 14 | } __packed; |
| 15 | |
| 16 | struct 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 | |
| 24 | struct 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; |
| 31 | struct imd_entry entries[0]; |
| 32 | } __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 */ |