mirror of
https://github.com/LongSoft/UEFITool.git
synced 2024-11-22 07:58:22 +08:00
Add support for Intel ME FPT header version 2.1
This commit is contained in:
parent
eabd6a8604
commit
74910c4658
@ -107,6 +107,9 @@ UString jedecIdToUString(UINT8 vendorId, UINT8 deviceId0, UINT8 deviceId1)
|
|||||||
case 0x204013: return UString("Micron M45PE40");
|
case 0x204013: return UString("Micron M45PE40");
|
||||||
case 0x204014: return UString("Micron M45PE80");
|
case 0x204014: return UString("Micron M45PE80");
|
||||||
case 0x204015: return UString("Micron M45PE16");
|
case 0x204015: return UString("Micron M45PE16");
|
||||||
|
case 0x204017: return UString("Micron XM25QH64C");
|
||||||
|
case 0x204018: return UString("Micron XM25QH128C");
|
||||||
|
case 0x204019: return UString("Micron XM25QH256C");
|
||||||
case 0x207114: return UString("Micron M25PX80");
|
case 0x207114: return UString("Micron M25PX80");
|
||||||
case 0x207115: return UString("Micron M25PX16");
|
case 0x207115: return UString("Micron M25PX16");
|
||||||
case 0x207116: return UString("Micron M25PX32");
|
case 0x207116: return UString("Micron M25PX32");
|
||||||
|
@ -162,7 +162,7 @@ UString bpdtEntryTypeToUString(const UINT16 type)
|
|||||||
case BPDT_ENTRY_TYPE_IFP_OVERRIDE: return UString("IFP Override");
|
case BPDT_ENTRY_TYPE_IFP_OVERRIDE: return UString("IFP Override");
|
||||||
case BPDT_ENTRY_TYPE_DEBUG_TOKENS: return UString("Debug Tokens");
|
case BPDT_ENTRY_TYPE_DEBUG_TOKENS: return UString("Debug Tokens");
|
||||||
case BPDT_ENTRY_TYPE_USF_PHY_CONFIG: return UString("USF Phy Config");
|
case BPDT_ENTRY_TYPE_USF_PHY_CONFIG: return UString("USF Phy Config");
|
||||||
case BPDT_ENTRY_TYPE_USB_GPP_LUN_ID: return UString("USF GPP LUN ID");
|
case BPDT_ENTRY_TYPE_USF_GPP_LUN_ID: return UString("USF GPP LUN ID");
|
||||||
case BPDT_ENTRY_TYPE_PMC: return UString("PMC");
|
case BPDT_ENTRY_TYPE_PMC: return UString("PMC");
|
||||||
case BPDT_ENTRY_TYPE_IUNIT: return UString("iUnit");
|
case BPDT_ENTRY_TYPE_IUNIT: return UString("iUnit");
|
||||||
case BPDT_ENTRY_TYPE_NVM_CONFIG: return UString("NVM Config");
|
case BPDT_ENTRY_TYPE_NVM_CONFIG: return UString("NVM Config");
|
||||||
@ -175,6 +175,8 @@ UString bpdtEntryTypeToUString(const UINT16 type)
|
|||||||
case BPDT_ENTRY_TYPE_TCSS_FW_IOM: return UString("TCSS FW IOM");
|
case BPDT_ENTRY_TYPE_TCSS_FW_IOM: return UString("TCSS FW IOM");
|
||||||
case BPDT_ENTRY_TYPE_TCSS_FW_PHY: return UString("TCSS FW PHY");
|
case BPDT_ENTRY_TYPE_TCSS_FW_PHY: return UString("TCSS FW PHY");
|
||||||
case BPDT_ENTRY_TYPE_TBT: return UString("TCSS TBT");
|
case BPDT_ENTRY_TYPE_TBT: return UString("TCSS TBT");
|
||||||
|
case BPDT_ENTRY_TYPE_USB_PHY: return UString("USB PHY");
|
||||||
|
case BPDT_ENTRY_TYPE_PCHC: return UString("PCHC");
|
||||||
case BPDT_ENTRY_TYPE_SAMF: return UString("SAMF");
|
case BPDT_ENTRY_TYPE_SAMF: return UString("SAMF");
|
||||||
case BPDT_ENTRY_TYPE_PPHY: return UString("PPHY");
|
case BPDT_ENTRY_TYPE_PPHY: return UString("PPHY");
|
||||||
default: return usprintf("Unknown %u", type);
|
default: return usprintf("Unknown %u", type);
|
||||||
|
@ -635,7 +635,7 @@ typedef struct BPDT_ENTRY_ {
|
|||||||
#define BPDT_ENTRY_TYPE_IFP_OVERRIDE 10
|
#define BPDT_ENTRY_TYPE_IFP_OVERRIDE 10
|
||||||
#define BPDT_ENTRY_TYPE_DEBUG_TOKENS 11
|
#define BPDT_ENTRY_TYPE_DEBUG_TOKENS 11
|
||||||
#define BPDT_ENTRY_TYPE_USF_PHY_CONFIG 12
|
#define BPDT_ENTRY_TYPE_USF_PHY_CONFIG 12
|
||||||
#define BPDT_ENTRY_TYPE_USB_GPP_LUN_ID 13
|
#define BPDT_ENTRY_TYPE_USF_GPP_LUN_ID 13
|
||||||
#define BPDT_ENTRY_TYPE_PMC 14
|
#define BPDT_ENTRY_TYPE_PMC 14
|
||||||
#define BPDT_ENTRY_TYPE_IUNIT 15
|
#define BPDT_ENTRY_TYPE_IUNIT 15
|
||||||
#define BPDT_ENTRY_TYPE_NVM_CONFIG 16
|
#define BPDT_ENTRY_TYPE_NVM_CONFIG 16
|
||||||
@ -648,6 +648,8 @@ typedef struct BPDT_ENTRY_ {
|
|||||||
#define BPDT_ENTRY_TYPE_TCSS_FW_IOM 23
|
#define BPDT_ENTRY_TYPE_TCSS_FW_IOM 23
|
||||||
#define BPDT_ENTRY_TYPE_TCSS_FW_PHY 24
|
#define BPDT_ENTRY_TYPE_TCSS_FW_PHY 24
|
||||||
#define BPDT_ENTRY_TYPE_TBT 25
|
#define BPDT_ENTRY_TYPE_TBT 25
|
||||||
|
#define BPDT_ENTRY_TYPE_USB_PHY 31
|
||||||
|
#define BPDT_ENTRY_TYPE_PCHC 32
|
||||||
#define BPDT_ENTRY_TYPE_SAMF 41
|
#define BPDT_ENTRY_TYPE_SAMF 41
|
||||||
#define BPDT_ENTRY_TYPE_PPHY 42
|
#define BPDT_ENTRY_TYPE_PPHY 42
|
||||||
|
|
||||||
|
@ -4648,6 +4648,8 @@ make_partition_table_consistent:
|
|||||||
|
|
||||||
// TODO: make this generic again
|
// TODO: make this generic again
|
||||||
if (partitions[i].ptEntry.Type > BPDT_ENTRY_TYPE_TBT
|
if (partitions[i].ptEntry.Type > BPDT_ENTRY_TYPE_TBT
|
||||||
|
&& partitions[i].ptEntry.Type != BPDT_ENTRY_TYPE_USB_PHY
|
||||||
|
&& partitions[i].ptEntry.Type != BPDT_ENTRY_TYPE_PCHC
|
||||||
&& partitions[i].ptEntry.Type != BPDT_ENTRY_TYPE_SAMF
|
&& partitions[i].ptEntry.Type != BPDT_ENTRY_TYPE_SAMF
|
||||||
&& partitions[i].ptEntry.Type != BPDT_ENTRY_TYPE_PPHY) {
|
&& partitions[i].ptEntry.Type != BPDT_ENTRY_TYPE_PPHY) {
|
||||||
msg(usprintf("%s: BPDT entry of unknown type found", __FUNCTION__), partitionIndex);
|
msg(usprintf("%s: BPDT entry of unknown type found", __FUNCTION__), partitionIndex);
|
||||||
|
32
common/me.h
32
common/me.h
@ -34,23 +34,43 @@ const UByteArray ME_VERSION_SIGNATURE2("\x24\x4D\x4E\x32", 4); //$MN2
|
|||||||
#define ME_ROM_BYPASS_VECTOR_SIZE 0x10
|
#define ME_ROM_BYPASS_VECTOR_SIZE 0x10
|
||||||
const UByteArray FPT_HEADER_SIGNATURE("\x24\x46\x50\x54", 4); //$FPT
|
const UByteArray FPT_HEADER_SIGNATURE("\x24\x46\x50\x54", 4); //$FPT
|
||||||
|
|
||||||
|
// Header version 1.0 or 2.0, default
|
||||||
typedef struct FPT_HEADER_ {
|
typedef struct FPT_HEADER_ {
|
||||||
UINT32 Signature;
|
UINT32 Signature;
|
||||||
UINT32 NumEntries;
|
UINT32 NumEntries;
|
||||||
UINT8 HeaderVersion;
|
UINT8 HeaderVersion; // 0x10 or 0x20
|
||||||
UINT8 EntryVersion;
|
UINT8 EntryVersion;
|
||||||
UINT8 HeaderLength;
|
UINT8 HeaderLength;
|
||||||
UINT8 Checksum; // One bit for Redundant before IFWI
|
UINT8 HeaderChecksum; // One bit for Redundant
|
||||||
UINT16 TicksToAdd;
|
UINT16 FlashCycleLife; // Maybe also TicksToAdd
|
||||||
UINT16 TokensToAdd;
|
UINT16 FlashCycleLimit;// Maybe also TokensToAdd
|
||||||
UINT32 UmaSize; // Flags in SPS
|
UINT32 UmaSize; // Maybe also Flags
|
||||||
UINT32 FlashLayout; // Crc32 before IFWI
|
UINT32 Flags; // Maybe also FlashLayout
|
||||||
UINT16 FitcMajor;
|
UINT16 FitcMajor;
|
||||||
UINT16 FitcMinor;
|
UINT16 FitcMinor;
|
||||||
UINT16 FitcHotfix;
|
UINT16 FitcHotfix;
|
||||||
UINT16 FitcBuild;
|
UINT16 FitcBuild;
|
||||||
} FPT_HEADER;
|
} FPT_HEADER;
|
||||||
|
|
||||||
|
// Header version 2.1, special case
|
||||||
|
#define FPT_HEADER_VERSION_21 0x21
|
||||||
|
typedef struct FPT_HEADER_21_ {
|
||||||
|
UINT32 Signature;
|
||||||
|
UINT32 NumEntries;
|
||||||
|
UINT8 HeaderVersion; // 0x21
|
||||||
|
UINT8 EntryVersion;
|
||||||
|
UINT8 HeaderLength;
|
||||||
|
UINT8 Flags; // One bit for Redundant
|
||||||
|
UINT16 TicksToAdd;
|
||||||
|
UINT16 TokensToAdd;
|
||||||
|
UINT32 SPSFlags;
|
||||||
|
UINT32 HeaderCrc32; // Header + Entries sums to 0
|
||||||
|
UINT16 FitcMajor;
|
||||||
|
UINT16 FitcMinor;
|
||||||
|
UINT16 FitcHotfix;
|
||||||
|
UINT16 FitcBuild;
|
||||||
|
} FPT_HEADER_21;
|
||||||
|
|
||||||
typedef struct FPT_HEADER_ENTRY_{
|
typedef struct FPT_HEADER_ENTRY_{
|
||||||
CHAR8 Name[4];
|
CHAR8 Name[4];
|
||||||
CHAR8 Owner[4];
|
CHAR8 Owner[4];
|
||||||
|
@ -131,22 +131,50 @@ USTATUS MeParser::parseFptRegion(const UByteArray & region, const UModelIndex &
|
|||||||
UByteArray body = region.mid(header.size(), ptBodySize);
|
UByteArray body = region.mid(header.size(), ptBodySize);
|
||||||
|
|
||||||
UString name = UString("FPT partition table");
|
UString name = UString("FPT partition table");
|
||||||
UString info = usprintf("Full size: %Xh (%u)\nHeader size: %" PRIXQ "h (%" PRIuQ ")\nBody size: %Xh (%u)\nROM bypass vector: %s\nNumber of entries: %u\nHeader version: %02Xh\nEntry version: %02Xh\n"
|
UString info;
|
||||||
"Header length: %02Xh\nTicks to add: %04Xh\nTokens to add: %04Xh\nUMA size: %Xh\nFlash layout: %Xh\nFITC version: %u.%u.%u.%u\nChecksum: %02Xh, ",
|
|
||||||
ptSize, ptSize,
|
// Special case of FPT header version 2.1
|
||||||
header.size(), header.size(),
|
if (ptHeader->HeaderVersion == FPT_HEADER_VERSION_21) {
|
||||||
ptBodySize, ptBodySize,
|
const FPT_HEADER_21* ptHeader21 = (const FPT_HEADER_21*)ptHeader;
|
||||||
(romBypassVectorSize ? "present" : "absent"),
|
|
||||||
ptHeader->NumEntries,
|
info = usprintf("Full size: %Xh (%u)\nHeader size: %" PRIXQ "h (%" PRIuQ ")\nBody size: %Xh (%u)\nROM bypass vector: %s\nNumber of entries: %u\nHeader version: %02Xh\nEntry version: %02Xh\n"
|
||||||
ptHeader->HeaderVersion,
|
"Header length: %02Xh\nFlags: %Xh\nTicks to add: %04Xh\nTokens to add: %04Xh\nSPS Flags: %Xh\nFITC version: %u.%u.%u.%u\nCRC32 Checksum: %08Xh",
|
||||||
ptHeader->EntryVersion,
|
ptSize, ptSize,
|
||||||
ptHeader->HeaderLength,
|
header.size(), header.size(),
|
||||||
ptHeader->TicksToAdd,
|
ptBodySize, ptBodySize,
|
||||||
ptHeader->TokensToAdd,
|
(romBypassVectorSize ? "present" : "absent"),
|
||||||
ptHeader->UmaSize,
|
ptHeader21->NumEntries,
|
||||||
ptHeader->FlashLayout,
|
ptHeader21->HeaderVersion,
|
||||||
ptHeader->FitcMajor, ptHeader->FitcMinor, ptHeader->FitcHotfix, ptHeader->FitcBuild,
|
ptHeader21->EntryVersion,
|
||||||
ptHeader->Checksum);
|
ptHeader21->HeaderLength,
|
||||||
|
ptHeader21->Flags,
|
||||||
|
ptHeader21->TicksToAdd,
|
||||||
|
ptHeader21->TokensToAdd,
|
||||||
|
ptHeader21->SPSFlags,
|
||||||
|
ptHeader21->FitcMajor, ptHeader21->FitcMinor, ptHeader21->FitcHotfix, ptHeader21->FitcBuild,
|
||||||
|
ptHeader21->HeaderCrc32);
|
||||||
|
// TODO: verify header crc32
|
||||||
|
}
|
||||||
|
// Default handling for all other versions, may be too generic in some corner cases
|
||||||
|
else {
|
||||||
|
info = usprintf("Full size: %Xh (%u)\nHeader size: %" PRIXQ "h (%" PRIuQ ")\nBody size: %Xh (%u)\nROM bypass vector: %s\nNumber of entries: %u\nHeader version: %02Xh\nEntry version: %02Xh\n"
|
||||||
|
"Header length: %02Xh\nFlash cycle life: %04Xh\nFlash cycle limit: %04Xh\nUMA size: %Xh\nFlags: %Xh\nFITC version: %u.%u.%u.%u\nChecksum: %02Xh",
|
||||||
|
ptSize, ptSize,
|
||||||
|
header.size(), header.size(),
|
||||||
|
ptBodySize, ptBodySize,
|
||||||
|
(romBypassVectorSize ? "present" : "absent"),
|
||||||
|
ptHeader->NumEntries,
|
||||||
|
ptHeader->HeaderVersion,
|
||||||
|
ptHeader->EntryVersion,
|
||||||
|
ptHeader->HeaderLength,
|
||||||
|
ptHeader->FlashCycleLife,
|
||||||
|
ptHeader->FlashCycleLimit,
|
||||||
|
ptHeader->UmaSize,
|
||||||
|
ptHeader->Flags,
|
||||||
|
ptHeader->FitcMajor, ptHeader->FitcMinor, ptHeader->FitcHotfix, ptHeader->FitcBuild,
|
||||||
|
ptHeader->HeaderChecksum);
|
||||||
|
// TODO: verify header checksum8
|
||||||
|
}
|
||||||
|
|
||||||
// Add tree item
|
// Add tree item
|
||||||
index = model->addItem(0, Types::FptStore, 0, name, UString(), info, header, body, UByteArray(), Fixed, parent);
|
index = model->addItem(0, Types::FptStore, 0, name, UString(), info, header, body, UByteArray(), Fixed, parent);
|
||||||
|
Loading…
Reference in New Issue
Block a user