util/ifdtool: Add a new switch -E to protect GPR0
This patch adds support for the new command-line option `-E` to
the ifdtool, which enables users (primarily factory users) to
protect GPR0.
Additionally, this patch refactors some code while adding support for
enabling GPR0 protection.
For more information on the scope of GPR0 (General Protection Range 0),
please refer to the Intel Meteor Lake-U Type 4 Client Platform SPI
Programming Guide, Document Number 768150.
BUG=b:270275115
TEST=Able to test GPR0 protection on google/rex and google/yahiko.
> ifdtool -p mtl -E image.bin -O image.bin_lock
...
Value at GPRD offset (64) is 0x83220004
--------- GPR0 Protected Range --------------
Start address = 0x00004000
End address = 0x00322fff
...
GPR0 protection is now enabled
Change-Id: I27c533ae4109c79299f4e7ff75e750d7cc64280f
Signed-off-by: Subrata Banik <subratabanik@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/80235
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Paul Menzel <paulepanter@mailbox.org>
Reviewed-by: Reka Norman <rekanorman@chromium.org>
diff --git a/util/ifdtool/ifdtool.h b/util/ifdtool/ifdtool.h
index 219634b..79fe0ab 100644
--- a/util/ifdtool/ifdtool.h
+++ b/util/ifdtool/ifdtool.h
@@ -208,3 +208,22 @@
const char *filename;
const char *fmapname;
};
+
+struct cse_fpt {
+ const char signature[4];
+ uint32_t count;
+ uint8_t header_version;
+ uint8_t entry_version;
+ uint8_t length;
+ uint8_t crc;
+ uint8_t reserved[20];
+};
+
+struct cse_fpt_sub_part {
+ const char signature[4];
+ uint32_t reserved_1;
+ uint32_t offset;
+ uint32_t length;
+ uint8_t reserved_2[12];
+ uint32_t flags;
+};