summaryrefslogtreecommitdiff
path: root/util/cbfstool/cse_fpt.h
diff options
context:
space:
mode:
authorFurquan Shaikh <furquan@google.com>2021-09-16 22:02:01 -0700
committerFurquan Shaikh <furquan@google.com>2021-10-19 16:08:03 +0000
commit796aeeba96fce7d6560c4d1994962a7107137666 (patch)
treebf0b79f0d0150488d7881dc44afb962a608a6777 /util/cbfstool/cse_fpt.h
parentafd268a0cb440c1ccfaec5593bffbfe49bcfbf24 (diff)
util/cse_fpt: Add a new tool for managing Intel CSE FPT binaries
This change adds a new tool `cse_fpt` which can be used to print and dump CSE partitions in Flash Partition Table (FPT) format. BUG=b:189167923 Change-Id: I93c8d33e9baa327cbdab918a14f2f7a039953be6 Signed-off-by: Furquan Shaikh <furquan@google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/55259 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Diffstat (limited to 'util/cbfstool/cse_fpt.h')
-rw-r--r--util/cbfstool/cse_fpt.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/util/cbfstool/cse_fpt.h b/util/cbfstool/cse_fpt.h
new file mode 100644
index 0000000000..eda8a07930
--- /dev/null
+++ b/util/cbfstool/cse_fpt.h
@@ -0,0 +1,37 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#ifndef __CBFSTOOL_CSE_FPT_H__
+#define __CBFSTOOL_CSE_FPT_H__
+
+#include <commonlib/endian.h>
+#include <commonlib/region.h>
+
+#include "common.h"
+
+#define FPT_MARKER "$FPT"
+#define FPT_ENTRY_VERSION 0x10
+
+#define READ_MEMBER(_buff, _x) read_member(_buff, &(_x), sizeof(_x))
+
+enum fpt_hdr_version {
+ FPT_HDR_VERSION_20 = 0x20,
+ FPT_HDR_VERSION_21 = 0x21,
+};
+
+typedef void *fpt_hdr_ptr;
+
+struct fpt_hdr_ops {
+ bool (*match_version)(struct buffer *buff);
+
+ fpt_hdr_ptr (*read)(struct buffer *buff);
+ void (*print)(const fpt_hdr_ptr ptr);
+
+ size_t (*get_entry_count)(const fpt_hdr_ptr ptr);
+};
+
+extern const struct fpt_hdr_ops fpt_hdr_20_ops;
+extern const struct fpt_hdr_ops fpt_hdr_21_ops;
+
+void read_member(struct buffer *buff, void *dst, size_t size);
+
+#endif /* __CBFSTOOL_CSE_FPT_H__ */