2 * Firmware Interface Table support.
4 * Copyright (C) 2012 Google Inc.
5 * Copyright (C) 2019 9elements Agency GmbH
6 * Copyright (C) 2019 Facebook Inc.
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; version 2 of the License.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
18 #ifndef __CBFSTOOL_FIT_H
19 #define __CBFSTOOL_FIT_H
21 #include "cbfs_image.h"
25 * Based on "Intel Trusted Execution Technology (Intel TXT) LAB Handout" and
26 * https://github.com/slimbootloader/slimbootloader/
30 FIT_TYPE_MICROCODE
= 1,
31 FIT_TYPE_BIOS_ACM
= 2,
32 FIT_TYPE_BIOS_STARTUP
= 7,
33 FIT_TYPE_TPM_POLICY
= 8,
34 FIT_TYPE_BIOS_POLICY
= 9,
35 FIT_TYPE_TXT_POLICY
= 0xa,
36 FIT_TYPE_KEY_MANIFEST
= 0xb,
37 FIT_TYPE_BOOT_POLICY
= 0xc,
38 FIT_TYPE_CSE_SECURE_BOOT
= 0x10,
39 FIT_TYPE_TXTSX_POLICY
= 0x2d,
40 FIT_TYPE_JMP_DEBUG_POLICY
= 0x2f,
41 FIT_TYPE_UNUSED
= 127,
45 * Converts between offsets from the start of the specified image region and
46 * "top-aligned" offsets from the top of the entire flash image. Should work in
47 * both directions: accepts either type of offset and produces the other type.
48 * The implementation must have some notion of the flash image's total size.
50 typedef unsigned (*fit_offset_converter_t
)(const struct buffer
*region
,
55 struct fit_table
*fit_get_table(struct buffer
*bootblock
,
56 fit_offset_converter_t offset_fn
,
57 uint32_t topswap_size
);
58 int fit_dump(struct fit_table
*fit
);
59 int fit_clear_table(struct fit_table
*fit
);
60 int fit_is_supported_type(const enum fit_type type
);
61 int fit_add_entry(struct fit_table
*fit
,
62 const uint32_t offset
,
64 const enum fit_type type
,
65 const size_t max_fit_entries
);
66 int fit_delete_entry(struct fit_table
*fit
,
69 int fit_add_microcode_file(struct fit_table
*fit
,
70 struct cbfs_image
*image
,
71 const char *blob_name
,
72 fit_offset_converter_t offset_helper
,
73 const size_t max_fit_entries
);