Change in ...flashrom[master]: ifwi: Add definitions for the Integrated Firmware Image format

Nico Huber has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/31017 Change subject: ifwi: Add definitions for the Integrated Firmware Image format ...................................................................... ifwi: Add definitions for the Integrated Firmware Image format The Integrated Firmware Image (IFWI) is used as a partitioning format on some Intel SoCs (e.g. Apollo Lake). It is not tied to NOR flashes, rather to have a common format between different types of boot media. Change-Id: I4bdf47637bfb68560e6d4269f89710572c1bb82a Signed-off-by: Nico Huber <nico.h@gmx.de> --- A ifwi.h 1 file changed, 80 insertions(+), 0 deletions(-) git pull ssh://review.coreboot.org:29418/flashrom refs/changes/17/31017/1 diff --git a/ifwi.h b/ifwi.h new file mode 100644 index 0000000..622fccf --- /dev/null +++ b/ifwi.h @@ -0,0 +1,80 @@ +/* + * This file is part of the flashrom project. + * + * 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +/* + * The Integrated Firmware Image (IFWI) is used as a partitioning + * format on some Intel SoCs (e.g. Apollo Lake). It is not tied to + * NOR flashes, rather to have a common format between different + * types of boot media. + */ + +#ifndef __IFWI_H__ +#define __IFWI_H__ 1 + +#include <stdint.h> + +#include "layout.h" + +int layout_from_ifwi_rom(struct flashrom_layout **, struct flashrom_flashctx *, const size_t flash_offset); + +/*********** Boot Partition Descriptor Table (BPDT) ***********/ + +#define BPDT_ENTRY_LENGTH 12 + +struct bpdt_entry { /* points to a Sub-Partition */ + uint16_t type; + uint16_t flags; + uint32_t offset; /* from start of Logical Boot Partition */ + uint32_t size; +}; + +#define BPDT_SIGNATURE 0x000055aa +#define BPDT_HEADER_LENGTH 24 + +struct bpdt { + uint32_t signature; + uint16_t desc_count; + uint16_t version; + uint32_t xorsum; /* covers BPDT to S-BPDT (inclusive), iff there is + a redundant Logical Boot Partition, otherwise 0 */ + uint32_t ifwi_version; /* revision of this IFWI build */ + struct bpdt_entry entries[]; +}; + +/**************** Sub-Partition Directory (SPD) ***************/ + +#define SPD_ENTRY_OFFSET_MASK 0x01ffffff +#define SPD_ENTRY_LENGTH 24 + +struct spd_entry { + char name[12 + 1]; /* serialized as 12 chars w/o terminator */ + uint32_t offset; /* from start of the SPD header */ + uint32_t length; +}; + +#define SPD_MARKER 0x44504324 /* $CPD */ +#define SPD_MIN_HEADER_LENGTH 16 + +struct spd { + uint32_t marker; + uint32_t num_entries; + uint8_t header_version; + uint8_t entry_version; + uint8_t header_length; + uint8_t checksum; /* xor-sum covering header + entries */ + char name[4 + 1]; /* serialized as 4 chars w/o terminator */ + struct spd_entry entries[]; +}; + +#endif /* __IFWI_H__ */ -- To view, visit https://review.coreboot.org/c/flashrom/+/31017 To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings Gerrit-Project: flashrom Gerrit-Branch: master Gerrit-Change-Id: I4bdf47637bfb68560e6d4269f89710572c1bb82a Gerrit-Change-Number: 31017 Gerrit-PatchSet: 1 Gerrit-Owner: Nico Huber <nico.h@gmx.de> Gerrit-MessageType: newchange

Nico Huber has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/31017 ) Change subject: ifwi: Add definitions for the Integrated Firmware Image format ...................................................................... Patch Set 1: Not sure if we want this upstream at all... it's not even about NOR flash. Just an Intel specific storage format. -- To view, visit https://review.coreboot.org/c/flashrom/+/31017 To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings Gerrit-Project: flashrom Gerrit-Branch: master Gerrit-Change-Id: I4bdf47637bfb68560e6d4269f89710572c1bb82a Gerrit-Change-Number: 31017 Gerrit-PatchSet: 1 Gerrit-Owner: Nico Huber <nico.h@gmx.de> Gerrit-Reviewer: Nico Huber <nico.h@gmx.de> Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org> Gerrit-Comment-Date: Sun, 20 Jan 2019 11:53:34 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: No Gerrit-MessageType: comment

Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/31017 ) Change subject: ifwi: Add definitions for the Integrated Firmware Image format ...................................................................... Patch Set 1:
Patch Set 1:
Not sure if we want this upstream at all... it's not even about NOR flash. Just an Intel specific storage format.
Isn't the IFD something similar however? I have to admit I know next to nothing about IFWI. -- To view, visit https://review.coreboot.org/c/flashrom/+/31017 To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings Gerrit-Project: flashrom Gerrit-Branch: master Gerrit-Change-Id: I4bdf47637bfb68560e6d4269f89710572c1bb82a Gerrit-Change-Number: 31017 Gerrit-PatchSet: 1 Gerrit-Owner: Nico Huber <nico.h@gmx.de> Gerrit-Reviewer: Nico Huber <nico.h@gmx.de> Gerrit-Reviewer: Thomas Heijligen <src@posteo.de> Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org> Gerrit-CC: Angel Pons <th3fanbus@gmail.com> Gerrit-Comment-Date: Mon, 21 Jan 2019 16:54:01 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: No Gerrit-MessageType: comment

