fix(inspur): show microcode version for every CPU, not just the first

Dedup by version caused CPU1 Microcode to be omitted when both CPUs run
the same version, leaving the firmware column blank for the second socket.
Each CPU gets its own firmware entry keyed by index.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Mikhail Chusavitin
2026-05-21 14:15:28 +03:00
parent f2c04cf0e8
commit 9505303d1d
2 changed files with 2 additions and 7 deletions

View File

@@ -117,7 +117,6 @@ func ParseAssetJSON(content []byte, pcieSlotDeviceNames map[int]string, pcieSlot
}
// Parse CPU info
seenMicrocode := make(map[string]bool)
for i, cpu := range asset.CpuInfo {
config.CPUs = append(config.CPUs, models.CPU{
Socket: i,
@@ -133,13 +132,11 @@ func ParseAssetJSON(content []byte, pcieSlotDeviceNames map[int]string, pcieSlot
PPIN: cpu.PPIN,
})
// Add CPU microcode to firmware list (deduplicated)
if cpu.MicroCodeVer != "" && !seenMicrocode[cpu.MicroCodeVer] {
if cpu.MicroCodeVer != "" {
config.Firmware = append(config.Firmware, models.FirmwareInfo{
DeviceName: fmt.Sprintf("CPU%d Microcode", i),
Version: cpu.MicroCodeVer,
})
seenMicrocode[cpu.MicroCodeVer] = true
}
}

View File

@@ -102,7 +102,6 @@ func parseCPUInfo(text string, hw *models.HardwareConfig) {
return
}
seenMicrocode := make(map[string]bool)
for _, proc := range cpuInfo.Processors {
if proc.ProcStatus != 1 && proc.ConfigStatus != 1 {
continue
@@ -120,12 +119,11 @@ func parseCPUInfo(text string, hw *models.HardwareConfig) {
TDP: proc.TDP,
PPIN: proc.PPIN,
})
if proc.MicroCode != "" && !seenMicrocode[proc.MicroCode] {
if proc.MicroCode != "" {
hw.Firmware = append(hw.Firmware, models.FirmwareInfo{
DeviceName: fmt.Sprintf("CPU%d Microcode", proc.ProcID),
Version: proc.MicroCode,
})
seenMicrocode[proc.MicroCode] = true
}
}
}