mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-09-12 09:58:03 +02:00
CPU (Linux): adds SPARC support (#2572)
/proc/cpuinfo on sparc has none of the fields the generic fallback looks for, so the module printed "Unknown (64)". The name is in "cpu", and the frequency in "Cpu<n>ClkTck" -- in Hz, hex on sparc64, decimal on sparc32.
This commit is contained in:
@@ -1,3 +1,8 @@
|
|||||||
|
# Unreleased
|
||||||
|
|
||||||
|
Features:
|
||||||
|
* Added CPU name and frequency detection support on SPARC. (CPU, Linux)
|
||||||
|
|
||||||
# 2.68.1
|
# 2.68.1
|
||||||
|
|
||||||
Changes:
|
Changes:
|
||||||
|
|||||||
@@ -619,6 +619,9 @@ static const char* parseCpuInfo(
|
|||||||
(cpu->name.length == 0 && ffParsePropLine(line, "cpu :", &cpu->name)) ||
|
(cpu->name.length == 0 && ffParsePropLine(line, "cpu :", &cpu->name)) ||
|
||||||
#elif __sh__
|
#elif __sh__
|
||||||
(cpu->name.length == 0 && ffParsePropLine(line, "cpu type :", &cpu->name)) ||
|
(cpu->name.length == 0 && ffParsePropLine(line, "cpu type :", &cpu->name)) ||
|
||||||
|
#elif __sparc__ || __sparc
|
||||||
|
(cpu->name.length == 0 && ffParsePropLine(line, "cpu :", &cpu->name)) ||
|
||||||
|
(cpuMHz->length == 0 && ffParsePropLine(line, "Cpu0ClkTck :", cpuMHz)) ||
|
||||||
#else
|
#else
|
||||||
(cpu->name.length == 0 && ffParsePropLine(line, "model name :", &cpu->name)) ||
|
(cpu->name.length == 0 && ffParsePropLine(line, "model name :", &cpu->name)) ||
|
||||||
(cpu->name.length == 0 && ffParsePropLine(line, "model :", &cpu->name)) ||
|
(cpu->name.length == 0 && ffParsePropLine(line, "model :", &cpu->name)) ||
|
||||||
@@ -1101,6 +1104,10 @@ static const char* detectPhysicalCores(FFCPUResult* cpu) {
|
|||||||
if (cpu->name.length) {
|
if (cpu->name.length) {
|
||||||
ffStrbufPrependS(&cpu->name, "Machine ");
|
ffStrbufPrependS(&cpu->name, "Machine ");
|
||||||
}
|
}
|
||||||
|
#elif __sparc__ || __sparc
|
||||||
|
// Cpu0ClkTck is in Hz, printed as "%016lx" by sparc64 and "%ld" by sparc32. A 32-bit userland can run
|
||||||
|
// on a 64-bit kernel, so take the base from the width of the value rather than from our own bitness.
|
||||||
|
cpu->frequencyBase = (uint32_t) (strtoull(cpuMHz.chars, nullptr, cpuMHz.length == 16 ? 16 : 10) / 1000000);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user