Paul Menzel has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/31017 ) Change subject: ifwi: Add definitions for the Integrated Firmware Image format ...................................................................... Patch Set 1: Code-Review+1 (1 comment) https://review.coreboot.org/#/c/31017/1/ifwi.h File ifwi.h: https://review.coreboot.org/#/c/31017/1/ifwi.h@66 PS1, Line 66: #define SPD_MARKER 0x44504324 /* $CPD */ What does the $ character mean? -- To view, visit https://review.coreboot.org/c/flashrom/+/31017 To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings Gerrit-Project: flashrom Gerrit-Branch: master Gerrit-Change-Id: I4bdf47637bfb68560e6d4269f89710572c1bb82a Gerrit-Change-Number: 31017 Gerrit-PatchSet: 1 Gerrit-Owner: Nico Huber <nico.h@gmx.de> Gerrit-Reviewer: Nico Huber <nico.h@gmx.de> Gerrit-Reviewer: Paul Menzel <paulepanter@users.sourceforge.net> Gerrit-Reviewer: Thomas Heijligen <src@posteo.de> Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org> Gerrit-CC: Angel Pons <th3fanbus@gmail.com> Gerrit-Comment-Date: Tue, 22 Jan 2019 12:01:06 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: Yes Gerrit-MessageType: comment

Thomas Heijligen has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/31017 ) Change subject: ifwi: Add definitions for the Integrated Firmware Image format ...................................................................... Patch Set 1: Code-Review+1 -- To view, visit https://review.coreboot.org/c/flashrom/+/31017 To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings Gerrit-Project: flashrom Gerrit-Branch: master Gerrit-Change-Id: I4bdf47637bfb68560e6d4269f89710572c1bb82a Gerrit-Change-Number: 31017 Gerrit-PatchSet: 1 Gerrit-Owner: Nico Huber <nico.h@gmx.de> Gerrit-Reviewer: Nico Huber <nico.h@gmx.de> Gerrit-Reviewer: Paul Menzel <paulepanter@users.sourceforge.net> Gerrit-Reviewer: Thomas Heijligen <src@posteo.de> Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org> Gerrit-CC: Angel Pons <th3fanbus@gmail.com> Gerrit-Comment-Date: Tue, 22 Jan 2019 16:40:42 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment

Nico Huber has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/31017 ) Change subject: ifwi: Add definitions for the Integrated Firmware Image format ...................................................................... Patch Set 1: (1 comment)
Not sure if we want this upstream at all... it's not even about NOR flash. Just an Intel specific storage format.
Isn't the IFD something similar however? I have to admit I know next to nothing about IFWI.
Well, the use case is similar: Flash only parts of Intel firmware. The structure is very different, though, in its nature. It seems that things can shift and sizes change when you prep a firmware update, for instance. So, IFD partitioning is reliable and read-only. IFWI partitioning is... well, not very nice, unless you have full control over all firmware parts. https://review.coreboot.org/#/c/31017/1/ifwi.h File ifwi.h: https://review.coreboot.org/#/c/31017/1/ifwi.h@66 PS1, Line 66: #define SPD_MARKER 0x44504324 /* $CPD */
What does the $ character mean? It's just a string that marks a valid sub-partition dir. I have no idea what C, P and D mean, either :) probably something historical.
-- To view, visit https://review.coreboot.org/c/flashrom/+/31017 To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings Gerrit-Project: flashrom Gerrit-Branch: master Gerrit-Change-Id: I4bdf47637bfb68560e6d4269f89710572c1bb82a Gerrit-Change-Number: 31017 Gerrit-PatchSet: 1 Gerrit-Owner: Nico Huber <nico.h@gmx.de> Gerrit-Reviewer: Nico Huber <nico.h@gmx.de> Gerrit-Reviewer: Paul Menzel <paulepanter@users.sourceforge.net> Gerrit-Reviewer: Thomas Heijligen <src@posteo.de> Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org> Gerrit-CC: Angel Pons <th3fanbus@gmail.com> Gerrit-Comment-Date: Thu, 24 Jan 2019 15:11:33 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: Paul Menzel <paulepanter@users.sourceforge.net> Gerrit-MessageType: comment

