s390/als: print machine type on facility mismatch
authorHeiko Carstens <heiko.carstens@de.ibm.com>
Tue, 28 Jun 2016 12:40:07 +0000 (14:40 +0200)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Sun, 31 Jul 2016 09:27:59 +0000 (05:27 -0400)
If we have a facility mismatch the kernel only emits a warning that
the processor is not recent enough and stops operating. This doesn't
give us a lot of an idea of what actually went wrong.

As a first step print the machine type in addition.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Reviewed-by: Sascha Silbe <silbe@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
arch/s390/kernel/als.c

index f96a577972c43252f1829712afb16ada4c8cf8bb..0eff858c24342513f532f2e57eb87956624dca51 100644 (file)
 
 static unsigned long als[] __initdata = { FACILITIES_ALS };
 
+static void __init u16_to_hex(char *str, u16 val)
+{
+       int i, num;
+
+       for (i = 1; i <= 4; i++) {
+               num = (val >> (16 - 4 * i)) & 0xf;
+               if (num >= 10)
+                       num += 7;
+               *str++ = '0' + num;
+       }
+       *str = '\0';
+}
+
+static void __init print_machine_type(void)
+{
+       static char mach_str[80] __initdata = "Detected machine-type number: ";
+       char type_str[5];
+       struct cpuid id;
+
+       get_cpu_id(&id);
+       u16_to_hex(type_str, id.machine);
+       strcat(mach_str, type_str);
+       _sclp_print_early(mach_str);
+}
+
+static void __init facility_mismatch(void)
+{
+       _sclp_print_early("The Linux kernel requires more recent processor hardware");
+       print_machine_type();
+       disabled_wait(0x8badcccc);
+}
+
 void __init verify_facilities(void)
 {
        int i;
@@ -38,9 +70,7 @@ void __init verify_facilities(void)
                             : "memory", "cc");
        }
        for (i = 0; i < ARRAY_SIZE(als); i++) {
-               if ((S390_lowcore.stfle_fac_list[i] & als[i]) == als[i])
-                       continue;
-               _sclp_print_early("The Linux kernel requires more recent processor hardware");
-               disabled_wait(0x8badcccc);
+               if ((S390_lowcore.stfle_fac_list[i] & als[i]) != als[i])
+                       facility_mismatch();
        }
 }