multiple fixes

This commit is contained in:
Alex Matrosov 2018-01-23 00:00:03 -08:00
parent 8fb214c322
commit 82a89b2c03
4 changed files with 35 additions and 26 deletions

View File

@ -17,7 +17,7 @@
UEFITool::UEFITool(QWidget *parent) : UEFITool::UEFITool(QWidget *parent) :
QMainWindow(parent), QMainWindow(parent),
ui(new Ui::UEFITool), ui(new Ui::UEFITool),
version(tr("NE alpha 45")) version(tr("NE alpha 46"))
{ {
clipboard = QApplication::clipboard(); clipboard = QApplication::clipboard();

View File

@ -114,6 +114,14 @@ UString jedecIdToUString(UINT8 vendorId, UINT8 deviceId0, UINT8 deviceId1)
case 0x20BB19: return UString("Micron MT25Q256"); case 0x20BB19: return UString("Micron MT25Q256");
case 0x20BB20: return UString("Micron MT25Q512"); 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 // Atmel
case 0x1F4500: return UString("Atmel AT26DF081"); case 0x1F4500: return UString("Atmel AT26DF081");
case 0x1F4501: return UString("Atmel AT26DF081A"); case 0x1F4501: return UString("Atmel AT26DF081A");
@ -177,11 +185,15 @@ UString jedecIdToUString(UINT8 vendorId, UINT8 deviceId0, UINT8 deviceId1)
case 0x374016: return UString("Amic A25L032A"); case 0x374016: return UString("Amic A25L032A");
// PMC // PMC
case 0x7F9D13: return UString("PMC Pm25LV080B"); case 0x9DF713: return UString("PMC Pm25LV080B");
case 0x7F9D14: return UString("PMC Pm25LV016B"); case 0x9DF714: return UString("PMC Pm25LV016B");
case 0x7F9D44: return UString("PMC Pm25LQ080C"); case 0x9DF744: return UString("PMC Pm25LQ080C");
case 0x7F9D45: return UString("PMC Pm25LQ016C"); case 0x9DF745: return UString("PMC Pm25LQ016C");
case 0x7F9D46: return UString("PMC Pm25LQ032C"); 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 // ISSI
case 0x9D6017: return UString("ISSI Ix25LP064"); case 0x9D6017: return UString("ISSI Ix25LP064");

View File

@ -14,7 +14,6 @@ WITHWARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <map> #include <map>
#include <algorithm> #include <algorithm>
#include <math.h>
#include <inttypes.h> #include <inttypes.h>
#include "descriptor.h" #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)); const VSCC_TABLE_ENTRY* vsccTableEntry = (const VSCC_TABLE_ENTRY*)(descriptor + ((UINT16)upperMap->VsccTableBase << 4));
info += UString("\nFlash chips in VSCC table:"); info += UString("\nFlash chips in VSCC table:");
UINT8 vsscTableSize = upperMap->VsccTableSize * sizeof(UINT32) / sizeof(VSCC_TABLE_ENTRY); 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++) { 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) info += usprintf("\n%02X%02X%02X (", vsccTableEntry->VendorId, vsccTableEntry->DeviceId0, vsccTableEntry->DeviceId1)
+ jedecId + jedecId
+ UString(")"); + 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++; vsccTableEntry++;
} }
// Add descriptor tree item // Add descriptor tree item
UModelIndex regionIndex = model->addItem(localOffset, Types::Region, Subtypes::DescriptorRegion, name, UString(), info, UByteArray(), body, UByteArray(), Fixed, index); 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 // Parse regions
UINT8 result = U_SUCCESS; UINT8 result = U_SUCCESS;
@ -829,9 +826,8 @@ USTATUS FfsParser::parseRawArea(const UModelIndex & index)
else { else {
// Show messages // Show messages
if (volumeSize != bmVolumeSize) if (volumeSize != bmVolumeSize)
msg(usprintf("parseRawArea: volume size stored in header %Xh (%u) differs from calculated using block map %Xh (%u)", msg(usprintf("parseRawArea: volume size stored in header %Xh differs from calculated using block map %Xh",
volumeSize, volumeSize, volumeSize, bmVolumeSize),
bmVolumeSize, bmVolumeSize),
volumeIndex); volumeIndex);
} }
@ -1498,11 +1494,11 @@ USTATUS FfsParser::parseFileHeader(const UByteArray & file, const UINT32 localOf
if (msgFileAlignmentIsGreaterThanVolumeAlignment) if (msgFileAlignmentIsGreaterThanVolumeAlignment)
msg(usprintf("parseFileHeader: file alignment %Xh is greater than parent volume alignment %Xh", alignment, volumeAlignment), index); msg(usprintf("parseFileHeader: file alignment %Xh is greater than parent volume alignment %Xh", alignment, volumeAlignment), index);
if (msgInvalidHeaderChecksum) 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) 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) if (msgInvalidTailValue)
msg(UString("parseFileHeader: invalid tail value"), index); msg(usprintf("parseFileHeader: invalid tail value %04h", *(const UINT16*)tail.constData()), index);
if (msgUnknownType) if (msgUnknownType)
msg(usprintf("parseFileHeader: unknown file type %02Xh", fileHeader->Type), index); msg(usprintf("parseFileHeader: unknown file type %02Xh", fileHeader->Type), index);
@ -1690,6 +1686,7 @@ USTATUS FfsParser::parseSections(const UByteArray & sections, const UModelIndex
else else
return U_INVALID_SECTION; return U_INVALID_SECTION;
} }
// Move to next section // Move to next section
sectionOffset += sectionSize; sectionOffset += sectionSize;
sectionOffset = ALIGN4(sectionOffset); sectionOffset = ALIGN4(sectionOffset);
@ -1756,7 +1753,7 @@ USTATUS FfsParser::parseCommonSectionHeader(const UByteArray & section, const UI
// Obtain required information from parent volume // Obtain required information from parent volume
UINT8 ffsVersion = 2; UINT8 ffsVersion = 2;
UModelIndex parentVolumeIndex = model->findParentOfType(index, Types::Volume); UModelIndex parentVolumeIndex = model->findParentOfType(parent, Types::Volume);
if (parentVolumeIndex.isValid() && model->hasEmptyParsingData(parentVolumeIndex) == false) { if (parentVolumeIndex.isValid() && model->hasEmptyParsingData(parentVolumeIndex) == false) {
UByteArray data = model->parsingData(parentVolumeIndex); UByteArray data = model->parsingData(parentVolumeIndex);
const VOLUME_PARSING_DATA* pdata = (const VOLUME_PARSING_DATA*)data.constData(); 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 // Obtain required information from parent volume
UINT8 ffsVersion = 2; UINT8 ffsVersion = 2;
UModelIndex parentVolumeIndex = model->findParentOfType(index, Types::Volume); UModelIndex parentVolumeIndex = model->findParentOfType(parent, Types::Volume);
if (parentVolumeIndex.isValid() && model->hasEmptyParsingData(parentVolumeIndex) == false) { if (parentVolumeIndex.isValid() && model->hasEmptyParsingData(parentVolumeIndex) == false) {
UByteArray data = model->parsingData(parentVolumeIndex); UByteArray data = model->parsingData(parentVolumeIndex);
const VOLUME_PARSING_DATA* pdata = (const VOLUME_PARSING_DATA*)data.constData(); 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 // Obtain required information from parent volume
UINT8 ffsVersion = 2; UINT8 ffsVersion = 2;
UModelIndex parentVolumeIndex = model->findParentOfType(index, Types::Volume); UModelIndex parentVolumeIndex = model->findParentOfType(parent, Types::Volume);
if (parentVolumeIndex.isValid() && model->hasEmptyParsingData(parentVolumeIndex) == false) { if (parentVolumeIndex.isValid() && model->hasEmptyParsingData(parentVolumeIndex) == false) {
UByteArray data = model->parsingData(parentVolumeIndex); UByteArray data = model->parsingData(parentVolumeIndex);
const VOLUME_PARSING_DATA* pdata = (const VOLUME_PARSING_DATA*)data.constData(); 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 // Obtain required information from parent volume
UINT8 ffsVersion = 2; UINT8 ffsVersion = 2;
UModelIndex parentVolumeIndex = model->findParentOfType(index, Types::Volume); UModelIndex parentVolumeIndex = model->findParentOfType(parent, Types::Volume);
if (parentVolumeIndex.isValid() && model->hasEmptyParsingData(parentVolumeIndex) == false) { if (parentVolumeIndex.isValid() && model->hasEmptyParsingData(parentVolumeIndex) == false) {
UByteArray data = model->parsingData(parentVolumeIndex); UByteArray data = model->parsingData(parentVolumeIndex);
const VOLUME_PARSING_DATA* pdata = (const VOLUME_PARSING_DATA*)data.constData(); 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 // Obtain required information from parent volume
UINT8 ffsVersion = 2; UINT8 ffsVersion = 2;
UModelIndex parentVolumeIndex = model->findParentOfType(index, Types::Volume); UModelIndex parentVolumeIndex = model->findParentOfType(parent, Types::Volume);
if (parentVolumeIndex.isValid() && model->hasEmptyParsingData(parentVolumeIndex) == false) { if (parentVolumeIndex.isValid() && model->hasEmptyParsingData(parentVolumeIndex) == false) {
UByteArray data = model->parsingData(parentVolumeIndex); UByteArray data = model->parsingData(parentVolumeIndex);
const VOLUME_PARSING_DATA* pdata = (const VOLUME_PARSING_DATA*)data.constData(); 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 // Obtain required information from parent volume
UINT8 ffsVersion = 2; UINT8 ffsVersion = 2;
UModelIndex parentVolumeIndex = model->findParentOfType(index, Types::Volume); UModelIndex parentVolumeIndex = model->findParentOfType(parent, Types::Volume);
if (parentVolumeIndex.isValid() && model->hasEmptyParsingData(parentVolumeIndex) == false) { if (parentVolumeIndex.isValid() && model->hasEmptyParsingData(parentVolumeIndex) == false) {
UByteArray data = model->parsingData(parentVolumeIndex); UByteArray data = model->parsingData(parentVolumeIndex);
const VOLUME_PARSING_DATA* pdata = (const VOLUME_PARSING_DATA*)data.constData(); const VOLUME_PARSING_DATA* pdata = (const VOLUME_PARSING_DATA*)data.constData();

View File

@ -853,7 +853,7 @@ USTATUS NvramParser::parseFtwStoreHeader(const UByteArray & store, const UINT32
// Obtain required information from parent volume // Obtain required information from parent volume
UINT8 emptyByte = 0xFF; UINT8 emptyByte = 0xFF;
UModelIndex parentVolumeIndex = model->findParentOfType(index, Types::Volume); UModelIndex parentVolumeIndex = model->findParentOfType(parent, Types::Volume);
if (parentVolumeIndex.isValid() && model->hasEmptyParsingData(parentVolumeIndex) == false) { if (parentVolumeIndex.isValid() && model->hasEmptyParsingData(parentVolumeIndex) == false) {
UByteArray data = model->parsingData(parentVolumeIndex); UByteArray data = model->parsingData(parentVolumeIndex);
const VOLUME_PARSING_DATA* pdata = (const VOLUME_PARSING_DATA*)data.constData(); const VOLUME_PARSING_DATA* pdata = (const VOLUME_PARSING_DATA*)data.constData();