1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright IBM Corp. 2016
5 #include <linux/kernel.h>
6 #include <asm/processor.h>
7 #include <asm/facility.h>
8 #include <asm/lowcore.h>
12 static unsigned long als[] = { FACILITIES_ALS };
14 static void u16_to_decimal(char *str, u16 val)
18 while (div * 10 <= val)
21 *str++ = '0' + val / div;
28 void print_missing_facilities(void)
30 static char als_str[80] = "Missing facilities: ";
36 for (i = 0; i < ARRAY_SIZE(als); i++) {
37 val = ~stfle_fac_list[i] & als[i];
38 for (j = 0; j < BITS_PER_LONG; j++) {
39 if (!(val & (1UL << (BITS_PER_LONG - 1 - j))))
44 * Make sure we stay within one line. Consider that
45 * each facility bit adds up to five characters and
46 * z/VM adds a four character prefix.
48 if (strlen(als_str) > 70) {
49 boot_emerg("%s\n", als_str);
52 u16_to_decimal(val_str, i * BITS_PER_LONG + j);
53 strcat(als_str, val_str);
57 boot_emerg("%s\n", als_str);
60 static void facility_mismatch(void)
65 boot_emerg("The Linux kernel requires more recent processor hardware\n");
66 boot_emerg("Detected machine-type number: %4x\n", id.machine);
67 print_missing_facilities();
68 boot_emerg("See Principles of Operations for facility bits\n");
72 void verify_facilities(void)
76 __stfle(stfle_fac_list, ARRAY_SIZE(stfle_fac_list));
77 for (i = 0; i < ARRAY_SIZE(als); i++) {
78 if ((stfle_fac_list[i] & als[i]) != als[i])