1 // SPDX-License-Identifier: GPL-2.0 1 2 /* 3 * Copyright IBM Corp. 2016 4 */ 5 #include <linux/kernel.h> 6 #include <asm/processor.h> 7 #include <asm/facility.h> 8 #include <asm/lowcore.h> 9 #include <asm/sclp.h> 10 #include "boot.h" 11 12 static unsigned long als[] = { FACILITIES_ALS 13 14 static void u16_to_decimal(char *str, u16 val) 15 { 16 int div = 1; 17 18 while (div * 10 <= val) 19 div *= 10; 20 while (div) { 21 *str++ = '' + val / div; 22 val %= div; 23 div /= 10; 24 } 25 *str = '\0'; 26 } 27 28 void print_missing_facilities(void) 29 { 30 static char als_str[80] = "Missing fac 31 unsigned long val; 32 char val_str[6]; 33 int i, j, first; 34 35 first = 1; 36 for (i = 0; i < ARRAY_SIZE(als); i++) 37 val = ~stfle_fac_list[i] & als 38 for (j = 0; j < BITS_PER_LONG; 39 if (!(val & (1UL << (B 40 continue; 41 if (!first) 42 strcat(als_str 43 /* 44 * Make sure we stay w 45 * each facility bit a 46 * z/VM adds a four ch 47 */ 48 if (strlen(als_str) > 49 boot_printk("% 50 *als_str = '\0 51 } 52 u16_to_decimal(val_str 53 strcat(als_str, val_st 54 first = 0; 55 } 56 } 57 boot_printk("%s\n", als_str); 58 } 59 60 static void facility_mismatch(void) 61 { 62 struct cpuid id; 63 64 get_cpu_id(&id); 65 boot_printk("The Linux kernel requires 66 boot_printk("Detected machine-type num 67 print_missing_facilities(); 68 boot_printk("See Principles of Operati 69 disabled_wait(); 70 } 71 72 void verify_facilities(void) 73 { 74 int i; 75 76 __stfle(stfle_fac_list, ARRAY_SIZE(stf 77 for (i = 0; i < ARRAY_SIZE(als); i++) 78 if ((stfle_fac_list[i] & als[i 79 facility_mismatch(); 80 } 81 } 82
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.