1 /* Firmware Interface Table support */
2 /* SPDX-License-Identifier: GPL-2.0-only */
4 #ifndef __CBFSTOOL_FIT_H
5 #define __CBFSTOOL_FIT_H
7 #include "cbfs_image.h"
11 * Based on "Intel Trusted Execution Technology (Intel TXT) LAB Handout" and
12 * https://github.com/slimbootloader/slimbootloader/
16 FIT_TYPE_MICROCODE
= 1,
17 FIT_TYPE_BIOS_ACM
= 2,
18 FIT_TYPE_PLATFORM_BOOT_POLICY
= 4,
19 FIT_TYPE_BIOS_STARTUP
= 7,
20 FIT_TYPE_TPM_POLICY
= 8,
21 FIT_TYPE_BIOS_POLICY
= 9,
22 FIT_TYPE_TXT_POLICY
= 0xa,
23 FIT_TYPE_KEY_MANIFEST
= 0xb,
24 FIT_TYPE_BOOT_POLICY
= 0xc,
25 FIT_TYPE_CSE_SECURE_BOOT
= 0x10,
26 FIT_TYPE_TXTSX_POLICY
= 0x2d,
27 FIT_TYPE_JMP_DEBUG_POLICY
= 0x2f,
28 FIT_TYPE_UNUSED
= 127,
32 * Converts between offsets from the start of the specified image region and
33 * "top-aligned" offsets from the top of the entire flash image. Should work in
34 * both directions: accepts either type of offset and produces the other type.
35 * The implementation must have some notion of the flash image's total size.
37 typedef unsigned (*fit_offset_converter_t
)(const struct buffer
*region
,
42 struct fit_table
*fit_get_table(struct buffer
*bootblock
,
43 fit_offset_converter_t offset_fn
,
44 uint32_t topswap_size
);
45 int fit_dump(struct fit_table
*fit
);
46 int fit_clear_table(struct fit_table
*fit
);
47 int fit_is_supported_type(const enum fit_type type
);
48 int fit_add_entry(struct fit_table
*fit
,
49 const uint32_t offset
,
51 const enum fit_type type
,
52 const size_t max_fit_entries
);
53 int fit_delete_entry(struct fit_table
*fit
,
56 int fit_add_microcode_file(struct fit_table
*fit
,
57 struct cbfs_image
*image
,
58 const char *blob_name
,
59 fit_offset_converter_t offset_helper
,
60 const size_t max_fit_entries
);
61 int set_fit_pointer(struct buffer
*bootblock
, const uint32_t offset
,
62 fit_offset_converter_t offset_fn
, uint32_t topswap_size
);