diff options
author | Philipp Deppenwiese <zaolin.daisuki@gmail.com> | 2018-11-20 13:54:49 +0100 |
---|---|---|
committer | Philipp Deppenwiese <zaolin.daisuki@gmail.com> | 2019-06-24 09:42:31 +0000 |
commit | 5ada0023d191eb6af1de6581f1b770b75b5554c4 (patch) | |
tree | 69e2b78e5230c3a8d5dd5692399db6c081b10113 /util/cbfstool/fit.h | |
parent | 42c44c2f8391a3b56acf9215044d2b2787061738 (diff) | |
download | coreboot-5ada0023d191eb6af1de6581f1b770b75b5554c4.tar.xz |
cbfstool: Add ifittool
Add the IntelFirmwareInterfaceTable-tool to modify the FIT.
As cbfstool is overloaded with arguments, introduce a new tool
to only modify FIT, which brings it's own command line syntax.
Provide clean interface to:
* Clear FIT
* Add entry to CBFS file
* Add entry to REGION
* Delete entries
* Add support for types other than 1
* Add support to dump current table
* Add support for top-swap
* Sort entries by type
Most code is reused from existing cbfstool and functionality of cbfstool
is kept. It will be removed once the make system uses only ifittool.
Based on "Intel Trusted Execution Technology (Intel TXT) LAB Handout"
and https://github.com/slimbootloader/slimbootloader .
Change-Id: I0fe8cd70611d58823aca1147d5b830722ed72bd5
Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/31493
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Philipp Deppenwiese <zaolin.daisuki@gmail.com>
Diffstat (limited to 'util/cbfstool/fit.h')
-rw-r--r-- | util/cbfstool/fit.h | 60 |
1 files changed, 50 insertions, 10 deletions
diff --git a/util/cbfstool/fit.h b/util/cbfstool/fit.h index 42b3b4722a..e5872ab599 100644 --- a/util/cbfstool/fit.h +++ b/util/cbfstool/fit.h @@ -2,6 +2,8 @@ * Firmware Interface Table support. * * Copyright (C) 2012 Google Inc. + * Copyright (C) 2019 9elements Agency GmbH + * Copyright (C) 2019 Facebook Inc. * * 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 @@ -19,6 +21,26 @@ #include "cbfs_image.h" #include "common.h" +/** + * Based on "Intel Trusted Execution Technology (Intel TXT) LAB Handout" and + * https://github.com/slimbootloader/slimbootloader/ + */ +enum fit_type { + FIT_TYPE_HEADER = 0, + FIT_TYPE_MICROCODE = 1, + FIT_TYPE_BIOS_ACM = 2, + FIT_TYPE_BIOS_STARTUP = 7, + FIT_TYPE_TPM_POLICY = 8, + FIT_TYPE_BIOS_POLICY = 9, + FIT_TYPE_TXT_POLICY = 0xa, + FIT_TYPE_KEY_MANIFEST = 0xb, + FIT_TYPE_BOOT_POLICY = 0xc, + FIT_TYPE_CSE_SECURE_BOOT = 0x10, + FIT_TYPE_TXTSX_POLICY = 0x2d, + FIT_TYPE_JMP_DEBUG_POLICY = 0x2f, + FIT_TYPE_UNUSED = 127, +}; + /* * Converts between offsets from the start of the specified image region and * "top-aligned" offsets from the top of the entire flash image. Should work in @@ -28,15 +50,33 @@ typedef unsigned (*fit_offset_converter_t)(const struct buffer *region, unsigned offset); -/* - * populate FIT with the MCUs prepsent in the blob provided. - * - * first_mcu_addr is an address (in ROM) that will point to a - * microcode patch. When provided, it will be forced as the first - * MCU entry into the FIT located in the topswap bootblock. - */ +struct fit_table; + +struct fit_table *fit_get_table(struct buffer *bootblock, + fit_offset_converter_t offset_fn, + uint32_t topswap_size); +int fit_dump(struct fit_table *fit); +int fit_clear_table(struct fit_table *fit); +int fit_is_supported_type(const enum fit_type type); +int fit_add_entry(struct fit_table *fit, + const uint32_t offset, + const uint32_t len, + const enum fit_type type, + const size_t max_fit_entries); +int fit_delete_entry(struct fit_table *fit, + const size_t idx); + +int fit_add_microcode_file(struct fit_table *fit, + struct cbfs_image *image, + const char *blob_name, + fit_offset_converter_t offset_helper, + const size_t max_fit_entries); + +/* Legacy code */ int fit_update_table(struct buffer *bootblock, struct cbfs_image *image, - const char *microcode_blob_name, int empty_entries, - fit_offset_converter_t offset_fn, - uint32_t topswap_size, uint32_t first_mcu_addr); + const char *microcode_blob_name, + unsigned int empty_entries, + fit_offset_converter_t offset_fn, uint32_t topswap_size, + uint32_t first_mcu_addr); + #endif |