2020-05-08 19:28:13 +02:00
|
|
|
/* Firmware Interface Table support */
|
util/: Replace GPLv2 boiler plate with SPDX header
Used commands:
perl -i -p0e 's|\/\*[\s*]*.*is free software[:;][\s*]*you[\s*]*can[\s*]*redistribute[\s*]*it[\s*]*and\/or[\s*]*modify[\s*]*it[\s*]*under[\s*]*the[\s*]*terms[\s*]*of[\s*]*the[\s*]*GNU[\s*]*General[\s*]*Public[\s*]*License[\s*]*as[\s*]*published[\s*]*by[\s*]*the[\s*]*Free[\s*]*Software[\s*]*Foundation[;,][\s*]*version[\s*]*2[\s*]*of[\s*]*the[\s*]*License.[\s*]*This[\s*]*program[\s*]*is[\s*]*distributed[\s*]*in[\s*]*the[\s*]*hope[\s*]*that[\s*]*it[\s*]*will[\s*]*be[\s*]*useful,[\s*]*but[\s*]*WITHOUT[\s*]*ANY[\s*]*WARRANTY;[\s*]*without[\s*]*even[\s*]*the[\s*]*implied[\s*]*warranty[\s*]*of[\s*]*MERCHANTABILITY[\s*]*or[\s*]*FITNESS[\s*]*FOR[\s*]*A[\s*]*PARTICULAR[\s*]*PURPOSE.[\s*]*See[\s*]*the[\s*]*GNU[\s*]*General[\s*]*Public[\s*]*License[\s*]*for[\s*]*more[\s*]*details.[\s*]*\*\/|/* SPDX-License-Identifier: GPL-2.0-only */|' $(cat filelist)
perl -i -p0e 's|This[\s*]*program[\s*]*is[\s*]*free[\s*]*software[:;][\s*]*you[\s*]*can[\s*]*redistribute[\s*]*it[\s*]*and/or[\s*]*modify[\s*]*it[\s*]*under[\s*]*the[\s*]*terms[\s*]*of[\s*]*the[\s*]*GNU[\s*]*General[\s*]*Public[\s*]*License[\s*]*as[\s*]*published[\s*]*by[\s*]*the[\s*]*Free[\s*]*Software[\s*]*Foundation[;,][\s*]*either[\s*]*version[\s*]*2[\s*]*of[\s*]*the[\s*]*License,[\s*]*or[\s*]*.at[\s*]*your[\s*]*option.*[\s*]*any[\s*]*later[\s*]*version.[\s*]*This[\s*]*program[\s*]*is[\s*]*distributed[\s*]*in[\s*]*the[\s*]*hope[\s*]*that[\s*]*it[\s*]*will[\s*]*be[\s*]*useful,[\s*]*but[\s*]*WITHOUT[\s*]*ANY[\s*]*WARRANTY;[\s*]*without[\s*]*even[\s*]*the[\s*]*implied[\s*]*warranty[\s*]*of[\s*]*MERCHANTABILITY[\s*]*or[\s*]*FITNESS[\s*]*FOR[\s*]*A[\s*]*PARTICULAR[\s*]*PURPOSE.[\s*]*See[\s*]*the[\s*]*GNU[\s*]*General[\s*]*Public[\s*]*License[\s*]*for[\s*]*more[\s*]*details.[\s*]*\*\/|/* SPDX-License-Identifier: GPL-2.0-or-later */|' $(cat filelist)
perl -i -p0e 's|\/\*[\s*]*.*This[\s*#]*program[\s*#]*is[\s*#]*free[\s*#]*software[;:,][\s*#]*you[\s*#]*can[\s*#]*redistribute[\s*#]*it[\s*#]*and/or[\s*#]*modify[\s*#]*it[\s*#]*under[\s*#]*the[\s*#]*terms[\s*#]*of[\s*#]*the[\s*#]*GNU[\s*#]*General[\s*#]*Public[\s*#]*License[\s*#]*as[\s*#]*published[\s*#]*by[\s*#]*the[\s*#]*Free[\s*#]*Software[\s*#]*Foundation[;:,][\s*#]*either[\s*#]*version[\s*#]*3[\s*#]*of[\s*#]*the[\s*#]*License[;:,][\s*#]*or[\s*#]*.at[\s*#]*your[\s*#]*option.*[\s*#]*any[\s*#]*later[\s*#]*version.[\s*#]*This[\s*#]*program[\s*#]*is[\s*#]*distributed[\s*#]*in[\s*#]*the[\s*#]*hope[\s*#]*that[\s*#]*it[\s*#]*will[\s*#]*be[\s*#]*useful[;:,][\s*#]*but[\s*#]*WITHOUT[\s*#]*ANY[\s*#]*WARRANTY[;:,][\s*#]*without[\s*#]*even[\s*#]*the[\s*#]*implied[\s*#]*warranty[\s*#]*of[\s*#]*MERCHANTABILITY[\s*#]*or[\s*#]*FITNESS[\s*#]*FOR[\s*#]*A[\s*#]*PARTICULAR[\s*#]*PURPOSE.[\s*#]*See[\s*#]*the[\s*#]*GNU[\s*#]*General[\s*#]*Public[\s*#]*License[\s*#]*for[\s*#]*more[\s*#]*details.[\s*]*\*\/|/* SPDX-License-Identifier: GPL-3.0-or-later */|' $(cat filelist)
perl -i -p0e 's|(\#\#*)[\w]*.*is free software[:;][\#\s]*you[\#\s]*can[\#\s]*redistribute[\#\s]*it[\#\s]*and\/or[\#\s]*modify[\#\s]*it[\s\#]*under[\s \#]*the[\s\#]*terms[\s\#]*of[\s\#]*the[\s\#]*GNU[\s\#]*General[\s\#]*Public[\s\#]*License[\s\#]*as[\s\#]*published[\s\#]*by[\s\#]*the[\s\#]*Free[\s\#]*Software[\s\#]*Foundation[;,][\s\#]*version[\s\#]*2[\s\#]*of[\s\#]*the[\s\#]*License.*[\s\#]*This[\s\#]*program[\s\#]*is[\s\#]*distributed[\s\#]*in[\s\#]*the[\s\#]*hope[\s\#]*that[\s\#]*it[\s\#]*will[\#\s]*be[\#\s]*useful,[\#\s]*but[\#\s]*WITHOUT[\#\s]*ANY[\#\s]*WARRANTY;[\#\s]*without[\#\s]*even[\#\s]*the[\#\s]*implied[\#\s]*warranty[\#\s]*of[\#\s]*MERCHANTABILITY[\#\s]*or[\#\s]*FITNESS[\#\s]*FOR[\#\s]*A[\#\s]*PARTICULAR[\#\s]*PURPOSE.[\#\s]*See[\#\s]*the[\#\s]*GNU[\#\s]*General[\#\s]*Public[\#\s]*License[\#\s]*for[\#\s]*more[\#\s]*details.\s(#* *\n)*|\1 SPDX-License-Identifier: GPL-2.0-only\n\n|' $(cat filelist)
perl -i -p0e 's|(\#\#*)[\w*]*.*is free software[:;][\s*]*you[\s*]*can[\s*]*redistribute[\s*]*it[\s*]*and\/or[\s*]*modify[\s*]*it[\s*]*under[\s*]*the[\s*]*terms[\s*]*of[\s*]*the[\s*]*GNU[\s*]*General[\s*]*Public[\s*]*License[\s*]*as[\s*]*published[\s*]*by[\s*]*the[\s*]*Free[\s*]*Software[\s*]*Foundation[;,][\s*]*version[\s*]*2[\s*]*of[\s*]*the[\s*]*License.[\s*]*This[\s*]*program[\s*]*is[\s*]*distributed[\s*]*in[\s*]*the[\s*]*hope[\s*]*that[\s*]*it[\s*]*will[\s*]*be[\s*]*useful,[\s*]*but[\s*]*WITHOUT[\s*]*ANY[\s*]*WARRANTY;[\s*]*without[\s*]*even[\s*]*the[\s*]*implied[\s*]*warranty[\s*]*of[\s*]*MERCHANTABILITY[\s*]*or[\s*]*FITNESS[\s*]*FOR[\s*]*A[\s*]*PARTICULAR[\s*]*PURPOSE.[\s*]*See[\s*]*the[\s*]*GNU[\s*]*General[\s*]*Public[\s*]*License[\s*]*for[\s*]*more[\s*]*details.\s(#* *\n)*|\1 SPDX-License-Identifier: GPL-2.0-only\n\n|' $(cat filelist)
Change-Id: I1008a63b804f355a916221ac994701d7584f60ff
Signed-off-by: Patrick Georgi <pgeorgi@google.com>
Signed-off-by: Elyes HAOUAS <ehaouas@noos.fr>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/41177
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2020-05-08 20:48:04 +02:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
2012-12-15 00:16:21 +01:00
|
|
|
|
|
|
|
#ifndef __CBFSTOOL_FIT_H
|
|
|
|
#define __CBFSTOOL_FIT_H
|
|
|
|
|
2015-05-06 23:44:40 +02:00
|
|
|
#include "cbfs_image.h"
|
|
|
|
#include "common.h"
|
|
|
|
|
2018-11-20 13:54:49 +01:00
|
|
|
/**
|
|
|
|
* 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,
|
|
|
|
};
|
|
|
|
|
2015-05-06 23:44:40 +02:00
|
|
|
/*
|
|
|
|
* 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
|
|
|
|
* both directions: accepts either type of offset and produces the other type.
|
|
|
|
* The implementation must have some notion of the flash image's total size.
|
|
|
|
*/
|
|
|
|
typedef unsigned (*fit_offset_converter_t)(const struct buffer *region,
|
|
|
|
unsigned offset);
|
|
|
|
|
2018-11-20 13:54:49 +01:00
|
|
|
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);
|
2021-02-17 17:34:44 +01:00
|
|
|
int set_fit_pointer(struct buffer *bootblock, const uint32_t offset,
|
|
|
|
fit_offset_converter_t offset_fn, uint32_t topswap_size);
|
2012-12-15 00:16:21 +01:00
|
|
|
#endif
|