]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lscpu: Parse loongarch specific lines
authorXi Ruoyao <xry111@xry111.site>
Wed, 22 Mar 2023 12:44:19 +0000 (20:44 +0800)
committerXi Ruoyao <xry111@xry111.site>
Wed, 22 Mar 2023 13:02:22 +0000 (21:02 +0800)
/proc/cpuinfo on loongarch uses UPPERCASE letters in some field names.
Add the patterns for them.

"Address Sizes", "CPU Family", "CPU Revision" (aka "Model"), and
"Model Name" are correctly outputed, but "CPU MHz" not (because we
don't have a CPUFreq driver yet).

Signed-off-by: Xi Ruoyao <xry111@xry111.site>
sys-utils/lscpu-cputype.c

index 31f4009bcefed438635468486740ed6ba34ca9e9..79805b540f815431288d40cdf631b4fa60be9748 100644 (file)
@@ -192,12 +192,16 @@ static const struct cpuinfo_pattern type_patterns[] =
 {
        /* Sort by fields name! */
        DEF_PAT_CPUTYPE( "ASEs implemented",    PAT_FLAGS,      flags),         /* mips */
+       DEF_PAT_CPUTYPE( "Address Sizes",       PAT_ADDRESS_SIZES,      addrsz),/* loongarch */
        DEF_PAT_CPUTYPE( "BogoMIPS",            PAT_BOGOMIPS,   bogomips),      /* aarch64 */
+       DEF_PAT_CPUTYPE( "CPU Family",          PAT_FAMILY,     family),        /* loongarch */
+       DEF_PAT_CPUTYPE( "CPU Revision",        PAT_REVISION,   revision),      /* loongarch */
        DEF_PAT_CPUTYPE( "CPU implementer",     PAT_IMPLEMENTER,vendor),        /* ARM and aarch64 */
        DEF_PAT_CPUTYPE( "CPU part",            PAT_PART,       model),         /* ARM and aarch64 */
        DEF_PAT_CPUTYPE( "CPU revision",        PAT_REVISION,   revision),      /* aarch64 */
        DEF_PAT_CPUTYPE( "CPU variant",         PAT_VARIANT,    stepping),      /* aarch64 */
        DEF_PAT_CPUTYPE( "Features",            PAT_FEATURES,   flags),         /* aarch64 */
+       DEF_PAT_CPUTYPE( "Model Name",          PAT_MODEL_NAME, modelname),     /* loongarch */
        DEF_PAT_CPUTYPE( "address sizes",       PAT_ADDRESS_SIZES,      addrsz),/* x86 */
        DEF_PAT_CPUTYPE( "bogomips per cpu",    PAT_BOGOMIPS,   bogomips),      /* s390 */
        DEF_PAT_CPUTYPE( "cpu",                 PAT_CPU,        modelname),     /* ppc, sparc */
@@ -230,6 +234,7 @@ static const struct cpuinfo_pattern type_patterns[] =
 static const struct cpuinfo_pattern cpu_patterns[] =
 {
        /* Sort by fields name! */
+       DEF_PAT_CPU( "CPU MHz",         PAT_MHZ,          mhz),         /* loongarch */
        DEF_PAT_CPU( "bogomips",        PAT_BOGOMIPS_CPU, bogomips),
        DEF_PAT_CPU( "cpu MHz",         PAT_MHZ,          mhz),
        DEF_PAT_CPU( "cpu MHz dynamic", PAT_MHZ_DYNAMIC,  dynamic_mhz), /* s390 */