summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorPatrick Rudolph <patrick.rudolph@9elements.com>2018-04-19 14:39:07 +0200
committerPhilipp Deppenwiese <zaolin.daisuki@gmail.com>2018-06-19 14:28:31 +0000
commita45e9f8106e0ae8f3315f7ca7d707eab171551d7 (patch)
tree44831451a450ee01465f38d53ffc3cf512e42a38 /src/include
parent59b8f275c21ccbd08019cc7d9f0b63671de6586a (diff)
downloadcoreboot-a45e9f8106e0ae8f3315f7ca7d707eab171551d7.tar.xz
lib: Raw import FIT parser
Import from https://chromium.googlesource.com/chromiumos/platform/depthcharge Coding style and coreboot integration will be done in a separate commit. Change-Id: Iee56db328d7eeffb0eaf829841243b0b9195c199 Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com> Reviewed-on: https://review.coreboot.org/25739 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
Diffstat (limited to 'src/include')
-rw-r--r--src/include/fit.h78
1 files changed, 78 insertions, 0 deletions
diff --git a/src/include/fit.h b/src/include/fit.h
new file mode 100644
index 0000000000..1b2f975042
--- /dev/null
+++ b/src/include/fit.h
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2013 Google Inc.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but without any warranty; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef __BOOT_FIT_H__
+#define __BOOT_FIT_H__
+
+#include <stddef.h>
+#include <stdint.h>
+
+#include "base/device_tree.h"
+#include "base/list.h"
+
+typedef enum CompressionType
+{
+ CompressionInvalid,
+ CompressionNone,
+ CompressionLzma,
+ CompressionLz4,
+} CompressionType;
+
+typedef struct FitImageNode
+{
+ const char *name;
+ void *data;
+ uint32_t size;
+ CompressionType compression;
+
+ ListNode list_node;
+} FitImageNode;
+
+typedef struct FitConfigNode
+{
+ const char *name;
+ const char *kernel;
+ FitImageNode *kernel_node;
+ const char *fdt;
+ FitImageNode *fdt_node;
+ const char *ramdisk;
+ FitImageNode *ramdisk_node;
+ FdtProperty compat;
+ int compat_rank;
+ int compat_pos;
+
+ ListNode list_node;
+} FitConfigNode;
+
+/*
+ * Unpack a FIT image into memory, choosing the right configuration through the
+ * compatible string set by fit_add_compat() and unflattening the corresponding
+ * kernel device tree.
+ */
+FitImageNode *fit_load(void *fit, char *cmd_line, DeviceTree **dt);
+
+/*
+ * Add a compatible string for the preferred kernel DT to the list for this
+ * platform. This should be called before the first fit_load() so it will be
+ * ranked as a better match than the default compatible strings. |compat| must
+ * stay accessible throughout depthcharge's runtime (i.e. not stack-allocated)!
+ */
+void fit_add_compat(const char *compat);
+
+void fit_add_ramdisk(DeviceTree *tree, void *ramdisk_addr, size_t ramdisk_size);
+
+#endif /* __BOOT_FIT_H__ */