1 // SPDX-License-Identifier: GPL-2.0
3 * Simple program to generate defines out of facility lists that use the bit
4 * numbering scheme from the Princples of Operations: most significant bit
7 * Copyright IBM Corp. 2015
21 static struct facility_def facility_defs
[] = {
24 * FACILITIES_ALS contains the list of facilities that are
25 * required to run a kernel that is compiled e.g. with
28 .name
= "FACILITIES_ALS",
30 #ifdef CONFIG_HAVE_MARCH_Z900_FEATURES
31 0, /* N3 instructions */
32 1, /* z/Arch mode installed */
34 #ifdef CONFIG_HAVE_MARCH_Z990_FEATURES
35 18, /* long displacement facility */
37 #ifdef CONFIG_HAVE_MARCH_Z9_109_FEATURES
38 21, /* extended-immediate facility */
39 25, /* store clock fast */
41 #ifdef CONFIG_HAVE_MARCH_Z10_FEATURES
43 32, /* compare and swap and store */
44 33, /* compare and swap and store 2 */
45 34, /* general instructions extension */
46 35, /* execute extensions */
48 #ifdef CONFIG_HAVE_MARCH_Z196_FEATURES
49 45, /* fast-BCR, etc. */
51 #ifdef CONFIG_HAVE_MARCH_ZEC12_FEATURES
52 49, /* misc-instruction-extensions */
53 52, /* interlocked facility 2 */
55 #ifdef CONFIG_HAVE_MARCH_Z13_FEATURES
56 53, /* load-and-zero-rightmost-byte, etc. */
58 #ifdef CONFIG_HAVE_MARCH_Z14_FEATURES
59 58, /* miscellaneous-instruction-extension 2 */
65 .name
= "FACILITIES_KVM",
67 0, /* N3 instructions */
68 1, /* z/Arch mode installed */
69 2, /* z/Arch mode active */
70 3, /* DAT-enhancement */
71 4, /* idte segment table */
72 5, /* idte region table */
73 6, /* ASN-and-LX reuse */
75 8, /* enhanced-DAT 1 */
76 9, /* sense-running-status */
77 10, /* conditional sske */
79 14, /* nonquiescing key-setting */
80 73, /* transactional execution */
81 75, /* access-exception-fetch/store indication */
82 76, /* msa extension 3 */
83 77, /* msa extension 4 */
84 78, /* enhanced-DAT 2 */
85 130, /* instruction-execution-protection */
86 131, /* enhanced-SOP 2 and side-effect */
87 139, /* multiple epoch facility */
88 146, /* msa extension 8 */
94 static void print_facility_list(struct facility_def
*def
)
96 unsigned int high
, bit
, dword
, i
;
97 unsigned long long *array
;
103 for (i
= 0; def
->bits
[i
] != -1; i
++) {
104 bit
= 63 - (def
->bits
[i
] & 63);
105 dword
= def
->bits
[i
] / 64;
107 array
= realloc(array
, (dword
+ 1) * 8);
110 memset(array
+ high
+ 1, 0, (dword
- high
) * 8);
113 array
[dword
] |= 1ULL << bit
;
115 printf("#define %s ", def
->name
);
116 for (i
= 0; i
<= high
; i
++)
117 printf("_AC(0x%016llx,UL)%c", array
[i
], i
< high
? ',' : '\n');
121 static void print_facility_lists(void)
125 for (i
= 0; i
< sizeof(facility_defs
) / sizeof(facility_defs
[0]); i
++)
126 print_facility_list(&facility_defs
[i
]);
129 int main(int argc
, char **argv
)
131 printf("#ifndef __ASM_S390_FACILITY_DEFS__\n");
132 printf("#define __ASM_S390_FACILITY_DEFS__\n");
134 printf(" * DO NOT MODIFY.\n");
136 printf(" * This file was generated by %s\n", __FILE__
);
138 printf("#include <linux/const.h>\n\n");
139 print_facility_lists();
140 printf("\n#endif\n");