From 82a89b2c032290f6f5dcb60b4ae48b1976481aae Mon Sep 17 00:00:00 2001 From: Alex Matrosov Date: Tue, 23 Jan 2018 00:00:03 -0800 Subject: [PATCH] multiple fixes --- UEFITool/uefitool.cpp | 2 +- common/descriptor.cpp | 22 +++++++++++++++++----- common/ffsparser.cpp | 35 ++++++++++++++++------------------- common/nvramparser.cpp | 2 +- 4 files changed, 35 insertions(+), 26 deletions(-) diff --git a/UEFITool/uefitool.cpp b/UEFITool/uefitool.cpp index 95bd58a..37c2c1f 100644 --- a/UEFITool/uefitool.cpp +++ b/UEFITool/uefitool.cpp @@ -17,7 +17,7 @@ UEFITool::UEFITool(QWidget *parent) : QMainWindow(parent), ui(new Ui::UEFITool), -version(tr("NE alpha 45")) +version(tr("NE alpha 46")) { clipboard = QApplication::clipboard(); diff --git a/common/descriptor.cpp b/common/descriptor.cpp index 578bd82..93afabe 100644 --- a/common/descriptor.cpp +++ b/common/descriptor.cpp @@ -114,6 +114,14 @@ UString jedecIdToUString(UINT8 vendorId, UINT8 deviceId0, UINT8 deviceId1) case 0x20BB19: return UString("Micron MT25Q256"); case 0x20BB20: return UString("Micron MT25Q512"); + // Intel + case 0x898911: return UString("Intel 25F160S33B8"); + case 0x898912: return UString("Intel 25F320S33B8"); + case 0x898913: return UString("Intel 25F640S33B8"); + case 0x898915: return UString("Intel 25F160S33T8"); + case 0x898916: return UString("Intel 25F320S33T8"); + case 0x898917: return UString("Intel 25F640S33T8"); + // Atmel case 0x1F4500: return UString("Atmel AT26DF081"); case 0x1F4501: return UString("Atmel AT26DF081A"); @@ -177,11 +185,15 @@ UString jedecIdToUString(UINT8 vendorId, UINT8 deviceId0, UINT8 deviceId1) case 0x374016: return UString("Amic A25L032A"); // PMC - case 0x7F9D13: return UString("PMC Pm25LV080B"); - case 0x7F9D14: return UString("PMC Pm25LV016B"); - case 0x7F9D44: return UString("PMC Pm25LQ080C"); - case 0x7F9D45: return UString("PMC Pm25LQ016C"); - case 0x7F9D46: return UString("PMC Pm25LQ032C"); + case 0x9DF713: return UString("PMC Pm25LV080B"); + case 0x9DF714: return UString("PMC Pm25LV016B"); + case 0x9DF744: return UString("PMC Pm25LQ080C"); + case 0x9DF745: return UString("PMC Pm25LQ016C"); + case 0x9DF746: return UString("PMC Pm25LQ032C"); + case 0x9DF77B: return UString("PMC Pm25LV512A"); + case 0x9DF77C: return UString("PMC Pm25LV010A"); + case 0x9DF77D: return UString("PMC Pm25LV020"); + case 0x9DF77E: return UString("PMC Pm25LV040"); // ISSI case 0x9D6017: return UString("ISSI Ix25LP064"); diff --git a/common/ffsparser.cpp b/common/ffsparser.cpp index e35d553..d724caf 100644 --- a/common/ffsparser.cpp +++ b/common/ffsparser.cpp @@ -14,7 +14,6 @@ WITHWARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include #include -#include #include #include "descriptor.h" @@ -519,21 +518,19 @@ USTATUS FfsParser::parseIntelImage(const UByteArray & intelImage, const UINT32 l const VSCC_TABLE_ENTRY* vsccTableEntry = (const VSCC_TABLE_ENTRY*)(descriptor + ((UINT16)upperMap->VsccTableBase << 4)); info += UString("\nFlash chips in VSCC table:"); UINT8 vsscTableSize = upperMap->VsccTableSize * sizeof(UINT32) / sizeof(VSCC_TABLE_ENTRY); - UString jedecId = jedecIdToUString(vsccTableEntry->VendorId, vsccTableEntry->DeviceId0, vsccTableEntry->DeviceId1); for (UINT8 i = 0; i < vsscTableSize; i++) { + UString jedecId = jedecIdToUString(vsccTableEntry->VendorId, vsccTableEntry->DeviceId0, vsccTableEntry->DeviceId1); info += usprintf("\n%02X%02X%02X (", vsccTableEntry->VendorId, vsccTableEntry->DeviceId0, vsccTableEntry->DeviceId1) + jedecId + UString(")"); + if (jedecId == UString("Unknown")) { + msg(usprintf("SPI flash with unknown JEDEC ID %02X%02X%02X found in VSCC table", vsccTableEntry->VendorId, vsccTableEntry->DeviceId0, vsccTableEntry->DeviceId1), index); + } vsccTableEntry++; } // Add descriptor tree item UModelIndex regionIndex = model->addItem(localOffset, Types::Region, Subtypes::DescriptorRegion, name, UString(), info, UByteArray(), body, UByteArray(), Fixed, index); - - // Show messages - if (jedecId == UString("Unknown")) { - msg(usprintf("SPI flash with unknown JEDEC ID %02X%02X%02X found in VSCC table", vsccTableEntry->VendorId, vsccTableEntry->DeviceId0, vsccTableEntry->DeviceId1), regionIndex); - } // Parse regions UINT8 result = U_SUCCESS; @@ -829,9 +826,8 @@ USTATUS FfsParser::parseRawArea(const UModelIndex & index) else { // Show messages if (volumeSize != bmVolumeSize) - msg(usprintf("parseRawArea: volume size stored in header %Xh (%u) differs from calculated using block map %Xh (%u)", - volumeSize, volumeSize, - bmVolumeSize, bmVolumeSize), + msg(usprintf("parseRawArea: volume size stored in header %Xh differs from calculated using block map %Xh", + volumeSize, bmVolumeSize), volumeIndex); } @@ -1498,11 +1494,11 @@ USTATUS FfsParser::parseFileHeader(const UByteArray & file, const UINT32 localOf if (msgFileAlignmentIsGreaterThanVolumeAlignment) msg(usprintf("parseFileHeader: file alignment %Xh is greater than parent volume alignment %Xh", alignment, volumeAlignment), index); if (msgInvalidHeaderChecksum) - msg(UString("parseFileHeader: invalid header checksum"), index); + msg(usprintf("parseFileHeader: invalid header checksum %02h, should be %02h", fileHeader->IntegrityCheck.Checksum.Header, calculatedHeader), index); if (msgInvalidDataChecksum) - msg(UString("parseFileHeader: invalid data checksum"), index); + msg(usprintf("parseFileHeader: invalid data checksum %02h, should be %02h", fileHeader->IntegrityCheck.Checksum.File, calculatedData), index); if (msgInvalidTailValue) - msg(UString("parseFileHeader: invalid tail value"), index); + msg(usprintf("parseFileHeader: invalid tail value %04h", *(const UINT16*)tail.constData()), index); if (msgUnknownType) msg(usprintf("parseFileHeader: unknown file type %02Xh", fileHeader->Type), index); @@ -1690,6 +1686,7 @@ USTATUS FfsParser::parseSections(const UByteArray & sections, const UModelIndex else return U_INVALID_SECTION; } + // Move to next section sectionOffset += sectionSize; sectionOffset = ALIGN4(sectionOffset); @@ -1756,7 +1753,7 @@ USTATUS FfsParser::parseCommonSectionHeader(const UByteArray & section, const UI // Obtain required information from parent volume UINT8 ffsVersion = 2; - UModelIndex parentVolumeIndex = model->findParentOfType(index, Types::Volume); + UModelIndex parentVolumeIndex = model->findParentOfType(parent, Types::Volume); if (parentVolumeIndex.isValid() && model->hasEmptyParsingData(parentVolumeIndex) == false) { UByteArray data = model->parsingData(parentVolumeIndex); const VOLUME_PARSING_DATA* pdata = (const VOLUME_PARSING_DATA*)data.constData(); @@ -1809,7 +1806,7 @@ USTATUS FfsParser::parseCompressedSectionHeader(const UByteArray & section, cons // Obtain required information from parent volume UINT8 ffsVersion = 2; - UModelIndex parentVolumeIndex = model->findParentOfType(index, Types::Volume); + UModelIndex parentVolumeIndex = model->findParentOfType(parent, Types::Volume); if (parentVolumeIndex.isValid() && model->hasEmptyParsingData(parentVolumeIndex) == false) { UByteArray data = model->parsingData(parentVolumeIndex); const VOLUME_PARSING_DATA* pdata = (const VOLUME_PARSING_DATA*)data.constData(); @@ -1883,7 +1880,7 @@ USTATUS FfsParser::parseGuidedSectionHeader(const UByteArray & section, const UI // Obtain required information from parent volume UINT8 ffsVersion = 2; - UModelIndex parentVolumeIndex = model->findParentOfType(index, Types::Volume); + UModelIndex parentVolumeIndex = model->findParentOfType(parent, Types::Volume); if (parentVolumeIndex.isValid() && model->hasEmptyParsingData(parentVolumeIndex) == false) { UByteArray data = model->parsingData(parentVolumeIndex); const VOLUME_PARSING_DATA* pdata = (const VOLUME_PARSING_DATA*)data.constData(); @@ -2077,7 +2074,7 @@ USTATUS FfsParser::parseFreeformGuidedSectionHeader(const UByteArray & section, // Obtain required information from parent volume UINT8 ffsVersion = 2; - UModelIndex parentVolumeIndex = model->findParentOfType(index, Types::Volume); + UModelIndex parentVolumeIndex = model->findParentOfType(parent, Types::Volume); if (parentVolumeIndex.isValid() && model->hasEmptyParsingData(parentVolumeIndex) == false) { UByteArray data = model->parsingData(parentVolumeIndex); const VOLUME_PARSING_DATA* pdata = (const VOLUME_PARSING_DATA*)data.constData(); @@ -2152,7 +2149,7 @@ USTATUS FfsParser::parseVersionSectionHeader(const UByteArray & section, const U // Obtain required information from parent volume UINT8 ffsVersion = 2; - UModelIndex parentVolumeIndex = model->findParentOfType(index, Types::Volume); + UModelIndex parentVolumeIndex = model->findParentOfType(parent, Types::Volume); if (parentVolumeIndex.isValid() && model->hasEmptyParsingData(parentVolumeIndex) == false) { UByteArray data = model->parsingData(parentVolumeIndex); const VOLUME_PARSING_DATA* pdata = (const VOLUME_PARSING_DATA*)data.constData(); @@ -2217,7 +2214,7 @@ USTATUS FfsParser::parsePostcodeSectionHeader(const UByteArray & section, const // Obtain required information from parent volume UINT8 ffsVersion = 2; - UModelIndex parentVolumeIndex = model->findParentOfType(index, Types::Volume); + UModelIndex parentVolumeIndex = model->findParentOfType(parent, Types::Volume); if (parentVolumeIndex.isValid() && model->hasEmptyParsingData(parentVolumeIndex) == false) { UByteArray data = model->parsingData(parentVolumeIndex); const VOLUME_PARSING_DATA* pdata = (const VOLUME_PARSING_DATA*)data.constData(); diff --git a/common/nvramparser.cpp b/common/nvramparser.cpp index 9fbcd73..ed2eebc 100644 --- a/common/nvramparser.cpp +++ b/common/nvramparser.cpp @@ -853,7 +853,7 @@ USTATUS NvramParser::parseFtwStoreHeader(const UByteArray & store, const UINT32 // Obtain required information from parent volume UINT8 emptyByte = 0xFF; - UModelIndex parentVolumeIndex = model->findParentOfType(index, Types::Volume); + UModelIndex parentVolumeIndex = model->findParentOfType(parent, Types::Volume); if (parentVolumeIndex.isValid() && model->hasEmptyParsingData(parentVolumeIndex) == false) { UByteArray data = model->parsingData(parentVolumeIndex); const VOLUME_PARSING_DATA* pdata = (const VOLUME_PARSING_DATA*)data.constData();