Thomas Heijligen has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/31017 ) Change subject: ifwi: Add definitions for the Integrated Firmware Image format ...................................................................... Patch Set 1: (1 comment) https://review.coreboot.org/#/c/31017/1/ifwi.h File ifwi.h: https://review.coreboot.org/#/c/31017/1/ifwi.h@66 PS1, Line 66: #define SPD_MARKER 0x44504324 /* $CPD */
It's just a string that marks a valid sub-partition dir. I have no idea […] could be "Code Partition Directory" There is this string in ME. https://www.troopers.de/downloads/troopers17/TR17_ME11_Static.pdf slide 12 the structure is identical
-- To view, visit https://review.coreboot.org/c/flashrom/+/31017 To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings Gerrit-Project: flashrom Gerrit-Branch: master Gerrit-Change-Id: I4bdf47637bfb68560e6d4269f89710572c1bb82a Gerrit-Change-Number: 31017 Gerrit-PatchSet: 1 Gerrit-Owner: Nico Huber <nico.h@gmx.de> Gerrit-Reviewer: Nico Huber <nico.h@gmx.de> Gerrit-Reviewer: Paul Menzel <paulepanter@users.sourceforge.net> Gerrit-Reviewer: Thomas Heijligen <src@posteo.de> Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org> Gerrit-CC: Angel Pons <th3fanbus@gmail.com> Gerrit-Comment-Date: Thu, 24 Jan 2019 19:22:26 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: Paul Menzel <paulepanter@users.sourceforge.net> Comment-In-Reply-To: Nico Huber <nico.h@gmx.de> Gerrit-MessageType: comment

Hello Thomas Heijligen, Paul Menzel, build bot (Jenkins), I'd like you to reexamine a change. Please visit https://review.coreboot.org/c/flashrom/+/31017 to look at the new patch set (#2). Change subject: ifwi: Add definitions for the Integrated Firmware Image format ...................................................................... ifwi: Add definitions for the Integrated Firmware Image format The Integrated Firmware Image (IFWI) is used as a partitioning format on some Intel SoCs (e.g. Apollo Lake). It is not tied to NOR flashes, rather to have a common format between different types of boot media. Change-Id: I4bdf47637bfb68560e6d4269f89710572c1bb82a Signed-off-by: Nico Huber <nico.h@gmx.de> --- A ifwi.h 1 file changed, 78 insertions(+), 0 deletions(-) git pull ssh://review.coreboot.org:29418/flashrom refs/changes/17/31017/2 -- To view, visit https://review.coreboot.org/c/flashrom/+/31017 To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings Gerrit-Project: flashrom Gerrit-Branch: master Gerrit-Change-Id: I4bdf47637bfb68560e6d4269f89710572c1bb82a Gerrit-Change-Number: 31017 Gerrit-PatchSet: 2 Gerrit-Owner: Nico Huber <nico.h@gmx.de> Gerrit-Reviewer: Nico Huber <nico.h@gmx.de> Gerrit-Reviewer: Paul Menzel <paulepanter@users.sourceforge.net> Gerrit-Reviewer: Thomas Heijligen <src@posteo.de> Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org> Gerrit-CC: Angel Pons <th3fanbus@gmail.com> Gerrit-MessageType: newpatchset

David Hendricks has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/31017 ) Change subject: ifwi: Add definitions for the Integrated Firmware Image format ...................................................................... Patch Set 3: Code-Review+2 Patch looks good. Got a document number with details? A cursory search did not turn up any obviously useful hits... -- To view, visit https://review.coreboot.org/c/flashrom/+/31017 To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings Gerrit-Project: flashrom Gerrit-Branch: master Gerrit-Change-Id: I4bdf47637bfb68560e6d4269f89710572c1bb82a Gerrit-Change-Number: 31017 Gerrit-PatchSet: 3 Gerrit-Owner: Nico Huber <nico.h@gmx.de> Gerrit-Reviewer: David Hendricks <david.hendricks@gmail.com> Gerrit-Reviewer: Nico Huber <nico.h@gmx.de> Gerrit-Reviewer: Paul Menzel <paulepanter@users.sourceforge.net> Gerrit-Reviewer: Thomas Heijligen <src@posteo.de> Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org> Gerrit-CC: Angel Pons <th3fanbus@gmail.com> Gerrit-Comment-Date: Mon, 02 Dec 2019 00:39:18 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
participants (5)
-
Angel Pons (Code Review)
-
David Hendricks (Code Review)
-
Nico Huber (Code Review)
-
Paul Menzel (Code Review)
-
Thomas Heijligen (Code Review)