From 6e5cc3bccc16f36f1edca0dffd18549fcc5c22d5 Mon Sep 17 00:00:00 2001 From: Nikolaj Schlej Date: Tue, 13 Sep 2022 10:21:25 +0200 Subject: [PATCH] Add support for AMI ROM hole files --- common/ffs.cpp | 34 ++++++++++++++++++++++++++++++++++ common/ffs.h | 20 ++++++++++++++++++++ common/ffsparser.cpp | 25 ++++++++++++++++++++++++- 3 files changed, 78 insertions(+), 1 deletion(-) diff --git a/common/ffs.cpp b/common/ffs.cpp index 973a747..d1d6f96 100644 --- a/common/ffs.cpp +++ b/common/ffs.cpp @@ -107,6 +107,40 @@ extern const UByteArray PROTECTED_RANGE_VENDOR_HASH_FILE_GUID_PHOENIX // 389CC6F extern const UByteArray PROTECTED_RANGE_VENDOR_HASH_FILE_GUID_AMI // CBC91F44-A4BC-4A5B-8696-703451D0B053 ("\x44\x1F\xC9\xCB\xBC\xA4\x5B\x4A\x86\x96\x70\x34\x51\xD0\xB0\x53", 16); +// AMI ROM Hole files +extern const UByteArray AMI_ROM_HOLE_FILE_GUID_0 //05CA01FC-0FC1-11DC-9011-00173153EBA8 +("\xFC\x01\xCA\x05\xC1\x0F\xDC\x11\x90\x11\x00\x17\x31\x53\xEB\xA8", 16); +extern const UByteArray AMI_ROM_HOLE_FILE_GUID_1 //05CA01FD-0FC1-11DC-9011-00173153EBA8 +("\xFD\x01\xCA\x05\xC1\x0F\xDC\x11\x90\x11\x00\x17\x31\x53\xEB\xA8", 16); +extern const UByteArray AMI_ROM_HOLE_FILE_GUID_2 //05CA01FE-0FC1-11DC-9011-00173153EBA8 +("\xFE\x01\xCA\x05\xC1\x0F\xDC\x11\x90\x11\x00\x17\x31\x53\xEB\xA8", 16); +extern const UByteArray AMI_ROM_HOLE_FILE_GUID_3 //05CA01FF-0FC1-11DC-9011-00173153EBA8 +("\xFF\x01\xCA\x05\xC1\x0F\xDC\x11\x90\x11\x00\x17\x31\x53\xEB\xA8", 16); +extern const UByteArray AMI_ROM_HOLE_FILE_GUID_4 //05CA0200-0FC1-11DC-9011-00173153EBA8 +("\x00\x02\xCA\x05\xC1\x0F\xDC\x11\x90\x11\x00\x17\x31\x53\xEB\xA8", 16); +extern const UByteArray AMI_ROM_HOLE_FILE_GUID_5 //05CA0201-0FC1-11DC-9011-00173153EBA8 +("\x01\x02\xCA\x05\xC1\x0F\xDC\x11\x90\x11\x00\x17\x31\x53\xEB\xA8", 16); +extern const UByteArray AMI_ROM_HOLE_FILE_GUID_6 //05CA0202-0FC1-11DC-9011-00173153EBA8 +("\x02\x02\xCA\x05\xC1\x0F\xDC\x11\x90\x11\x00\x17\x31\x53\xEB\xA8", 16); +extern const UByteArray AMI_ROM_HOLE_FILE_GUID_7 //05CA0203-0FC1-11DC-9011-00173153EBA8 +("\x03\x02\xCA\x05\xC1\x0F\xDC\x11\x90\x11\x00\x17\x31\x53\xEB\xA8", 16); +extern const UByteArray AMI_ROM_HOLE_FILE_GUID_8 //05CA0204-0FC1-11DC-9011-00173153EBA8 +("\x04\x02\xCA\x05\xC1\x0F\xDC\x11\x90\x11\x00\x17\x31\x53\xEB\xA8", 16); +extern const UByteArray AMI_ROM_HOLE_FILE_GUID_9 //05CA0205-0FC1-11DC-9011-00173153EBA8 +("\x05\x02\xCA\x05\xC1\x0F\xDC\x11\x90\x11\x00\x17\x31\x53\xEB\xA8", 16); +extern const UByteArray AMI_ROM_HOLE_FILE_GUID_10 //05CA0206-0FC1-11DC-9011-00173153EBA8 +("\x06\x02\xCA\x05\xC1\x0F\xDC\x11\x90\x11\x00\x17\x31\x53\xEB\xA8", 16); +extern const UByteArray AMI_ROM_HOLE_FILE_GUID_11 //05CA0207-0FC1-11DC-9011-00173153EBA8 +("\x07\x02\xCA\x05\xC1\x0F\xDC\x11\x90\x11\x00\x17\x31\x53\xEB\xA8", 16); +extern const UByteArray AMI_ROM_HOLE_FILE_GUID_12 //05CA0208-0FC1-11DC-9011-00173153EBA8 +("\x08\x02\xCA\x05\xC1\x0F\xDC\x11\x90\x11\x00\x17\x31\x53\xEB\xA8", 16); +extern const UByteArray AMI_ROM_HOLE_FILE_GUID_13 //05CA0209-0FC1-11DC-9011-00173153EBA8 +("\x09\x02\xCA\x05\xC1\x0F\xDC\x11\x90\x11\x00\x17\x31\x53\xEB\xA8", 16); +extern const UByteArray AMI_ROM_HOLE_FILE_GUID_14 //05CA020A-0FC1-11DC-9011-00173153EBA8 +("\x0A\x02\xCA\x05\xC1\x0F\xDC\x11\x90\x11\x00\x17\x31\x53\xEB\xA8", 16); +extern const UByteArray AMI_ROM_HOLE_FILE_GUID_15 //05CA020B-0FC1-11DC-9011-00173153EBA8 +("\x0B\x02\xCA\x05\xC1\x0F\xDC\x11\x90\x11\x00\x17\x31\x53\xEB\xA8", 16); + const std::vector FFSv2Volumes({ EFI_FIRMWARE_FILE_SYSTEM_GUID, EFI_FIRMWARE_FILE_SYSTEM2_GUID, diff --git a/common/ffs.h b/common/ffs.h index c3d122a..bfcd3d7 100644 --- a/common/ffs.h +++ b/common/ffs.h @@ -819,6 +819,26 @@ typedef struct PROTECTED_RANGE_VENDOR_HASH_FILE_HEADER_AMI_V3_ // UINT32 Size[SOME_HARDCODED_N]; } PROTECTED_RANGE_VENDOR_HASH_FILE_HEADER_AMI_V3; +// +// AMI ROM Hole files +// +extern const UByteArray AMI_ROM_HOLE_FILE_GUID_0; //05CA01FC-0FC1-11DC-9011-00173153EBA8 +extern const UByteArray AMI_ROM_HOLE_FILE_GUID_1; //05CA01FD-0FC1-11DC-9011-00173153EBA8 +extern const UByteArray AMI_ROM_HOLE_FILE_GUID_2; //05CA01FE-0FC1-11DC-9011-00173153EBA8 +extern const UByteArray AMI_ROM_HOLE_FILE_GUID_3; //05CA01FF-0FC1-11DC-9011-00173153EBA8 +extern const UByteArray AMI_ROM_HOLE_FILE_GUID_4; //05CA0200-0FC1-11DC-9011-00173153EBA8 +extern const UByteArray AMI_ROM_HOLE_FILE_GUID_5; //05CA0201-0FC1-11DC-9011-00173153EBA8 +extern const UByteArray AMI_ROM_HOLE_FILE_GUID_6; //05CA0202-0FC1-11DC-9011-00173153EBA8 +extern const UByteArray AMI_ROM_HOLE_FILE_GUID_7; //05CA0203-0FC1-11DC-9011-00173153EBA8 +extern const UByteArray AMI_ROM_HOLE_FILE_GUID_8; //05CA0204-0FC1-11DC-9011-00173153EBA8 +extern const UByteArray AMI_ROM_HOLE_FILE_GUID_9; //05CA0205-0FC1-11DC-9011-00173153EBA8 +extern const UByteArray AMI_ROM_HOLE_FILE_GUID_10; //05CA0206-0FC1-11DC-9011-00173153EBA8 +extern const UByteArray AMI_ROM_HOLE_FILE_GUID_11; //05CA0207-0FC1-11DC-9011-00173153EBA8 +extern const UByteArray AMI_ROM_HOLE_FILE_GUID_12; //05CA0208-0FC1-11DC-9011-00173153EBA8 +extern const UByteArray AMI_ROM_HOLE_FILE_GUID_13; //05CA0209-0FC1-11DC-9011-00173153EBA8 +extern const UByteArray AMI_ROM_HOLE_FILE_GUID_14; //05CA020A-0FC1-11DC-9011-00173153EBA8 +extern const UByteArray AMI_ROM_HOLE_FILE_GUID_15; //05CA020B-0FC1-11DC-9011-00173153EBA8 + // Restore previous packing rules #pragma pack(pop) diff --git a/common/ffsparser.cpp b/common/ffsparser.cpp index cd366f8..2305937 100644 --- a/common/ffsparser.cpp +++ b/common/ffsparser.cpp @@ -1890,13 +1890,36 @@ USTATUS FfsParser::parseFileBody(const UModelIndex & index) return nvramParser->parseNvarStore(index); } else if (fileGuid == NVRAM_NVAR_BB_DEFAULTS_FILE_GUID) { - model->setText(index, UString("NVAR bb defaults")); + model->setText(index, UString("NVAR BB defaults")); return nvramParser->parseNvarStore(index); } // Parse vendor hash file else if (fileGuid == PROTECTED_RANGE_VENDOR_HASH_FILE_GUID_PHOENIX) { return parseVendorHashFile(fileGuid, index); } + // Parse AMI ROM hole + else if (fileGuid == AMI_ROM_HOLE_FILE_GUID_0 + || fileGuid == AMI_ROM_HOLE_FILE_GUID_1 + || fileGuid == AMI_ROM_HOLE_FILE_GUID_2 + || fileGuid == AMI_ROM_HOLE_FILE_GUID_3 + || fileGuid == AMI_ROM_HOLE_FILE_GUID_4 + || fileGuid == AMI_ROM_HOLE_FILE_GUID_5 + || fileGuid == AMI_ROM_HOLE_FILE_GUID_6 + || fileGuid == AMI_ROM_HOLE_FILE_GUID_7 + || fileGuid == AMI_ROM_HOLE_FILE_GUID_8 + || fileGuid == AMI_ROM_HOLE_FILE_GUID_9 + || fileGuid == AMI_ROM_HOLE_FILE_GUID_10 + || fileGuid == AMI_ROM_HOLE_FILE_GUID_11 + || fileGuid == AMI_ROM_HOLE_FILE_GUID_12 + || fileGuid == AMI_ROM_HOLE_FILE_GUID_13 + || fileGuid == AMI_ROM_HOLE_FILE_GUID_14 + || fileGuid == AMI_ROM_HOLE_FILE_GUID_15) { + model->setText(index, UString("AMI ROM hole")); + // Mark ROM hole file as Fixed in the image + model->setFixed(index, Fixed); + // No need to parse further + return U_SUCCESS; + } return parseRawArea(index); }