Add support for NVRAM_NVAR_PEI_EXTERNAL_DEFAULTS_FILE_GUID, fixes #163

This commit is contained in:
vit9696 2019-02-10 18:38:37 +03:00
parent 5c98152c58
commit f34894b9fd
4 changed files with 46 additions and 39 deletions

View File

@ -913,7 +913,10 @@
<bool>false</bool>
</property>
<property name="text">
<string>Export discovered GUIDs...</string>
<string>&amp;Export discovered GUIDs...</string>
</property>
<property name="shortcut">
<string>Ctrl+Alt+E</string>
</property>
</action>
</widget>

View File

@ -1659,12 +1659,20 @@ USTATUS FfsParser::parseFileBody(const UModelIndex & index)
UByteArray fileGuid = UByteArray(model->header(index).constData(), sizeof(EFI_GUID));
// Parse NVAR store
if (fileGuid == NVRAM_NVAR_STORE_FILE_GUID)
if (fileGuid == NVRAM_NVAR_STORE_FILE_GUID) {
model->setText(index, UString("NVAR store"));
return nvramParser->parseNvarStore(index);
}
if (fileGuid == NVRAM_NVAR_PEI_EXTERNAL_DEFAULTS_FILE_GUID) {
model->setText(index, UString("NVRAM external defaults"));
return nvramParser->parseNvarStore(index);
}
// Parse vendor hash file
else if (fileGuid == BG_VENDOR_HASH_FILE_GUID_PHOENIX)
else if (fileGuid == BG_VENDOR_HASH_FILE_GUID_PHOENIX) {
return parseVendorHashFile(fileGuid, index);
}
return parseRawArea(index);
}
@ -2796,39 +2804,34 @@ USTATUS FfsParser::parseRawSectionBody(const UModelIndex & index)
// Get parent file parsing data
UByteArray parentFileGuid(model->header(parentFile).constData(), sizeof(EFI_GUID));
if (parentFileGuid == EFI_PEI_APRIORI_FILE_GUID) { // PEI apriori file
// Parse apriori file list
UString str;
USTATUS result = parseAprioriRawSection(model->body(index), str);
if (!result && !str.isEmpty())
model->addInfo(index, UString("\nFile list:") + str);
// Set parent file text
model->setText(parentFile, UString("PEI apriori file"));
return U_SUCCESS;
}
else if (parentFileGuid == EFI_DXE_APRIORI_FILE_GUID) { // DXE apriori file
// Parse apriori file list
UString str;
USTATUS result = parseAprioriRawSection(model->body(index), str);
if (!result && !str.isEmpty())
model->addInfo(index, UString("\nFile list:") + str);
// Set parent file text
return result;
}
else if (parentFileGuid == EFI_DXE_APRIORI_FILE_GUID) { // DXE apriori file
// Rename parent file
model->setText(parentFile, UString("DXE apriori file"));
return U_SUCCESS;
// Parse apriori file list
UString str;
USTATUS result = parseAprioriRawSection(model->body(index), str);
if (!result && !str.isEmpty())
model->addInfo(index, UString("\nFile list:") + str);
return result;
}
else if (parentFileGuid == NVRAM_NVAR_EXTERNAL_DEFAULTS_FILE_GUID) { // AMI NVRAM external defaults
// Parse NVAR area
nvramParser->parseNvarStore(index);
// Set parent file text
// Rename parent file
model->setText(parentFile, UString("NVRAM external defaults"));
// Parse NVAR area
return nvramParser->parseNvarStore(index);
}
else if (parentFileGuid == BG_VENDOR_HASH_FILE_GUID_AMI) { // AMI vendor hash file
// Parse AMI vendor hash file
parseVendorHashFile(parentFileGuid, index);
return parseVendorHashFile(parentFileGuid, index);
}
// Parse as raw area

View File

@ -34,6 +34,10 @@ const UByteArray NVRAM_NVAR_STORE_FILE_GUID
const UByteArray NVRAM_NVAR_EXTERNAL_DEFAULTS_FILE_GUID
("\x5B\x31\x21\x92\xBB\x30\xB5\x46\x81\x3E\x1B\x1B\xF4\x71\x2B\xD3", 16);
// 77D3DC50-D42B-4916-AC80-8F469035D150
const UByteArray NVRAM_NVAR_PEI_EXTERNAL_DEFAULTS_FILE_GUID
("\x50\xDC\xD3\x77\x2B\xD4\x16\x49\xAC\x80\x8F\x46\x90\x35\xD1\x50", 16);
extern UString nvarAttributesToUString(const UINT8 attributes);
extern UString nvarExtendedAttributesToUString(const UINT8 attributes);
extern UString efiTimeToUString(const EFI_TIME & time);
@ -41,7 +45,7 @@ extern UString efiTimeToUString(const EFI_TIME & time);
typedef struct NVAR_ENTRY_HEADER_ {
UINT32 Signature; // NVAR
UINT16 Size; // Size of the entry including header
UINT32 Next : 24; // Offset to the next entry in a list, or empty if latest in the list
UINT32 Next : 24; // Offset to the next entry in a list, or empty if the latest in the list
UINT32 Attributes : 8; // Attributes
} NVAR_ENTRY_HEADER;

View File

@ -44,9 +44,6 @@ USTATUS NvramParser::parseNvarStore(const UModelIndex & index)
emptyByte = readUnaligned(pdata).emptyByte;
}
// Rename parent file
model->setText(parentFileIndex, UString("NVAR store"));
// Get local offset
UINT32 localOffset = model->header(index).size();