summaryrefslogtreecommitdiff
path: root/src/lib/imd.c
diff options
context:
space:
mode:
authorJakub Czapiga <jacz@semihalf.com>2020-10-05 10:20:29 +0200
committerPatrick Georgi <pgeorgi@google.com>2020-10-19 06:55:03 +0000
commita01138b7a4c5c4d6078d5995d81f5f3c31364db2 (patch)
treeef4d47cc739f288faeedc7992d76403622288a1d /src/lib/imd.c
parent72cd6b0d01a8027f3b00d408c25db1ca6bb9d770 (diff)
downloadcoreboot-a01138b7a4c5c4d6078d5995d81f5f3c31364db2.tar.xz
lib/imd: move struct definitions to a new header file
Make IMD private structures definitions accessible by other units. To test IMD API correctness there is a need to access its internal structure. It is only possible when private implementation is visible in testing scope. Signed-off-by: Jakub Czapiga <jacz@semihalf.com> Change-Id: Iff87cc1990426bee6ac3cc1dfa6f85a787334976 Reviewed-on: https://review.coreboot.org/c/coreboot/+/46216 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org>
Diffstat (limited to 'src/lib/imd.c')
-rw-r--r--src/lib/imd.c33
1 files changed, 2 insertions, 31 deletions
diff --git a/src/lib/imd.c b/src/lib/imd.c
index 02779651c9..ac19d76f52 100644
--- a/src/lib/imd.c
+++ b/src/lib/imd.c
@@ -7,39 +7,10 @@
#include <stdlib.h>
#include <string.h>
#include <types.h>
+#include <imd_private.h>
-/* For more details on implementation and usage please see the imd.h header. */
-static const uint32_t IMD_ROOT_PTR_MAGIC = 0xc0389481;
-static const uint32_t IMD_ENTRY_MAGIC = ~0xc0389481;
-static const uint32_t SMALL_REGION_ID = CBMEM_ID_IMD_SMALL;
-
-/* In-memory data structures. */
-struct imd_root_pointer {
- uint32_t magic;
- /* Relative to upper limit/offset. */
- int32_t root_offset;
-} __packed;
-
-struct imd_entry {
- uint32_t magic;
- /* start is located relative to imd_root */
- int32_t start_offset;
- uint32_t size;
- uint32_t id;
-} __packed;
-
-struct imd_root {
- uint32_t max_entries;
- uint32_t num_entries;
- uint32_t flags;
- uint32_t entry_align;
- /* Used for fixing the size of an imd. Relative to the root. */
- int32_t max_offset;
- struct imd_entry entries[0];
-} __packed;
-
-#define IMD_FLAG_LOCKED 1
+/* For more details on implementation and usage please see the imd.h header. */
static void *relative_pointer(void *base, ssize_t offset)
{