Skip to content

Commit d684e4b

Browse files
committed
Refactor size-related info into addInfoRecursive, now only item-specific info should be supplied to addItem
1 parent 818f0ac commit d684e4b

File tree

11 files changed

+257
-510
lines changed

11 files changed

+257
-510
lines changed

UEFITool/uefitool.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -348,11 +348,11 @@ void UEFITool::populateUi(const QModelIndex &current)
348348
// Set info text
349349
ui->infoEdit->setPlainText(model->info(current));
350350
enableDock(ui->infoDock, true);
351-
351+
352352
// Set Hex view
353353
selectedHexView.clearMetadata();
354354
selectedHexView.setBackground(0, model->header(current).size(),
355-
model->markingDarkMode() ? Qt::darkGreen : Qt::green);
355+
model->markingDarkMode() ? Qt::darkGreen : Qt::green);
356356
selectedHexView.setData(model->entire(current));
357357
enableDock(ui->hexViewDock, true);
358358

@@ -364,7 +364,7 @@ void UEFITool::populateUi(const QModelIndex &current)
364364
ui->menuVolumeActions->setEnabled(type == Types::Volume);
365365
ui->menuFileActions->setEnabled(type == Types::File);
366366
ui->menuSectionActions->setEnabled(type == Types::Section);
367-
ui->menuEntryActions->setEnabled(type == Types::Microcode
367+
ui->menuEntryActions->setEnabled(type == Types::IntelMicrocode
368368
|| type == Types::SlicData
369369
|| type == Types::NvarEntry
370370
|| type == Types::VssEntry
@@ -384,6 +384,7 @@ void UEFITool::populateUi(const QModelIndex &current)
384384
|| type == Types::CpdExtension
385385
|| type == Types::CpdSpiEntry
386386
|| type == Types::StartupApDataEntry
387+
|| type == Types::AmdMicrocode
387388
);
388389
ui->menuStoreActions->setEnabled(type == Types::VssStore
389390
|| type == Types::Vss2Store

common/amd_microcode.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
#include "amd_microcode.h"
22
#include "basetypes.h"
33

4-
UINT32 getDataSizeMicrocodeAmd(const AMD_MICROCODE_HEADER *ucodeHeader) {
4+
UINT32 amdMicrocodeGetDataSize(const AMD_MICROCODE_HEADER *ucodeHeader) {
55
if (ucodeHeader->LoaderID >= 0x8005) {
66
return ((ucodeHeader->InitializationFlag << 8) | ucodeHeader->DataSize) * 0x10;
77
}
88

99
return ucodeHeader->DataSize;
1010
}
1111

12-
UINT32 getSizeMicrocodeAmd(const AMD_MICROCODE_HEADER *ucodeHeader) {
13-
UINT32 microcodeDataLen = getDataSizeMicrocodeAmd(ucodeHeader);
14-
UINT32 cpuIdByte = (getCpuIdMicrocodeAmd(ucodeHeader) >> 16) & 0xFF;
12+
UINT32 amdMicrocodeGetSize(const AMD_MICROCODE_HEADER *ucodeHeader) {
13+
UINT32 microcodeDataLen = amdMicrocodeGetDataSize(ucodeHeader);
14+
UINT32 cpuIdByte = (amdMicrocodeGetCpuId(ucodeHeader) >> 16) & 0xFF;
1515
UINT32 microcodeLen = 0;
1616

1717
if (microcodeDataLen == 0x20) {
@@ -41,34 +41,34 @@ UINT32 getSizeMicrocodeAmd(const AMD_MICROCODE_HEADER *ucodeHeader) {
4141
return microcodeLen;
4242
}
4343

44-
UINT32 getCpuIdMicrocodeAmd(const AMD_MICROCODE_HEADER *ucodeHeader) {
44+
UINT32 amdMicrocodeGetCpuId(const AMD_MICROCODE_HEADER *ucodeHeader) {
4545
return (((ucodeHeader->ProcessorSignature >> 8) & 0xFF) << 16) | (0x0f << 8) |
4646
(ucodeHeader->ProcessorSignature & 0xff);
4747
}
4848

49-
UINT16 getYearMicrocodeAmd(const AMD_MICROCODE_HEADER *ucodeHeader) {
50-
if (getCpuIdMicrocodeAmd(ucodeHeader) == 0x00800F11 && ucodeHeader->UpdateRevision == 0x8001105 &&
49+
UINT16 amdMicrocodeGetYear(const AMD_MICROCODE_HEADER *ucodeHeader) {
50+
if (amdMicrocodeGetCpuId(ucodeHeader) == 0x00800F11 && ucodeHeader->UpdateRevision == 0x8001105 &&
5151
ucodeHeader->DateYear == 0x2016) {
5252
return 0x2017;
5353
}
5454

5555
return ucodeHeader->DateYear;
5656
}
5757

58-
UINT8 getMonthMicrocodeAmd(const AMD_MICROCODE_HEADER *ucodeHeader) {
59-
if (getCpuIdMicrocodeAmd(ucodeHeader) == 0x00300F10 && ucodeHeader->UpdateRevision == 0x3000027 &&
58+
UINT8 amdMicrocodeGetMonth(const AMD_MICROCODE_HEADER *ucodeHeader) {
59+
if (amdMicrocodeGetCpuId(ucodeHeader) == 0x00300F10 && ucodeHeader->UpdateRevision == 0x3000027 &&
6060
ucodeHeader->DateMonth == 0x13) {
6161
return 0x12;
62-
} else if (getCpuIdMicrocodeAmd(ucodeHeader) == 0x00730F01 && ucodeHeader->UpdateRevision == 0x7030106 &&
62+
} else if (amdMicrocodeGetCpuId(ucodeHeader) == 0x00730F01 && ucodeHeader->UpdateRevision == 0x7030106 &&
6363
ucodeHeader->DateMonth == 0x09) {
6464
return 0x02;
6565
}
6666

6767
return ucodeHeader->DateMonth;
6868
}
6969

70-
UINT8 getDayMicrocodeAmd(const AMD_MICROCODE_HEADER *ucodeHeader) {
71-
if (getCpuIdMicrocodeAmd(ucodeHeader) == 0x00730F01 && ucodeHeader->UpdateRevision == 0x7030106 &&
70+
UINT8 amdMicrocodeGetDay(const AMD_MICROCODE_HEADER *ucodeHeader) {
71+
if (amdMicrocodeGetCpuId(ucodeHeader) == 0x00730F01 && ucodeHeader->UpdateRevision == 0x7030106 &&
7272
ucodeHeader->DateDay == 0x02) {
7373
return 0x09;
7474
}

common/amd_microcode.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ typedef struct AMD_MICROCODE_HEADER_ {
2929
UINT8 Reserved_1F;
3030
} AMD_MICROCODE_HEADER;
3131

32-
UINT32 getDataSizeMicrocodeAmd(const AMD_MICROCODE_HEADER *ucodeHeader);
33-
UINT32 getSizeMicrocodeAmd(const AMD_MICROCODE_HEADER *ucodeHeader);
34-
UINT32 getCpuIdMicrocodeAmd(const AMD_MICROCODE_HEADER *ucodeHeader);
35-
UINT16 getYearMicrocodeAmd(const AMD_MICROCODE_HEADER *ucodeHeader);
36-
UINT8 getMonthMicrocodeAmd(const AMD_MICROCODE_HEADER *ucodeHeader);
37-
UINT8 getDayMicrocodeAmd(const AMD_MICROCODE_HEADER *ucodeHeader);
32+
UINT32 amdMicrocodeGetDataSize(const AMD_MICROCODE_HEADER *ucodeHeader);
33+
UINT32 amdMicrocodeGetSize(const AMD_MICROCODE_HEADER *ucodeHeader);
34+
UINT32 amdMicrocodeGetCpuId(const AMD_MICROCODE_HEADER *ucodeHeader);
35+
UINT16 amdMicrocodeGetYear(const AMD_MICROCODE_HEADER *ucodeHeader);
36+
UINT8 amdMicrocodeGetMonth(const AMD_MICROCODE_HEADER *ucodeHeader);
37+
UINT8 amdMicrocodeGetDay(const AMD_MICROCODE_HEADER *ucodeHeader);
3838

3939
#pragma pack(pop)
4040

0 commit comments

Comments
 (0)